Skip to content

Add missing envs to solidity readme #129

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions solidity/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
Expand All @@ -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"
16 changes: 15 additions & 1 deletion solidity/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion solidity/script/DeployToken.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
2 changes: 1 addition & 1 deletion solidity/script/OpenOrder.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
2 changes: 1 addition & 1 deletion solidity/script/RefundOrder.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
4 changes: 2 additions & 2 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -13153,11 +13153,11 @@ __metadata:

"typescript@patch:typescript@npm%3A^5.6.3#optional!builtin<compat/typescript>":
version: 5.7.3
resolution: "typescript@patch:typescript@npm%3A5.7.3#optional!builtin<compat/typescript>::version=5.7.3&hash=5786d5"
resolution: "typescript@patch:typescript@npm%3A5.7.3#optional!builtin<compat/typescript>::version=5.7.3&hash=cef18b"
bin:
tsc: bin/tsc
tsserver: bin/tsserver
checksum: 10/dc58d777eb4c01973f7fbf1fd808aad49a0efdf545528dab9b07d94fdcb65b8751742804c3057e9619a4627f2d9cc85547fdd49d9f4326992ad0181b49e61d81
checksum: 10/3ac7b7e3e899273d2fbdce6e24b93d4d53a705ad7a7e4cc83b4c57bcb6d25948abcd2a21994f6b9c73ab03960f395aae95f0458de292a66ce0134233261714c3
languageName: node
linkType: hard

Expand Down