Skip to content

Commit

Permalink
ERC6160 (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
seunlanlege authored Jan 18, 2024
1 parent b41cbbe commit 200f57d
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 19 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# multichain-token
An example implementation of EIP-6160
# ERC6160
Implementation of ERC6160

This set of interfaces and contracts relates to the [Multi-Chain Native Token Standard.](https://github.com/polytope-labs/EIPs/blob/master/EIPS/eip-6160.md)

Expand All @@ -14,9 +14,9 @@ Multi-Chain token contracts that chooses to conform to this EIP `MUST` extend th


These example core token contracts implements the interfaces as so:
* {{ERC20.sol}}
* {{ERC721.sol}}
* {{ERC1155.sol}}
* {{ERC6160Ext20.sol}}
* {{ERC6160Ext721.sol}}
* {{ERC6160Ext1155.sol}}

|Note | This standard is unopinionated, however, aims to set the foundation for creating multi-chain native tokens, also the specifics for authorization and access control are left for developers to implement in token contracts.|
----- | -----
2 changes: 1 addition & 1 deletion src/tokens/ERC1155.sol → src/tokens/ERC6160Ext1155.sol
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ error PermissionDenied();
/// @notice Thrown if account is not the admin of a given role
error NotRoleAdmin();

contract MultiChainNativeERC1155 is ERC1155, ERC165Storage, IERC6160Ext1155 {
contract ERC6160Ext1155 is ERC1155, ERC165Storage, IERC6160Ext1155 {
/// @notice InterfaceId for ERC6160Ext1155
bytes4 constant _IERC6160Ext1155_ID_ = 0x9f77104c;

Expand Down
4 changes: 1 addition & 3 deletions src/tokens/ERC20.sol → src/tokens/ERC6160Ext20.sol
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ error NotRoleAdmin();
/// @notice Thrown if account does not have required permission
error PermissionDenied();

contract MultiChainNativeERC20 is ERC165Storage, ERC20, IERC6160Ext20 {
contract ERC6160Ext20 is ERC165Storage, ERC20, IERC6160Ext20 {
/// @notice InterfaceId for ERC6160Ext20
bytes4 constant _IERC6160Ext20_ID_ = 0xbbb8b47e;

Expand All @@ -32,8 +32,6 @@ contract MultiChainNativeERC20 is ERC165Storage, ERC20, IERC6160Ext20 {
_registerInterface(type(IERC5679Ext20).interfaceId);
_registerInterface(type(IERC_ACL_CORE).interfaceId);

super._mint(admin, 1_000_000 * 10e18); // 1million initial supply

_rolesAdmin[MINTER_ROLE][admin] = true;
_roles[MINTER_ROLE][admin] = true;

Expand Down
2 changes: 1 addition & 1 deletion src/tokens/ERC721.sol → src/tokens/ERC6160Ext721.sol
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ error PermissionDenied();
/// @notice Thrown if account is not the admin of a given role
error NotRoleAdmin();

contract MultiChainNativeERC721 is ERC721, ERC165Storage, IERC6160Ext721 {
contract ERC6160Ext721 is ERC721, ERC165Storage, IERC6160Ext721 {
/// @notice InterfaceId for ERC6160Ext721
bytes4 constant _IERC6160Ext721_ID_ = 0xa75a5a72;

Expand Down
6 changes: 3 additions & 3 deletions test/ERC1155.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ pragma solidity ^0.8.13;
import "forge-std/Test.sol";
import "forge-std/console.sol";

import "../src/tokens/ERC1155.sol";
import "../src/tokens/ERC6160Ext1155.sol";

contract ERC1155Test is Test {
MultiChainNativeERC1155 token;
ERC6160Ext1155 token;
address beef = 0x000000000000000000000000000000000000bEEF;
address dead = 0x000000000000000000000000000000000000dEaD;

Expand All @@ -23,7 +23,7 @@ contract ERC1155Test is Test {
uint256 TOKEN2_FT = 1;

function setUp() public {
token = new MultiChainNativeERC1155(address(this), "");
token = new ERC6160Ext1155(address(this), "");
}

function testRoles() public view {
Expand Down
6 changes: 3 additions & 3 deletions test/ERC20.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ pragma solidity ^0.8.13;
import "forge-std/Test.sol";
import "forge-std/console.sol";

import "../src/tokens/ERC20.sol";
import "../src/tokens/ERC6160Ext20.sol";

contract ERC20Test is Test {
MultiChainNativeERC20 token;
ERC6160Ext20 token;
address deployer = 0xb4c79daB8f259C7Aee6E5b2Aa729821864227e84;

address beef = 0x000000000000000000000000000000000000bEEF;
Expand All @@ -21,7 +21,7 @@ contract ERC20Test is Test {
bytes32 constant BURNER_ROLE = keccak256("BURNER ROLE");

function setUp() public {
token = new MultiChainNativeERC20(address(this), "Multi Chain Native ERC20 TOken", "MCNT");
token = new ERC6160Ext20(address(this), "Multi Chain Native ERC20 TOken", "MCNT");
}

function testNameSymbol() public {
Expand Down
6 changes: 3 additions & 3 deletions test/ERC721.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ pragma solidity ^0.8.13;
import "forge-std/Test.sol";
import "forge-std/console.sol";

import "../src/tokens/ERC721.sol";
import "../src/tokens/ERC6160Ext721.sol";

contract ERC721Test is Test {
MultiChainNativeERC721 token;
ERC6160Ext721 token;
address beef = 0x000000000000000000000000000000000000bEEF;
address dead = 0x000000000000000000000000000000000000dEaD;

Expand All @@ -20,7 +20,7 @@ contract ERC721Test is Test {
bytes32 constant BURNER_ROLE = keccak256("BURNER ROLE");

function setUp() public {
token = new MultiChainNativeERC721(address(this), "", "");
token = new ERC6160Ext721(address(this), "", "");
}

function testRoles() public view {
Expand Down

0 comments on commit 200f57d

Please sign in to comment.