Skip to content

Commit f8f1339

Browse files
authored
Merge pull request #128 from bgd-labs/feat/add-ink-aave-dao
Feat/add ink aave dao
2 parents 5ad0b19 + abcf1f1 commit f8f1339

39 files changed

+1608
-602
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ These documents contain tables with the following information:
5656
| CELO | V3 | [Permissions](./out/CELO-V3.md#contracts) | |--------|--------|--------|
5757
| AVALANCHE | V3 | [Permissions](./out/AVALANCHE-V3.md#contracts) | |--------|--------|--------|
5858
| AVALANCHE | V2 | [Permissions](./out/AVALANCHE-V2.md#contracts) | |--------|--------|--------|
59-
| INK_WHITELABEL | V3 | [Permissions](./out/INK_WHITELABEL-V3.md#contracts) | |--------|--------|--------|
59+
| INK | V3_WHITE_LABEL | [Permissions](./out/INK-V3_WHITE_LABEL.md#contracts) | |--------|--------|--------|
6060
| LINEA | V3 | [Permissions](./out/LINEA-V3.md#contracts) | |--------|--------|--------|
6161
| SCROLL | V3 | [Permissions](./out/SCROLL-V3.md#contracts) | |--------|--------|--------|
6262

helpers/adminRoles.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,6 @@ export const getCurrentRoleAdmins = async (
138138

139139
latestBlockNumber = preTenderlyForkCurrentBlock;
140140
} else {
141-
console.log('fromBlock : ', fromBlock);
142-
console.log('contract : ', contract);
143141
const { logs: networkEvents, currentBlock: eventsCurrentBlock } = await getEvents({
144142
client,
145143
fromBlock,
@@ -151,7 +149,6 @@ export const getCurrentRoleAdmins = async (
151149
events = networkEvents;
152150
latestBlockNumber = eventsCurrentBlock;
153151
}
154-
console.log('events : ', events.length);
155152
const roles = getRoleAdmins({
156153
oldRoles,
157154
roleNames,

helpers/configs.ts

Lines changed: 28 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ import {
6060
GovernanceV3InkWhitelabel,
6161
AaveV3InkWhitelabel,
6262
MiscInkWhitelabel,
63+
GovernanceV3Ink,
64+
MiscInk,
6365
} from '@bgd-labs/aave-address-book';
6466
import { NetworkConfigs } from './types.js';
6567
import { ChainId } from '@bgd-labs/toolbox';
@@ -87,6 +89,7 @@ export enum Pools {
8789
ETHERFI = 'ETHERFI',
8890
ETHERFI_TENDERLY = 'ETHERFI_TENDERLY',
8991
LIDO_TENDERLY = 'LIDO_TENDERLY',
92+
V3_WHITE_LABEL = 'V3_WHITE_LABEL',
9093
}
9194

9295
export const ghoRoleNames = [
@@ -218,6 +221,8 @@ export const networkConfigs: NetworkConfigs = {
218221
permissionsJson: './statics/functionsPermissionsV3.json',
219222
crossChainPermissionsJson: './statics/functionsPermissionsGovV3.json',
220223
governanceAddressBook: GovernanceV3Ethereum,
224+
ppcPermissionsJson: './statics/functionsPermissionsPpcV1.json',
225+
ppcAddressBook: { ...UmbrellaEthereum, ...MiscEthereum },
221226
aclBlock: 16291117,
222227
crossChainControllerBlock: 18090380,
223228
granularGuardianBlock: 20324867,
@@ -230,6 +235,7 @@ export const networkConfigs: NetworkConfigs = {
230235
'0x6Abb61beb5848B476d026C4934E8a6415e2E75a8': 'HyperLaneAdapter',
231236
},
232237
clinicStewardBlock: 21967120,
238+
233239
},
234240
[Pools.LIDO]: {
235241
collectorBlock: 21765718,
@@ -1037,34 +1043,46 @@ export const networkConfigs: NetworkConfigs = {
10371043
},
10381044
},
10391045
[ChainId.ink]: {
1040-
name: 'Ink_Whitelabel',
1046+
name: 'Ink',
10411047
rpcUrl: process.env.RPC_INK,
10421048
explorer: 'https://explorer.inkonchain.com/',
10431049
addressesNames: {
10441050
'0x00C2B13eF4F70Bf1827179Fe6d8facF7cFf6AcD2':
1045-
'Ink emergency-admin multisig',
1051+
'WhiteLabel Ink emergency-admin multisig',
10461052
'0x2e8090716C5a25332cf963d454250B88bf04E6dC':
1047-
'Ink super-admin multisig',
1053+
'WhiteLabel Ink super-admin multisig',
1054+
'0x1bBcC6F0BB563067Ca45450023a13E34fa963Fa9': 'Aave Governance Guardian Ink',
1055+
'0x81D251dA015A0C7bD882918Ca1ec6B7B8E094585': 'BGD',
1056+
'0xEAF6183bAb3eFD3bF856Ac5C058431C8592394d6': 'Deployer',
10481057
},
10491058
pools: {
1050-
[Pools.V3]: {
1059+
[Pools.V3_WHITE_LABEL]: {
10511060
aclBlock: 19948732,
10521061
collectorBlock: 19948732,
1053-
granularGuardianBlock: 19948732,
1054-
crossChainControllerBlock: 19948732,
10551062
permissionsJson: './statics/functionsPermissionsV3.json',
1056-
crossChainPermissionsJson: './statics/functionsPermissionsGovV3.json',
10571063
addressBook: {
10581064
...AaveV3InkWhitelabel,
10591065
...MiscInkWhitelabel,
10601066
},
1061-
governanceAddressBook: {
1067+
ppcPermissionsJson: './statics/functionsPermissionsPpcV2.json',
1068+
ppcAddressBook: {
10621069
...GovernanceV3InkWhitelabel,
10631070
...MiscInkWhitelabel
10641071
},
1065-
addresses: {
1066-
},
10671072
},
1073+
[Pools.V3]: {
1074+
granularGuardianBlock: 9343700,
1075+
crossChainControllerBlock: 9342650,
1076+
permissionsJson: './statics/functionsPermissionsV3.json',
1077+
crossChainPermissionsJson: './statics/functionsPermissionsGovV3.json',
1078+
governanceAddressBook: {
1079+
...GovernanceV3Ink,
1080+
...MiscInk,
1081+
},
1082+
addressBook: {
1083+
...MiscInk,
1084+
}
1085+
}
10681086
},
10691087
},
10701088
};

helpers/decentralization.ts

Lines changed: 46 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { ContractInfo, Contracts, GovV3, PoolInfo } from './types.js';
1+
import { ContractInfo, Contracts } from './types.js';
22
import actionsConfig from '../statics/actionsConfig.json' assert { type: 'json' };
33

44
export type Decentralization = {
@@ -11,29 +11,35 @@ export enum Controller {
1111
GOV_V3 = 'Governance',
1212
MULTI_SIG = 'Multi-sig',
1313
EOA = 'External Contract',
14+
PPC_MULTI_SIG = 'PPC Multi-sig',
1415
}
1516

16-
export const getActionExecutors = (poolInfo: Contracts, govInfo: Contracts) => {
17+
export const getActionExecutors = (poolInfo: Contracts, govInfo: Contracts, isWhiteLabel: boolean) => {
1718
const actionsObject: Record<string, Set<string>> = {};
1819
Object.keys(actionsConfig).forEach((action) => {
1920
actionsObject[action] = new Set<string>();
20-
if (
21-
action === 'updateReserveBorrowSettings' ||
22-
action === 'configureCollateral' ||
23-
action === 'updateReserveSettings' ||
24-
action === 'reserveUpgradeability'
25-
) {
26-
actionsObject[action].add(Controller.GOV_V3);
27-
} else {
28-
for (let contractName of Object.keys(poolInfo)) {
29-
const contract = poolInfo[contractName];
30-
// search all modifiers
31-
contract.modifiers.forEach((modifier) => {
32-
const hasFunction = modifier.functions.some((functionName: string) =>
33-
// @ts-ignore
34-
actionsConfig[action].includes(functionName),
35-
);
36-
if (hasFunction) {
21+
for (let contractName of Object.keys(poolInfo)) {
22+
const contract = poolInfo[contractName];
23+
// search all modifiers
24+
contract.modifiers.forEach((modifier) => {
25+
const hasFunction = modifier.functions.some((functionName: string) =>
26+
// @ts-ignore
27+
actionsConfig[action].includes(functionName),
28+
);
29+
if (hasFunction) {
30+
if (
31+
action === 'updateReserveBorrowSettings' ||
32+
action === 'configureCollateral' ||
33+
action === 'updateReserveSettings' ||
34+
action === 'reserveUpgradeability' ||
35+
action === 'configureProtocolFees'
36+
) {
37+
if (isWhiteLabel) {
38+
actionsObject[action].add(Controller.PPC_MULTI_SIG);
39+
} else {
40+
actionsObject[action].add(Controller.GOV_V3);
41+
}
42+
} else {
3743
modifier.addresses.map((addressInfo) => {
3844
if (addressInfo.owners.length > 0) {
3945
actionsObject[action].add(Controller.MULTI_SIG);
@@ -42,6 +48,7 @@ export const getActionExecutors = (poolInfo: Contracts, govInfo: Contracts) => {
4248
addressInfo.address,
4349
poolInfo,
4450
govInfo,
51+
isWhiteLabel,
4552
);
4653
if (ownedInfo.owned) {
4754
actionsObject[action].add(ownedInfo.ownedBy);
@@ -51,8 +58,8 @@ export const getActionExecutors = (poolInfo: Contracts, govInfo: Contracts) => {
5158
}
5259
});
5360
}
54-
});
55-
}
61+
}
62+
});
5663
}
5764
});
5865

@@ -63,6 +70,7 @@ export const getLevelOfDecentralization = (
6370
contract: ContractInfo,
6471
poolInfo: Contracts,
6572
govInfo: Contracts,
73+
isWhiteLabel: boolean,
6674
): Decentralization => {
6775
let upgradeable = false;
6876
let ownedBy = Controller.NONE;
@@ -74,13 +82,14 @@ export const getLevelOfDecentralization = (
7482
contract.proxyAdmin,
7583
poolInfo,
7684
govInfo,
85+
isWhiteLabel,
7786
);
7887

7988
if (proxyOwnership.owned) {
8089
ownedBy = proxyOwnership.ownedBy;
8190
}
8291
} else {
83-
let ownership = isOwnedAndByWho(contract.address, poolInfo, govInfo);
92+
let ownership = isOwnedAndByWho(contract.address, poolInfo, govInfo, isWhiteLabel);
8493
if (ownership.owned) {
8594
ownedBy = ownership.ownedBy;
8695
}
@@ -137,13 +146,14 @@ const isOwnedAndByWho = (
137146
address: string,
138147
poolInfo: Contracts,
139148
govInfo: Contracts,
149+
isWhiteLabel: boolean,
140150
): { owned: boolean; ownedBy: Controller } => {
141151
let ownerInfo = { owned: false, ownedBy: Controller.EOA };
142152
for (let contractName of Object.keys(poolInfo)) {
143153
const contract = poolInfo[contractName];
144154
if (contract.address?.toLowerCase() === address.toLowerCase()) {
145155
if (contract.proxyAdmin) {
146-
ownerInfo = isOwnedAndByWho(contract.proxyAdmin, poolInfo, govInfo);
156+
ownerInfo = isOwnedAndByWho(contract.proxyAdmin, poolInfo, govInfo, isWhiteLabel);
147157
} else {
148158
contract.modifiers.forEach((modifierInfo) => {
149159
if (modifierInfo.modifier === 'onlyOwner') {
@@ -156,7 +166,11 @@ const isOwnedAndByWho = (
156166
modifierInfo.addresses[0].address,
157167
);
158168
if (ownedByGov) {
159-
ownerInfo = { owned: true, ownedBy: Controller.GOV_V3 };
169+
if (isWhiteLabel) {
170+
ownerInfo = { owned: true, ownedBy: Controller.PPC_MULTI_SIG };
171+
} else {
172+
ownerInfo = { owned: true, ownedBy: Controller.GOV_V3 };
173+
}
160174
} else {
161175
ownerInfo = { owned: true, ownedBy: Controller.EOA };
162176
}
@@ -174,13 +188,14 @@ const isAdministeredAndByWho = (
174188
address: string,
175189
poolInfo: Contracts,
176190
govInfo: Contracts,
191+
isWhiteLabel: boolean,
177192
): { owned: boolean; ownedBy: Controller } => {
178193
let ownerInfo = { owned: false, ownedBy: Controller.EOA };
179194
for (let contractName of Object.keys(poolInfo)) {
180195
const contract = poolInfo[contractName];
181196
if (contract.address?.toLowerCase() === address.toLowerCase()) {
182197
if (contract.proxyAdmin) {
183-
ownerInfo = isOwnedAndByWho(contract.proxyAdmin, poolInfo, govInfo);
198+
ownerInfo = isOwnedAndByWho(contract.proxyAdmin, poolInfo, govInfo, isWhiteLabel);
184199
} else {
185200
contract.modifiers.forEach((modifierInfo) => {
186201
if (
@@ -190,6 +205,7 @@ const isAdministeredAndByWho = (
190205
contractName !== 'GhoStewardV2') ||
191206
modifierInfo.modifier === 'onlyEmergencyAdmin' ||
192207
modifierInfo.modifier === 'onlyDefaultAdmin'
208+
// modifierInfo.modifier === 'onlyPayloadsManager'
193209
) {
194210
if (modifierInfo.addresses[0].owners.length > 0) {
195211
ownerInfo = { owned: true, ownedBy: Controller.MULTI_SIG };
@@ -200,7 +216,11 @@ const isAdministeredAndByWho = (
200216
modifierInfo.addresses[0].address,
201217
);
202218
if (ownedByGov) {
203-
ownerInfo = { owned: true, ownedBy: Controller.GOV_V3 };
219+
if (isWhiteLabel) {
220+
ownerInfo = { owned: true, ownedBy: Controller.PPC_MULTI_SIG };
221+
} else {
222+
ownerInfo = { owned: true, ownedBy: Controller.GOV_V3 };
223+
}
204224
} else {
205225
ownerInfo = { owned: true, ownedBy: Controller.EOA };
206226
}

helpers/types.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ export type GovV3 = {
2424
ggRoles?: Roles;
2525
// bridgeAdapters: string[];
2626
};
27+
export type Ppc = {
28+
contracts: Contracts;
29+
};
30+
2731
export type Collector = {
2832
latestBlockNumber: number;
2933
contracts: Contracts;
@@ -58,6 +62,7 @@ export type PoolInfo = {
5862
collector?: Collector;
5963
clinicSteward?: ClinicSteward;
6064
umbrella?: Umbrella;
65+
ppc?: Ppc;
6166
};
6267

6368
export type Pool = Record<string, PoolInfo>;
@@ -88,6 +93,9 @@ export type PoolConfigs = {
8893
umbrellaBlock?: number;
8994
umbrellaIncentivesBlock?: number;
9095
umbrellaAddressBook?: any;
96+
97+
ppcPermissionsJson?: string;
98+
ppcAddressBook?: any;
9199
};
92100
export type Network = {
93101
name: string;

out/CELO-V3.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
| type |can be executed by |
2929
|----------|----------|
3030
| updateReserveBorrowSettings | Governance | |--------|--------|
31-
| configureProtocolFees | Governance,Multi-sig | |--------|--------|
31+
| configureProtocolFees | Governance | |--------|--------|
3232
| updateReserveCaps | Governance,Multi-sig | |--------|--------|
3333
| updateReserveSettings | Governance | |--------|--------|
3434
| configureCollateral | Governance | |--------|--------|

out/ETHEREUM-GHO.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,6 @@
1313
### Actions type
1414
| type |can be executed by |
1515
|----------|----------|
16-
| updateReserveBorrowSettings | Governance | |--------|--------|
17-
| updateReserveSettings | Governance | |--------|--------|
18-
| configureCollateral | Governance | |--------|--------|
19-
| reserveUpgradeability | Governance | |--------|--------|
2016
| adiConfigurations | Governance | |--------|--------|
2117
| retryAndInvalidateMessages | Multi-sig,Governance | |--------|--------|
2218
| configureGovernance | Governance | |--------|--------|

out/ETHEREUM-SAFETY_MODULE.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,6 @@
1212
### Actions type
1313
| type |can be executed by |
1414
|----------|----------|
15-
| updateReserveBorrowSettings | Governance | |--------|--------|
16-
| updateReserveSettings | Governance | |--------|--------|
17-
| configureCollateral | Governance | |--------|--------|
18-
| reserveUpgradeability | Governance | |--------|--------|
1915
| adiConfigurations | Governance | |--------|--------|
2016
| retryAndInvalidateMessages | Multi-sig,Governance | |--------|--------|
2117
| configureGovernance | Governance | |--------|--------|

out/ETHEREUM-V2_MISC.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,6 @@
1111
### Actions type
1212
| type |can be executed by |
1313
|----------|----------|
14-
| updateReserveBorrowSettings | Governance | |--------|--------|
15-
| updateReserveSettings | Governance | |--------|--------|
16-
| configureCollateral | Governance | |--------|--------|
17-
| reserveUpgradeability | Governance | |--------|--------|
1814
| adiConfigurations | Governance | |--------|--------|
1915
| retryAndInvalidateMessages | Multi-sig,Governance | |--------|--------|
2016
| configureGovernance | Governance | |--------|--------|

0 commit comments

Comments
 (0)