diff --git a/bin/config.sh b/bin/config.sh index 390fdf5..cd81dbd 100755 --- a/bin/config.sh +++ b/bin/config.sh @@ -5,5 +5,9 @@ set -eo pipefail export LINE_CONFIG_FILE="ormp_line.c" export LINE_DEPLOY_FILE="deploy_ormp_line.a" export LINE_KEY=".ORMP_LINE" -forge script script/config/LineConfig.s.sol:LineConfig --sig "run(uint256[])" "[421614]" --chain-id 44 --broadcast -forge script script/config/LineConfig.s.sol:LineConfig --sig "run(uint256[])" "[44]" --chain-id 421614 --broadcast --skip-simulation + +cid="QmPqyGBHxRCxZJEKf8WTeDZB2JDMrtfrPqxGcxN2scj64E" +cid=$(ipfs cid format -v 1 -b base32 $cid) +uri="ipfs:://$cid" +forge script script/config/LineConfig.s.sol:LineConfig --sig "run(uint256[],string)" "[421614]" $uri --chain-id 44 --broadcast +forge script script/config/LineConfig.s.sol:LineConfig --sig "run(uint256[],string)" "[44]" $uri --chain-id 421614 --broadcast --skip-simulation diff --git a/ipfs/ormp.json b/ipfs/ormp.json new file mode 100644 index 0000000..66692fd --- /dev/null +++ b/ipfs/ormp.json @@ -0,0 +1,6 @@ +{ + "name": "ORMP", + "provider": "Msgport", + "description": "ORMP line by Msgport", + "api": "https://github.com/darwinia-network/darwinia-msgport-api/blob/main/README.md" +} diff --git a/script/config/LineConfig.s.sol b/script/config/LineConfig.s.sol index 33f535e..8ea485b 100644 --- a/script/config/LineConfig.s.sol +++ b/script/config/LineConfig.s.sol @@ -11,6 +11,8 @@ interface III { function setToLine(uint256 toChainId, address toLineAddress) external; function fromLineLookup(uint256) external view returns (address); function toLineLookup(uint256) external view returns (address); + function setURI(string calldata uri) external; + function uri() external view returns (string memory); } contract LineConfig is Common { @@ -36,9 +38,10 @@ contract LineConfig is Common { dao = deployedLine.readAddress(".DAO"); } - function run(uint256[] memory chainIds) public { + function run(uint256[] memory chainIds, string memory uri) public { require(dao == msg.sender, "!dao"); setLine(chainIds); + setURI(uri); } function setLine(uint256[] memory chainIds) public broadcast { @@ -52,4 +55,13 @@ contract LineConfig is Common { require(III(line).toLineLookup(chainId) == l); } } + + function setURI(string memory uri) public broadcast { + III(line).setURI(uri); + require(eq(III(line).uri(), uri)); + } + + function eq(string memory a, string memory b) internal pure returns (bool) { + return keccak256(bytes(a)) == keccak256(bytes(b)); + } }