-
Notifications
You must be signed in to change notification settings - Fork 91
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
Sell Pressure Dampening via Transfer Hook - Proof of Concept #347
Comments
Reference #218 |
POC should be as simple as possible but ideally if you can do it off of post-swap-price e.g. (0.98 and below) |
Report for sell pressure Dampening0x10693e86f2e7151B3010469E33b6C1C2dA8887d6 Transfer hookto fight a big sell off the idea was to leverage the transfer hook to immediately counter it by adding 3CRV in the curve pool I started by adding an incentive contract + test on this branch to assess the price change I simulate a balance change and get the price based on the updated balances. As seen in the test either swapping or adding liquidity fails and the reason is reentrancy guard inside curve metapool indeed the transfer hook happens inside the swap function when the metapool is tranfering uAD from the seller. It is then impossible to add liquidity to curve when we sell on curve. Another idea is to instead add liquidity to uniswap pool (uAD/DAI for instance) when we sell on curve and add liquidity to curve when we sell on curve
Offchain AutomationWe can monitor for transfer event from the metapool to detect a sell and based on the same calculation as before trigger a tx that will provide liquidity to the curve pool. This can be done with Open Zeppelin defender for instance as they not only provide a convenient event watcher but also a relay that includes a private key secure storage. @pavlovcik wants a fully onchain mechanism |
Lets only do whatever the collateral reserve is in (LUSD/RAI/ETH?)
We can arbitrage this (and profit?) with transfer hooks. Famously coined by 1inch "positive slippage"
Because theres profit with arbitraging, I think that this should be resolved naturally by market forces.
We should consider using a rollup that Uniswap is on. We also must define what liquidity range. Probably 1 tick below market price and down to 1.00 would make the most sense for adding single sided liquidity. We could also recycle NFT positions that we already made, for example, always add to the NFT position we made at $1.00 - $1.000001 etc |
I'll release the bounty but I hope that we can continue working on this research together. I see your wallet address at the top of report (as confirmed in our Telegram chat)
https://etherscan.io/tx/0xaa514f34d2e6d0903e889b12c889c75dc4b54a3d2b4f50410ac3fd09716fc820 |
it depends if we want an absolute peg to $USD
arbitrage here would mean buy cheap uAD for 3CRV on curve thus increasing its price on curve and sell it on uniswap
I agree with that
so making a cross chain call from mainnet (triggered by the transfer hook) to let say optimism uniswap pool uAD/LUSD |
Economically I think that floating, like RAI, makes more sense; but from an adoption standpoint I think that "absolute peg" makes more sense for normal people to use and understand.
And getting back LUSD/RAI/ETH(?) and then storing it back in the collateral reserve, yes. That, or ideally putting it right back into the market but I don't think thats possible due to re-entrancy.
No I think that we should consider a full new protocol deployment on Optimism etc if we're going to depend heavily on complex logic for transfer hooks for stability etc. We might have to do the boring, simple solution of letting people take their uAD and redeeming directly from our collateral reserve, and letting those people arbitrage to save the price. |
Does it make sense to preserve your code in some type of tests/research folder? I fear if it only lives on some obscure branch that it may get deleted on accident at some point in the future. |
@zgorizzo69 following up on my previous comment. |
I think we can fork that branch to another repo indeed if we are worried about it being deleted |
Okay I'll let you handle that cause I'm not sure exactly what you mean. |
Seems cleaner than making separate repos. Sure let's use tags. |
Permit generation skipped because the issue was not closed as completed |
Let's say that a whale is selling huge amount of uAD on the curve metapool. This can very affect the peg and trigger an unwanted chain of events leading to a bank run.
The idea is to use the transfer hook to detect and counter that sell with a one sided liquidity provision
so the flow is
use sells uAD from uAD-3crv metapool
that triggers a hook that will transfer an ERC20 (e.g) to the metapool as a one sided liquidity
the erc20 belongs to the hook contract and only the hook contract can provide it as liquidity and thus receive the corresponding LP token
X Amount
Y Amount
ofDAI
USDC
USDT
as liquity whereY = z * X
estimation between 1 and 2 days
The text was updated successfully, but these errors were encountered: