Skip to content

Commit

Permalink
Get ChainID from ENV
Browse files Browse the repository at this point in the history
  • Loading branch information
sshmatrix committed Aug 15, 2023
1 parent 319596d commit acc417d
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 acc417d

Please sign in to comment.