Skip to content

TIP-111: Increase stable backing to 90-100%#897

Merged
thomas-waite merged 21 commits intodevelopfrom
feat/lido-deposit-oracle
Jun 15, 2022
Merged

TIP-111: Increase stable backing to 90-100%#897
thomas-waite merged 21 commits intodevelopfrom
feat/lido-deposit-oracle

Conversation

@eswak
Copy link
Contributor

@eswak eswak commented Jun 11, 2022

PR Type: Feature

DAO action :

  • Add an oracle on the stETH PCVDeposit, and migrate stETH from the old contract to a new contract
  • Unstake all B-70WETH-30FEI from Balancer gauge, remove liquidity, burn FEI, and send WETH to PSM
  • FIP_104b actions (Prepare LBP withdraw #821)

PR Checklist - Feature (Proposal)

  • All Tests Passing
  • Proposal Added to ProposalsConfig
  • Fork Block Correct
  • Remove Any .only's on Tests
  • Update Documentation If Needed
  • Update Roles Config
  • Proposal Submitted

Copy link
Contributor

@thomas-waite thomas-waite left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Know this is WIP, few clarifying questions

@eswak eswak changed the title (wip) steth new contract + proposal TIP-111: Increase stable backing to 90-100% Jun 13, 2022
Copy link
Contributor

@thomas-waite thomas-waite left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me. Small comments. When we merge this, I'll consolidate into one DAO vote to also pull the DAI out of the DPI LBP

@eswak eswak marked this pull request as ready for review June 13, 2022 19:32
@eswak eswak requested a review from a team as a code owner June 13, 2022 19:32
Copy link
Contributor

@thomas-waite thomas-waite left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me

'10000' // basisPoints, 100%
],
description:
'Withdraw all DPI from the Compound DAI PCV deposit (~$200k) to the TribalCouncil multisig, where it will be liquidated'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is what I had originally put together - send the leftover DPI to the TC safe where it can be liquidated on a DEX aggregator. Flagging here for others, it's a small amount, appropriate imo

convexPoolPCVDeposit: {
artifactName: 'ERC20CompoundPCVDeposit',
address: '0x525eA5983A2e02abA8aA0BE7D15Cd73150812379',
category: AddressCategory.PCV_V1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this actually PCV_V1?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fun fact but this PCV deposit is actually using the PCV_V2 interface, idk why but a wrapper has been deployed, and it's the wrapper that is in the CR oracle (even though there was no need for wrapping)

If we flag this as PCV, the e2e automatically expect it to be configured in the CR oracle, which is not the case

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added it because it was not in our mainnetAddresses file & that's a problem because it's holding protocol funds (only the wrapper was in mainnetAddresses)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's so weird

this.fei = await ethers.getContractAt('Fei', await this.core.fei());
this.steth = await (await ethers.getContractFactory('MockStEthToken')).deploy();
this.stableswap = await (await ethers.getContractFactory('MockStEthStableSwap')).deploy(this.steth.address);
this.oracle = await (await ethers.getContractFactory('MockOracle')).deploy(1);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should remove references to this in this file - I know most of them were already here but this is bad practice as this bypasses type checking since these vars are created at runtime.

await ethers.getContractFactory('EthLidoPCVDeposit')
).deploy(
this.core.address,
{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Getting some errors on typing for the oracle params, are you sure this is correct? My types show that the second param here should be a string.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you may need to recompile, I had this problem while developing, the old types were used and I got a lot of warnings in my editor. I have added a structure for oracle params in the constructor, but the old 2nd parameter was a string (now the 3rd parameter is a string, and 2nd is a structure)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

one more reason why I don't like that we add a compilation layer on top of js btw

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this is functionally the same as doInvert, should we use that verbage so that it's the same across oracles?

Copy link
Contributor

@Joeysantoro Joeysantoro Jun 13, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd add this naming has confusing boolean interpretations. It is not multiply || divide

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we just name it multiply ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doInvert to me means you're directly inverting something - 1 / quantity. Not sure of the smoothest syntax. Maybe two boolean parameters:

bool multiply
bool divide

require(multiply != true && divide != true, "Can not set multiply and divide to true")

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we settled for invertOracleB in dev chat, used that

expect(stethBalanceBefore).to.be.at.most(51000);

// --------------------------------------------------------------
// FIP_104b validation
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: FIP_104 incorrect

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these are actually the steps from Tom's fip_104, that have been combined with tip_111 to not need a 2nd dao vote

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I called it FIP_104b to indicate it was the second part/cleanup (FIP_104 started the LBP, transferred CREAM and did various technical maintenance tasks)

values: '0',
method: 'deposit()',
arguments: () => [],
description: 'Deposit all WETH in Aave'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we may not want to do this, Aave could have solvency issues with stETH leverage

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm adding a call to move WETH to PSM (we can pause PSM with guardian prior to execution)

thomas-waite
thomas-waite previously approved these changes Jun 15, 2022
Copy link
Contributor

@thomas-waite thomas-waite left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me

@thomas-waite thomas-waite merged commit f155def into develop Jun 15, 2022
@thomas-waite thomas-waite deleted the feat/lido-deposit-oracle branch June 15, 2022 20:02
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.

4 participants

Comments