harb/onchain/README.md

164 lines
3.5 KiB
Markdown
Raw Normal View History

2024-03-12 12:01:48 +01:00
## Foundry
2023-11-21 21:24:48 +01:00
2024-03-12 12:01:48 +01:00
**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
2024-03-12 20:22:10 +01:00
### Install
```shell
$ git clone
$ git submodule init
$ git submodule update
$ cd lib/uni-v3-lib
$ yarn
```
2024-03-12 12:01:48 +01:00
### Build
```shell
$ forge build
```
### Test
```shell
$ forge test
2023-11-21 21:24:48 +01:00
```
2024-03-12 12:01:48 +01:00
### Format
```shell
$ forge fmt
```
### Gas Snapshots
```shell
$ forge snapshot
2023-11-21 21:24:48 +01:00
```
2024-03-12 12:01:48 +01:00
### Anvil
2023-11-21 21:24:48 +01:00
2024-03-12 12:01:48 +01:00
```shell
$ anvil
2023-11-21 21:24:48 +01:00
```
2024-03-12 12:01:48 +01:00
### Deploy
```shell
2024-06-25 09:38:23 +02:00
forge clean
forge cache clean
2024-03-12 20:22:10 +01:00
source .env
2024-04-11 22:32:47 +02:00
forge script script/Deploy.sol:SepoliaScript --slow --broadcast --verify --rpc-url ${SEPOLIA_RPC_URL}
2024-03-12 12:01:48 +01:00
```
2024-04-11 22:32:47 +02:00
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
2024-04-11 22:32:47 +02:00
forge verify-contract --watch --chain sepolia --constructor-args $(cast abi-encode "constructor(address)" "0x7517db0f2b24223f2f0e3567149ca180e204da8a") 0x00b4d656b8182d0c2f4841b7a6f1429b94f73a66 Stake
2024-04-11 22:32:47 +02:00
```
2024-03-12 12:01:48 +01:00
### Cast
```shell
$ cast <subcommand>
2023-11-21 21:24:48 +01:00
```
2024-03-12 12:01:48 +01:00
### Help
2023-11-21 21:24:48 +01:00
2024-03-12 12:01:48 +01:00
```shell
$ forge --help
$ anvil --help
$ cast --help
2023-11-21 21:24:48 +01:00
```
2024-03-12 20:22:10 +01:00
## Deployment on Sepolia
### Harb
2024-06-25 10:33:33 +02:00
address: 0x087F256D11fe533b0c7d372e44Ee0F9e47C89dF9
2024-05-15 19:44:56 +02:00
[abi](../subgraph/harb/abis/Harb.json)
2024-03-12 20:22:10 +01:00
### Stake
2024-06-25 10:33:33 +02:00
address: 0xCd21a41a137BCAf8743E47D048F57D92398f7Da9
2024-05-15 19:44:56 +02:00
[abi](../subgraph/harb/abis/Stake.json)
2024-04-11 22:32:47 +02:00
2024-06-25 10:33:33 +02:00
### LP
address: 0xCc7467616bBDB574D04C7e9d2B0982c59F33D43c
[abi](../subgraph/harb/abis/BaseLineLP.json)
2024-08-15 18:30:43 +02:00
## Deployment on Base Sepolia
### Harberg
address: 0x00d5690044cf91fb3fc674c780697d511702f729
### Stake
address: 0x275403401f9c6f4659b6ffb6ab01798e1de9a912
### LP
address: 0x0360c20822a7298e9061248b39fe475a78d4de48
## References
- take percentage math from here: https://github.com/attestate/libharberger/tree/master
- add this function: https://github.com/721labs/partial-common-ownership/blob/3e7713bc60b6bb2e103320036ec5aeaaaceb7d2b/contracts/token/modules/Taxation.sol#L260
2024-04-11 22:32:47 +02:00
- limit discovery position growth to max_issuance / day
2024-06-19 10:33:28 +02:00
open features:
- token minting limit / limit on discovery position growth
- ERC721 & ERC4907, user/owner separation, influencer incentives
- token contract not visible in uniswap sepolia
- snatch collision
- previousTotalSupply at beginning?
- profit for staking position
- tax paid for staking position
- partially snatched
- liquidation bot
- shift/slide bot
- ubi claim bot
2024-07-13 18:33:47 +02:00
- deployment on L2
- make minStake a gov param
- prep for audit
- clean up TODOs
- clean up magic numbers
- coverage
- overflows
- reentry
2024-07-16 19:47:39 +02:00
- HARB
- mint - limit supply to 2^96?
- Stake
- what if someone calls payTax and exitPosition in the same transaction?
2024-07-17 14:08:53 +02:00
- LiquidityManager
2024-07-16 19:47:39 +02:00
- what to do with stuck funds if slide/shift become inoperable?
2024-07-17 14:08:53 +02:00
- _isPriceStable - // Handle try catch, possibly by trying with a different time interval or providing a default response\
- test wraparound of vwap
2024-07-16 19:47:39 +02:00
2024-07-13 18:33:47 +02:00
- NFT support of etherscan
https://etherscan.io/nft/0xe12edaab53023c75473a5a011bdb729ee73545e8/4218