diff --git a/simulations/vip-260/bsctestnet/abi/votesSyncReceiverAbi.json b/simulations/vip-260/bsctestnet/abi/votesSyncReceiverAbi.json new file mode 100644 index 000000000..98df31861 --- /dev/null +++ b/simulations/vip-260/bsctestnet/abi/votesSyncReceiverAbi.json @@ -0,0 +1,358 @@ +[ + { + "inputs": [ + { "internalType": "address", "name": "endpoint_", "type": "address" }, + { "internalType": "contract IMultichainVoteRegistry", "name": "multichainVoteRegistry_", "type": "address" } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { "inputs": [], "name": "ZeroAddressNotAllowed", "type": "error" }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "uint16", "name": "_srcChainId", "type": "uint16" }, + { "indexed": false, "internalType": "bytes", "name": "_srcAddress", "type": "bytes" }, + { "indexed": false, "internalType": "uint64", "name": "_nonce", "type": "uint64" }, + { "indexed": false, "internalType": "bytes", "name": "_payload", "type": "bytes" }, + { "indexed": false, "internalType": "bytes", "name": "_reason", "type": "bytes" } + ], + "name": "MessageFailed", + "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": "uint16", "name": "remoteChainId", "type": "uint16" }, + { "indexed": false, "internalType": "bytes", "name": "remoteAddress", "type": "bytes" }, + { "indexed": false, "internalType": "uint64", "name": "nonce", "type": "uint64" }, + { "indexed": false, "internalType": "bytes", "name": "reason", "type": "bytes" } + ], + "name": "ReceivePayloadFailed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "uint16", "name": "_srcChainId", "type": "uint16" }, + { "indexed": false, "internalType": "bytes", "name": "_srcAddress", "type": "bytes" }, + { "indexed": false, "internalType": "uint64", "name": "_nonce", "type": "uint64" }, + { "indexed": false, "internalType": "bytes32", "name": "_payloadHash", "type": "bytes32" } + ], + "name": "RetryMessageSuccess", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "uint16", "name": "_dstChainId", "type": "uint16" }, + { "indexed": false, "internalType": "uint16", "name": "_type", "type": "uint16" }, + { "indexed": false, "internalType": "uint256", "name": "_minDstGas", "type": "uint256" } + ], + "name": "SetMinDstGas", + "type": "event" + }, + { + "anonymous": false, + "inputs": [{ "indexed": false, "internalType": "address", "name": "precrime", "type": "address" }], + "name": "SetPrecrime", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "uint16", "name": "_remoteChainId", "type": "uint16" }, + { "indexed": false, "internalType": "bytes", "name": "_path", "type": "bytes" } + ], + "name": "SetTrustedRemote", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "uint16", "name": "_remoteChainId", "type": "uint16" }, + { "indexed": false, "internalType": "bytes", "name": "_remoteAddress", "type": "bytes" } + ], + "name": "SetTrustedRemoteAddress", + "type": "event" + }, + { + "anonymous": false, + "inputs": [{ "indexed": true, "internalType": "uint16", "name": "chainId", "type": "uint16" }], + "name": "TrustedRemoteRemoved", + "type": "event" + }, + { + "anonymous": false, + "inputs": [{ "indexed": false, "internalType": "address", "name": "account", "type": "address" }], + "name": "Unpaused", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "delegatee", "type": "address" }, + { "indexed": false, "internalType": "uint32", "name": "checkpoints", "type": "uint32" }, + { "indexed": true, "internalType": "uint96", "name": "votes", "type": "uint96" }, + { "indexed": false, "internalType": "uint32", "name": "nCheckpoint", "type": "uint32" } + ], + "name": "VotesSynced", + "type": "event" + }, + { + "inputs": [], + "name": "DEFAULT_PAYLOAD_SIZE_LIMIT", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint16", "name": "", "type": "uint16" }, + { "internalType": "bytes", "name": "", "type": "bytes" }, + { "internalType": "uint64", "name": "", "type": "uint64" } + ], + "name": "failedMessages", + "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint16", "name": "_srcChainId", "type": "uint16" }, + { "internalType": "bytes", "name": "_srcAddress", "type": "bytes" } + ], + "name": "forceResumeReceive", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint16", "name": "_version", "type": "uint16" }, + { "internalType": "uint16", "name": "_chainId", "type": "uint16" }, + { "internalType": "address", "name": "", "type": "address" }, + { "internalType": "uint256", "name": "_configType", "type": "uint256" } + ], + "name": "getConfig", + "outputs": [{ "internalType": "bytes", "name": "", "type": "bytes" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint16", "name": "_remoteChainId", "type": "uint16" }], + "name": "getTrustedRemoteAddress", + "outputs": [{ "internalType": "bytes", "name": "", "type": "bytes" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint16", "name": "_srcChainId", "type": "uint16" }, + { "internalType": "bytes", "name": "_srcAddress", "type": "bytes" } + ], + "name": "isTrustedRemote", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "lzEndpoint", + "outputs": [{ "internalType": "contract ILayerZeroEndpoint", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint16", "name": "_srcChainId", "type": "uint16" }, + { "internalType": "bytes", "name": "_srcAddress", "type": "bytes" }, + { "internalType": "uint64", "name": "_nonce", "type": "uint64" }, + { "internalType": "bytes", "name": "_payload", "type": "bytes" } + ], + "name": "lzReceive", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint16", "name": "", "type": "uint16" }, + { "internalType": "uint16", "name": "", "type": "uint16" } + ], + "name": "minDstGasLookup", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "multichainVoteRegistry", + "outputs": [{ "internalType": "contract IMultichainVoteRegistry", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint16", "name": "_srcChainId", "type": "uint16" }, + { "internalType": "bytes", "name": "_srcAddress", "type": "bytes" }, + { "internalType": "uint64", "name": "_nonce", "type": "uint64" }, + { "internalType": "bytes", "name": "_payload", "type": "bytes" } + ], + "name": "nonblockingLzReceive", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "paused", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint16", "name": "", "type": "uint16" }], + "name": "payloadSizeLimitLookup", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "precrime", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint16", "name": "remoteChainId", "type": "uint16" }], + "name": "removeTrustedRemote", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { "inputs": [], "name": "renounceOwnership", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [ + { "internalType": "uint16", "name": "srcChainId", "type": "uint16" }, + { "internalType": "bytes", "name": "srcAddress", "type": "bytes" }, + { "internalType": "uint64", "name": "nonce", "type": "uint64" }, + { "internalType": "bytes", "name": "payload", "type": "bytes" } + ], + "name": "retryMessage", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint16", "name": "_version", "type": "uint16" }, + { "internalType": "uint16", "name": "_chainId", "type": "uint16" }, + { "internalType": "uint256", "name": "_configType", "type": "uint256" }, + { "internalType": "bytes", "name": "_config", "type": "bytes" } + ], + "name": "setConfig", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint16", "name": "_dstChainId", "type": "uint16" }, + { "internalType": "uint16", "name": "_packetType", "type": "uint16" }, + { "internalType": "uint256", "name": "_minGas", "type": "uint256" } + ], + "name": "setMinDstGas", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint16", "name": "_dstChainId", "type": "uint16" }, + { "internalType": "uint256", "name": "_size", "type": "uint256" } + ], + "name": "setPayloadSizeLimit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "_precrime", "type": "address" }], + "name": "setPrecrime", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint16", "name": "_version", "type": "uint16" }], + "name": "setReceiveVersion", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint16", "name": "_version", "type": "uint16" }], + "name": "setSendVersion", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint16", "name": "_remoteChainId", "type": "uint16" }, + { "internalType": "bytes", "name": "_path", "type": "bytes" } + ], + "name": "setTrustedRemote", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint16", "name": "_remoteChainId", "type": "uint16" }, + { "internalType": "bytes", "name": "_remoteAddress", "type": "bytes" } + ], + "name": "setTrustedRemoteAddress", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "newOwner", "type": "address" }], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint16", "name": "", "type": "uint16" }], + "name": "trustedRemoteLookup", + "outputs": [{ "internalType": "bytes", "name": "", "type": "bytes" }], + "stateMutability": "view", + "type": "function" + } +] diff --git a/simulations/vip-260/bsctestnet/simulations.ts b/simulations/vip-260/bsctestnet/simulations.ts new file mode 100644 index 000000000..a0723e569 --- /dev/null +++ b/simulations/vip-260/bsctestnet/simulations.ts @@ -0,0 +1,38 @@ +import { expect } from "chai"; +import { ethers } from "hardhat"; + +import { NETWORK_ADDRESSES } from "../../../src/networkAddresses"; +import { networkChainIds } from "../../../src/utils"; +import { forking, pretendExecutingVip } from "../../../src/vip-framework"; +import { vip260Testnet } from "../../../vips/vip-260/bsctestnet"; +import VotesSyncReceiver_ABI from "./abi/votesSyncReceiverAbi.json"; + +const { bsctestnet } = NETWORK_ADDRESSES; + +forking(37908025, async () => { + const provider = ethers.provider; + let votesSyncReceiver: ethers.Contract; + + before(async () => { + votesSyncReceiver = new ethers.Contract(bsctestnet.VOTE_SYNC_RECEIVER, VotesSyncReceiver_ABI, provider); + }); + + describe("Pre-VIP behaviour", async () => { + it("Trusted remote is not set", async () => { + expect(await votesSyncReceiver.trustedRemoteLookup(networkChainIds["sepolia"])).to.equal("0x"); + }); + }); + + describe("Post-VIP behaviour", async () => { + before(async () => { + await pretendExecutingVip(vip260Testnet()); + }); + it("Trusted remote is set", async () => { + const destinationAdd = ethers.utils.solidityPack( + ["address", "address"], + [bsctestnet.VOTE_SYNC_SENDER, bsctestnet.VOTE_SYNC_RECEIVER], + ); + expect(await votesSyncReceiver.trustedRemoteLookup(networkChainIds["sepolia"])).to.equal(destinationAdd); + }); + }); +}); diff --git a/simulations/vip-260/sepolia/abi/XVSVaultDestAbi.json b/simulations/vip-260/sepolia/abi/XVSVaultDestAbi.json new file mode 100644 index 000000000..d7590f40c --- /dev/null +++ b/simulations/vip-260/sepolia/abi/XVSVaultDestAbi.json @@ -0,0 +1,766 @@ +[ + { "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": "rewardPerBlock", "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": "contract IVotesSyncSender", "name": "oldBridge", "type": "address" }, + { "indexed": false, "internalType": "contract IVotesSyncSender", "name": "newBridge", "type": "address" } + ], + "name": "SetBridge", + "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": 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": "_rewardPerBlock", "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": [ + { "internalType": "address", "name": "", "type": "address" }, + { "internalType": "uint32", "name": "", "type": "uint32" } + ], + "name": "checkpoints", + "outputs": [ + { "internalType": "uint32", "name": "fromBlock", "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" }, + { "internalType": "bytes", "name": "adapterParams", "type": "bytes" } + ], + "name": "delegate", + "outputs": [], + "payable": true, + "stateMutability": "payable", + "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" }, + { "internalType": "bytes", "name": "adapterParams", "type": "bytes" } + ], + "name": "delegateBySig", + "outputs": [], + "payable": true, + "stateMutability": "payable", + "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" }, + { "internalType": "bytes", "name": "_adapterParams", "type": "bytes" } + ], + "name": "deposit", + "outputs": [], + "payable": true, + "stateMutability": "payable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { "internalType": "bytes", "name": "payload", "type": "bytes" }, + { "internalType": "bytes", "name": "adapterParams", "type": "bytes" } + ], + "name": "estimateFee", + "outputs": [ + { "internalType": "uint256", "name": "", "type": "uint256" }, + { "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": "executeWithdrawal", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "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": "blockNumber", "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": true, + "inputs": [{ "internalType": "address", "name": "", "type": "address" }], + "name": "isStakedToken", + "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": "lastRewardBlock", "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" }, + { "internalType": "bytes", "name": "_adapterParams", "type": "bytes" } + ], + "name": "requestWithdrawal", + "outputs": [], + "payable": true, + "stateMutability": "payable", + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "resume", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [{ "internalType": "address", "name": "", "type": "address" }], + "name": "rewardTokenAmountsPerBlock", + "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 IVotesSyncSender", "name": "votesSyncSenderBridge", "type": "address" }], + "name": "setBridge", + "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": "setRewardAmountPerBlock", + "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": "votesSyncSender", + "outputs": [{ "internalType": "contract IVotesSyncSender", "name": "", "type": "address" }], + "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/simulations/vip-260/sepolia/abi/votesSyncSenderAbi.json b/simulations/vip-260/sepolia/abi/votesSyncSenderAbi.json new file mode 100644 index 000000000..8b5dfb4ba --- /dev/null +++ b/simulations/vip-260/sepolia/abi/votesSyncSenderAbi.json @@ -0,0 +1,187 @@ +[ + { + "inputs": [ + { "internalType": "contract ILayerZeroEndpoint", "name": "lzEndpoint_", "type": "address" }, + { "internalType": "contract IAccessControlManagerV8", "name": "accessControlManager_", "type": "address" }, + { "internalType": "uint16", "name": "dstChainId_", "type": "uint16" } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { "inputs": [], "name": "ZeroAddressNotAllowed", "type": "error" }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "uint256", "name": "failedNonce", "type": "uint256" }, + { "indexed": false, "internalType": "bytes32", "name": "hash", "type": "bytes32" } + ], + "name": "ClearPayload", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "uint16", "name": "remoteChainId", "type": "uint16" }, + { "indexed": false, "internalType": "bytes", "name": "payload", "type": "bytes" }, + { "indexed": false, "internalType": "bytes", "name": "adapterParams", "type": "bytes" } + ], + "name": "ExecuteSyncVotes", + "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": "uint16", "name": "remoteChainId", "type": "uint16" }, + { "indexed": false, "internalType": "bytes", "name": "remoteAddress", "type": "bytes" } + ], + "name": "SetTrustedRemoteAddress", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "uint256", "name": "votesSync", "type": "uint256" }, + { "indexed": false, "internalType": "uint16", "name": "remoteChainId", "type": "uint16" }, + { "indexed": false, "internalType": "bytes", "name": "payload", "type": "bytes" }, + { "indexed": false, "internalType": "bytes", "name": "adapterParams", "type": "bytes" }, + { "indexed": false, "internalType": "uint256", "name": "value", "type": "uint256" }, + { "indexed": false, "internalType": "bytes", "name": "reason", "type": "bytes" } + ], + "name": "StorePayload", + "type": "event" + }, + { + "anonymous": false, + "inputs": [{ "indexed": true, "internalType": "uint16", "name": "chainId", "type": "uint16" }], + "name": "TrustedRemoteRemoved", + "type": "event" + }, + { + "anonymous": false, + "inputs": [{ "indexed": false, "internalType": "address", "name": "account", "type": "address" }], + "name": "Unpaused", + "type": "event" + }, + { + "inputs": [], + "name": "BSC_CHAIN_ID", + "outputs": [{ "internalType": "uint16", "name": "", "type": "uint16" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "LZ_ENDPOINT", + "outputs": [{ "internalType": "contract ILayerZeroEndpoint", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "accessControlManager", + "outputs": [{ "internalType": "contract IAccessControlManagerV8", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "bytes", "name": "payload", "type": "bytes" }, + { "internalType": "bytes", "name": "adapterParams", "type": "bytes" } + ], + "name": "estimateFee", + "outputs": [ + { "internalType": "uint256", "name": "", "type": "uint256" }, + { "internalType": "uint256", "name": "", "type": "uint256" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "nonce", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "paused", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "view", + "type": "function" + }, + { "inputs": [], "name": "removeTrustedRemote", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, + { "inputs": [], "name": "renounceOwnership", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [ + { "internalType": "uint256", "name": "failedNonce", "type": "uint256" }, + { "internalType": "bytes", "name": "payload", "type": "bytes" }, + { "internalType": "bytes", "name": "adapterParams", "type": "bytes" }, + { "internalType": "uint256", "name": "originalValue", "type": "uint256" } + ], + "name": "retrySyncVotes", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [{ "internalType": "bytes", "name": "remoteAddress", "type": "bytes" }], + "name": "setTrustedRemoteAddress", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "name": "storedExecutionHashes", + "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "bytes", "name": "payload", "type": "bytes" }, + { "internalType": "bytes", "name": "adapterParams", "type": "bytes" } + ], + "name": "syncVotes", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "newOwner", "type": "address" }], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint16", "name": "", "type": "uint16" }], + "name": "trustedRemoteLookup", + "outputs": [{ "internalType": "bytes", "name": "", "type": "bytes" }], + "stateMutability": "view", + "type": "function" + } +] diff --git a/simulations/vip-260/sepolia/simulations.ts b/simulations/vip-260/sepolia/simulations.ts new file mode 100644 index 000000000..3fc748373 --- /dev/null +++ b/simulations/vip-260/sepolia/simulations.ts @@ -0,0 +1,52 @@ +import { expect } from "chai"; +import { ethers } from "hardhat"; + +import { NETWORK_ADDRESSES } from "../../../src/networkAddresses"; +import { networkChainIds } from "../../../src/utils"; +import { forking, pretendExecutingVip } from "../../../src/vip-framework"; +import { vip260Testnet } from "../../../vips/vip-260/sepolia"; +import XVSVaultDest_ABI from "./abi/XVSVaultDestAbi.json"; +import VotesSyncSender_ABI from "./abi/votesSyncSenderAbi.json"; + +const { sepolia } = NETWORK_ADDRESSES; + +const XVS_Vault_OLD_implementation = "0x4129dF6BB93E9ABb9CC40816E63Be77c3042Ef27"; + +forking(5331707, async () => { + const provider = ethers.provider; + let xvsVault: ethers.Contract; + let votesSyncSender: ethers.Contract; + + before(async () => { + xvsVault = new ethers.Contract(sepolia.XVS_VAULT_PROXY, XVSVaultDest_ABI, provider); + votesSyncSender = new ethers.Contract(sepolia.VOTE_SYNC_SENDER, VotesSyncSender_ABI, provider); + }); + describe("Pre-VIP behaviour", async () => { + it("Return old implementation", async () => { + expect(await xvsVault.implementation()).to.equals(XVS_Vault_OLD_implementation); + }); + it("Sets trusted remote of Binance", async () => { + expect(await votesSyncSender.trustedRemoteLookup(networkChainIds["bsctestnet"])).to.equal("0x"); + }); + }); + + describe("Post-VIP behaviour", async () => { + before(async () => { + await pretendExecutingVip(vip260Testnet()); + }); + it("Return new implementation", async () => { + expect(await xvsVault.implementation()).to.equals(sepolia.XVS_Vault_Dest); + }); + it("Owner of XVSVault is NORMAL TIMELOCK", async () => { + const owner = await xvsVault.admin(); + expect(owner).to.equal(sepolia.NORMAL_TIMELOCK); + }); + it("Sets trusted remote of Binance", async () => { + const destinationAdd = ethers.utils.solidityPack( + ["address", "address"], + [sepolia.VOTE_SYNC_RECEIVER, sepolia.VOTE_SYNC_SENDER], + ); + expect(await votesSyncSender.trustedRemoteLookup(networkChainIds["bsctestnet"])).to.equal(destinationAdd); + }); + }); +}); diff --git a/src/networkAddresses.ts b/src/networkAddresses.ts index 317b3ae98..404da49d3 100644 --- a/src/networkAddresses.ts +++ b/src/networkAddresses.ts @@ -31,6 +31,7 @@ export const NETWORK_ADDRESSES = { DEFAULT_PROPOSER_ADDRESS: "0x2Ce1d0ffD7E869D9DF33e28552b12DdDed326706", GOVERNOR_PROXY: "0x5573422a1a59385c247ec3a66b93b7c08ec2f8f2", NORMAL_TIMELOCK: bsctestnet_deployed_contracts.contracts.NormalTimelock.address, + ACM: bsctestnet_deployed_contracts.contracts.AccessControlManager.address, ETH_CHAINLINK_FEED: "0x143db3CEEfbdfe5631aDD3E50f7614B6ba708BA7", USDT_CHAINLINK_FEED: "0xEca2605f0BCF2BA5966372C99837b1F182d3D620", CHAINLINK_ORACLE: "0xCeA29f1266e880A1482c06eD656cD08C148BaA32", @@ -46,6 +47,10 @@ export const NETWORK_ADDRESSES = { POOL_REGISTRY: il_bsctestnet_deployed_contracts.addresses.PoolRegistry, BINANCE_ORACLE: bsctestnet_deployed_contracts.contracts.BinanceOracle.address, RESILIENT_ORACLE: bsctestnet_deployed_contracts.contracts.ResilientOracle.address, + MULTICHAIN_VOTE_REGISTRY: "0x3588679688de91D832e55a0B80173Fa993285A6C", + VOTE_SYNC_RECEIVER_ADMIN: "0xFA959a9aEFb1d840C084870dF8947DDa9DBB64fa", + VOTE_SYNC_RECEIVER: "0xe54Cbf7D9647c9BAa907bA101b49262E6dcD9acF", + VOTE_SYNC_SENDER: "0x53a03DC68A4d255a4b060CfEf98818C400c30564", }, ethereum: { NORMAL_TIMELOCK: "0x285960C5B22fD66A736C7136967A3eB15e93CC67", @@ -90,6 +95,9 @@ export const NETWORK_ADDRESSES = { MOCK_crvUSD: "0x36421d873abCa3E2bE6BB3c819C0CF26374F63b6", XVS_VAULT_PROXY: "0x1129f882eAa912aE6D4f6D445b2E2b1eCbA99fd5", GENERIC_TEST_USER_ACCOUNT: "0x2Ce1d0ffD7E869D9DF33e28552b12DdDed326706", + XVS_Vault_Dest: "0x0e9953fA505d642313bE182f74a7353D20C079ed", + VOTE_SYNC_SENDER: "0x53a03DC68A4d255a4b060CfEf98818C400c30564", + VOTE_SYNC_RECEIVER: "0xe54Cbf7D9647c9BAa907bA101b49262E6dcD9acF", }, opbnbtestnet: { NORMAL_TIMELOCK: "0xb15f6EfEbC276A3b9805df81b5FB3D50C2A62BDf", diff --git a/src/utils.ts b/src/utils.ts index f44501240..11d6331c6 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -396,3 +396,10 @@ export const setMaxStaleCoreAssets = async (chainlinkAddress: string, admin: str await setMaxStalePeriodInChainlinkOracle(chainlinkAddress, asset.address, asset.feed, admin); } }; +export const networkChainIds = { + ethereum: 101, + sepolia: 10161, + arbitrum_goerli: 10143, + bsctestnet: 10102, + bscmainnet: 102, +}; diff --git a/vips/vip-260/bsctestnet.ts b/vips/vip-260/bsctestnet.ts new file mode 100644 index 000000000..3500ee2d9 --- /dev/null +++ b/vips/vip-260/bsctestnet.ts @@ -0,0 +1,107 @@ +import { NETWORK_ADDRESSES } from "../../src/networkAddresses"; +import { ProposalType } from "../../src/types"; +import { makeProposal, networkChainIds } from "../../src/utils"; + +const { bsctestnet } = NETWORK_ADDRESSES; + +export const vip260Testnet = () => { + const meta = { + version: "v2", + title: "VIP-260 Binance bridge set up", + description: `Set up bridge on Binance for vote syncing`, + forDescription: "I agree that Venus Protocol should proceed with the this proposal", + againstDescription: "I do not think that Venus Protocol should proceed with the this proposal", + abstainDescription: "I am indifferent to whether Venus Protocol proceeds with the this proposal or not", + }; + return makeProposal( + [ + { + target: bsctestnet.ACM, + signature: "giveCallPermission(address,string,address)", + params: [bsctestnet.VOTE_SYNC_RECEIVER_ADMIN, "setSendVersion(uint16)", bsctestnet.NORMAL_TIMELOCK], + }, + { + target: bsctestnet.ACM, + signature: "giveCallPermission(address,string,address)", + params: [bsctestnet.VOTE_SYNC_RECEIVER_ADMIN, "setReceiveVersion(uint16)", bsctestnet.NORMAL_TIMELOCK], + }, + { + target: bsctestnet.ACM, + signature: "giveCallPermission(address,string,address)", + params: [bsctestnet.VOTE_SYNC_RECEIVER_ADMIN, "forceResumeReceive(uint16,bytes)", bsctestnet.NORMAL_TIMELOCK], + }, + { + target: bsctestnet.ACM, + signature: "giveCallPermission(address,string,address)", + params: [bsctestnet.VOTE_SYNC_RECEIVER_ADMIN, "setOracle(address)", bsctestnet.NORMAL_TIMELOCK], + }, + { + target: bsctestnet.ACM, + signature: "giveCallPermission(address,string,address)", + params: [ + bsctestnet.VOTE_SYNC_RECEIVER_ADMIN, + "setMaxDailyReceiveLimit(uint16,uint256)", + bsctestnet.NORMAL_TIMELOCK, + ], + }, + { + target: bsctestnet.ACM, + signature: "giveCallPermission(address,string,address)", + params: [bsctestnet.VOTE_SYNC_RECEIVER_ADMIN, "pause()", bsctestnet.NORMAL_TIMELOCK], + }, + { + target: bsctestnet.ACM, + signature: "giveCallPermission(address,string,address)", + params: [bsctestnet.VOTE_SYNC_RECEIVER_ADMIN, "unpause()", bsctestnet.NORMAL_TIMELOCK], + }, + { + target: bsctestnet.ACM, + signature: "giveCallPermission(address,string,address)", + params: [bsctestnet.VOTE_SYNC_RECEIVER_ADMIN, "setPrecrime(address)", bsctestnet.NORMAL_TIMELOCK], + }, + { + target: bsctestnet.ACM, + signature: "giveCallPermission(address,string,address)", + params: [ + bsctestnet.VOTE_SYNC_RECEIVER_ADMIN, + "setMinDstGas(uint16,uint16,uint256)", + bsctestnet.NORMAL_TIMELOCK, + ], + }, + { + target: bsctestnet.ACM, + signature: "giveCallPermission(address,string,address)", + params: [ + bsctestnet.VOTE_SYNC_RECEIVER_ADMIN, + "setPayloadSizeLimit(uint16,uint256)", + bsctestnet.NORMAL_TIMELOCK, + ], + }, + { + target: bsctestnet.ACM, + signature: "giveCallPermission(address,string,address)", + params: [ + bsctestnet.VOTE_SYNC_RECEIVER_ADMIN, + "setConfig(uint16,uint16,uint256,bytes)", + bsctestnet.NORMAL_TIMELOCK, + ], + }, + { + target: bsctestnet.ACM, + signature: "giveCallPermission(address,string,address)", + params: [ + bsctestnet.VOTE_SYNC_RECEIVER_ADMIN, + "setTrustedRemoteAddress(uint16,bytes)", + bsctestnet.NORMAL_TIMELOCK, + ], + }, + { + target: bsctestnet.VOTE_SYNC_RECEIVER_ADMIN, + signature: "setTrustedRemoteAddress(uint16,bytes)", + params: [networkChainIds["sepolia"], bsctestnet.VOTE_SYNC_SENDER], + }, + ], + meta, + ProposalType.REGULAR, + ); +}; diff --git a/vips/vip-260/sepolia.ts b/vips/vip-260/sepolia.ts new file mode 100644 index 000000000..bb3f389b8 --- /dev/null +++ b/vips/vip-260/sepolia.ts @@ -0,0 +1,68 @@ +import { NETWORK_ADDRESSES } from "../../src/networkAddresses"; +import { ProposalType } from "../../src/types"; +import { makeProposal } from "../../src/utils"; + +const { sepolia } = NETWORK_ADDRESSES; +export const vip260Testnet = () => { + const meta = { + version: "v2", + title: "VIP-260 XVS Vault Upgrade on sepolia and set up bridge", + description: `Update XVS Vault implementation to XVSVaultDest to enable Syncing of Votes feature`, + 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 with this proposal or not", + }; + + return makeProposal( + [ + { + target: sepolia.XVS_VAULT_PROXY, + signature: "_setPendingImplementation(address)", + params: [sepolia.XVS_Vault_Dest], + }, + + { + target: sepolia.XVS_Vault_Dest, + signature: "_become(address)", + params: [sepolia.XVS_VAULT_PROXY], + }, + { + target: sepolia.ACM, + signature: "giveCallPermission(address,string,address)", + params: [sepolia.VOTE_SYNC_SENDER, "setTrustedRemoteAddress(bytes)", sepolia.NORMAL_TIMELOCK], + }, + { + target: sepolia.ACM, + signature: "giveCallPermission(address,string,address)", + params: [sepolia.VOTE_SYNC_SENDER, "setTrustedRemoteAddress(bytes)", sepolia.NORMAL_TIMELOCK], + }, + { + target: sepolia.ACM, + signature: "giveCallPermission(address,string,address)", + params: [sepolia.VOTE_SYNC_SENDER, "retrySyncVotes(uint256,bytes,bytes,uint256)", sepolia.NORMAL_TIMELOCK], + }, + { + target: sepolia.ACM, + signature: "giveCallPermission(address,string,address)", + params: [sepolia.VOTE_SYNC_SENDER, "syncVotes(bytes,bytes)", sepolia.XVS_VAULT_PROXY], + }, + { + target: sepolia.ACM, + signature: "giveCallPermission(address,string,address)", + params: [sepolia.VOTE_SYNC_SENDER, "pause()", sepolia.XVS_VAULT_PROXY], + }, + { + target: sepolia.ACM, + signature: "giveCallPermission(address,string,address)", + params: [sepolia.VOTE_SYNC_SENDER, "unpause()", sepolia.XVS_VAULT_PROXY], + }, + { + target: sepolia.VOTE_SYNC_SENDER, + signature: "setTrustedRemoteAddress(bytes)", + params: [sepolia.VOTE_SYNC_RECEIVER], + }, + ], + meta, + ProposalType.REGULAR, + ); +};