Skip to content

Commit

Permalink
feat: add vip for vtreasury
Browse files Browse the repository at this point in the history
  • Loading branch information
Debugger022 committed Jul 4, 2024
1 parent 66fbe94 commit 9276c26
Show file tree
Hide file tree
Showing 8 changed files with 175 additions and 1 deletion.
4 changes: 3 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,6 @@ ARCHIVE_NODE_opbnbmainnet=https://opbnb-mainnet.nodereal.io/v1/<YOUR_KEY_HERE>
ARCHIVE_NODE_arbitrumsepolia=https://sepolia-rollup.arbitrum.io/rpc
ARCHIVE_NODE_arbitrumone=https://open-platform.nodereal.io/<YOUR_KEY_HERE>/arbitrum-nitro/
ARCHIVE_NODE_xlayertestnet=https://rpc.ankr.com/xlayer_testnet/<YOUR_KEY_HERE>
ARCHIVE_NODE_xlayermainnet=https://rpc.ankr.com/xlayer<YOUR_KEY_HERE>
ARCHIVE_NODE_xlayermainnet=https://rpc.ankr.com/xlayer<YOUR_KEY_HERE>
ARCHIVE_NODE_opsepolia="https://sepolia.optimism.io"
ARCHIVE_NODE_opmainnet="https://opt-mainnet.nodereal.io/v1/<YOUR_KEY_HERE>"
14 changes: 14 additions & 0 deletions hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ const BLOCK_GAS_LIMIT_PER_NETWORK = {
arbitrumsepolia: 30000000,
arbitrumone: 30000000,
xlayertestnet: 30000000,
opsepolia: 30000000,
opmainnet: 30000000,
};

task("propose", "Propose proposal")
Expand Down Expand Up @@ -137,6 +139,18 @@ const config: HardhatUserConfig = {
chainId: 196,
accounts: DEPLOYER_PRIVATE_KEY ? [`0x${DEPLOYER_PRIVATE_KEY}`] : [],
},
opsepolia: {
url: process.env.ARCHIVE_NODE_opsepolia || "https://sepolia.optimism.io",
chainId: 11155420,
accounts: DEPLOYER_PRIVATE_KEY ? [`0x${DEPLOYER_PRIVATE_KEY}`] : [],
blockGasLimit: BLOCK_GAS_LIMIT_PER_NETWORK.opsepolia,
},
opmainnet: {
url: process.env.ARCHIVE_NODE_opmainnet || "https://mainnet.optimism.io",
chainId: 10,
accounts: DEPLOYER_PRIVATE_KEY ? [`0x${DEPLOYER_PRIVATE_KEY}`] : [],
blockGasLimit: BLOCK_GAS_LIMIT_PER_NETWORK.opmainnet,
},
},
paths: {
tests: "./tests",
Expand Down
14 changes: 14 additions & 0 deletions multisig/proposals/opsepolia/vip-000/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { makeProposal } from "../../../../src/utils";

const TREASURY = "0x5A1a12F47FA7007C9e23cf5e025F3f5d3aC7d755";

const vip000 = () => {
return makeProposal([
{
target: TREASURY,
signature: "acceptOwnership()",
params: [],
},
]);
};
export default vip000;
86 changes: 86 additions & 0 deletions multisig/simulations/opsepolia/vip-000/abi/treasury.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
[
{ "inputs": [], "name": "ZeroAddressNotAllowed", "type": "error" },
{
"anonymous": false,
"inputs": [
{ "indexed": true, "internalType": "address", "name": "previousOwner", "type": "address" },
{ "indexed": true, "internalType": "address", "name": "newOwner", "type": "address" }
],
"name": "OwnershipTransferStarted",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{ "indexed": true, "internalType": "address", "name": "previousOwner", "type": "address" },
{ "indexed": true, "internalType": "address", "name": "newOwner", "type": "address" }
],
"name": "OwnershipTransferred",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{ "indexed": false, "internalType": "uint256", "name": "withdrawAmount", "type": "uint256" },
{ "indexed": true, "internalType": "address", "name": "withdrawAddress", "type": "address" }
],
"name": "WithdrawTreasuryNative",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{ "indexed": true, "internalType": "address", "name": "tokenAddress", "type": "address" },
{ "indexed": false, "internalType": "uint256", "name": "withdrawAmount", "type": "uint256" },
{ "indexed": true, "internalType": "address", "name": "withdrawAddress", "type": "address" }
],
"name": "WithdrawTreasuryToken",
"type": "event"
},
{ "stateMutability": "payable", "type": "fallback" },
{ "inputs": [], "name": "acceptOwnership", "outputs": [], "stateMutability": "nonpayable", "type": "function" },
{
"inputs": [],
"name": "owner",
"outputs": [{ "internalType": "address", "name": "", "type": "address" }],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "pendingOwner",
"outputs": [{ "internalType": "address", "name": "", "type": "address" }],
"stateMutability": "view",
"type": "function"
},
{ "inputs": [], "name": "renounceOwnership", "outputs": [], "stateMutability": "nonpayable", "type": "function" },
{
"inputs": [{ "internalType": "address", "name": "newOwner", "type": "address" }],
"name": "transferOwnership",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{ "internalType": "uint256", "name": "withdrawAmount", "type": "uint256" },
{ "internalType": "address payable", "name": "withdrawAddress", "type": "address" }
],
"name": "withdrawTreasuryNative",
"outputs": [],
"stateMutability": "payable",
"type": "function"
},
{
"inputs": [
{ "internalType": "address", "name": "tokenAddress", "type": "address" },
{ "internalType": "uint256", "name": "withdrawAmount", "type": "uint256" },
{ "internalType": "address", "name": "withdrawAddress", "type": "address" }
],
"name": "withdrawTreasuryToken",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{ "stateMutability": "payable", "type": "receive" }
]
26 changes: 26 additions & 0 deletions multisig/simulations/opsepolia/vip-000/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { expect } from "chai";
import { Contract } from "ethers";
import { ethers } from "hardhat";

