Skip to content

Commit

Permalink
Implement ChainID (#45)
Browse files Browse the repository at this point in the history
* README update

* Purge masterhash()

* README.md update

* README.md update: 2

* Reinstate signedRedirect() & ownerhash[]

* some more NatSpec

* Goerli-v4: 0x4b9A4521442485ad7e1b25295125240b5f3F5aaC

* Remove redundant parts; more natSpec

* update ownerhash[addr] to accept keccak(addr)

* natSpec for GatewayManager

* Mainnet: 0x57532d78FfBcC6ac5534A9b39899C7eC89082CdA

* Fixes for bugs in v1-beta

* Fixes for bugs in v1-beta (#34)

* Some natSpec and fix for avatar/contenthash

* Updated Fixes in v1.0.0-beta (#36)

* Fixes for bugs in v1-beta

* Some natSpec and fix for avatar/contenthash

* Fix error in test.yml

* Fix errors in test.yml  (#38)

* Fixes for bugs in v1-beta

* Some natSpec and fix for avatar/contenthash

* Fix error in test.yml

* Review of #40

* Fix typo-2

* Re-try merge (#43)

* README update

* Purge masterhash()

* README.md update

* README.md update: 2

* Reinstate signedRedirect() & ownerhash[]

* some more NatSpec

* Goerli-v4: 0x4b9A4521442485ad7e1b25295125240b5f3F5aaC

* Remove redundant parts; more natSpec

* update ownerhash[addr] to accept keccak(addr)

* natSpec for GatewayManager

* Mainnet: 0x57532d78FfBcC6ac5534A9b39899C7eC89082CdA

* Fixes for bugs in v1-beta

* Fixes for bugs in v1-beta (#34)

* Some natSpec and fix for avatar/contenthash

* Updated Fixes in v1.0.0-beta (#36)

* Fixes for bugs in v1-beta

* Some natSpec and fix for avatar/contenthash

* Fix error in test.yml

* Fix errors in test.yml  (#38)

* Fixes for bugs in v1-beta

* Some natSpec and fix for avatar/contenthash

* Fix error in test.yml

* Review of #40

* Fix typo-2

* Typo-2

* Typo-2.1

* Typo-2.2

* Get ChainID from ENV
  • Loading branch information
sshmatrix authored Aug 15, 2023
1 parent 1e31088 commit 484d622
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 13 deletions.
4 changes: 1 addition & 3 deletions script/Deploy.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@ contract CCIP2ETHDeploy is Script {
function run() external {
vm.startBroadcast();
GatewayManager manager = new GatewayManager();
//uint256 ChainID = uint256(5);
//require(ChainID == uint256(1), "WARNING: Deploying with Goerli ChainID. Please double check [!]"); // Comment this for Goerli deploy
new CCIP2ETH(address(manager), "5");
new CCIP2ETH(address(manager));
vm.stopBroadcast();
}
}
20 changes: 14 additions & 6 deletions src/CCIP2ETH.sol
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,15 @@ contract CCIP2ETH is iCCIP2ETH {
mapping(bytes4 => bool) public supportsInterface;

/// @dev - Constructor
constructor(address _gateway, string memory _chainID) {
constructor(address _gateway) {
gateway = iGatewayManager(_gateway);
chainID = _chainID;
chainID = gateway.uintToString(block.chainid);
/// @dev - Sets ENS Mainnet wrapper as Wrapper
isWrapper[0xD4416b13d2b3a9aBae7AcD5D6C2BbDBE25686401] = true;
emit UpdatedWrapper(0xD4416b13d2b3a9aBae7AcD5D6C2BbDBE25686401, true);

/// @dev - Sets ENS TESTNET wrapper contract
/// @TODO - [!!!] REMOVE FOR MAINNET
isWrapper[0x0000000000000000000000000000000000000000] = true;
emit UpdatedWrapper(0x0000000000000000000000000000000000000000, true);

Expand Down Expand Up @@ -538,10 +539,10 @@ contract CCIP2ETH is iCCIP2ETH {
}

/**
* @dev Sets multiple signer (= manager) as approved to manage records for a node
* @param _node - Namehash of ENS domain
* @param _signer - Address of signer (= manager)
* @param _approval - Status to set
* @dev Sets multiple signers (= managers) as approved to manage records for a node
* @param _node - Namehash[] of ENS domains
* @param _signer - Address[] of signers (= managers)
* @param _approval - Status[] to set
*/
function multiApprove(bytes32[] calldata _node, address[] calldata _signer, bool[] calldata _approval) external {
uint256 len = _node.length;
Expand Down Expand Up @@ -615,6 +616,13 @@ contract CCIP2ETH is iCCIP2ETH {
emit UpdatedWrapper(_addr, _set);
}

/**
* @dev - Updates Chain ID in case of a hardfork
*/
function updateChainID() public {
chainID = gateway.uintToString(block.chainid);
}

/**
* @dev - Owner of contract
*/
Expand Down
4 changes: 2 additions & 2 deletions src/Interface.sol
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ interface iENS {
}

interface iENSIP10 {
function resolve(bytes memory _name, bytes memory _data) external view returns (bytes memory);

error OffchainLookup(address _to, string[] _gateways, bytes _data, bytes4 _callbackFunction, bytes _extradata);

function resolve(bytes memory _name, bytes memory _data) external view returns (bytes memory);
}

interface iCCIP2ETH is iENSIP10 {
Expand Down
4 changes: 2 additions & 2 deletions test/CCIP2ETH.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ contract CCIP2ETHTest is Test {

function setUp() public {
gateway = new GatewayManager();
chainID = "5";
ccip2eth = new CCIP2ETH(address(gateway), chainID);
chainID = gateway.uintToString(block.chainid);
ccip2eth = new CCIP2ETH(address(gateway));
}

function testRecordHash() public {
Expand Down

0 comments on commit 484d622

Please sign in to comment.