Skip to content

sidestream-tech/sky-star-test-setup

Repository files navigation

Sky Star Test Setup

Easily deploy the Sky allocation system and Spark ALM controller to any EVM-compatible chain, including all required mock contracts. This repository is designed to help Sky Stars test and validate contracts quickly.

Included Deployments

Prerequisites

Quick Start

To deploy and configure contracts to the Avalanche Fuji public testnet:

  1. Set environment variables

    • Copy the example environment via cp .env.dev .env
    • Edit .env to update the variables as described in the "Environment Variables" section below
  2. Set correct variables inside script/input/{CHAIN_ID}/input.json based on the "Configuration Variables" section below

  3. Create correct output folders in script (script/output/{CHAIN_ID}/dry-run/) to log created contracts address correctly

  4. Dry-run a transaction to determine the amount of required gas

    forge script script/SetUpAll.s.sol:SetUpAll --fork-url fuji -vv
  5. Get enough gas tokens using a faucet

  6. (optional) Required for CCTP testing: Get enough testnet USDC from Circle USDC faucet. This is required by the LitePSM mock contract which expects USDC to be present on the deployer wallet.

  7. Deploy, configure and verify contracts

    forge script script/SetUpAll.s.sol:SetUpAll --fork-url fuji -vv --broadcast --verify --slow
  8. (optional) Commit generated broadcast/SetUpAll.s.sol/11155111/run-latest.json and script/output/11155111/output-latest.json to record deployed contract addresses

Environment Variables

Variable Description
PRIVATE_KEY Deployer's private key (used as admin for all contracts)
FOUNDRY_ROOT_CHAINID Chain ID for deployment
FUJI_RPC_URL RPC URL for Avalanche Fuji

Deploying to Other Chains

  1. Update FOUNDRY_ROOT_CHAINID in .env to use chain id of the network you're trying to deploy to. For example, to deploy to Sepolia that would be 11155111
  2. Add new *_RPC_URL to the .env pointing to the PRC endpoint for the chain specified above, e.g:
    SEPOLIA_RPC_URL = "https://..."
  3. Create script/input/{CHAIN_ID}/input.json file with relevant content
  4. Add the new verification endpoint to the foundry.toml, e.g:
    sepolia = { key = "${ETHERSCAN_API_KEY}", chain = 11155111 }
  5. Add the new rpc_endpoints in foundry.toml, e.g.:
    sepolia = "${SEPOLIA_RPC_URL}"
  6. Follow the "Quick start" section, while specifying the chain name under --fork-url (e.g. sepolia) when running the script, e.g.:
    forge script script/SetUpAll.s.sol:SetUpAll --fork-url ${CHAIN} -vv

input.json Configuration Variables

Variable Description
ilk Collateral type identifier (e.g., "ALLOCATOR_STAR_A")
usdcUnitSize Amount of USDC (in smallest units, e.g., wei) to use for testing (default: 10)
cctpDestinationDomain CCTP destination domain ID for cross-chain messaging (see supported domains)
cctpTokenMessenger Address of the CCTP Token Messenger contract on the target chain (see EVM contracts)
cctpRecipient USDC token account of the CCTP transfer recipient in HEX, decode can be done using tools like this. It should correspond to the destination domain
usdc Address of the USDC token contract on the target chain (see contract addresses)
relayer Address of the relayer to be used by the ALM controller

Running Tests

  • Run all tests:

    forge test
  • Run a specific test by name:

    forge test --match-test ${YourTestName} -vvv

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •