Skip to content

FIP-5 Update Bonding Curve Allocation#98

Merged
Joeysantoro merged 9 commits intomasterfrom
FIP-5-Fix-Bonding-Curve-Allocation
May 19, 2021
Merged

FIP-5 Update Bonding Curve Allocation#98
Joeysantoro merged 9 commits intomasterfrom
FIP-5-Fix-Bonding-Curve-Allocation

Conversation

@Joeysantoro
Copy link
Contributor

@Joeysantoro Joeysantoro commented May 13, 2021

Summary

This PR mitigates manipulation on the ETH-FEI pair before calling the deposit() function on the EthUniswapPCVDeposit. It adds slippage protection so new deposits can only occur when FEI is trading within a specified percent from the peg. The percent will be set to 1% in the DAO vote.

As part of the fix, we will update the bonding curve so it sends new ETH to the EthReserveStabilizer via the dripper rather than depositing to Uniswap. This removes the attack vector as a malicious actor can no longer deposit arbitrarily large amounts of ETH through the protocol.

This code was reviewed by OpenZeppelin as a part of the issue disclosed here: https://medium.com/fei-protocol/fei-bonding-curve-bug-post-mortem-98d2c6f271e9

Contract Changes

EthUniswapPCVDeposit - 0x5d6446880FCD004c851EA8920a628c70Ca101117

  • updated so liquidity provision can only occur when the FEI-ETH spot price is within maxBasisPointsFromPegLP basis points from the oracle price.
  • maxBasisPointsFromPegLP is settable by governance

EthPCVDepositAdapter - 0x4c52aD4Ad171a58B57592893c37Cc81655e11611 (pointing to new EthUniswapPCVDeposit) and 0xB72dDeD4Fa321e093E2083B596404A56ffC5b574 (pointing to EthPCVDripper)

  • allows ETH transfers to and from contracts that do not conform to the IPCVDeposit interface

RatioPCVController - 0xfC1aD6eb84351597cD3b9B65179633697d65B920

  • allows for a percentage of PCV held in a contract to be withdrawn rather than a raw amount
  • used to fully transfer ETH out of the old EthUniswapPCVDeposit even though the ETH amount can change

DAO Proposal Steps

  1. Update Bonding Curve Allocation
  1. Grant PCV controller new RatioPCVController
  1. Grant Minter new EthUniswapPCVDeposit
  1. Revoke Minter old EthUniswapPCVDeposit
  1. Unpause old EthUniswapPCVDeposit
  1. Transfer liquidity to new EthUniswapPCVDeposit
  1. Set maxBasisPointsFromPegLP on new EthUniswapPCVDeposit

@Bobface
Copy link

Bobface commented May 13, 2021

Looks good to me!

@Joeysantoro Joeysantoro requested a review from Bobface May 13, 2021 19:50
@Joeysantoro Joeysantoro changed the title FIP-5 Fix Bonding Curve Allocation FIP-5 Update Bonding Curve Allocation May 15, 2021
@Joeysantoro Joeysantoro merged commit d3a864e into master May 19, 2021
@xklob xklob deleted the FIP-5-Fix-Bonding-Curve-Allocation branch September 19, 2021 18:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments