Skip to content

sprintertech/sprinter-stash-contracts

Repository files navigation

sprinter-liquidity-contracts

Solidity contracts that facilitate Sprinter Liquidity logic

Install

node 22.x is required
nvm use
npm install
npm run compile

Test

npm run test

Deployment

For local development you need to run a local hardhat node and deploy to it:

npm run node
npm run deploy-local

Local deployment wallet private key is: 0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80

To deploy to live networks, create a .env file using the .env.example and fill in the relevant variables (only the ones needed for your deployment). You need to have a private key specified. Inspect and modify if needed the network.config.ts. To deploy to Base Sepolia Testnet do:

npm run dry:deploy-basesepolia
npm run deploy-basesepolia

Make sure to save the output of the deployment. You can use those later in the .env file to run other scripts on the already deployed system.

You could optionally set VERIFY to true in order to publish the source code after deployment to Etherscan.

Deployed contract addresses

YAML

Deployment logs

Base Sepolia, Optimism Sepolia, Arbitrum Sepolia

Base, Optimism Mainnet, Arbitrum One

Rebalancing

Manual Rebalance transaction creation through Safe UI:

  1. Connect to the operations multisig on the source chain.
  2. Click New Transaction -> Transaction Builder (URL is like: https://app.safe.global/apps/open?safe=base:0x83B8D2eAda788943c3e80892f37f9c102271C1D6&appUrl=https%3A%2F%2Fapps-portal.safe.global%2Ftx-builder)
  3. Enter Rebalancer address from deployments config: 0xA85Cf46c150db2600b1D03E437bedD5513869888
  4. Enter initiateRebalance ABI:
[{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"},
{"internalType":"address","name":"sourcePool","type":"address"},
{"internalType":"address","name":"destinationPool","type":"address"},
{"internalType":"enum IRoute.Domain","name":"destinationDomain","type":"uint8"},
{"internalType":"enum IRoute.Provider","name":"provider","type":"uint8"},
{"internalType":"bytes","name":"extraData","type":"bytes"}],
"name":"initiateRebalance","outputs":[],"stateMutability":"nonpayable","type":"function"}]
  1. Fill in transaction details (Base -> Base):

  2. Click + Add new transaction.

  3. Optionally add more transactions to the batch.

  4. Fill in transaction details (Base -> Arbitrum):

  5. Click Create Batch.

  6. Click Simulate.

  7. Click Send Batch.


If rebalancing destination was another chain, then you will need to execute one more transaction on the destination multisig. By CCTP V1 docs it says that attestation could be produced 9-19 minutes after initial transaction, you will need a tx hash for that.

  1. Execute the following in the sprinter stash repo for the source network hardhat --network BASE cctp-get-process-data --txhash {initiate tx hash} to get extra data. If there were multiple rebalances, there would be multiple extra datas, one for each processRebalance call.
  2. Connect to the operations multisig on the destination chain.
  3. Click New Transaction -> Transaction Builder.
  4. Enter Rebalancer address from deployments config: 0xA85Cf46c150db2600b1D03E437bedD5513869888
  5. Enter processRebalance ABI:
[{"inputs":[{"internalType":"address","name":"destinationPool","type":"address"},
{"internalType":"enum IRoute.Provider","name":"provider","type":"uint8"},
{"internalType":"bytes","name":"extraData","type":"bytes"}],
"name":"processRebalance","outputs":[],"stateMutability":"nonpayable","type":"function"}]
  1. Fill in transaction details:

  2. Click + Add new transaction.

  3. Optionally add more transactions to the batch.

  4. Click Create Batch.

  5. Click Simulate.

  6. Click Send Batch.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 5