Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Repository files navigation

About

This project is meant to be a stablecoin where users can deposit WETH and WBTC in exchange for a token that will be pegged to the USD.

Getting Started

Requirements

• git ⸰ You'll know you did it right if you can run git --version and you see a response like git version x.x.x • foundry ⸰ You'll know you did it right if you can run forge --version and you see a response like forge 0.2.0 (816e00b 2023-03-16T00:05:26.396218Z)

Quickstart

git clone https://github.com/Preciousbas/foundry-stablecoin
cd foundry-stablecoin
forge build

Usage

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

Test

forge test

Test 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.

⸰ PRIVATE_KEY: The private key of your account (like from metamask). ⸰ 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 any faucet of your choice and get some Sepolia testnet ETH. You should see the ETH show up in your metamask.

  2. 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 WETH
cast send 0x3b3901ea5DF1fDF6c7f3B22b8A03d935b42D1E85 "deposit()" --value 0.1ether --rpc-url $SEPOLIA_RPC_URL --private-key $PRIVATE_KEY
  1. Approve the WETH
cast send 0x3b3901ea5DF1fDF6c7f3B22b8A03d935b42D1E85 "approve(address,uint256)" 0x091EA0838eBD5b7ddA2F2A641B068d6D59639b98 1000000000000000000 --rpc-url $SEPOLIA_RPC_URL --private-key $PRIVATE_KEY
  1. Deposit and Mint ZEN
cast send 0x091EA0838eBD5b7ddA2F2A641B068d6D59639b98 "depositCollateralandMintZen(address,uint256,uint256)" 0xdd13E55209Fd76AfE204dBda4007C227904f0a81 100000000000000000 10000000000000000 --rpc-url $SEPOLIA_RPC_URL --private-key $PRIVATE_KEY

Format

forge fmt

Gas Snapshots

You can estimate how much gas things cost by running:

forge snapshot

Help

forge --help
anvil --help
cast --help

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages