-
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
FIP-55: PCV Guardian #353
Merged
Merged
FIP-55: PCV Guardian #353
Changes from 2 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
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
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,62 @@ | ||
import { ethers } from 'hardhat'; | ||
import chai, { expect } from 'chai'; | ||
import CBN from 'chai-bn'; | ||
import { | ||
DeployUpgradeFunc, | ||
NamedContracts, | ||
SetupUpgradeFunc, | ||
TeardownUpgradeFunc, | ||
ValidateUpgradeFunc | ||
} from '../../types/types'; | ||
import { PCVGuardian } from '@custom-types/contracts'; | ||
|
||
chai.use(CBN(ethers.BigNumber)); | ||
|
||
/* | ||
PCV Guardian | ||
|
||
DEPLOY ACTIONS: | ||
|
||
1. Deploy PCV Guardian | ||
|
||
DAO ACTIONS: | ||
1. Grant PCV Guardian GUARDIAN_ROLE | ||
2. Grant PCV Guardian PCV_CONTROLLER_ROLE | ||
|
||
*/ | ||
|
||
export const deploy: DeployUpgradeFunc = async (deployAddress, addresses, logging = false) => { | ||
const { core, feiDAOTimelock, compoundEthPCVDeposit, ethReserveStabilizer, aaveEthPCVDeposit } = addresses; | ||
|
||
if (!core) { | ||
throw new Error('An environment variable contract address is not set'); | ||
} | ||
|
||
// 1. Deploy PCV Guardian | ||
const factory = await ethers.getContractFactory('PCVGuardian'); | ||
const safeAddresses = [feiDAOTimelock, compoundEthPCVDeposit, ethReserveStabilizer, aaveEthPCVDeposit]; | ||
const pcvGuardian = await factory.deploy(core, safeAddresses); | ||
|
||
await pcvGuardian.deployTransaction.wait(); | ||
|
||
logging && console.log('pcvGuardian: ', pcvGuardian.address); | ||
|
||
return { | ||
pcvGuardian | ||
} as NamedContracts; | ||
}; | ||
|
||
export const setup: SetupUpgradeFunc = async (addresses, oldContracts, contracts, logging) => { | ||
logging && console.log('No setup'); | ||
}; | ||
|
||
export const teardown: TeardownUpgradeFunc = async (addresses, oldContracts, contracts, logging) => { | ||
logging && console.log('No teardown'); | ||
}; | ||
|
||
export const validate: ValidateUpgradeFunc = async (addresses, oldContracts, contracts) => { | ||
const pcvGuardian: PCVGuardian = contracts.pcvGuardian as PCVGuardian; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We shouldn't need to cast to type of PCVGuardian as the artifact that is loaded from contracts should be correct. |
||
|
||
const safeAddresses = await pcvGuardian.getSafeAddresses(); | ||
expect(safeAddresses.length).to.be.equal(4); | ||
}; |
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,31 @@ | ||
import { ProposalDescription } from '@custom-types/types'; | ||
|
||
const fip_55: ProposalDescription = { | ||
title: 'FIP-55: PCV Guardian', | ||
commands: [ | ||
{ | ||
target: 'core', | ||
values: '0', | ||
method: 'grantGuardian(address)', | ||
arguments: ['{pcvGuardian}'], | ||
description: 'Grant PCV Guardian GUARDIAN_ROLE' | ||
}, | ||
{ | ||
target: 'core', | ||
values: '0', | ||
method: 'grantPCVController(address)', | ||
arguments: ['{pcvGuardian}'], | ||
description: 'Grant PCV Guardian PCV_CONTROLLER_ROLE' | ||
} | ||
], | ||
description: ` | ||
Create a PCV Guardian which can move PCV only to safe locations, namely other PCV deposits that are particularly low risk. | ||
|
||
This would help save assets in the event of a hack or extreme market conditions if Fei Protocol has a heads up. | ||
|
||
Code: https://github.com/fei-protocol/fei-protocol-core/pull/353 | ||
Discussion: https://tribe.fei.money/t/fip-55-pcv-guardian/3744 | ||
` | ||
}; | ||
|
||
export default fip_55; |
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.
use shorthand