diff --git a/solidity/.env.example b/solidity/.env.example index 30d6872b..eabf76a6 100644 --- a/solidity/.env.example +++ b/solidity/.env.example @@ -14,6 +14,7 @@ export NETWORK="NETWORK NAME WHERE THE SCRIPT IS RUNNNIG" export ETHERSCAN_API_KEY="YOUR ETHERSCAN API KEY ON NETWORK_NAME" export MAILBOX="HYPERLANE MAILBOX ADDRESS ON NETWORK_NAME" export PERMIT2="PERMIT2 ADDRESS ON NETWORK_NAME" +export CREATEX_ADDRESS="CREATEX ADDRESS ON NETWORK_NAME" export DEPLOYER_PK="YOU DEPLOYER PRIVATE KEY" export HYPERLANE7683_SALT="A ONTE TIME USE SALT FOR DEPLOYING THE ROUTER" @@ -24,6 +25,9 @@ export ROUTER_OWNER="ADDRESS OF THE OWNER OF THE ROUTER" # enrollRemoteRouters and setDestinationGas export DOMAINS="COMA SEPARATED LIST OF DOMAINS TO ENROLL" +### TEST TOKEN +export TEST_TOKEN_SALT="A ONTE TIME USE SALT FOR DEPLOYING THE TEST TOKEN" + ### Open export ROUTER_ADDRESS = "ROUTER ADDRESS" export ORDER_SENDER = "ORDER SENDER ADDRESS" @@ -34,3 +38,8 @@ export AMOUNT_IN = "AMOUNT IN" export AMOUNT_OUT = "AMOUNT OUT" export SENDER_NONCE = "SENDER_NONCE" export DESTINATION_DOMAIN = "DESTINATION DOMAIN ID" + +### Refund +export ORDER_FILL_DEADLINE = "FILL DEADLINE OF THE ORDER" +export ORDER_ORIGIN = "ORIGIN DOMAIN OF THE ORDER" +export ORDER_DATA = "ORDER DATA OF THE ORDER" diff --git a/solidity/README.md b/solidity/README.md index 2592c7b2..216ab40c 100644 --- a/solidity/README.md +++ b/solidity/README.md @@ -100,26 +100,40 @@ variable are set: - `HYPERLANE7683_SALT`: a single use by chain salt for deploying the router. Make sure you use the same on all chains so the routers are deployed all under the same address. - `DOMAINS`: the domains list of the routers to enroll, separated by commas +- `CREATEX_ADDRESS`: address of CreateX contract on the chain + +### Deploy Test Token + +For deploying a test token you can run `yarn run:deployToken`. Make sure the following environment variable are set: + +- `DEPLOYER_PK`: deployer private key +- `ROUTER_OWNER`: address of the router owner +- `TEST_TOKEN_SALT`: a single use by chain salt for deploying the test token. Make sure you use the same on all ### Open an Order For opening an onchain order you can run `yarn run:openOrder`. Make sure the following environment variable are set: -- `ROUTER_OWNER_PK`: the router's owner private key. Only the owner can enroll routers +- `USER_PK`: user private key +- `ROUTER_ADDRESS`: address of router - `ORDER_SENDER`: address of order sender - `ORDER_RECIPIENT`: address of order recipient - `ITT_INPUT`: token input address - `ITT_OUTPUT`: token output address - `AMOUNT_IN`: amount in - `AMOUNT_OUT`: amount out +- `SENDER_NONCE`: nonce of sender - `DESTINATION_DOMAIN`: destination domain id +`SENDER_NONCE` value must be updated before each order. + ### Refund Order For refunding an expired order you can run `yarn run:refundOrder`. Make sure the following environment variable are set: - `NETWORK`: the name of the network you want to run the script, it should be the destination network of your order - `USER_PK`: the private key to use for executing the tx, the address should own some gas to pay for the Hyperlane message +- `ROUTER_ADDRESS`: address of router - `ORDER_ORIGIN`: the chain id of the order's origin chain - `ORDER_FILL_DEADLINE`: the `fillDeadline` used when opening the order - `ORDER_DATA`: the `orderData` used when opening the order diff --git a/solidity/script/DeployToken.s.sol b/solidity/script/DeployToken.s.sol index c547afb2..b1485f4f 100644 --- a/solidity/script/DeployToken.s.sol +++ b/solidity/script/DeployToken.s.sol @@ -17,10 +17,11 @@ contract DeployToken is Script { function run() public { uint256 deployerPrivateKey = vm.envUint("DEPLOYER_PK"); address owner = vm.envAddress("ROUTER_OWNER"); + string memory TEST_TOKEN_SALT = vm.envString("TEST_TOKEN_SALT"); vm.startBroadcast(deployerPrivateKey); - IntentTestToken itt = new IntentTestToken{salt: keccak256(abi.encode("IntentTestToken.0.0.1"))}(owner); + IntentTestToken itt = new IntentTestToken{salt: keccak256(abi.encode(TEST_TOKEN_SALT))}(owner); vm.stopBroadcast(); diff --git a/solidity/script/OpenOrder.s.sol b/solidity/script/OpenOrder.s.sol index 686624b1..b458c27a 100644 --- a/solidity/script/OpenOrder.s.sol +++ b/solidity/script/OpenOrder.s.sol @@ -17,7 +17,7 @@ import { /// @dev See the Solidity Scripting tutorial: https://book.getfoundry.sh/tutorials/solidity-scripting contract OpenOrder is Script { function run() public { - uint256 deployerPrivateKey = vm.envUint("DEPLOYER_PK"); + uint256 deployerPrivateKey = vm.envUint("USER_PK"); vm.startBroadcast(deployerPrivateKey); diff --git a/solidity/script/RefundOrder.s.sol b/solidity/script/RefundOrder.s.sol index ee629ade..71f6b6bb 100644 --- a/solidity/script/RefundOrder.s.sol +++ b/solidity/script/RefundOrder.s.sol @@ -19,7 +19,7 @@ contract RefundOrder is Script { function run() public { uint256 deployerPrivateKey = vm.envUint("USER_PK"); - address router = vm.envAddress("ROUTER"); + address router = vm.envAddress("ROUTER_ADDRESS"); uint32 fillDeadline = uint32(vm.envUint("ORDER_FILL_DEADLINE")); uint32 orderOrigin = uint32(vm.envUint("ORDER_ORIGIN")); bytes memory orderData = vm.envBytes("ORDER_DATA"); diff --git a/yarn.lock b/yarn.lock index ee835189..8c2b9261 100644 --- a/yarn.lock +++ b/yarn.lock @@ -13153,11 +13153,11 @@ __metadata: "typescript@patch:typescript@npm%3A^5.6.3#optional!builtin": version: 5.7.3 - resolution: "typescript@patch:typescript@npm%3A5.7.3#optional!builtin::version=5.7.3&hash=5786d5" + resolution: "typescript@patch:typescript@npm%3A5.7.3#optional!builtin::version=5.7.3&hash=cef18b" bin: tsc: bin/tsc tsserver: bin/tsserver - checksum: 10/dc58d777eb4c01973f7fbf1fd808aad49a0efdf545528dab9b07d94fdcb65b8751742804c3057e9619a4627f2d9cc85547fdd49d9f4326992ad0181b49e61d81 + checksum: 10/3ac7b7e3e899273d2fbdce6e24b93d4d53a705ad7a7e4cc83b4c57bcb6d25948abcd2a21994f6b9c73ab03960f395aae95f0458de292a66ce0134233261714c3 languageName: node linkType: hard