Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[VEN-1830]: Poc/sepolia VIP multisig tx execution #64

Merged
merged 16 commits into from
Oct 31, 2023
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
4 changes: 3 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@ FORK_TESTNET=
QUICK_NODE_KEY=YOUR_KEY_HERE
BSC_ARCHIVE_NODE=https://tame-white-dinghy.bsc.discover.quiknode.pro/YOUR_KEY_HERE
DEPLOYER_PRIVATE_KEY="E9873D79C6D87DC0FB6A5778633389F4453213303DA61F20BD67FC233AA33262"
VIP_NUMBER=101
VIP_NUMBER=101
NETWORK=sepolia
MULTISIG=true
3 changes: 2 additions & 1 deletion .eslinttsconfigrc
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"./scripts",
"./src",
"./vips",
"./simulations"
"./simulations",
"./multisig"
]
}
26 changes: 26 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ yarn install
npx hardhat test simulations/<simulation-path>
```

### Run Simulations for Multisig

```
npx hardhat test multisig/simulations/<network>/<path>
```

### Create Proposal

Script to generate proposal data for multiple destinations such as venusApp bscexplorer and gnosis tx builder.
Expand All @@ -45,3 +51,23 @@ In .env, replace VIP_NUMBER with the number of vip to propose.
```
npx hardhat test scripts/proposeVIP.ts
```

### Execute VIP (via Multisig)

Script to execute a VIP through the Gnosis Safe Multisig

Procedure for executing VIP

In .env, make sure that `DEPLOYER_PRIVATE_KEY` is the one of the multisig owner on sepolia `0xFEA1c651A47FE29dB9b1bf3cC1f224d8D9CFF68C`

Proceed by executing the following command:

```
npx hardhat run scripts/executeMultiSigTx.ts --network sepolia
```

After executing the commant, provide the proposal name to be executed and press enter:

```
Name of tx file (from ./multisig/<network>/ dir) to execute =>
```
6 changes: 5 additions & 1 deletion hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,11 @@ const config: HardhatUserConfig = {
url: `https://bsc-dataseed.binance.org/`,
accounts: DEPLOYER_PRIVATE_KEY ? [`0x${DEPLOYER_PRIVATE_KEY}`] : [],
},
sepolia: {
url: "https://ethereum-sepolia.blockpi.network/v1/rpc/public",
chainId: 11155111,
accounts: DEPLOYER_PRIVATE_KEY ? [`0x${DEPLOYER_PRIVATE_KEY}`] : [],
},
},
paths: {
tests: "./tests",
Expand All @@ -80,7 +85,6 @@ function isFork() {
loggingEnabled: false,
forking: {
url: `${process.env.BSC_ARCHIVE_NODE}`,
blockNumber: 21068448,
},
accounts: {
accountsBalance: "1000000000000000000",
Expand Down
29 changes: 29 additions & 0 deletions multisig/helpers/config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { ethers } from "ethers";

export interface deployedContracts {
[key: string]: string;
}
export interface NetworkAddress {
[key: string]: deployedContracts;
}
export const ZERO_ADDRESS = ethers.constants.AddressZero;
export const ADDRESSES: NetworkAddress = {
sepoliaContracts: {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't the key be only the network name without Contracts suffix?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree we can import it into other files using an alias name to prevent confusion.

CHAINLINK_ORACLE: "0x0a16c96EB3E767147DB477196aA8E9774945CDf7",
RESILIENT_ORACLE: "0x9005091f2E0b20bEf6AaF2bD7F21dfd45DA8Af07",
BOUND_VALIDATOR: "0x8305fF2eEAE00bc0C19746851c1c8643Ebd68193",
ACM: "0xbf705C00578d43B6147ab4eaE04DBBEd1ccCdc96",
TIMELOCK: "0x94fa6078b6b8a26F0B6EDFFBE6501B22A10470fB", // Sepolia Multisig
MOCK_USDC: "0x772d68929655ce7234C8C94256526ddA66Ef641E",
MOCK_USDT: "0x8d412FD0bc5d826615065B931171Eed10F5AF266",
MOCK_WETH: "0x700868CAbb60e90d77B6588ce072d9859ec8E281",
MOCK_WBTC: "0x92A2928f5634BEa89A195e7BeCF0f0FEEDAB885b",
POOL_REGISTRY: "0x22067CF4a23955Ab7b834D4a9336ca624D93485e",
COMPTROLLER: "0x4e4048b5eb13DD377872A418268b788f672653aa",
VWBTC: "0x13c15cA5A074E7E1450492D474087b99c7253001",
VWETH: "0x195D27b4cAfcb543C9104583FA37743ad5E4cEe5",
VUSDT: "0x2c3Cc8EED38b4d323ce97DB11f98737F3F7421A1",
VUSDC: "0x6f1089e90C6a14397C20348eE704d596819DFEd4",
VTREASURY: "0xD51008eAe81475b542638433a617f5f4171b39ee",
},
};
19 changes: 19 additions & 0 deletions multisig/helpers/utils.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
export const loadMultisigTx = async (txName: string, networkName: string) => {
const x = await import(`../proposals/${networkName}/${txName}.ts`);
return x[txName]();
};

export const getSafeAddress = (networkName: string): string => {
// Define Safe addresses for different networks here
const safeAddresses: Record<string, string> = {
// Sepolia network
sepolia: "0x94fa6078b6b8a26f0b6edffbe6501b22a10470fb",
// Add more networks and their corresponding Safe addresses as needed
};

if (networkName in safeAddresses) {
return safeAddresses[networkName];
} else {
throw new Error(`Safe address for network ${networkName} is not defined.`);
}
};
20 changes: 20 additions & 0 deletions multisig/proposals/sepolia/example.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { makeProposal } from "../../../src/utils";

const STORAGE_UINT_CONTRACT = "0x049f77F7046266d27C3bC96376f53C17Ef09c986";
const STORAGE_MAPPING_COTNRACT = "0x435D55709070ee1f0789685F9859038e9D5C39d7";
const VENUS_DEPLOYER_ADDRESS = "0xFEA1c651A47FE29dB9b1bf3cC1f224d8D9CFF68C";

export const example = () => {
return makeProposal([
{
target: STORAGE_UINT_CONTRACT,
signature: "store(uint256)",
params: [10],
},
{
target: STORAGE_MAPPING_COTNRACT,
signature: "store(address,uint256)",
params: [VENUS_DEPLOYER_ADDRESS, 11],
},
]);
};
61 changes: 61 additions & 0 deletions multisig/proposals/sepolia/oracleAclOwnership.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
import { makeProposal } from "../../../src/utils";
import { ADDRESSES, ZERO_ADDRESS } from "../../helpers/config";

const { sepoliaContracts } = ADDRESSES;
export const oracleAclOwnership = () => {
return makeProposal([
{
target: sepoliaContracts.ACM,
signature: "giveCallPermission(address,string,address)",
params: [ZERO_ADDRESS, "pause()", sepoliaContracts.TIMELOCK],
},
{
target: sepoliaContracts.ACM,
signature: "giveCallPermission(address,string,address)",
params: [ZERO_ADDRESS, "unpause()", sepoliaContracts.TIMELOCK],
},
{
target: sepoliaContracts.ACM,
signature: "giveCallPermission(address,string,address)",
params: [ZERO_ADDRESS, "setOracle(address,address,uint8)", sepoliaContracts.TIMELOCK],
},
{
target: sepoliaContracts.ACM,
signature: "giveCallPermission(address,string,address)",
params: [ZERO_ADDRESS, "enableOracle(address,uint8,bool)", sepoliaContracts.TIMELOCK],
},
{
target: sepoliaContracts.ACM,
signature: "giveCallPermission(address,string,address)",
params: [ZERO_ADDRESS, "setTokenConfig(TokenConfig)", sepoliaContracts.TIMELOCK],
},
{
target: sepoliaContracts.ACM,
signature: "giveCallPermission(address,string,address)",
params: [ZERO_ADDRESS, "setDirectPrice(address,uint256)", sepoliaContracts.TIMELOCK],
},
{
target: sepoliaContracts.ACM,
signature: "giveCallPermission(address,string,address)",
params: [ZERO_ADDRESS, "setValidateConfig(ValidateConfig)", sepoliaContracts.TIMELOCK],
},
{
target: sepoliaContracts.ACM,
signature: "giveCallPermission(address,string,address)",
params: [ZERO_ADDRESS, "setMaxStalePeriod(string,uint256)", sepoliaContracts.TIMELOCK],
},
{
target: sepoliaContracts.ACM,
signature: "giveCallPermission(address,string,address)",
params: [ZERO_ADDRESS, "setSymbolOverride(string,string)", sepoliaContracts.TIMELOCK],
},
{
target: sepoliaContracts.ACM,
signature: "giveCallPermission(address,string,address)",
params: [ZERO_ADDRESS, "setUnderlyingPythOracle(address)", sepoliaContracts.TIMELOCK],
},
{ target: sepoliaContracts.RESILIENT_ORACLE, signature: "acceptOwnership()", params: [] },
{ target: sepoliaContracts.CHAINLINK_ORACLE, signature: "acceptOwnership()", params: [] },
{ target: sepoliaContracts.BOUND_VALIDATOR, signature: "acceptOwnership()", params: [] },
]);
};
76 changes: 76 additions & 0 deletions multisig/proposals/sepolia/oracleAssetConfig.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
import { makeProposal } from "../../../src/utils";
import { ADDRESSES, ZERO_ADDRESS } from "../../helpers/config";

const { sepoliaContracts } = ADDRESSES;
const WBTC_CHAINLINK_FEED = "0x1b44F3514812d835EB1BDB0acB33d3fA3351Ee43";
const WETH_CHAINLINK_FEED = "0x694AA1769357215DE4FAC081bf1f309aDC325306";
const USDC_CHAINLINK_FEED = "0xA2F78ab2355fe2f984D808B5CeE7FD0A93D5270E";

export const oracleAssetConfig = () => {
return makeProposal([
{
target: sepoliaContracts.CHAINLINK_ORACLE,
signature: "setTokenConfig((address,address,uint256))",
params: [[sepoliaContracts.MOCK_WBTC, WBTC_CHAINLINK_FEED, 86400]],
},
{
target: sepoliaContracts.RESILIENT_ORACLE,
signature: "setTokenConfig((address,address[3],bool[3]))",
params: [
[
sepoliaContracts.MOCK_WBTC,
[sepoliaContracts.CHAINLINK_ORACLE, ZERO_ADDRESS, ZERO_ADDRESS],
[true, false, false],
],
],
},
{
target: sepoliaContracts.CHAINLINK_ORACLE,
signature: "setTokenConfig((address,address,uint256))",
params: [[sepoliaContracts.MOCK_WETH, WETH_CHAINLINK_FEED, 86400]],
},
{
target: sepoliaContracts.RESILIENT_ORACLE,
signature: "setTokenConfig((address,address[3],bool[3]))",
params: [
[
sepoliaContracts.MOCK_WETH,
[sepoliaContracts.CHAINLINK_ORACLE, ZERO_ADDRESS, ZERO_ADDRESS],
[true, false, false],
],
],
},
{
target: sepoliaContracts.CHAINLINK_ORACLE,
signature: "setTokenConfig((address,address,uint256))",
params: [[sepoliaContracts.MOCK_USDC, USDC_CHAINLINK_FEED, 86400]],
},
{
target: sepoliaContracts.RESILIENT_ORACLE,
signature: "setTokenConfig((address,address[3],bool[3]))",
params: [
[
sepoliaContracts.MOCK_USDC,
[sepoliaContracts.CHAINLINK_ORACLE, ZERO_ADDRESS, ZERO_ADDRESS],
[true, false, false],
],
],
},
{
target: sepoliaContracts.CHAINLINK_ORACLE,
signature: "setDirectPrice(address,uint256)",
params: [sepoliaContracts.MOCK_USDT, "1000000000000000000"],
},
{
target: sepoliaContracts.RESILIENT_ORACLE,
signature: "setTokenConfig((address,address[3],bool[3]))",
params: [
[
sepoliaContracts.MOCK_USDT,
[sepoliaContracts.CHAINLINK_ORACLE, ZERO_ADDRESS, ZERO_ADDRESS],
[true, false, false],
],
],
},
]);
};
Loading