Skip to content

Commit

Permalink
feat: grant permissisons to timelocks
Browse files Browse the repository at this point in the history
  • Loading branch information
GitGuru7 committed Sep 14, 2023
1 parent b14dbd0 commit a06055b
Show file tree
Hide file tree
Showing 4 changed files with 192 additions and 12 deletions.
2 changes: 1 addition & 1 deletion simulations/vip-170/vip-170-testnet/simulations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ forking(33043237, () => {
before(async () => {
[user] = await ethers.getSigners();
impersonatedTimelock = await initMainnetUser(NORMAL_TIMELOCK, ethers.utils.parseEther("3"));
await mine(IL_MARKETS.length * 2 + 2); // Number of Vip steps
await mine(IL_MARKETS.length * 2 + 10); // Number of Vip steps
});
for (const market of IL_MARKETS) {
it(`Save pre VIP storage snapshot of ${market.name}`, async () => {
Expand Down
2 changes: 1 addition & 1 deletion simulations/vip-171/vip-171-testnet/simulations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ forking(33155924, () => {
before(async () => {
[user] = await ethers.getSigners();
impersonatedTimelock = await initMainnetUser(NORMAL_TIMELOCK, ethers.utils.parseEther("3"));
await mine(CORE_MARKETS.length * 4 + 7); // Number of Vip steps
await mine(CORE_MARKETS.length * 4 + 28); // Number of Vip steps
});
for (const market of CORE_MARKETS) {
it(`Save pre VIP storage snapshot of ${market.name}`, async () => {
Expand Down
59 changes: 55 additions & 4 deletions vips/vip-170/vip-170-testnet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ const VTOKEN_BEACON = "0xBF85A90673E61956f8c79b9150BAB7893b791bDd";
const NEW_IMPL_VTOKEN = "0x37130dd8181477Be3dDe8b22A32FE302ca602BA7";
const ACCESS_CONTROL_MANAGER = "0x45f8a08F534f34A97187626E05d4b6648Eeaa9AA";
const NORMAL_TIMELOCK = "0xce10739590001705F7FF231611ba4A48B2820327";
const FAST_TRACK_TIMELOCK = "0x3CFf21b7AF8390fE68799D58727d3b4C25a83cb6";
const CRITICAL_TIMELOCK = "0x23B893a7C45a5Eb8c8C062b9F32d0D2e43eD286D";
const PROTOCOL_SHARE_RESERVE = "0x8b293600c50d6fbdc6ed4251cc75ece29880276f";

interface AssetConfig {
Expand Down Expand Up @@ -141,14 +143,63 @@ export const vip170Testnet = () => {
return makeProposal(
[
{
target: VTOKEN_BEACON,
signature: "upgradeTo(address)",
params: [NEW_IMPL_VTOKEN],
target: ACCESS_CONTROL_MANAGER,
signature: "giveCallPermission(address,string,address)",
params: [ethers.constants.AddressZero, "setReduceReservesBlockDelta(uint256)", NORMAL_TIMELOCK],
},

{
target: ACCESS_CONTROL_MANAGER,
signature: "giveCallPermission(address,string,address)",
params: [ethers.constants.AddressZero, "setReduceReservesBlockDelta(uint256)", NORMAL_TIMELOCK],
params: [ethers.constants.AddressZero, "setReduceReservesBlockDelta(uint256)", FAST_TRACK_TIMELOCK],
},

{
target: ACCESS_CONTROL_MANAGER,
signature: "giveCallPermission(address,string,address)",
params: [ethers.constants.AddressZero, "setReduceReservesBlockDelta(uint256)", CRITICAL_TIMELOCK],
},

{
target: ACCESS_CONTROL_MANAGER,
signature: "giveCallPermission(address,string,address)",
params: [ethers.constants.AddressZero, "setReserveFactor(uint256)", NORMAL_TIMELOCK],
},

{
target: ACCESS_CONTROL_MANAGER,
signature: "giveCallPermission(address,string,address)",
params: [ethers.constants.AddressZero, "setReserveFactor(uint256)", FAST_TRACK_TIMELOCK],
},

{
target: ACCESS_CONTROL_MANAGER,
signature: "giveCallPermission(address,string,address)",
params: [ethers.constants.AddressZero, "setReserveFactor(uint256)", CRITICAL_TIMELOCK],
},

{
target: ACCESS_CONTROL_MANAGER,
signature: "giveCallPermission(address,string,address)",
params: [ethers.constants.AddressZero, "setInterestRateModel(address)", NORMAL_TIMELOCK],
},

{
target: ACCESS_CONTROL_MANAGER,
signature: "giveCallPermission(address,string,address)",
params: [ethers.constants.AddressZero, "setInterestRateModel(address)", FAST_TRACK_TIMELOCK],
},

{
target: ACCESS_CONTROL_MANAGER,
signature: "giveCallPermission(address,string,address)",
params: [ethers.constants.AddressZero, "setInterestRateModel(address)", CRITICAL_TIMELOCK],
},

{
target: VTOKEN_BEACON,
signature: "upgradeTo(address)",
params: [NEW_IMPL_VTOKEN],
},
...IL_MARKETS.map(asset => {
return {
Expand Down
141 changes: 135 additions & 6 deletions vips/vip-171/vip-171-testnet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ import { makeProposal } from "../../src/utils";
const NEW_VBEP20_DELEGATE_IMPL = "0xAC5CFaC96871f35f7ce4eD2b46484Db34B548b40";
const ACCESS_CONTROL_MANAGER = "0x45f8a08F534f34A97187626E05d4b6648Eeaa9AA";
const NORMAL_TIMELOCK = "0xce10739590001705F7FF231611ba4A48B2820327";
const FAST_TRACK_TIMELOCK = "0x3CFf21b7AF8390fE68799D58727d3b4C25a83cb6";
const CRITICAL_TIMELOCK = "0x23B893a7C45a5Eb8c8C062b9F32d0D2e43eD286D";
const PROTOCOL_SHARE_RESERVE = "0x8b293600c50d6fbdc6ed4251cc75ece29880276f";
const COMPTROLLER = "0x94d1820b2D1c7c7452A163983Dc888CEC546b77D";

interface AssetConfig {
name: string;
Expand Down Expand Up @@ -110,6 +113,138 @@ export const vip171Testnet = () => {

return makeProposal(
[
{
target: ACCESS_CONTROL_MANAGER,
signature: "giveCallPermission(address,string,address)",
params: [ethers.constants.AddressZero, "setReduceReservesBlockDelta(uint256)", NORMAL_TIMELOCK],
},

{
target: ACCESS_CONTROL_MANAGER,
signature: "giveCallPermission(address,string,address)",
params: [ethers.constants.AddressZero, "setReduceReservesBlockDelta(uint256)", FAST_TRACK_TIMELOCK],
},

{
target: ACCESS_CONTROL_MANAGER,
signature: "giveCallPermission(address,string,address)",
params: [ethers.constants.AddressZero, "setReduceReservesBlockDelta(uint256)", CRITICAL_TIMELOCK],
},

{
target: ACCESS_CONTROL_MANAGER,
signature: "giveCallPermission(address,string,address)",
params: [ethers.constants.AddressZero, "_setReserveFactor(uint256)", NORMAL_TIMELOCK],
},

{
target: ACCESS_CONTROL_MANAGER,
signature: "giveCallPermission(address,string,address)",
params: [ethers.constants.AddressZero, "_setReserveFactor(uint256)", FAST_TRACK_TIMELOCK],
},

{
target: ACCESS_CONTROL_MANAGER,
signature: "giveCallPermission(address,string,address)",
params: [ethers.constants.AddressZero, "_setReserveFactor(uint256)", CRITICAL_TIMELOCK],
},

{
target: ACCESS_CONTROL_MANAGER,
signature: "giveCallPermission(address,string,address)",
params: [ethers.constants.AddressZero, "_setInterestRateModel(address)", NORMAL_TIMELOCK],
},

{
target: ACCESS_CONTROL_MANAGER,
signature: "giveCallPermission(address,string,address)",
params: [ethers.constants.AddressZero, "_setInterestRateModel(address)", FAST_TRACK_TIMELOCK],
},

{
target: ACCESS_CONTROL_MANAGER,
signature: "giveCallPermission(address,string,address)",
params: [ethers.constants.AddressZero, "_setInterestRateModel(address)", CRITICAL_TIMELOCK],
},

{
target: ACCESS_CONTROL_MANAGER,
signature: "giveCallPermission(address,string,address)",
params: [ethers.constants.AddressZero, "_reduceReserves(uint256)", NORMAL_TIMELOCK],
},

{
target: ACCESS_CONTROL_MANAGER,
signature: "giveCallPermission(address,string,address)",
params: [ethers.constants.AddressZero, "_reduceReserves(uint256)", FAST_TRACK_TIMELOCK],
},

{
target: ACCESS_CONTROL_MANAGER,
signature: "giveCallPermission(address,string,address)",
params: [ethers.constants.AddressZero, "_reduceReserves(uint256)", CRITICAL_TIMELOCK],
},

{
target: ACCESS_CONTROL_MANAGER,
signature: "giveCallPermission(address,string,address)",
params: [COMPTROLLER, "_setCollateralFactor(address,uint256)", FAST_TRACK_TIMELOCK],
},

{
target: ACCESS_CONTROL_MANAGER,
signature: "giveCallPermission(address,string,address)",
params: [COMPTROLLER, "_setCollateralFactor(address,uint256)", CRITICAL_TIMELOCK],
},

{
target: ACCESS_CONTROL_MANAGER,
signature: "giveCallPermission(address,string,address)",
params: [COMPTROLLER, "_setMarketBorrowCaps(address[],uint256[])", FAST_TRACK_TIMELOCK],
},

{
target: ACCESS_CONTROL_MANAGER,
signature: "giveCallPermission(address,string,address)",
params: [COMPTROLLER, "_setMarketBorrowCaps(address[],uint256[])", CRITICAL_TIMELOCK],
},

{
target: ACCESS_CONTROL_MANAGER,
signature: "giveCallPermission(address,string,address)",
params: [COMPTROLLER, "_setMarketSupplyCaps(address[],uint256[])", FAST_TRACK_TIMELOCK],
},

{
target: ACCESS_CONTROL_MANAGER,
signature: "giveCallPermission(address,string,address)",
params: [COMPTROLLER, "_setMarketSupplyCaps(address[],uint256[])", CRITICAL_TIMELOCK],
},

{
target: ACCESS_CONTROL_MANAGER,
signature: "giveCallPermission(address,string,address)",
params: [COMPTROLLER, "_setProtocolPaused(bool)", FAST_TRACK_TIMELOCK],
},

{
target: ACCESS_CONTROL_MANAGER,
signature: "giveCallPermission(address,string,address)",
params: [COMPTROLLER, "_setProtocolPaused(bool)", CRITICAL_TIMELOCK],
},

{
target: ACCESS_CONTROL_MANAGER,
signature: "giveCallPermission(address,string,address)",
params: [COMPTROLLER, "_setActionsPaused(address[],uint256[],bool)", FAST_TRACK_TIMELOCK],
},

{
target: ACCESS_CONTROL_MANAGER,
signature: "giveCallPermission(address,string,address)",
params: [COMPTROLLER, "_setActionsPaused(address[],uint256[],bool)", CRITICAL_TIMELOCK],
},

...MARKETS_WITH_ACCEPT_ADMIN.map(asset => {
return {
target: asset.address,
Expand All @@ -133,12 +268,6 @@ export const vip171Testnet = () => {
};
}),

{
target: ACCESS_CONTROL_MANAGER,
signature: "giveCallPermission(address,string,address)",
params: [ethers.constants.AddressZero, "setReduceReservesBlockDelta(uint256)", NORMAL_TIMELOCK],
},

...CORE_MARKETS.map(asset => {
return {
target: asset.address,
Expand Down

0 comments on commit a06055b

Please sign in to comment.