From 4532689f79fe85aef28148f5ec557639f5e7822f Mon Sep 17 00:00:00 2001 From: GitGuru7 Date: Wed, 12 Feb 2025 15:12:37 +0530 Subject: [PATCH 1/6] feat: add vip for reward distributor on unichain --- .../unichainmainnet/vip-007/index.ts | 76 + .../unichainmainnet/vip-007/abi/xvs.json | 716 +++++++ .../unichainmainnet/vip-007/abi/xvsvault.json | 1651 +++++++++++++++++ .../unichainmainnet/vip-007/index.ts | 103 + 4 files changed, 2546 insertions(+) create mode 100644 multisig/proposals/unichainmainnet/vip-007/index.ts create mode 100644 multisig/simulations/unichainmainnet/vip-007/abi/xvs.json create mode 100644 multisig/simulations/unichainmainnet/vip-007/abi/xvsvault.json create mode 100644 multisig/simulations/unichainmainnet/vip-007/index.ts diff --git a/multisig/proposals/unichainmainnet/vip-007/index.ts b/multisig/proposals/unichainmainnet/vip-007/index.ts new file mode 100644 index 000000000..d1684f205 --- /dev/null +++ b/multisig/proposals/unichainmainnet/vip-007/index.ts @@ -0,0 +1,76 @@ +import { parseUnits } from "ethers/lib/utils"; +import { ethers } from "hardhat"; +import { NETWORK_ADDRESSES } from "src/networkAddresses"; +import { makeProposal } from "src/utils"; + +const { unichainmainnet } = NETWORK_ADDRESSES; + +export const REWARD_TOKEN_SPEED = "77160493827160"; // 200 XVS / 30 days (77160493827160 XVS/second) +export const XVS = unichainmainnet.XVS; +export const XVS_REWARD_AMOUNT = parseUnits("1500", 18); +export const REWARD_DISTRIBUTOR_AMOUNT = parseUnits("18000", 18); +export const XVS_STORE = "0x0ee4b35c2cEAb19856Bf35505F81608d12B2a7Bb"; +export const XVS_VAULT_PROXY = "0x5ECa0FBBc5e7bf49dbFb1953a92784F8e4248eF6"; +export const REWARD_DISTRIBUTOR_CORE_0 = "0x4630B71C1BD27c99DD86aBB2A18C50c3F75C88fb"; +export const COMPTROLLER_CORE = "0xe22af1e6b78318e1Fe1053Edbd7209b8Fc62c4Fe"; +export const VUSDC_CORE = "0xB953f92B9f759d97d2F2Dec10A8A3cf75fcE3A95"; +export const VWETH_CORE = "0xc219BC179C7cDb37eACB03f993f9fDc2495e3374"; +const ACM = "0x1f12014c497a9d905155eB9BfDD9FaC6885e61d0"; + +export const vip007 = () => { + return makeProposal([ + // ACM Permissions + { + target: ACM, + signature: "giveCallPermission(address,string,address)", + params: [ + ethers.constants.AddressZero, + "setLastRewardingBlockTimestamps(address[],uint32[],uint32[])", + unichainmainnet.GUARDIAN, + ], + }, + { + target: ACM, + signature: "giveCallPermission(address,string,address)", + params: [ + ethers.constants.AddressZero, + "setRewardTokenSpeeds(address[],uint256[],uint256[])", + unichainmainnet.GUARDIAN, + ], + }, + + // Configure pool rewards + { + target: unichainmainnet.VTREASURY, + signature: "withdrawTreasuryToken(address,uint256,address)", + params: [unichainmainnet.XVS, XVS_REWARD_AMOUNT, XVS_STORE], + }, + { + target: XVS_VAULT_PROXY, + signature: "setRewardAmountPerBlockOrSecond(address,uint256)", + params: [unichainmainnet.XVS, REWARD_TOKEN_SPEED], + }, + { target: REWARD_DISTRIBUTOR_CORE_0, signature: "acceptOwnership()", params: [] }, + { + target: unichainmainnet.VTREASURY, + signature: "withdrawTreasuryToken(address,uint256,address)", + params: [unichainmainnet.XVS, REWARD_DISTRIBUTOR_AMOUNT, REWARD_DISTRIBUTOR_CORE_0], + }, + { + target: COMPTROLLER_CORE, + signature: "addRewardsDistributor(address)", + params: [REWARD_DISTRIBUTOR_CORE_0], + }, + { + target: REWARD_DISTRIBUTOR_CORE_0, + signature: "setRewardTokenSpeeds(address[],uint256[],uint256[])", + params: [ + [VWETH_CORE, VUSDC_CORE], + ["578703703703704", "578703703703704"], + ["192901234567901", "192901234567901"], + ], + }, + ]); +}; + +export default vip007; diff --git a/multisig/simulations/unichainmainnet/vip-007/abi/xvs.json b/multisig/simulations/unichainmainnet/vip-007/abi/xvs.json new file mode 100644 index 000000000..69092bb4a --- /dev/null +++ b/multisig/simulations/unichainmainnet/vip-007/abi/xvs.json @@ -0,0 +1,716 @@ +[ + { + "inputs": [ + { + "internalType": "address", + "name": "accessControlManager_", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "user", + "type": "address" + } + ], + "name": "AccountBlacklisted", + "type": "error" + }, + { + "inputs": [], + "name": "AddressesMustDiffer", + "type": "error" + }, + { + "inputs": [], + "name": "MintLimitExceed", + "type": "error" + }, + { + "inputs": [], + "name": "MintedAmountExceed", + "type": "error" + }, + { + "inputs": [], + "name": "NewCapNotGreaterThanMintedTokens", + "type": "error" + }, + { + "inputs": [], + "name": "Unauthorized", + "type": "error" + }, + { + "inputs": [], + "name": "ZeroAddressNotAllowed", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "value", + "type": "bool" + } + ], + "name": "BlacklistUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "minter", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "MintCapChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "minter", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newLimit", + "type": "uint256" + } + ], + "name": "MintLimitDecreased", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "minter", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newLimit", + "type": "uint256" + } + ], + "name": "MintLimitIncreased", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "source", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "destination", + "type": "address" + } + ], + "name": "MintedTokensMigrated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "oldAccessControlManager", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newAccessControlManager", + "type": "address" + } + ], + "name": "NewAccessControlManager", + "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": "address", + "name": "account", + "type": "address" + } + ], + "name": "Paused", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "Transfer", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "Unpaused", + "type": "event" + }, + { + "inputs": [], + "name": "accessControlManager", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "spender", + "type": "address" + } + ], + "name": "allowance", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "approve", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account_", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount_", + "type": "uint256" + } + ], + "name": "burn", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "decimals", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "subtractedValue", + "type": "uint256" + } + ], + "name": "decreaseAllowance", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "addedValue", + "type": "uint256" + } + ], + "name": "increaseAllowance", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "user_", + "type": "address" + } + ], + "name": "isBlackListed", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "source_", + "type": "address" + }, + { + "internalType": "address", + "name": "destination_", + "type": "address" + } + ], + "name": "migrateMinterTokens", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account_", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount_", + "type": "uint256" + } + ], + "name": "mint", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "minterToCap", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "minterToMintedAmount", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "name", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "pause", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "paused", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newAccessControlAddress_", + "type": "address" + } + ], + "name": "setAccessControlManager", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "minter_", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount_", + "type": "uint256" + } + ], + "name": "setMintCap", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "symbol", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "transfer", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "transferFrom", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "unpause", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "user_", + "type": "address" + }, + { + "internalType": "bool", + "name": "value_", + "type": "bool" + } + ], + "name": "updateBlacklist", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } +] diff --git a/multisig/simulations/unichainmainnet/vip-007/abi/xvsvault.json b/multisig/simulations/unichainmainnet/vip-007/abi/xvsvault.json new file mode 100644 index 000000000..e32e0b3d1 --- /dev/null +++ b/multisig/simulations/unichainmainnet/vip-007/abi/xvsvault.json @@ -0,0 +1,1651 @@ +[ + { + "inputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "rewardToken", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "pid", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Claim", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "delegator", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "fromDelegate", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "toDelegate", + "type": "address" + } + ], + "name": "DelegateChangedV2", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "delegate", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "previousBalance", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newBalance", + "type": "uint256" + } + ], + "name": "DelegateVotesChangedV2", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "rewardToken", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "pid", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Deposit", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "rewardToken", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "pid", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "ExecutedWithdrawal", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "oldAccessControlManager", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newAccessControlManager", + "type": "address" + } + ], + "name": "NewAccessControlManager", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "contract IPrime", + "name": "oldPrimeToken", + "type": "address" + }, + { + "indexed": true, + "internalType": "contract IPrime", + "name": "newPrimeToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "oldPrimeRewardToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newPrimeRewardToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "oldPrimePoolId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newPrimePoolId", + "type": "uint256" + } + ], + "name": "NewPrimeToken", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "rewardToken", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "pid", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "allocPoints", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "rewardPerBlockOrSecond", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "lockPeriod", + "type": "uint256" + } + ], + "name": "PoolAdded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "rewardToken", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "pid", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "oldAllocPoints", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newAllocPoints", + "type": "uint256" + } + ], + "name": "PoolUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "rewardToken", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "pid", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "RequestedWithdrawal", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "rewardToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "oldReward", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newReward", + "type": "uint256" + } + ], + "name": "RewardAmountUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "oldXvs", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "oldStore", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newXvs", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newStore", + "type": "address" + } + ], + "name": "StoreUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "rewardToken", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "userAddress", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "oldOwedAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newOwedAmount", + "type": "uint256" + } + ], + "name": "VaultDebtUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "admin", + "type": "address" + } + ], + "name": "VaultPaused", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "admin", + "type": "address" + } + ], + "name": "VaultResumed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "rewardToken", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "pid", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "oldPeriod", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newPeriod", + "type": "uint256" + } + ], + "name": "WithdrawalLockingPeriodUpdated", + "type": "event" + }, + { + "constant": true, + "inputs": [], + "name": "DELEGATION_TYPEHASH", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "DOMAIN_TYPEHASH", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "MAX_LOCK_PERIOD", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "SECONDS_PER_YEAR", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "contract XVSVaultProxy", + "name": "xvsVaultProxy", + "type": "address" + } + ], + "name": "_become", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "accessControlManager", + "outputs": [ + { + "internalType": "contract IAccessControlManagerV5", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "_rewardToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_allocPoint", + "type": "uint256" + }, + { + "internalType": "contract IBEP20", + "name": "_token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_rewardPerBlockOrSecond", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_lockPeriod", + "type": "uint256" + } + ], + "name": "add", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "admin", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "blocksOrSecondsPerYear", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint32", + "name": "", + "type": "uint32" + } + ], + "name": "checkpoints", + "outputs": [ + { + "internalType": "uint32", + "name": "fromBlockOrSecond", + "type": "uint32" + }, + { + "internalType": "uint96", + "name": "votes", + "type": "uint96" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "_account", + "type": "address" + }, + { + "internalType": "address", + "name": "_rewardToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_pid", + "type": "uint256" + } + ], + "name": "claim", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "delegatee", + "type": "address" + } + ], + "name": "delegate", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "delegatee", + "type": "address" + }, + { + "internalType": "uint256", + "name": "nonce", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "expiry", + "type": "uint256" + }, + { + "internalType": "uint8", + "name": "v", + "type": "uint8" + }, + { + "internalType": "bytes32", + "name": "r", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "s", + "type": "bytes32" + } + ], + "name": "delegateBySig", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "delegates", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "_rewardToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_pid", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "deposit", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "_rewardToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_pid", + "type": "uint256" + } + ], + "name": "executeWithdrawal", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "getBlockNumberOrTimestamp", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "getCurrentVotes", + "outputs": [ + { + "internalType": "uint96", + "name": "", + "type": "uint96" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "_rewardToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_pid", + "type": "uint256" + }, + { + "internalType": "address", + "name": "_user", + "type": "address" + } + ], + "name": "getEligibleWithdrawalAmount", + "outputs": [ + { + "internalType": "uint256", + "name": "withdrawalAmount", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "uint256", + "name": "blockNumberOrSecond", + "type": "uint256" + } + ], + "name": "getPriorVotes", + "outputs": [ + { + "internalType": "uint96", + "name": "", + "type": "uint96" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "_rewardToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_pid", + "type": "uint256" + }, + { + "internalType": "address", + "name": "_user", + "type": "address" + } + ], + "name": "getRequestedAmount", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "_rewardToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_pid", + "type": "uint256" + }, + { + "internalType": "address", + "name": "_user", + "type": "address" + } + ], + "name": "getUserInfo", + "outputs": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rewardDebt", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "pendingWithdrawals", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "_rewardToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_pid", + "type": "uint256" + }, + { + "internalType": "address", + "name": "_user", + "type": "address" + } + ], + "name": "getWithdrawalRequests", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "uint128", + "name": "lockedUntil", + "type": "uint128" + }, + { + "internalType": "uint128", + "name": "afterUpgrade", + "type": "uint128" + } + ], + "internalType": "struct XVSVaultStorageV1.WithdrawalRequest[]", + "name": "", + "type": "tuple[]" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "implementation", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "bool", + "name": "timeBased_", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "blocksPerYear_", + "type": "uint256" + } + ], + "name": "initializeTimeManager", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "isStakedToken", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "isTimeBased", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "nonces", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "numCheckpoints", + "outputs": [ + { + "internalType": "uint32", + "name": "", + "type": "uint32" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "pause", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "pendingAdmin", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "_rewardToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_pid", + "type": "uint256" + }, + { + "internalType": "address", + "name": "_user", + "type": "address" + } + ], + "name": "pendingReward", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "pendingRewardTransfers", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "_rewardToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_pid", + "type": "uint256" + }, + { + "internalType": "address", + "name": "_user", + "type": "address" + } + ], + "name": "pendingWithdrawalsBeforeUpgrade", + "outputs": [ + { + "internalType": "uint256", + "name": "beforeUpgradeWithdrawalAmount", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "pendingXVSVaultImplementation", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "poolInfos", + "outputs": [ + { + "internalType": "contract IBEP20", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "allocPoint", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastRewardBlockOrSecond", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "accRewardPerShare", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lockPeriod", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "rewardToken", + "type": "address" + } + ], + "name": "poolLength", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "primePoolId", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "primeRewardToken", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "primeToken", + "outputs": [ + { + "internalType": "contract IPrime", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "_rewardToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_pid", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "requestWithdrawal", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "resume", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "_rewardToken", + "type": "address" + } + ], + "name": "rewardTokenAmountsPerBlock", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "rewardTokenAmountsPerBlockOrSecond", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "_rewardToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_pid", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_allocPoint", + "type": "uint256" + } + ], + "name": "set", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "newAccessControlAddress", + "type": "address" + } + ], + "name": "setAccessControl", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "contract IPrime", + "name": "_primeToken", + "type": "address" + }, + { + "internalType": "address", + "name": "_primeRewardToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_primePoolId", + "type": "uint256" + } + ], + "name": "setPrimeToken", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "_rewardToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_rewardAmount", + "type": "uint256" + } + ], + "name": "setRewardAmountPerBlockOrSecond", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "_rewardToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_pid", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_newPeriod", + "type": "uint256" + } + ], + "name": "setWithdrawalLockingPeriod", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "_xvs", + "type": "address" + }, + { + "internalType": "address", + "name": "_xvsStore", + "type": "address" + } + ], + "name": "setXvsStore", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "totalAllocPoints", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "_rewardToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_pid", + "type": "uint256" + } + ], + "name": "updatePool", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "vaultPaused", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "xvsAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "xvsStore", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + } +] diff --git a/multisig/simulations/unichainmainnet/vip-007/index.ts b/multisig/simulations/unichainmainnet/vip-007/index.ts new file mode 100644 index 000000000..8633f5bc9 --- /dev/null +++ b/multisig/simulations/unichainmainnet/vip-007/index.ts @@ -0,0 +1,103 @@ +import { expect } from "chai"; +import { Contract } from "ethers"; +import { parseUnits } from "ethers/lib/utils"; +import { ethers } from "hardhat"; +import { NETWORK_ADDRESSES } from "src/networkAddresses"; +import { initMainnetUser } from "src/utils"; +import { + RewardsDistributorConfig, + checkRewardsDistributor, + checkRewardsDistributorPool, +} from "src/vip-framework/checks/rewardsDistributor"; +import { forking, pretendExecutingVip } from "src/vip-framework/index"; + +import vip000 from "../../../proposals/unichainmainnet/vip-000"; +import vip001 from "../../../proposals/unichainmainnet/vip-001"; +import vip002 from "../../../proposals/unichainmainnet/vip-002"; +import vip003 from "../../../proposals/unichainmainnet/vip-003"; +import vip004 from "../../../proposals/unichainmainnet/vip-004"; +import { + COMPTROLLER_CORE, + REWARD_DISTRIBUTOR_CORE_0, + REWARD_TOKEN_SPEED, + VUSDC_CORE, + VWETH_CORE, + XVS, + XVS_REWARD_AMOUNT, + XVS_STORE, + vip007, +} from "../../../proposals/unichainmainnet/vip-007"; +import XVS_ABI from "./abi/xvs.json"; +import XVS_VAULT_ABI from "./abi/xvsvault.json"; + +const { unichainmainnet } = NETWORK_ADDRESSES; + +const XVS_PROXY_OFT_DEST = "0x9c95f8aa28fFEB7ECdC0c407B9F632419c5daAF8"; +const TREASURY_AMOUNT = parseUnits("19500", 18); + +forking(8540765, async () => { + let xvs: Contract; + let xvsVault: Contract; + describe("Post VIP checks", async () => { + before(async () => { + xvs = new ethers.Contract(XVS, XVS_ABI, ethers.provider); + + xvsVault = new ethers.Contract(unichainmainnet.XVS_VAULT_PROXY, XVS_VAULT_ABI, ethers.provider); + + const impersonateBridge = await initMainnetUser(XVS_PROXY_OFT_DEST, ethers.utils.parseEther("2")); + await pretendExecutingVip(await vip000()); + await pretendExecutingVip(await vip001()); + await pretendExecutingVip(await vip002()); + + await pretendExecutingVip(await vip003()); + await pretendExecutingVip(await vip004()); + + await xvs.connect(impersonateBridge).mint(unichainmainnet.VTREASURY, TREASURY_AMOUNT); + + await pretendExecutingVip(await vip007()); + }); + + it("rewards distributor should have expected number of xvs tokens", async () => { + expect(await xvs.balanceOf(REWARD_DISTRIBUTOR_CORE_0)).to.be.equal(parseUnits("18000", 18)); + }); + + it("should have correct reward speed", async () => { + expect(await xvsVault.rewardTokenAmountsPerBlockOrSecond(XVS)).to.be.equal(REWARD_TOKEN_SPEED); + }); + + it("xvs store should have 1500 xvs", async () => { + expect(await xvs.balanceOf(XVS_STORE)).to.be.equal(XVS_REWARD_AMOUNT); + }); + + const rewardBasicConfig = { + pool: COMPTROLLER_CORE, + address: REWARD_DISTRIBUTOR_CORE_0, + token: XVS, + }; + describe("Generic checks", async () => { + checkRewardsDistributorPool(COMPTROLLER_CORE, 1); + + const tokensRewardConfig: RewardsDistributorConfig[] = [ + { + ...rewardBasicConfig, + vToken: VUSDC_CORE, + borrowSpeed: "192901234567901", + supplySpeed: "578703703703704", + totalRewardsToDistribute: parseUnits("18000", 18), + }, + + { + ...rewardBasicConfig, + vToken: VWETH_CORE, + borrowSpeed: "192901234567901", + supplySpeed: "578703703703704", + totalRewardsToDistribute: parseUnits("18000", 18), + }, + ]; + + for (const config of tokensRewardConfig) { + checkRewardsDistributor("RewardsDistributor_Core_0_XVS", config); + } + }); + }); +}); From 108a5f279bb82f2bd71935afdf52aeba385d26af Mon Sep 17 00:00:00 2001 From: Jesus Lanchas Date: Thu, 13 Feb 2025 16:25:29 +0100 Subject: [PATCH 2/6] refactor: update block number in the simulation after the executions of TXs --- multisig/proposals/unichainmainnet/vip-007/index.ts | 2 +- .../simulations/unichainmainnet/vip-007/index.ts | 13 +------------ 2 files changed, 2 insertions(+), 13 deletions(-) diff --git a/multisig/proposals/unichainmainnet/vip-007/index.ts b/multisig/proposals/unichainmainnet/vip-007/index.ts index d1684f205..49f3518d0 100644 --- a/multisig/proposals/unichainmainnet/vip-007/index.ts +++ b/multisig/proposals/unichainmainnet/vip-007/index.ts @@ -25,7 +25,7 @@ export const vip007 = () => { signature: "giveCallPermission(address,string,address)", params: [ ethers.constants.AddressZero, - "setLastRewardingBlockTimestamps(address[],uint32[],uint32[])", + "setLastRewardingBlockTimestamps(address[],uint256[],uint256[])", unichainmainnet.GUARDIAN, ], }, diff --git a/multisig/simulations/unichainmainnet/vip-007/index.ts b/multisig/simulations/unichainmainnet/vip-007/index.ts index 8633f5bc9..bdc0a5902 100644 --- a/multisig/simulations/unichainmainnet/vip-007/index.ts +++ b/multisig/simulations/unichainmainnet/vip-007/index.ts @@ -11,11 +11,6 @@ import { } from "src/vip-framework/checks/rewardsDistributor"; import { forking, pretendExecutingVip } from "src/vip-framework/index"; -import vip000 from "../../../proposals/unichainmainnet/vip-000"; -import vip001 from "../../../proposals/unichainmainnet/vip-001"; -import vip002 from "../../../proposals/unichainmainnet/vip-002"; -import vip003 from "../../../proposals/unichainmainnet/vip-003"; -import vip004 from "../../../proposals/unichainmainnet/vip-004"; import { COMPTROLLER_CORE, REWARD_DISTRIBUTOR_CORE_0, @@ -35,7 +30,7 @@ const { unichainmainnet } = NETWORK_ADDRESSES; const XVS_PROXY_OFT_DEST = "0x9c95f8aa28fFEB7ECdC0c407B9F632419c5daAF8"; const TREASURY_AMOUNT = parseUnits("19500", 18); -forking(8540765, async () => { +forking(8711530, async () => { let xvs: Contract; let xvsVault: Contract; describe("Post VIP checks", async () => { @@ -45,12 +40,6 @@ forking(8540765, async () => { xvsVault = new ethers.Contract(unichainmainnet.XVS_VAULT_PROXY, XVS_VAULT_ABI, ethers.provider); const impersonateBridge = await initMainnetUser(XVS_PROXY_OFT_DEST, ethers.utils.parseEther("2")); - await pretendExecutingVip(await vip000()); - await pretendExecutingVip(await vip001()); - await pretendExecutingVip(await vip002()); - - await pretendExecutingVip(await vip003()); - await pretendExecutingVip(await vip004()); await xvs.connect(impersonateBridge).mint(unichainmainnet.VTREASURY, TREASURY_AMOUNT); From a9c56686634c66bc0768d479cfecf0e64285bdaf Mon Sep 17 00:00:00 2001 From: Jesus Lanchas Date: Wed, 19 Feb 2025 15:46:49 +0100 Subject: [PATCH 3/6] test: update the simulation block after receiving the expected funds --- multisig/simulations/unichainmainnet/vip-007/index.ts | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/multisig/simulations/unichainmainnet/vip-007/index.ts b/multisig/simulations/unichainmainnet/vip-007/index.ts index bdc0a5902..8ecc17b83 100644 --- a/multisig/simulations/unichainmainnet/vip-007/index.ts +++ b/multisig/simulations/unichainmainnet/vip-007/index.ts @@ -3,7 +3,6 @@ import { Contract } from "ethers"; import { parseUnits } from "ethers/lib/utils"; import { ethers } from "hardhat"; import { NETWORK_ADDRESSES } from "src/networkAddresses"; -import { initMainnetUser } from "src/utils"; import { RewardsDistributorConfig, checkRewardsDistributor, @@ -27,10 +26,7 @@ import XVS_VAULT_ABI from "./abi/xvsvault.json"; const { unichainmainnet } = NETWORK_ADDRESSES; -const XVS_PROXY_OFT_DEST = "0x9c95f8aa28fFEB7ECdC0c407B9F632419c5daAF8"; -const TREASURY_AMOUNT = parseUnits("19500", 18); - -forking(8711530, async () => { +forking(9227729, async () => { let xvs: Contract; let xvsVault: Contract; describe("Post VIP checks", async () => { @@ -39,10 +35,6 @@ forking(8711530, async () => { xvsVault = new ethers.Contract(unichainmainnet.XVS_VAULT_PROXY, XVS_VAULT_ABI, ethers.provider); - const impersonateBridge = await initMainnetUser(XVS_PROXY_OFT_DEST, ethers.utils.parseEther("2")); - - await xvs.connect(impersonateBridge).mint(unichainmainnet.VTREASURY, TREASURY_AMOUNT); - await pretendExecutingVip(await vip007()); }); From ccd552c85dcefa58b0740df36b36864f6381d2ee Mon Sep 17 00:00:00 2001 From: Jesus Lanchas Date: Wed, 19 Feb 2025 15:50:02 +0100 Subject: [PATCH 4/6] refactor: set the expected nonce --- .../proposals/unichainmainnet/{vip-007 => vip-008}/index.ts | 4 ++-- .../unichainmainnet/{vip-007 => vip-008}/abi/xvs.json | 0 .../unichainmainnet/{vip-007 => vip-008}/abi/xvsvault.json | 0 .../unichainmainnet/{vip-007 => vip-008}/index.ts | 6 +++--- 4 files changed, 5 insertions(+), 5 deletions(-) rename multisig/proposals/unichainmainnet/{vip-007 => vip-008}/index.ts (98%) rename multisig/simulations/unichainmainnet/{vip-007 => vip-008}/abi/xvs.json (100%) rename multisig/simulations/unichainmainnet/{vip-007 => vip-008}/abi/xvsvault.json (100%) rename multisig/simulations/unichainmainnet/{vip-007 => vip-008}/index.ts (95%) diff --git a/multisig/proposals/unichainmainnet/vip-007/index.ts b/multisig/proposals/unichainmainnet/vip-008/index.ts similarity index 98% rename from multisig/proposals/unichainmainnet/vip-007/index.ts rename to multisig/proposals/unichainmainnet/vip-008/index.ts index 49f3518d0..bc4912b4c 100644 --- a/multisig/proposals/unichainmainnet/vip-007/index.ts +++ b/multisig/proposals/unichainmainnet/vip-008/index.ts @@ -17,7 +17,7 @@ export const VUSDC_CORE = "0xB953f92B9f759d97d2F2Dec10A8A3cf75fcE3A95"; export const VWETH_CORE = "0xc219BC179C7cDb37eACB03f993f9fDc2495e3374"; const ACM = "0x1f12014c497a9d905155eB9BfDD9FaC6885e61d0"; -export const vip007 = () => { +export const vip008 = () => { return makeProposal([ // ACM Permissions { @@ -73,4 +73,4 @@ export const vip007 = () => { ]); }; -export default vip007; +export default vip008; diff --git a/multisig/simulations/unichainmainnet/vip-007/abi/xvs.json b/multisig/simulations/unichainmainnet/vip-008/abi/xvs.json similarity index 100% rename from multisig/simulations/unichainmainnet/vip-007/abi/xvs.json rename to multisig/simulations/unichainmainnet/vip-008/abi/xvs.json diff --git a/multisig/simulations/unichainmainnet/vip-007/abi/xvsvault.json b/multisig/simulations/unichainmainnet/vip-008/abi/xvsvault.json similarity index 100% rename from multisig/simulations/unichainmainnet/vip-007/abi/xvsvault.json rename to multisig/simulations/unichainmainnet/vip-008/abi/xvsvault.json diff --git a/multisig/simulations/unichainmainnet/vip-007/index.ts b/multisig/simulations/unichainmainnet/vip-008/index.ts similarity index 95% rename from multisig/simulations/unichainmainnet/vip-007/index.ts rename to multisig/simulations/unichainmainnet/vip-008/index.ts index 8ecc17b83..cd9284b62 100644 --- a/multisig/simulations/unichainmainnet/vip-007/index.ts +++ b/multisig/simulations/unichainmainnet/vip-008/index.ts @@ -19,8 +19,8 @@ import { XVS, XVS_REWARD_AMOUNT, XVS_STORE, - vip007, -} from "../../../proposals/unichainmainnet/vip-007"; + vip008, +} from "../../../proposals/unichainmainnet/vip-008"; import XVS_ABI from "./abi/xvs.json"; import XVS_VAULT_ABI from "./abi/xvsvault.json"; @@ -35,7 +35,7 @@ forking(9227729, async () => { xvsVault = new ethers.Contract(unichainmainnet.XVS_VAULT_PROXY, XVS_VAULT_ABI, ethers.provider); - await pretendExecutingVip(await vip007()); + await pretendExecutingVip(await vip008()); }); it("rewards distributor should have expected number of xvs tokens", async () => { From e6e32c7f12ed91c4bb323d72fdefeeb2330ad9ac Mon Sep 17 00:00:00 2001 From: Jesus Lanchas Date: Wed, 19 Feb 2025 17:05:27 +0100 Subject: [PATCH 5/6] feat: set ID and description for the VIP 457 --- simulations/vip-457/bscmainnet.ts | 7 ++++ vips/vip-457/bscmainnet.ts | 58 +++++++++++++++++++++++++++++++ 2 files changed, 65 insertions(+) create mode 100644 simulations/vip-457/bscmainnet.ts create mode 100644 vips/vip-457/bscmainnet.ts diff --git a/simulations/vip-457/bscmainnet.ts b/simulations/vip-457/bscmainnet.ts new file mode 100644 index 000000000..3f570c331 --- /dev/null +++ b/simulations/vip-457/bscmainnet.ts @@ -0,0 +1,7 @@ +import { forking, testVip } from "src/vip-framework"; + +import vip457 from "../../vips/vip-457/bscmainnet"; + +forking(46799555, async () => { + testVip("VIP-457", await vip457(), {}); +}); diff --git a/vips/vip-457/bscmainnet.ts b/vips/vip-457/bscmainnet.ts new file mode 100644 index 000000000..8314978c4 --- /dev/null +++ b/vips/vip-457/bscmainnet.ts @@ -0,0 +1,58 @@ +import { ProposalType } from "src/types"; +import { makeProposal } from "src/utils"; +import { FAST_TRACK_TIMELOCK } from "src/vip-framework"; + +const vip457 = () => { + const meta = { + version: "v2", + title: "VIP-457 [Unichain] XVS Rewards on Unichain", + description: `#### Summary + +If passed, this VIP will perform these actions following the proposal [[Unichain] XVS Incentives Model Proposal](https://community.venus.io/t/unichain-xvs-incentives-model-proposal/4864) (and the associated [snapshot](https://snapshot.box/#/s:venus-xvs.eth/proposal/0x6fb0e2eadd6713e6ed073122f3c7a576fa3499eed0bd4149fa7c081ab6d5f324)): + +- Transfer 18,000 XVS from the [Venus Treasury on Unichain](https://uniscan.xyz/address/0x958F4C84d3ad523Fa9936Dc465A123C7AD43D69B) to the [XVS RewardsDistributor](https://uniscan.xyz/address/0x4630B71C1BD27c99DD86aBB2A18C50c3F75C88fb) of the Core pool, used as market emissions, and configure the emissions for 30 days +- Transfer 1,500 XVS from the [Venus Treasury on Unichain](https://uniscan.xyz/address/0x958F4C84d3ad523Fa9936Dc465A123C7AD43D69B) to the [XVSStore](https://uniscan.xyz/address/0x0ee4b35c2cEAb19856Bf35505F81608d12B2a7Bb) contract, used as XVS Vault rewards, and configure the XVS Vault base rewards for 30 days + +#### Description + +According to the proposal [[Unichain] XVS Incentives Model Proposal](https://community.venus.io/t/unichain-xvs-incentives-model-proposal/4864), the following XVS rewards will be enabled on Unichain for the first 30 days: + +- **Market Emissions**: 4,000 XVS allocated as liquidity incentives, for the following markets in the Core pool on Unichain: + - WETH: 2,000 XVS + - USDC: 2,000 XVS + - In both cases, 75% of the XVS rewards will be for the suppliers and 25% for the borrowers +- Market emissions could be updated after 30 days in a different VIP, following the incentives model proposal, to distribute the 14,000 XVS also sent to the RewardsDistributor contract + +The **XVS Vault Base Rewards** will be configured in this VIP to distribute 200 XVS in 30 days. + +#### References + +- [VIP simulation](https://github.com/VenusProtocol/vips/pull/496) +- Snapshot "[[Unichain] XVS Incentives Model Proposal](https://snapshot.box/#/s:venus-xvs.eth/proposal/0x6fb0e2eadd6713e6ed073122f3c7a576fa3499eed0bd4149fa7c081ab6d5f324)" +- Community proposal "[[Unichain] XVS Incentives Model Proposal](https://community.venus.io/t/unichain-xvs-incentives-model-proposal/4864)" +- [VIP-452 XVS bridge among Unichain and every supported network](https://app.venus.io/#/governance/proposal/452?chainId=56), where the XVS funds used by this VIP were transferred to the Venus Treasury on Unichain +- [Documentation](https://docs-v4.venus.io/) + +#### Disclaimer for Unichain VIPs + +Privilege commands on Unichain will be executed by the [](https://etherscan.io/address/0x285960C5B22fD66A736C7136967A3eB15e93CC67)[Guardian wallet](https://uniscan.xyz/address/0x1803Cf1D3495b43cC628aa1d8638A981F8CD341C), until the [Multichain Governance](https://docs-v4.venus.io/technical-reference/reference-technical-articles/multichain-governance) contracts are fully enabled. If this VIP passes, [](https://app.safe.global/transactions/tx?safe=eth:0x285960C5B22fD66A736C7136967A3eB15e93CC67&id=multisig_0x285960C5B22fD66A736C7136967A3eB15e93CC67_0x79ca5d7ef82648f5c52054aa996356da270a60e95a959c595ee3c29defc6a4ca)[this](https://app.safe.global/transactions/tx?safe=unichain:0x1803Cf1D3495b43cC628aa1d8638A981F8CD341C&id=multisig_0x1803Cf1D3495b43cC628aa1d8638A981F8CD341C_0x5c990862fd2ceed2cdaabf3e699e9a70ef1ba2b3fd362d29d2203ce709782d24) multisig transaction will be executed. Otherwise, it will be rejected.`, + forDescription: "Execute this proposal", + againstDescription: "Do not execute this proposal", + abstainDescription: "Indifferent to execution", + }; + + return makeProposal( + [ + { + target: FAST_TRACK_TIMELOCK, + signature: "", + params: [], + value: "1", + }, + ], + meta, + ProposalType.FAST_TRACK, + ); +}; + +export default vip457; From 702e2e20c7f6fead6f2f7b6f2e60d5abf5b52f87 Mon Sep 17 00:00:00 2001 From: Jesus Lanchas Date: Wed, 19 Feb 2025 17:35:54 +0100 Subject: [PATCH 6/6] fix: remove typos in the VIP description --- vips/vip-457/bscmainnet.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vips/vip-457/bscmainnet.ts b/vips/vip-457/bscmainnet.ts index 8314978c4..6884e5053 100644 --- a/vips/vip-457/bscmainnet.ts +++ b/vips/vip-457/bscmainnet.ts @@ -35,7 +35,7 @@ The **XVS Vault Base Rewards** will be configured in this VIP to distribute 200 #### Disclaimer for Unichain VIPs -Privilege commands on Unichain will be executed by the [](https://etherscan.io/address/0x285960C5B22fD66A736C7136967A3eB15e93CC67)[Guardian wallet](https://uniscan.xyz/address/0x1803Cf1D3495b43cC628aa1d8638A981F8CD341C), until the [Multichain Governance](https://docs-v4.venus.io/technical-reference/reference-technical-articles/multichain-governance) contracts are fully enabled. If this VIP passes, [](https://app.safe.global/transactions/tx?safe=eth:0x285960C5B22fD66A736C7136967A3eB15e93CC67&id=multisig_0x285960C5B22fD66A736C7136967A3eB15e93CC67_0x79ca5d7ef82648f5c52054aa996356da270a60e95a959c595ee3c29defc6a4ca)[this](https://app.safe.global/transactions/tx?safe=unichain:0x1803Cf1D3495b43cC628aa1d8638A981F8CD341C&id=multisig_0x1803Cf1D3495b43cC628aa1d8638A981F8CD341C_0x5c990862fd2ceed2cdaabf3e699e9a70ef1ba2b3fd362d29d2203ce709782d24) multisig transaction will be executed. Otherwise, it will be rejected.`, +Privilege commands on Unichain will be executed by the [Guardian wallet](https://uniscan.xyz/address/0x1803Cf1D3495b43cC628aa1d8638A981F8CD341C), until the [Omnichain Governance](https://docs-v4.venus.io/technical-reference/reference-technical-articles/omnichain-governance) contracts are fully enabled. If this VIP passes, [this](https://app.safe.global/transactions/tx?safe=unichain:0x1803Cf1D3495b43cC628aa1d8638A981F8CD341C&id=multisig_0x1803Cf1D3495b43cC628aa1d8638A981F8CD341C_0x5c990862fd2ceed2cdaabf3e699e9a70ef1ba2b3fd362d29d2203ce709782d24) multisig transaction will be executed. Otherwise, it will be rejected.`, forDescription: "Execute this proposal", againstDescription: "Do not execute this proposal", abstainDescription: "Indifferent to execution",