Skip to content

Commit

Permalink
Merge pull request #71 from helix-bridge/xiaoch05-reconstruct-files
Browse files Browse the repository at this point in the history
reconstruct files(#2)
  • Loading branch information
xiaoch05 committed Apr 9, 2024
2 parents fd6333f + c3264f7 commit 036054c
Show file tree
Hide file tree
Showing 42 changed files with 1,310 additions and 321 deletions.
4 changes: 4 additions & 0 deletions helix-contract/contracts/messagers/LayerZeroMessager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ contract LayerZeroMessager is AccessController {
whiteList[_caller] = _enable;
}

function updateEndpoint(address _endpoint) external onlyDao {
endpoint = ILayerZeroEndpoint(_endpoint);
}

function setRemoteMessager(uint256 _appRemoteChainId, uint16 _lzRemoteChainId, address _remoteMessager) onlyDao external {
remoteMessagers[_appRemoteChainId] = RemoteMessager(_lzRemoteChainId, _remoteMessager);
trustedRemotes[_lzRemoteChainId] = keccak256(abi.encodePacked(_remoteMessager, address(this)));
Expand Down
16 changes: 0 additions & 16 deletions helix-contract/contracts/xtoken/interfaces/IBacking.sol

This file was deleted.

21 changes: 0 additions & 21 deletions helix-contract/contracts/xtoken/interfaces/ICrossChainFilter.sol

This file was deleted.

20 changes: 0 additions & 20 deletions helix-contract/contracts/xtoken/interfaces/IERC20.sol

This file was deleted.

12 changes: 0 additions & 12 deletions helix-contract/contracts/xtoken/interfaces/IErc1155Backing.sol

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

12 changes: 0 additions & 12 deletions helix-contract/contracts/xtoken/interfaces/IErc721Backing.sol

This file was deleted.

This file was deleted.

This file was deleted.

20 changes: 0 additions & 20 deletions helix-contract/contracts/xtoken/interfaces/IFeeMarket.sol

This file was deleted.

8 changes: 0 additions & 8 deletions helix-contract/contracts/xtoken/interfaces/IGuard.sol

This file was deleted.

This file was deleted.

23 changes: 0 additions & 23 deletions helix-contract/contracts/xtoken/interfaces/IHelixApp.sol

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

19 changes: 0 additions & 19 deletions helix-contract/contracts/xtoken/interfaces/IInboundLane.sol

This file was deleted.

15 changes: 0 additions & 15 deletions helix-contract/contracts/xtoken/interfaces/IOutboundLane.sol

This file was deleted.

2 changes: 1 addition & 1 deletion helix-contract/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"scripts": {
"build": "hardhat compile",
"test": "npx hardhat test",
"deploy": "npx hardhat run",
"script": "npx hardhat run",
"clean": "shx rm -rf cache artifacts abi",
"flatten": "npx hardhat flatten",
"flat": "npx hardhat flat",
Expand Down
20 changes: 20 additions & 0 deletions helix-contract/script/api/create2.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
var Create2 = {
getDeployedBytecode: function(factory, constructorTypes, constructorArgs) {
const abiCoder = ethers.utils.defaultAbiCoder;
const encodedParams = abiCoder.encode(constructorTypes, constructorArgs);
console.log(`constructor bytes: ${encodedParams.slice(2)}`);
const bytecode = `${factory.bytecode}${encodedParams.slice(2)}`;
return bytecode;
},
deploy: async function(deployAddress, wallet, bytecode, salt, gasLimit, saltText) {
const hexSalt = saltText ? '0x' + Buffer.from(salt).toString('hex') : ethers.utils.id(salt.toString());
const deployer = await ethers.getContractAt("Create2Deployer", deployAddress, wallet);
const result = await (await deployer.deploy(bytecode, hexSalt, {gasLimit: gasLimit})).wait();
const targetEvent = result.events.find((e) => e.event == 'Deployed');
const abiCoder = ethers.utils.defaultAbiCoder;
const eventParams = abiCoder.decode(["address", "uint256"], targetEvent.data);
return eventParams[0];
}
}

module.exports = Create2

0 comments on commit 036054c

Please sign in to comment.