This project is a cross-chain rebase token where users can depost ETH in exchange for rebase tokens which accrue rewards over time.
make anvil
This will default to your local node. You need to have it running in another terminal in order for it to deploy.
make deploy
We talk about 4 test tiers on Updraft:
- Unit
- Integration
- Forked
- Staging
In this repo we cover #1 and Fuzzing.
forge test
forge coverage
and for coverage based testing:
forge coverage --report debug
- Setup environment variables
You'll want to set your SEPOLIA_RPC_URL
and PRIVATE_KEY
as environment variables. You can add them to a .env
file, similar to what you see in .env.example
.
PRIVATE_KEY
: The private key of your account (like from metamask). NOTE: FOR DEVELOPMENT, PLEASE USE A KEY THAT DOESN'T HAVE ANY REAL FUNDS ASSOCIATED WITH IT.- You can learn how to export it here.
SEPOLIA_RPC_URL
: This is url of the sepolia testnet node you're working with. You can get setup with one for free from Alchemy
Optionally, add your ETHERSCAN_API_KEY
if you want to verify your contract on Etherscan.
- Get testnet ETH
Head over to faucets.chain.link and get some testnet ETH. You should see the ETH show up in your metamask.
- Deploy
make deploy ARGS="--network sepolia"
Instead of scripts, we can directly use the cast
command to interact with the contract.
For example, on Sepolia:
- Get some RebaseTokens
cast send <vault-contract-address> "deposit()" --value 0.1ether --rpc-url $SEPOLIA_RPC_URL --wallet
- Redeem RebaseTokens for ETH
cast send <vault-contractaddress> "redeem(uint256)" 10000000000000000 --rpc-url $SEPOLIA_RPC_URL --wallet
## Estimate gas
You can estimate how much gas things cost by running:
forge snapshot
And you'll see an output file called .gas-snapshot
To run code formatting:
forge fmt