Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

erc7656

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

erc7656 - npm Package Compare versions

Comparing version 0.0.1 to 0.0.2

3

package.json
{
"name": "erc7656",
"version": "0.0.1",
"version": "0.0.2",
"description": "ERC7656 Reference Implementation",

@@ -29,4 +29,5 @@ "publishConfig": {

"dependencies": {
"@openzeppelin/contracts": "^5.0.2",
"erc6551": "^0.3.1"
}
}

@@ -18,3 +18,48 @@ # ERC-7656

Install it as a dependency
```
npm i erc7656 @openzeppelin/contracts erc6551
```
Make your nft able to deploy plugins
```solidity
// SPDX-License-Identifier: MIT
// Compatible with OpenZeppelin Contracts ^5.0.0
pragma solidity ^0.8.20;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "erc7656/utils/ERC7656Deployer.sol";
contract MyExpandableToken is ERC721, Ownable, ERC7656Deployer {
error NotTheTokenOwner();
constructor(address initialOwner)
ERC721("MyExpandableToken", "MET")
Ownable(initialOwner) {
}
function safeMint(address to, uint256 tokenId) public onlyOwner {
_safeMint(to, tokenId);
}
function deployContractsOwnedByTheTokenId(
address implementation,
bytes32 salt,
uint256 tokenId
) external payable virtual override {
if (_msgSender() != ownerOf(tokenId)) revert NotTheTokenOwner();
// passing address(0) as the manager address, since the token is the manager
_deploy(implementation, salt, address(this), tokenId, address(0));
}
}
```
For more elaborate example, take a look at the [Cruna Protocol](https://github.com/crunaprotocol/cruna-protocol).
Notice that the plugin can be deployed by anyone, not only by the owner. Deploying it from the token itself, however, allows for more controls; for example, if executing an initializing function allowed only by the token owner.
## License

@@ -21,0 +66,0 @@

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc