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
13 changes: 13 additions & 0 deletions contracts/pods/PodAdminGateway.sol
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,19 @@ contract PodAdminGateway is CoreRef, IPodAdminGateway {
emit PodMembershipTransferLock(_podId, _lock);
}

/// @notice Transfer the admin of a pod to a new address
/// @dev Permissioned to GOVERNOR, POD_ADMIN and the specific pod admin role
function transferAdmin(uint256 _podId, address _newAdmin)
external
hasAnyOfThreeRoles(TribeRoles.GOVERNOR, TribeRoles.POD_ADMIN, getSpecificPodAdminRole(_podId))
{
ControllerV1 podController = ControllerV1(memberToken.memberController(_podId));
address oldPodAdmin = podController.podAdmin(_podId);

podController.updatePodAdmin(_podId, _newAdmin);
emit UpdatePodAdmin(_podId, oldPodAdmin, _newAdmin);
}

/////////////// VETO CONTROLLER /////////////////

/// @notice Allow a proposal to be vetoed in a pod timelock
Expand Down
27 changes: 27 additions & 0 deletions contracts/test/integration/governance/PodAdminGateway.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ pragma solidity ^0.8.0;

import {TimelockController} from "@openzeppelin/contracts/governance/TimelockController.sol";
import {ControllerV1} from "@orcaprotocol/contracts/contracts/ControllerV1.sol";
import {MemberToken} from "@orcaprotocol/contracts/contracts/MemberToken.sol";
import {Vm} from "../../utils/Vm.sol";
import {DSTest} from "../../utils/DSTest.sol";
import {PodFactory} from "../../../pods/PodFactory.sol";
Expand Down Expand Up @@ -149,6 +150,32 @@ contract PodAdminGatewayIntegrationTest is DSTest {
assertFalse(memberTransfersLocked);
}

/// @notice Transfer pod admin to new admin
function testTransferPodAdmin() public {
address memberToRemove = podConfig.members[0];
address newAdmin = address(0x22);

vm.prank(feiDAOTimelock);
podAdminGateway.transferAdmin(podId, newAdmin);

address newAdminOnFactory = factory.getPodAdmin(podId);
assertEq(newAdminOnFactory, newAdmin);

address newAdminOnController = ControllerV1(podController).podAdmin(podId);
assertEq(newAdminOnController, newAdmin);

// Validate new pod admin can perform an admin function, such as removing a member
vm.prank(newAdmin);
MemberToken(memberToken).burn(memberToRemove, podId);

uint256 numPodMembers = factory.getNumMembers(podId);
assertEq(numPodMembers, podConfig.members.length - 1);

address[] memory podMembers = factory.getPodMembers(podId);
assertEq(podMembers[0], podConfig.members[1]);
assertEq(podMembers[1], podConfig.members[2]);
}

