-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
External Liquidity Providers #13
Conversation
Made the AbstractARM more generic Improved OETH ARM tests
Added donation attack protection to MultiLP
Made it clear the deposit and withdraw hooks are post function
Moved calc of perf fee to LP deposit and withdraw instead of swaps
…est to claimTimestamp Fixed compilation of contracts using PerformanceFee
Renamed liquidityToken to liquidityAsset Renamed _assetsInWithdrawalQueue to _externalWithdrawQueue
* fix: remove zap restricted method.. * style: change liquidity provider param name. * fix: change state then write call. * fix: state change then transfer token. * fix: use `fees` instead of `fee` when collecting fees. * fix: move up `nextWithdrawalIndex` increase. * fix: avoid code duplication. * fix: pack variable action (read & write).
Fixed comment typos
* Set buy and sell prices in initialize function setCrossPrice also validates buy and sell prices against the new cross price * fix: use `newCrossPrice` instead of `crossPrice`. * fix: use `<=` instead of `<` for `setCrossPrice`. * test: add reverting test for `setCrossPrice`. * fix: revert commit `a7947f3`. * fix: move `setCrossPrice` test to new file. * test: add more test for `setCrossPrice`. * feat: allow anyone to call claimLidoWithdrawals. * fix: adjust failing test * fix: remove testing stuff. --------- Co-authored-by: Clément <[email protected]>
initial performance fee set to 20% initial total assets cap set to 400 ether
* Increased rounding in swapTokensForExactTokens to cover 1-2 wei lost with stETH transfers Added test_SwapTokensForExactTokens_Steth_Transfer_Truncated test Added test modifiers disableCaps, setPrices and setArmBalances * Updated fuzz tests for SwapTokensForExactTokens * Added to SwapExactTokensForTokens fuzz tests * Added workaround to swapExactTokensForTokens fuzz test * fix: adjust test structure. * fix: initialize `accountCapEnabled` to false. * fix: adjust lastTotalAsset check after swap. --------- Co-authored-by: Clément <[email protected]>
* chore: add solmate. * feat: add mock for stETH. * feat: add mock for Lido Withdraw. * fix: cleanup variables * feat: create shared contract for invariant. * [WIP] feat: add handler logic. * feat: add more users. * [WIP] feat: add distribution handler. * chore: add invariant config * fix: address null user bug. * feat: add LP Handler. * [WIP]: feat: swapHandler. * feat: add swapTokensForExactTokens to handler. * fix: adjust handler weight. * fix: set default verbosity to 3. * fix: adjust console log * feat: add Owner handler. * fix: account withdraw queue in available liquidity. * fix: adjust failing tx. * fix: use vm to send ETH instead of .call. * feat: add Lido Liquidity Manager Handler. * feat: check preview return corerct amount. * fix: use correct price * fix: adjust new availableTotalAssets * chore: use --fail-fast for test * [WIP] feat: add first invariants. * [WIP] feat: add more invariants. * [WIP] feat: adjust handler and add more invariants. * [WIP] feat: add invariant for lido liquidity manager. * feat: add donation handler. * test: add new concrete scenario test. * test: fix CI. * try to fix CI. * test[invariant]: ensure enough liquiidty before claiming fees. * chore: add --show-progress for `make test` * test[invariant]: adjust `withdrawsClaimable` removal. * fix: use aproxEq instead of Eq due to rounding error * chore: remove --show-progress * test[invariant]: only request when there is enough liquidity * test[invariant]: add more invariant. * fix: remove wrong invariant. * fix: adjust with latest update. * test: adjust with lastest update. * test[invariant]: use owner to set price. * chore: add --show-progress for tests. * fix: use new claimDelay. * docs: adjust comments. * test[invariant]: add setCrossPrice to handlers. * test[invariant]: adjust test. * forge fmt * feat: add stats for invariants. * chore: ignore warning in Proxy.sol. * fix: adjust with new variable name. * test[invariant]: adjust swap handler with latest update. * fix: import console. * fix: adjust claimResquest for invariant. * test[invariant]: WIP. * test[invariant]: add LLM to invariant. * test[invariant]: adjust owner handler. * perf: optimize calls for logs. * perf: adjust % for call distribution. * feat: add skip %. * test[invariant]: adjust last invariant. * fix: log stat bool. * test[invariant]: up only shares values invariant. * fix: adjust type uint120 to uint128 * fix: prevetn setCrossPrice to revert. * feat: remove all user funds after invariants. * test[invariant]: add approx up-only invariant [WIP] * test[invariant]: add invariant for approx up-only. * docs: adjust natspec and description. * forge fmt * fix: increase error tolerance.
* fix: remove etherscan setting from config. * chore: update forge version. * chore: exclude invariant from classic test.
// Wrap all the received ETH to WETH. | ||
weth.deposit{value: etherAfter}(); | ||
|
||
emit ClaimLidoWithdrawals(requestIds); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🟠 We have the amount out in the RequestLidoWithdrawals
event. It would seem symmetrical to also have it in the ClaimLidoWithdrawals
. Plus it allows tracking the lidoWithdrawalQueueAmount
via only events.
// Store the updated queued amount which reserves liquidity assets (WETH) in the withdrawal queue | ||
withdrawsQueued = queued; | ||
|
||
uint40 claimTimestamp = uint40(block.timestamp + claimDelay); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🟣 Not a safecast. Somewhere around the year 34,963, this will roll over. As it is, it will allow for instant redeems during that ten minute time. With a safecast, it would block new claim requests for that ten minutes, before allowing them request and collect again as normal.
Anyone with an old claims from before the roll over is going to be an LP for another couple wànsuì one way or the other, regardless of what this does.
Lido Automated Redemption Manager (ARM)
Upgrades the existing OSwapWEthStEth contract originally deployed for experimenting with AMMs to a new Lido Automated Redemption Manager (ARM)
LidoARM
implementation.The new implementation supports:
Existing features include:
Contracts Diagrams
LidoARM
CapManager
ZapperLidoARM
Testnet
The following contracts have been deployed to the Lido ARM 4 Tenderly Testnet
Contrcts
ABI
Lido ARM
CapManager
ZapperLidoARM
Deployment
Tenderly Testnet
# set the TESTNET_URL environment variable in the .env file make deploy-testnet
Mainnet
The mainnet deploy script is
script/deploy/mainnet/003_UpgradeLidoARMScript.sol
.This will update the contract addresses in
build/deployments-1.json
.# set the PROVIDER_URL and DEPLOYER_PRIVATE_KEY environment variables in the .env file make deploy
Deployment Plan
ARM-WETH-stETH
and nameLido ARM
Testing
The following will run all the ARM fork and smoke tests
Testnet using Hardhat tasks