forge script script/DeployTokens.s.sol:DeployTokens --rpc-url base_goerli --broadcast --verify
forge script script/DeployFarming.s.sol:DeployFarming --rpc-url base_goerli --broadcast --verify
forge script script/DeployOracle.s.sol:DeployOracle --rpc-url base_goerli --broadcast --verify
forge script script/DeployPool.s.sol:DeployPool --rpc-url base_goerli --broadcast --verify
forge script script/DeployCreditGuard.s.sol:DeployCreditGuard --rpc-url base_goerli --broadcast --verify
forge script script/DeployDebugGuard.s.sol.s.sol:DeployDebugGuard.s.sol --rpc-url base_goerli --broadcast --verify
Next, create a Safe at https://app.safe.global/. Set the CreditGuard as the guard of the Safe using setGuard
function of the deployed Safe contract.
ABI of setGuard
:
[{
"constant": false,
"inputs": [
{
"internalType": "address",
"name": "guard",
"type": "address"
}
],
"name": "setGuard",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
}]
Next, you can perform a leverage farming strategy using Safe Transaction Builder.
- Mint some
MockDAI
to the Safe as initial funds - Borrow more tokens from
TokenPool
- Approve
Farming
to spend tokens - Deposit tokens to
Farming
CreditGuard
post-transaction check will make sure that the Safe is not over-leveraged after the batch of transactions.
If you try to borrow more funds that causes the health factor to be too low, the transaction will be reverted.
Foundry is a blazing fast, portable and modular toolkit for Ethereum application development written in Rust.
Foundry consists of:
- Forge: Ethereum testing framework (like Truffle, Hardhat and DappTools).
- Cast: Swiss army knife for interacting with EVM smart contracts, sending transactions and getting chain data.
- Anvil: Local Ethereum node, akin to Ganache, Hardhat Network.
- Chisel: Fast, utilitarian, and verbose solidity REPL.
$ forge build
$ forge test
$ forge fmt
$ forge snapshot
$ anvil
$ forge script script/BaseScript.sol:CounterScript --rpc-url <your_rpc_url> --private-key <your_private_key>
$ cast <subcommand>
$ forge --help
$ anvil --help
$ cast --help