Skip to content

This project is a cross-chain rebase token where users can depost ETH in exchange for rebase tokens which accrue rewards over time.

Notifications You must be signed in to change notification settings

sg-milad/foundry-cross-chain-rebase-token

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Foundry Cross Chain Rebase Token

About

This project is a cross-chain rebase token where users can depost ETH in exchange for rebase tokens which accrue rewards over time.

Start a local node

make anvil

Deploy

This will default to your local node. You need to have it running in another terminal in order for it to deploy.

make deploy

Deploy - Other Network

See below

Testing

We talk about 4 test tiers on Updraft:

  1. Unit
  2. Integration
  3. Forked
  4. Staging

In this repo we cover #1 and Fuzzing.

forge test

Testing Coverage

forge coverage

and for coverage based testing:

forge coverage --report debug

Deployment to a testnet or mainnet

  1. 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.
  • 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.

  1. Get testnet ETH

Head over to faucets.chain.link and get some testnet ETH. You should see the ETH show up in your metamask.

  1. Deploy
make deploy ARGS="--network sepolia"

Scripts

Instead of scripts, we can directly use the cast command to interact with the contract.

For example, on Sepolia:

  1. Get some RebaseTokens
cast send <vault-contract-address> "deposit()" --value 0.1ether --rpc-url $SEPOLIA_RPC_URL --wallet
  1. 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

Formatting

To run code formatting:

forge fmt

About

This project is a cross-chain rebase token where users can depost ETH in exchange for rebase tokens which accrue rewards over time.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published