harb/onchain/README.md
2024-09-10 19:13:43 +02:00

138 lines
2.6 KiB
Markdown

## Foundry
**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.
## Documentation
https://book.getfoundry.sh/
## Usage
### Install
```shell
$ git clone
$ git submodule init
$ git submodule update
$ cd lib/uni-v3-lib
$ yarn
```
### Build
```shell
$ forge build
```
### Test
```shell
$ forge test
```
### Format
```shell
$ forge fmt
```
### Gas Snapshots
```shell
$ forge snapshot
```
### Anvil
```shell
$ anvil
```
### Deploy
```shell
forge clean
forge cache clean
source .env
forge script script/Deploy.sol:SepoliaScript --slow --broadcast --verify --rpc-url ${SEPOLIA_RPC_URL}
```
if verification fails:
```shell
forge verify-contract --watch --chain sepolia --constructor-args $(cast abi-encode "constructor(string,string,address,address,address)" "Harberger Tax" "HARB" "0x0227628f3F023bb0B980b67D528571c95c6DaC1c" "0xb16F35c0Ae2912430DAc15764477E179D9B9EbEa" "0x64dda11815b883c589afed914666ef2d63c8c338") 0x7517db0f2b24223f2f0e3567149ca180e204da8a Harb
forge verify-contract --watch --chain sepolia --constructor-args $(cast abi-encode "constructor(address)" "0x7517db0f2b24223f2f0e3567149ca180e204da8a") 0x00b4d656b8182d0c2f4841b7a6f1429b94f73a66 Stake
```
### Cast
```shell
$ cast <subcommand>
```
### Help
```shell
$ forge --help
$ anvil --help
$ cast --help
```
## Deployment on Sepolia
### Harb
address: 0x087F256D11fe533b0c7d372e44Ee0F9e47C89dF9
[abi](../subgraph/harb/abis/Harb.json)
### Stake
address: 0xCd21a41a137BCAf8743E47D048F57D92398f7Da9
[abi](../subgraph/harb/abis/Stake.json)
### LP
address: 0xCc7467616bBDB574D04C7e9d2B0982c59F33D43c
[abi](../subgraph/harb/abis/BaseLineLP.json)
## Deployment on Base Sepolia
### Harberg
address: 0x00d5690044cf91fb3fc674c780697d511702f729
### Stake
address: 0x275403401f9c6f4659b6ffb6ab01798e1de9a912
### LP
address: 0x0360c20822a7298e9061248b39fe475a78d4de48
## References
open features:
- reduce snatch collision
- profit for staking position
- tax paid for staking position
- deployment on L2
todos:
- write unit test for capital exit function
- recenter bot
- put ownerOnly restriction on recenter, remove it later. gives more control to the team initally, but keeps it decentralized
- liquidation bot