/// @notice Validate that a non-PodAdmin fails to call a priviledged admin method
function testNonAdminFailsToRemoveMember() public {
vm.expectRevert(bytes("UNAUTHORIZED"));
Expand Down
10 changes: 5 additions & 5 deletions proposals/dao/fip_82.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ const transferOrcaTokens = async (
const fipNumber = '82';

const deploy: DeployUpgradeFunc = async (deployAddress: string, addresses: NamedAddresses, logging: boolean) => {
const deploySigner = (await ethers.getSigners())[0];
// 1. Deploy public pod executor
const podExecutorFactory = await ethers.getContractFactory('PodExecutor');
const podExecutor = await podExecutorFactory.deploy(addresses.core);
Expand All @@ -59,6 +60,7 @@ const deploy: DeployUpgradeFunc = async (deployAddress: string, addresses: Named
podExecutor.address // Public pod executor
);
await podFactory.deployTransaction.wait();
logging && console.log('Pod factory deployed to:', podFactory.address);

// 3. Deploy PodAdminGateway contract
const podAdminGatewayFactory = await ethers.getContractFactory('PodAdminGateway');
Expand All @@ -69,8 +71,7 @@ const deploy: DeployUpgradeFunc = async (deployAddress: string, addresses: Named
);
await podAdminGateway.deployTransaction.wait();
logging && console.log(`Deployed PodAdminGateway at ${podAdminGateway.address}`);
await transferOrcaTokens(addresses.orcaShipToken, deployAddress, podFactory.address, 2);
logging && console.log('Pod factory deployed to:', podFactory.address);
await transferOrcaTokens(addresses.orcaShipToken, deployAddress, podFactory.address, 1);

// 4. Create TribalCouncil and Protocol Tier pods
const tribalCouncilPod: PodCreationConfig = {
Expand All @@ -95,9 +96,8 @@ const deploy: DeployUpgradeFunc = async (deployAddress: string, addresses: Named
logging && console.log('Tribal council Gnosis safe is: ', councilSafeAddress);

// 5. Create contract artifacts for timelock, so address is available to DAO script
const mockSigner = await getImpersonatedSigner(deployAddress);
const tribalCouncilTimelock = new ethers.Contract(councilTimelockAddress, timelockABI, mockSigner);
const tribalCouncilSafe = new ethers.Contract(councilSafeAddress, gnosisSafeABI, mockSigner);
const tribalCouncilTimelock = new ethers.Contract(councilTimelockAddress, timelockABI, deploySigner);
const tribalCouncilSafe = new ethers.Contract(councilSafeAddress, gnosisSafeABI, deploySigner);

// 6. Deploy GovernanceMetadataRegistry contract
const metadataRegistryFactory = await ethers.getContractFactory('GovernanceMetadataRegistry');
Expand Down
10 changes: 8 additions & 2 deletions protocol-configuration/dependencies.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1024,10 +1024,10 @@ const dependencies: DependencyMap = {
contractDependencies: ['core', 'podExecutor', 'podAdminGateway']
},
podAdminGateway: {
contractDependencies: ['core', 'podFactory']
contractDependencies: ['core', 'podFactory', 'tribalCouncilTimelock']
},
podExecutor: {
contractDependencies: ['podFactory']
contractDependencies: ['podFactory', 'tribalCouncilTimelock']
},
nopeDAO: {
contractDependencies: ['core', 'tribe']
Expand All @@ -1052,6 +1052,12 @@ const dependencies: DependencyMap = {
},
voltOracle: {
contractDependencies: ['volt', 'voltDepositWrapper', 'collateralizationOracle']
},
tribalCouncilTimelock: {
contractDependencies: ['podExecutor', 'tribalCouncilSafe', 'podAdminGateway']
},
tribalCouncilSafe: {
contractDependencies: ['tribalCouncilTimelock']
}
};

Expand Down
40 changes: 40 additions & 0 deletions protocol-configuration/mainnetAddresses.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2000,6 +2000,46 @@ const MainnetAddresses: MainnetAddresses = {
artifactName: 'unknown',
address: '0x84dc71500D504163A87756dB6368CC8bB654592f',
category: AddressCategory.Volt
},
podExecutor: {
artifactName: 'PodExecutor',
address: '0x489BeB7b2829D0e57f1776899D561afc1bBeef11',
category: AddressCategory.Governance
},
podAdminGateway: {
artifactName: 'PodAdminGateway',
address: '0xf14DccfB071672F1394BaA58d136D94dD1cEDc85',
category: AddressCategory.Governance
},
podFactory: {
artifactName: 'PodFactory',
address: '0xeF9f961266Ad9Bb46396577A77234dBFEb4dAac7',
category: AddressCategory.Governance
},
governanceMetadataRegistry: {
artifactName: 'GovernanceMetadataRegistry',
address: '0xd78Cd3AaE6168BE43B548877aAc68312B9df9AFb',
category: AddressCategory.Governance
},
nopeDAO: {
artifactName: 'NopeDAO',
address: '0x6C7aF43Ce97686e0C8AcbBc03b2E4f313c0394C7',
category: AddressCategory.Governance
},
tribalCouncilTimelock: {
artifactName: 'TimelockController',
address: '0x9F80E03985303eB8b2ABC031Cb82716D7913f531',
category: AddressCategory.Governance
},
tribalCouncilSafe: {
artifactName: 'unknown',
address: '0xdb6236E5363aBdeb807198e820DD5CC04BfC8dDd',
category: AddressCategory.Governance
},
roleBastion: {
artifactName: 'RoleBastion',
address: '0x8096314D9014EbB69Fc777ED3791DDE6FFbaFAed',
category: AddressCategory.Governance
}
};

Expand Down
8 changes: 4 additions & 4 deletions protocol-configuration/optimisticGovernance.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { ethers } from 'ethers';

export type PodConfig = {
members: string[];
threshold: number;
Expand Down Expand Up @@ -50,10 +48,12 @@ export const MIN_TIMELOCK_DELAY = 86400; // 1 day
export const tribeCouncilPodConfig: PodConfig = {
members: tribalCouncilMembers,
threshold: 5,
label: '0x54726962616c436f756e63696c00000000000000000000000000000000000000', // TribalCouncil
ensString: 'tribalcouncil',
label: '0xcc74924992a4b3a8d464650443c1d35252c3c4eacfcae441e1a646c194eda9c9', // tribalcouncil
ensString: 'tribalcouncil.pod.xyz',
imageUrl: '',
minDelay: 86400 * 4, // 4 days
numMembers: tribalCouncilMembers.length,
placeHolderMembers: placeHolderCouncilMembers
};

export const TRIBAL_COUNCIL_POD_ID = 24;
11 changes: 7 additions & 4 deletions test/integration/proposals_config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,24 @@ const proposals: ProposalsConfigMap = {
}
*/
fip_82: {
deploy: true, // deploy flag for whether to run deploy action during e2e tests or use mainnet state
deploy: false, // deploy flag for whether to run deploy action during e2e tests or use mainnet state
totalValue: 0, // amount of ETH to send to DAO execution
proposal: fip_82, // full proposal file, imported from '@proposals/description/fip_xx.ts'
proposalId: '',
affectedContractSignoff: [
'podAdminFactory',
'roleBastion',
'podFactory',
'podExecutor',
'nopeDAO',
'governanceMetadataRegistry',
'core',
'tribe'
'tribe',
'feiDAOTimelock',
'tribalCouncilTimelock',
'tribalCouncilSafe',
'podAdminGateway'
],
deprecatedContractSignoff: [''],
deprecatedContractSignoff: [],
category: ProposalCategory.DAO
},
fip_98: {
Expand Down