Skip to content

Commit

Permalink
feat: add final id for VIP 186 and description
Browse files Browse the repository at this point in the history
  • Loading branch information
chechu committed Oct 17, 2023
1 parent 3ebdc2f commit b8c1a3d
Show file tree
Hide file tree
Showing 11 changed files with 102 additions and 69 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { ethers } from "hardhat";

import { expectEvents, initMainnetUser } from "../../../src/utils";
import { forking, testVip } from "../../../src/vip-framework";
import { vip185Testnet } from "../../../vips/vip-185/vip-185-testnet";
import { vip186Testnet } from "../../../vips/vip-186/vip-186-testnet";
import ACM_ABI from "./abi/AccessControlManager.json";
import COMPTROLLER_BEACON_ABI from "./abi/comptroller-beacon.json";
import COMPTROLLER_ABI from "./abi/comptroller.json";
Expand Down Expand Up @@ -95,7 +95,7 @@ forking(34165908, () => {
});
});

testVip("vip185Testnet", vip185Testnet(), {
testVip("vip186Testnet", vip186Testnet(), {
callbackAfterExecution: async txResponse => {
await expectEvents(txResponse, [COMPTROLLER_BEACON_ABI], ["Upgraded"], [1]);
await expectEvents(txResponse, [ACM_ABI], ["RoleGranted"], [15]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { ethers } from "hardhat";

import { expectEvents, initMainnetUser } from "../../../src/utils";
import { forking, testVip } from "../../../src/vip-framework";
import { vip185 } from "../../../vips/vip-185/vip-185";
import { vip186 } from "../../../vips/vip-186/vip-186";
import ACM_ABI from "./abi/AccessControlManager.json";
import COMPTROLLER_BEACON_ABI from "./abi/comptroller-beacon.json";
import COMPTROLLER_ABI from "./abi/comptroller.json";
Expand Down Expand Up @@ -96,7 +96,7 @@ forking(32567583, () => {
});
});

testVip("vip185", vip185(), {
testVip("vip186", vip186(), {
callbackAfterExecution: async txResponse => {
await expectEvents(txResponse, [COMPTROLLER_BEACON_ABI], ["Upgraded"], [1]);
await expectEvents(txResponse, [ACM_ABI], ["RoleGranted"], [15]);
Expand Down
64 changes: 0 additions & 64 deletions vips/vip-185/vip-185.ts

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const grantAccessControl = (contract: string) => {
return accessProposals;
};

export const vip185Testnet = () => {
export const vip186Testnet = () => {
const meta = {
version: "v2",
title: "VIP comptroller beacon upgrade",
Expand Down
97 changes: 97 additions & 0 deletions vips/vip-186/vip-186.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
import { ProposalType } from "../../src/types";
import { makeProposal } from "../../src/utils";

const COMPTROLLER_BEACON = "0x38B4Efab9ea1bAcD19dC81f19c4D1C2F9DeAe1B2";
const NEW_COMPTROLLER_IMPLEMENTATION = "0x69Ca940186C29b6a9D64e1Be1C59fb7A466354E2";
const ACM = "0x4788629ABc6cFCA10F9f969efdEAa1cF70c23555";
const POOL_STABLECOIN = "0x94c1495cD4c557f1560Cbd68EAB0d197e6291571";
const POOL_DEFI = "0x3344417c9360b963ca93A4e8305361AEde340Ab9";
const POOL_GAMEFI = "0x1b43ea8622e76627B81665B1eCeBB4867566B963";
const POOL_LIQUID_STAKED_BNB = "0xd933909A4a2b7A4638903028f44D1d38ce27c352";
const POOL_TRON = "0x23b4404E4E5eC5FF5a6FFb70B7d14E3FabF237B0";
const CRITICAL_TIMELOCK = "0x213c446ec11e45b15a6E29C1C1b402B8897f606d";
const NORMAL_TIMELOCK = "0x939bD8d64c0A9583A7Dcea9933f7b21697ab6396";
const FAST_TRACK_TIMELOCK = "0x555ba73dB1b006F3f2C7dB7126d6e4343aDBce02";

interface GrantAccess {
target: string;
signature: string;
params: Array<string>;
}

const grantAccessControl = (contract: string) => {
const accessProposals: Array<GrantAccess> = [];
[NORMAL_TIMELOCK, FAST_TRACK_TIMELOCK, CRITICAL_TIMELOCK].map(target => {
accessProposals.push({
target: ACM,
signature: "giveCallPermission(address,string,address)",
params: [contract, "setForcedLiquidation(address,bool)", target],
});
});

return accessProposals;
};

export const vip186 = () => {
const meta = {
version: "v2",
title: "VIP-186 Add forced liquidations feature into the Isolated pools",
description: `#### Summary
If passed, this VIP will upgrade the implementation of the Comptroller contracts of the Isolated pools, including the feature “forced liquidations”. This feature was already added to the Comptroller contract of the Core pool in the [VIP-172](https://app.venus.io/#/governance/proposal/172). Forced liquidations will be initially disabled for every market in Isolated pools. To enable it, a new VIP would be needed.
#### Description
This VIP upgrades the implementation of the Comptroller contracts in the Isolated pools, including the feature “forced liquidations”, that will be **initially disabled for every market**.
You can read more about this feature in the [VIP-172](https://app.venus.io/#/governance/proposal/172), and in the [public documentation site](https://docs-v4.venus.io/guides/liquidation#forced-liquidations).
Finally, this VIP will authorize Normal, Fast-track and Critical timelocks to enable and disable the forced liquidations on any market of the Isolated pools.
**Security and additional considerations**
We applied the following security procedures for this upgrade:
- **Behavior post upgrade**: in a simulation environment, validating “forced liquidations” work as expected after the upgrade
- **Deployment on testnet**: the same implementation has been deployed to testnet, and used in the Venus Protocol testnet deployment
- **Audit: Certik has audited the deployed code**
**Audit reports**
- [Certik audit report (2023/10/16)](https://github.com/VenusProtocol/isolated-pools/blob/41a96ca24b0e32b8087ea7b916ae2864cbf1a05f/audits/078_forcedLiquidations_certik_20231016.pdf)
**Deployed contracts**
- [New Comptroller implementation - mainnet](https://bscscan.com/address/0x69Ca940186C29b6a9D64e1Be1C59fb7A466354E2)
- [New Comptroller implementation - testnet](https://testnet.bscscan.com/address/0x11a92852fA7D70C220Dada69969b2f1C4e18e663)
**References**
- [Pull request with the changeset](https://github.com/VenusProtocol/isolated-pools/pull/305)
- [Simulation post upgrade](https://github.com/VenusProtocol/vips/pull/74)
- [Old Comptroller implementation](https://bscscan.com/address/0x17a6ac4f7f01387303deb1d78f01ac0a0c1a75b0#code)
- [Beacon contract](https://bscscan.com/address/0x38B4Efab9ea1bAcD19dC81f19c4D1C2F9DeAe1B2)
- [Documentation](https://docs-v4.venus.io/guides/liquidation#forced-liquidations)`,

forDescription: "I agree that Venus Protocol should proceed with this proposal",
againstDescription: "I do not think that Venus Protocol should proceed with this proposal",
abstainDescription: "I am indifferent to whether Venus Protocol proceeds or not",
};

return makeProposal(
[
{
target: COMPTROLLER_BEACON,
signature: "upgradeTo(address)",
params: [NEW_COMPTROLLER_IMPLEMENTATION],
},
...grantAccessControl(POOL_STABLECOIN),
...grantAccessControl(POOL_DEFI),
...grantAccessControl(POOL_GAMEFI),
...grantAccessControl(POOL_LIQUID_STAKED_BNB),
...grantAccessControl(POOL_TRON),
],
meta,
ProposalType.REGULAR,
);
};

0 comments on commit b8c1a3d

Please sign in to comment.