MrToph / goostew

MIT License
49 stars 4 forks source link

GooStew

Note pronounced gusto with an Italian accent - gù·sto

GooStew optimizes goo production for its users. Users deposit gobblers and/or goo and receive more goo than they would have received from goo inflation. The simplest example is pairing a gobbler without goo with a user who does not own a gobbler but has lots of goo; or a gobbler with a high emission multiple but a low goo tank with another gobbler with a low emission multiple but a high goo tank. Combined, the goo production will be higher than the sum of their individual goo productions.

It turns out that providing your gobblers and goo to the protocol is always superior to producing goo on your own, no matter your gobbler / goo ratio. Intuitively, this is because putting all goo into a single pot and optimally distributing this goo over all gobblers (according to their different emission multiples) leads to a higher total goo production than the sum of several smaller non-optimized gobbler & goo pots.

GooStew is therefore a no-loss goo production protocol. In the worst case, users receive as much goo as they would have produced on their own, in the average case they vastly improve their goo production. The additional goo produced by the protocol is distributed to users according to their individual contributions. See the technical paper for more info on how contributions are measured.

Features

Development

### Installation ```sh forge install forge build # copy example.env and fill in the required env vars cp example.env .env forge test ``` ### Run Tests ```sh source .env forge test -vvv ``` ### Gas Benchmarks ```sh forge snapshot --match-contract BenchmarksTest --diff ``` ### Web app testing ```sh source .env # start local anvil node forking from mainnet anvil --accounts 1 --fork-url $ETHEREUM_RPC_URL --fork-block-number 15854780 --port 8546 # deploy contracts to local node forge script script/DeploymentLocal.s.sol:Deployment --rpc-url local --broadcast -vv # let web app know the ABI & deployment addresses cp out/GooStew.sol/GooStew.json ../goostew-app/abis/GooStew.json cp broadcast/DeploymentLocal.s.sol/1/run-latest.json ../goostew-app/abis/deployment.json ``` ### Deployment ```sh source .env # mainnet forge script script/DeploymentEthereum.s.sol:Deployment --rpc-url mainnet --private-key $PRIVATE_KEY --broadcast --verify --etherscan-api-key $ETHERSCAN_KEY -vvvv # if verification fails with "Etherscan could not detect the deployment.". Resume script forge script script/DeploymentEthereum.s.sol:Deployment --rpc-url mainnet --private-key $PRIVATE_KEY --resume --verify --etherscan-api-key $ETHERSCAN_KEY -vvvv ```