Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 21 additions & 6 deletions contract-addresses/permissions.json
Original file line number Diff line number Diff line change
@@ -1,28 +1,43 @@
{
"minter": [
"MINTER_ROLE": [
"bondingCurve",
"uniswapPCVDeposit",
"feiDAOTimelock",
"dpiBondingCurve",
"daiBondingCurve",
"dpiUniswapPCVDeposit",
"raiBondingCurve"
"raiBondingCurve",
"pcvEquityMinter",
"collateralizationOracleKeeper"
],
"burner": [
"BURNER_ROLE": [
"ethReserveStabilizer"
],
"governor": [
"GOVERN_ROLE": [
"core",
"timelock",
"feiDAOTimelock"
],
"pcvController": [
"PCV_CONTROLLER_ROLE": [
"feiDAOTimelock",
"ratioPCVController",
"aaveEthPCVDripController",
"compoundEthPCVDripController"
],
"guardian": [
"GUARDIAN_ROLE": [
"multisig"
],
"ORACLE_ADMIN_ROLE" : [
"collateralizationOracleGuardian",
"optimisticTimelock"
],
"SWAP_ADMIN_ROLE" : [
"pcvEquityMinter"
],
"BALANCER_MANAGER_ADMIN_ROLE" : [

],
"TRIBAL_CHIEF_ADMIN_ROLE" : [
"optimisticTimelock"
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,7 @@ contract CollateralizationOracle is ICollateralizationOracle, CoreRef {
_addDeposits(_deposits);

// Shared admin with other oracles
_setContractAdminRole(keccak256("GUARDIAN_ROLE")); // initialize with Guardian before transitioning to ORACLE_ADMIN via DAO
// _setContractAdminRole(keccak256("ORACLE_ADMIN_ROLE"));
_setContractAdminRole(keccak256("ORACLE_ADMIN_ROLE"));
}

// ----------- Convenience getters -----------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,7 @@ contract CollateralizationOracleWrapper is Timed, ICollateralizationOracleWrappe
deviationThresholdBasisPoints = _deviationThresholdBasisPoints;

// Shared admin with other oracles
_setContractAdminRole(keccak256("GUARDIAN_ROLE")); // initialize with Guardian before transitioning to ORACLE_ADMIN via DAO
// _setContractAdminRole(keccak256("ORACLE_ADMIN_ROLE"));
_setContractAdminRole(keccak256("ORACLE_ADMIN_ROLE"));
}

// ----------- Setter methods ----------------------------------------------
Expand Down
3 changes: 1 addition & 2 deletions proposals/dao/fip_33.ts
Original file line number Diff line number Diff line change
Expand Up @@ -208,8 +208,7 @@ export const validate: ValidateUpgradeFunc = async (addresses, oldContracts, con

const { multisig, optimisticTimelock } = addresses;

// keccak256("ORACLE_ADMIN")
const oracleAdminRole = '0xa8d944a5277d6a203f114d020d26918a390f167b089a46be4fca9da716d23783';
const oracleAdminRole = ethers.utils.id('ORACLE_ADMIN_ROLE');
expect(await collateralizationOracle.CONTRACT_ADMIN_ROLE()).to.be.equal(oracleAdminRole);
expect(await collateralizationOracleWrapper.CONTRACT_ADMIN_ROLE()).to.be.equal(oracleAdminRole);

Expand Down
18 changes: 9 additions & 9 deletions proposals/description/fip_33.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,31 +30,31 @@
"values": "0",
"method": "createRole(bytes32,bytes32)",
"arguments": [
"0xa8d944a5277d6a203f114d020d26918a390f167b089a46be4fca9da716d23783",
"0xc307c44629779eb8fc0b85f224c3d22f5876a6c84de0ee42d481eb7814f0d3a8",
"0x899bd46557473cb80307a9dabc297131ced39608330a2d29b2d52b660c03923e"
],
"description": "Create ORACLE_ADMIN role"
"description": "Create ORACLE_ADMIN_ROLE role"
},
{
"target": "collateralizationOracle",
"values": "0",
"method": "setContractAdminRole(bytes32)",
"arguments": ["0xa8d944a5277d6a203f114d020d26918a390f167b089a46be4fca9da716d23783"],
"description": "Set ORACLE_ADMIN role to admin for CR Oracle"
"arguments": ["0xc307c44629779eb8fc0b85f224c3d22f5876a6c84de0ee42d481eb7814f0d3a8"],
"description": "Set ORACLE_ADMIN_ROLE role to admin for CR Oracle"
},
{
"target": "collateralizationOracleWrapper",
"values": "0",
"method": "setContractAdminRole(bytes32)",
"arguments": ["0xa8d944a5277d6a203f114d020d26918a390f167b089a46be4fca9da716d23783"],
"description": "Set ORACLE_ADMIN role to admin for CR Oracle Wrapper"
"arguments": ["0xc307c44629779eb8fc0b85f224c3d22f5876a6c84de0ee42d481eb7814f0d3a8"],
"description": "Set ORACLE_ADMIN_ROLE role to admin for CR Oracle Wrapper"
},
{
"target": "core",
"values": "0",
"method": "grantRole(bytes32,address)",
"arguments": [
"0xa8d944a5277d6a203f114d020d26918a390f167b089a46be4fca9da716d23783",
"0xc307c44629779eb8fc0b85f224c3d22f5876a6c84de0ee42d481eb7814f0d3a8",
"{collateralizationOracleGuardian}"
],
"description": "Grant Oracle Admin role to Collateralization Oracle Guardian"
Expand Down Expand Up @@ -84,10 +84,10 @@
"values": "0",
"method": "grantRole(bytes32,address)",
"arguments": [
"0xa8d944a5277d6a203f114d020d26918a390f167b089a46be4fca9da716d23783",
"0xc307c44629779eb8fc0b85f224c3d22f5876a6c84de0ee42d481eb7814f0d3a8",
"{optimisticTimelock}"
],
"description": "Grant ORACLE_ADMIN to OA Timelock"
"description": "Grant ORACLE_ADMIN_ROLE to OA Timelock"
}
]
}
2 changes: 1 addition & 1 deletion test/integration/tests/buybacks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ before(async () => {
await resetFork();
});

describe.only('e2e', function () {
describe('e2e', function () {
let contracts: NamedContracts;
let contractAddresses: NamedAddresses;
let deployAddress: string;
Expand Down
80 changes: 24 additions & 56 deletions test/integration/tests/dao.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { getImpersonatedSigner, increaseTime, latestTime, resetFork, time } from
import proposals from '@test/integration/proposals_config.json';
import { TestEndtoEndCoordinator } from '@test/integration/setup';
import { forceEth } from '@test/integration/setup/utils';
import { Core } from '@custom-types/contracts';
const toBN = ethers.BigNumber.from;

before(async () => {
Expand Down Expand Up @@ -242,77 +243,44 @@ describe('e2e-dao', function () {
await e2eCoord.revokeDeployAddressPermission();
});

it.skip('should have granted correct role cardinality', async function () {
it('should have granted correct role cardinality', async function () {
const core = contracts.core;
const accessRights = e2eCoord.getAccessControlMapping();

const minterId = await core.MINTER_ROLE();
const numMinterRoles = await core.getRoleMemberCount(minterId);
expect(numMinterRoles.toNumber()).to.be.equal(accessRights.minter.length);
const roles = Object.keys(accessRights);

const burnerId = await core.BURNER_ROLE();
const numBurnerRoles = await core.getRoleMemberCount(burnerId);
expect(numBurnerRoles.toNumber()).to.be.equal(accessRights.burner.length);

const pcvControllerId = await core.PCV_CONTROLLER_ROLE();
const numPCVControllerRoles = await core.getRoleMemberCount(pcvControllerId);
expect(numPCVControllerRoles.toNumber()).to.be.equal(accessRights.pcvController.length);

const governorId = await core.GOVERN_ROLE();
const numGovernorRoles = await core.getRoleMemberCount(governorId);
expect(numGovernorRoles.toNumber()).to.be.equal(accessRights.governor.length);

const guardianId = await core.GUARDIAN_ROLE();
const numGuaridanRoles = await core.getRoleMemberCount(guardianId);
expect(numGuaridanRoles.toNumber()).to.be.equal(accessRights.guardian.length);
for (let i = 0; i < roles.length; i++) {
const element = roles[i];
const id = ethers.utils.id(element);
const numRoles = await core.getRoleMemberCount(id);
doLogging && console.log(`Role count for ${element}: ${numRoles}`);
expect(numRoles.toNumber()).to.be.equal(accessRights[element].length);
}
});

it.skip('should have granted contracts correct roles', async function () {
const core = contracts.core;
it('should have granted contracts correct roles', async function () {
const core: Core = contracts.core as Core;
const accessControl = e2eCoord.getAccessControlMapping();

doLogging && console.log(`Testing minter role...`);
for (let i = 0; i < accessControl.minter.length; i++) {
const contractAddress = accessControl.minter[i];
doLogging && console.log(`Minter contract address: ${contractAddress}`);
const isMinter = await core.isMinter(contractAddress);
expect(isMinter).to.be.true;
}

doLogging && console.log(`Testing burner role...`);
for (let i = 0; i < accessControl.burner.length; i += 1) {
const contractAddress = accessControl.burner[i];
const isBurner = await core.isBurner(contractAddress);
expect(isBurner).to.be.equal(true);
}

doLogging && console.log(`Testing pcv controller role...`);
for (let i = 0; i < accessControl.pcvController.length; i += 1) {
const contractAddress = accessControl.pcvController[i];
const isPCVController = await core.isPCVController(contractAddress);
expect(isPCVController).to.be.equal(true);
}

doLogging && console.log(`Testing guardian role...`);
for (let i = 0; i < accessControl.guardian.length; i += 1) {
const contractAddress = accessControl.guardian[i];
const isGuardian = await core.isGuardian(contractAddress);
expect(isGuardian).to.be.equal(true);
}

doLogging && console.log(`Testing governor role...`);
for (let i = 0; i < accessControl.governor.length; i += 1) {
const contractAddress = accessControl.governor[i];
const isGovernor = await core.isGovernor(contractAddress);
expect(isGovernor).to.be.equal(true);
const roles = Object.keys(accessControl);

for (let i = 0; i < roles.length; i++) {
const element = roles[i];
const id = ethers.utils.id(element);
for (let i = 0; i < accessControl[element].length; i++) {
const contractAddress = accessControl[element][i];
doLogging && console.log(`${element} contract address: ${contractAddress}`);
const isMinter = await core.hasRole(id, contractAddress);
expect(isMinter).to.be.true;
}
}

/*
doLogging && console.log(`Testing tribe minter address...`);
const tribe = contracts.tribe;
const tribeMinter = await tribe.minter();
expect(tribeMinter).to.equal(contractAddresses.tribeReserveStabilizer);
*/ // re-enable after tribe reserve stabilizer is deployed
*/ // TODO re-enable after tribe reserve stabilizer is deployed
});
});
});