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.
dss-allocatorspark-alm-controller- Mock contracts:
vat,usdsJoin,usds,sUsds,jug,usdsDai,dai,daiJoin,psmLite
- Foundry must be installed.
To deploy and configure contracts to the Avalanche Fuji public testnet:
-
Set environment variables
- Copy the example environment via
cp .env.dev .env - Edit
.envto update the variables as described in the "Environment Variables" section below
- Copy the example environment via
-
Set correct variables inside
script/input/{CHAIN_ID}/input.jsonbased on the "Configuration Variables" section below -
Create correct output folders in
script(script/output/{CHAIN_ID}/dry-run/) to log created contracts address correctly -
Dry-run a transaction to determine the amount of required gas
forge script script/SetUpAll.s.sol:SetUpAll --fork-url fuji -vv
-
Get enough gas tokens using a faucet
-
(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.
-
Deploy, configure and verify contracts
forge script script/SetUpAll.s.sol:SetUpAll --fork-url fuji -vv --broadcast --verify --slow
-
(optional) Commit generated
broadcast/SetUpAll.s.sol/11155111/run-latest.jsonandscript/output/11155111/output-latest.jsonto record deployed contract addresses
| 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 |
- Update
FOUNDRY_ROOT_CHAINIDin.envto use chain id of the network you're trying to deploy to. For example, to deploy to Sepolia that would be11155111 - Add new
*_RPC_URLto the.envpointing to the PRC endpoint for the chain specified above, e.g:SEPOLIA_RPC_URL = "https://..."
- Create
script/input/{CHAIN_ID}/input.jsonfile with relevant content - Add the new verification endpoint to the
foundry.toml, e.g:sepolia = { key = "${ETHERSCAN_API_KEY}", chain = 11155111 }
- Add the new
rpc_endpointsinfoundry.toml, e.g.:sepolia = "${SEPOLIA_RPC_URL}"
- 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
| 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 |
-
Run all tests:
forge test -
Run a specific test by name:
forge test --match-test ${YourTestName} -vvv