-
Notifications
You must be signed in to change notification settings - Fork 99
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
Prepare LBP withdraw #821
Merged
Merged
Prepare LBP withdraw #821
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
e04cf3f
feat: add withdraw lbp liquidity withdraw script
thomas-waite 5d09213
feat: add TC proposal script
thomas-waite 3518a49
refactor: validate safe addresses set
thomas-waite ecdd690
Merge branch 'consolidate-to-one-vote' into prep-lbp-withdraw
thomas-waite 437362e
Merge branch 'develop' into prep-lbp-withdraw
thomas-waite 8be4899
test: remove need to drop liquidity
thomas-waite b93fd66
refactor: remove executed proposal, update block num
thomas-waite 48ad2a3
refactor: use exitPool in withdraw proposal
thomas-waite 43ab496
docs: update proposal name and copy
thomas-waite 64aa64f
Merge branch 'develop' into prep-lbp-withdraw
thomas-waite 434f695
refactor: make use of ratio PCV controller
thomas-waite 2a8dbef
docs: update proposal copy
thomas-waite 19f131c
refactor: remove TC multisig from being safe address
thomas-waite 8830555
docs: update proposal copy
thomas-waite 5fc72b1
Merge branch 'develop' into prep-lbp-withdraw
thomas-waite 8d66561
refactor: remove unneeded safe addresses, cleanup
thomas-waite 44065d8
refactor: update block num, add proposal back in
thomas-waite 1ab8c54
test: unpause RAI psm for e2e
thomas-waite 1f77029
test: setup test fixture for incentives
thomas-waite a818cbe
test: relax sanity check on DAI amount
thomas-waite File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
14885000 | ||
14915266 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
import { ethers } from 'hardhat'; | ||
import { expect } from 'chai'; | ||
import { | ||
DeployUpgradeFunc, | ||
NamedAddresses, | ||
SetupUpgradeFunc, | ||
TeardownUpgradeFunc, | ||
ValidateUpgradeFunc | ||
} from '@custom-types/types'; | ||
import { time } from '@test/helpers'; | ||
import { BigNumber } from 'ethers'; | ||
|
||
/* | ||
Withdraw liquidity from the LBP once it has finished | ||
*/ | ||
|
||
const fipNumber = 'fip_104b'; | ||
|
||
let initialDaiPCVBalance: BigNumber; | ||
let initialTCDpiBalance: BigNumber; | ||
|
||
// Do any deployments | ||
// This should exclusively include new contract deployments | ||
const deploy: DeployUpgradeFunc = async (deployAddress: string, addresses: NamedAddresses, logging: boolean) => { | ||
console.log(`No deploy actions for fip${fipNumber}`); | ||
return { | ||
// put returned contract objects here | ||
}; | ||
}; | ||
|
||
// Do any setup necessary for running the test. | ||
// This could include setting up Hardhat to impersonate accounts, | ||
// ensuring contracts have a specific state, etc. | ||
const setup: SetupUpgradeFunc = async (addresses, oldContracts, contracts, logging) => { | ||
const dpi = contracts.dpi; | ||
initialTCDpiBalance = await dpi.balanceOf(addresses.tribalCouncilSafe); | ||
initialDaiPCVBalance = await contracts.compoundDaiPCVDeposit.balance(); | ||
logging && console.log('Initial dai balance: ', initialDaiPCVBalance.toString()); | ||
|
||
// Fast forward to end of LPB | ||
const timeRemaining = await contracts.dpiToDaiLBPSwapper.remainingTime(); | ||
await time.increase(timeRemaining); | ||
}; | ||
|
||
// Tears down any changes made in setup() that need to be | ||
// cleaned up before doing any validation checks. | ||
const teardown: TeardownUpgradeFunc = async (addresses, oldContracts, contracts, logging) => { | ||
console.log(`No actions to complete in teardown for fip${fipNumber}`); | ||
}; | ||
|
||
// Run any validations required on the fip using mocha or console logging | ||
// IE check balances, check state of contracts, etc. | ||
const validate: ValidateUpgradeFunc = async (addresses, oldContracts, contracts, logging) => { | ||
// 1. Validate withdrawn liquidity destinations | ||
const sanityCheckDAIAmount = ethers.constants.WeiPerEther.mul(3_200_000); | ||
const finalDAIDepositBalance = await contracts.compoundDaiPCVDeposit.balance(); | ||
const daiGained = finalDAIDepositBalance.sub(initialDaiPCVBalance); | ||
expect(daiGained).to.be.bignumber.at.least(sanityCheckDAIAmount); | ||
|
||
const dpi = contracts.dpi; | ||
const sanityCheckDPIAmount = ethers.constants.WeiPerEther.mul(1500); | ||
const finalTCDpiBalance = await dpi.balanceOf(addresses.tribalCouncilSafe); | ||
const dpiGained = finalTCDpiBalance.sub(initialTCDpiBalance); | ||
expect(dpiGained).to.be.bignumber.at.least(sanityCheckDPIAmount); | ||
}; | ||
|
||
export { deploy, setup, teardown, validate }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import { ProposalDescription } from '@custom-types/types'; | ||
|
||
const fip_104b: ProposalDescription = { | ||
title: 'FIP_104b: Withdraw LBP liquidity', | ||
commands: [ | ||
{ | ||
target: 'dpiToDaiLBPSwapper', | ||
values: '0', | ||
method: 'exitPool(address)', | ||
arguments: ['{compoundDaiPCVDeposit}'], | ||
description: 'Withdraw all DAI and DPI from LBP pool to the compoundDAIPCVDeposit (~$3.8m)' | ||
}, | ||
{ | ||
target: 'ratioPCVControllerV2', | ||
values: '0', | ||
method: 'withdrawRatioERC20(address,address,address,uint256)', | ||
arguments: [ | ||
'{compoundDaiPCVDeposit}', // pcvDeposit | ||
'{dpi}', // token | ||
'{tribalCouncilSafe}', // to | ||
thomas-waite marked this conversation as resolved.
Show resolved
Hide resolved
|
||
'10000' // basisPoints, 100% | ||
], | ||
description: | ||
'Withdraw all DPI from the Compound DAI PCV deposit (~$200k) to the TribalCouncil multisig, where it will be liquidated' | ||
}, | ||
{ | ||
target: 'compoundDaiPCVDeposit', | ||
values: '0', | ||
method: 'deposit()', | ||
arguments: [], | ||
description: 'Deposit DAI on compoundDAIPCVdeposit into Compound' | ||
} | ||
], | ||
description: ` | ||
FIP_104b: Withdraw all liquidity from the DPI LBP. | ||
|
||
This FIP cleans up and finishes elements of the PCV reinforcement process snapshotted here: | ||
https://snapshot.fei.money/#/proposal/0x2fd5bdda0067098f6c0520fe309dfe90ca403758f0ce98c1854a00bf38999674 | ||
and discussed here: https://tribe.fei.money/t/fip-104-fei-pcv-reinforcement-proposal/4162 . | ||
|
||
Specifically it: | ||
- Exits the LBP pool and withdraws all liquidity to the compound DAI deposit | ||
- Withdraws the DPI from the deposit to the TribalCouncil multisig, using the ratioPCVController | ||
- Deposits the DAI on the deposit into Compound | ||
` | ||
}; | ||
|
||
export default fip_104b; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
This is a fixture that sets up a staker to have some TRIBE rewards to claim.
It is later relied on in an e2e test to ensure that the ending of incentives does not stop people who were staking LP tokens from claiming rewards. It will be removed along with the test once the proposal executes.