import { NETWORK_ADDRESSES } from "../../../../src/networkAddresses";
import { forking, pretendExecutingVip } from "../../../../src/vip-framework";
import vip000 from "../../../proposals/opsepolia/vip-000";
import TREASURY_ABI from "./abi/treasury.json";

const TREASURY = "0x5A1a12F47FA7007C9e23cf5e025F3f5d3aC7d755";

forking(14147950, () => {

Check failure on line 12 in multisig/simulations/opsepolia/vip-000/index.ts

View workflow job for this annotation

GitHub Actions / lint

Argument of type '() => void' is not assignable to parameter of type '() => Promise<void>'.
let treasury: Contract;

before(async () => {
treasury = await ethers.getContractAt(TREASURY_ABI, TREASURY);
await pretendExecutingVip(vip000());

Check failure on line 17 in multisig/simulations/opsepolia/vip-000/index.ts

View workflow job for this annotation

GitHub Actions / lint

Argument of type 'Promise<Proposal>' is not assignable to parameter of type 'Proposal'.
});

describe("Post tx checks", () => {
it("Should set owner to multisig", async () => {
const owner = await treasury.owner();
expect(owner).equals(NETWORK_ADDRESSES.opsepolia.NORMAL_TIMELOCK);
});
});
});
12 changes: 12 additions & 0 deletions src/multisig/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,18 @@ export const getContractNetworks = (chainId: number): ContractNetworksConfig =>
simulateTxAccessorAddress: "0x727a77a074D1E6c4530e814F89E618a3298FC044",
},
},
opsepolia: {
[chainId]: {
safeMasterCopyAddress: "0xe1Ed13Dd60b85a072401a3C4Fc7d2EaA678092F8",
safeProxyFactoryAddress: "0xf509dB5de5e01ce6e29EAaF8301981DE3C4c7cda",
multiSendAddress: "0x0A941df0A84634098abE04f52037c7Fb05C2dEd7",
multiSendCallOnlyAddress: "0x2694246B72e40a72B0F9137A9A0a9e818775B4dc",
fallbackHandlerAddress: "0x4f85CF627f6106FFDB72aBee57f143C61b6aEcA2",
signMessageLibAddress: "0xe5A8983525b0dC8757C47eD001C22ADB003ae372",
createCallAddress: "0xFf17bb26b8B702b698FE3De40C10d430742C9F47",
simulateTxAccessorAddress: "0xe7A7552B0Cff45E837e1422b479d2dEDE748f571",
},
},
// Add more networks as needed
};

Expand Down
4 changes: 4 additions & 0 deletions src/networkAddresses.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,4 +140,8 @@ export const NETWORK_ADDRESSES = {
NORMAL_TIMELOCK: "0x5961449d63149035aCfC0714D5155f24C9819004", // xlayer testnet Multisig
GUARDIAN: "0x5961449d63149035aCfC0714D5155f24C9819004",
},
opsepolia: {
NORMAL_TIMELOCK: "0xd57365EE4E850e881229e2F8Aa405822f289e78d", // opsepolia Multisig
GUARDIAN: "0xd57365EE4E850e881229e2F8Aa405822f289e78d",
},
};
16 changes: 16 additions & 0 deletions src/networkConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,20 @@ export const NETWORK_CONFIG = {
},
XVS_VAULT_POOL_ID: 0,
},
opsepolia: {
DELAY_BLOCKS: {
[ProposalType.REGULAR]: 200,
[ProposalType.FAST_TRACK]: 100,
[ProposalType.CRITICAL]: 34,
},
XVS_VAULT_POOL_ID: 0,
},
opmainnet: {
DELAY_BLOCKS: {
[ProposalType.REGULAR]: 200,
[ProposalType.FAST_TRACK]: 100,
[ProposalType.CRITICAL]: 34,
},
XVS_VAULT_POOL_ID: 0,
},
};

0 comments on commit 9276c26

Please sign in to comment.