Skip to content

Commit

Permalink
chore: update simulation as per latest deployments
Browse files Browse the repository at this point in the history
  • Loading branch information
GitGuru7 committed Nov 28, 2023
1 parent 5b1c8d7 commit 0637deb
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 188 deletions.
17 changes: 8 additions & 9 deletions simulations/vip-187/vip-187-testnet/simulations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ import XVS_ABI from "./abi/XVS.json";
import XVSBridgeAdmin_ABI from "./abi/XVSBridgeAdmin.json";
import XVSProxyOFTSrc_ABI from "./abi/XVSProxyOFTSrc.json";

const XVSProxyOFTSrc = "0x00E7C1cA08346f50910dB4484E29582b16eF13Db";
const XVSBridgeAdmin_Proxy = "0x4ABaE1278ecC419c49c4362a21b231b36eeEB62C";
const XVSProxyOFTSrc = "0x963cAbDC5bb51C1479ec94Df44DE2EC1a49439E3";
const XVSBridgeAdmin_Proxy = "0x5D08D49A2e43aC4c72C60754d1550BA12e846d66";
const NORMAL_TIMELOCK = "0xce10739590001705F7FF231611ba4A48B2820327";
const XVS = "0xB9e0E753630434d7863528cc73CB7AC638a7c8ff";
const XVS_HOLDER = "0x2Ce1d0ffD7E869D9DF33e28552b12DdDed326706";

forking(34308002, () => {
forking(35486130, () => {
const provider = ethers.provider;
let bridge: ethers.Contract;
let bridgeAdmin: ethers.Contract;
Expand Down Expand Up @@ -58,10 +58,10 @@ forking(34308002, () => {
"SetMaxDailyLimit",
"SetMaxSingleReceiveTransactionLimit",
"SetMaxDailyReceiveLimit",
"SetTrustedRemote",
"SetTrustedRemoteAddress",
"Failure",
],
[51, 2, 1, 1, 1, 1, 1, 1, 0],
[20, 2, 1, 1, 1, 1, 1, 1, 0],
);
},
});
Expand Down Expand Up @@ -118,7 +118,7 @@ forking(34308002, () => {
});

it("Reverts if single transaction limit exceed", async function () {
const amount = ethers.utils.parseUnits("11", 18);
const amount = ethers.utils.parseUnits("2", 18);
await xvs.connect(xvsHolderSigner).approve(bridge.address, amount);

const nativeFee = (
Expand All @@ -140,15 +140,14 @@ forking(34308002, () => {

it("Reverts if max daily transaction limit exceed", async function () {
const maxPlusAmount = ethers.utils.parseUnits("110");
const amount = ethers.utils.parseUnits("2");
const amount = ethers.utils.parseUnits("1");

await xvs.connect(xvsHolderSigner).approve(bridge.address, maxPlusAmount);
const nativeFee = (
await bridge.estimateSendFee(DEST_CHAIN_ID, receiverAddressBytes32, amount, false, defaultAdapterParams)
).nativeFee;

// After 4 transaction it should fail as limit of max daily transaction is 50 USD and price per full token in USD is ~4
for (let i = 0; i < 4; i++) {
for (let i = 0; i < 70; i++) {
await bridge
.connect(xvsHolderSigner)
.sendFrom(
Expand Down
201 changes: 22 additions & 179 deletions vips/vip-187/vip-187-testnet.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
import { ProposalType } from "../../src/types";
import { makeProposal } from "../../src/utils";

const XVSBridgeAdmin_Proxy = "0x4ABaE1278ecC419c49c4362a21b231b36eeEB62C";
const XVSBridgeAdmin_Proxy = "0x5D08D49A2e43aC4c72C60754d1550BA12e846d66";
const ACM = "0x45f8a08F534f34A97187626E05d4b6648Eeaa9AA";
const NORMAL_TIMELOCK = "0xce10739590001705F7FF231611ba4A48B2820327";
const FAST_TRACK_TIMELOCK = "0x3CFf21b7AF8390fE68799D58727d3b4C25a83cb6";
const CRITICAL_TIMELOCK = "0x23B893a7C45a5Eb8c8C062b9F32d0D2e43eD286D";

export const MIN_DST_GAS = "200000";
export const SINGLE_SEND_LIMIT = "10000000000000000000";
export const MAX_DAILY_SEND_LIMIT = "50000000000000000000";
export const MAX_DAILY_SEND_LIMIT = "500000000000000000000";
export const SINGLE_RECEIVE_LIMIT = "10000000000000000000";
export const MAX_DAILY_RECEIVE_LIMIT = "50000000000000000000";
export const MAX_DAILY_RECEIVE_LIMIT = "500000000000000000000";
export const DEST_CHAIN_ID = 10161;

export const vip187Testnet = () => {
Expand Down Expand Up @@ -80,12 +78,17 @@ export const vip187Testnet = () => {
{
target: ACM,
signature: "giveCallPermission(address,string,address)",
params: [XVSBridgeAdmin_Proxy, "setTrustedRemote(uint16,bytes)", NORMAL_TIMELOCK],
params: [XVSBridgeAdmin_Proxy, "removeTrustedRemote(uint16)", NORMAL_TIMELOCK],
},
{
target: ACM,
signature: "giveCallPermission(address,string,address)",
params: [XVSBridgeAdmin_Proxy, "setTrustedRemoteAddress(uint16,bytes)", NORMAL_TIMELOCK],
params: [XVSBridgeAdmin_Proxy, "dropFailedMessage(uint16,bytes)", NORMAL_TIMELOCK],
},
{
target: ACM,
signature: "giveCallPermission(address,string,address)",
params: [XVSBridgeAdmin_Proxy, "fallbackWithdraw(address,uint256)", NORMAL_TIMELOCK],
},
{
target: ACM,
Expand Down Expand Up @@ -115,188 +118,23 @@ export const vip187Testnet = () => {
{
target: ACM,
signature: "giveCallPermission(address,string,address)",
params: [XVSBridgeAdmin_Proxy, "setSendVersion(uint16)", FAST_TRACK_TIMELOCK],
},
{
target: ACM,
signature: "giveCallPermission(address,string,address)",
params: [XVSBridgeAdmin_Proxy, "setReceiveVersion(uint16)", FAST_TRACK_TIMELOCK],
},
{
target: ACM,
signature: "giveCallPermission(address,string,address)",
params: [XVSBridgeAdmin_Proxy, "forceResumeReceive(uint16,bytes)", FAST_TRACK_TIMELOCK],
},
{
target: ACM,
signature: "giveCallPermission(address,string,address)",
params: [XVSBridgeAdmin_Proxy, "setOracle(address)", FAST_TRACK_TIMELOCK],
},
{
target: ACM,
signature: "giveCallPermission(address,string,address)",
params: [XVSBridgeAdmin_Proxy, "setMaxSingleTransactionLimit(uint16,uint256)", FAST_TRACK_TIMELOCK],
},
{
target: ACM,
signature: "giveCallPermission(address,string,address)",
params: [XVSBridgeAdmin_Proxy, "setMaxDailyLimit(uint16,uint256)", FAST_TRACK_TIMELOCK],
},
{
target: ACM,
signature: "giveCallPermission(address,string,address)",
params: [XVSBridgeAdmin_Proxy, "setMaxSingleReceiveTransactionLimit(uint16,uint256)", FAST_TRACK_TIMELOCK],
},
{
target: ACM,
signature: "giveCallPermission(address,string,address)",
params: [XVSBridgeAdmin_Proxy, "setMaxDailyReceiveLimit(uint16,uint256)", FAST_TRACK_TIMELOCK],
},
{
target: ACM,
signature: "giveCallPermission(address,string,address)",
params: [XVSBridgeAdmin_Proxy, "pause()", FAST_TRACK_TIMELOCK],
},
{
target: ACM,
signature: "giveCallPermission(address,string,address)",
params: [XVSBridgeAdmin_Proxy, "unpause()", FAST_TRACK_TIMELOCK],
},
{
target: ACM,
signature: "giveCallPermission(address,string,address)",
params: [XVSBridgeAdmin_Proxy, "setTrustedRemote(uint16,bytes)", FAST_TRACK_TIMELOCK],
},
{
target: ACM,
signature: "giveCallPermission(address,string,address)",
params: [XVSBridgeAdmin_Proxy, "setTrustedRemoteAddress(uint16,bytes)", FAST_TRACK_TIMELOCK],
},
{
target: ACM,
signature: "giveCallPermission(address,string,address)",
params: [XVSBridgeAdmin_Proxy, "setPrecrime(address)", FAST_TRACK_TIMELOCK],
},
{
target: ACM,
signature: "giveCallPermission(address,string,address)",
params: [XVSBridgeAdmin_Proxy, "setMinDstGas(uint16,uint16,uint256)", FAST_TRACK_TIMELOCK],
},
{
target: ACM,
signature: "giveCallPermission(address,string,address)",
params: [XVSBridgeAdmin_Proxy, "setPayloadSizeLimit(uint16,uint256)", FAST_TRACK_TIMELOCK],
},
{
target: ACM,
signature: "giveCallPermission(address,string,address)",
params: [XVSBridgeAdmin_Proxy, "setWhitelist(address,bool)", FAST_TRACK_TIMELOCK],
},
{
target: ACM,
signature: "giveCallPermission(address,string,address)",
params: [XVSBridgeAdmin_Proxy, "setConfig(uint16,uint16,uint256,bytes)", FAST_TRACK_TIMELOCK],
},
{
target: ACM,
signature: "giveCallPermission(address,string,address)",
params: [XVSBridgeAdmin_Proxy, "setSendVersion(uint16)", CRITICAL_TIMELOCK],
},
{
target: ACM,
signature: "giveCallPermission(address,string,address)",
params: [XVSBridgeAdmin_Proxy, "setReceiveVersion(uint16)", CRITICAL_TIMELOCK],
},
{
target: ACM,
signature: "giveCallPermission(address,string,address)",
params: [XVSBridgeAdmin_Proxy, "forceResumeReceive(uint16,bytes)", CRITICAL_TIMELOCK],
},
{
target: ACM,
signature: "giveCallPermission(address,string,address)",
params: [XVSBridgeAdmin_Proxy, "setOracle(address)", CRITICAL_TIMELOCK],
},
{
target: ACM,
signature: "giveCallPermission(address,string,address)",
params: [XVSBridgeAdmin_Proxy, "setMaxSingleTransactionLimit(uint16,uint256)", CRITICAL_TIMELOCK],
},
{
target: ACM,
signature: "giveCallPermission(address,string,address)",
params: [XVSBridgeAdmin_Proxy, "setMaxDailyLimit(uint16,uint256)", CRITICAL_TIMELOCK],
},
{
target: ACM,
signature: "giveCallPermission(address,string,address)",
params: [XVSBridgeAdmin_Proxy, "setMaxSingleReceiveTransactionLimit(uint16,uint256)", CRITICAL_TIMELOCK],
},
{
target: ACM,
signature: "giveCallPermission(address,string,address)",
params: [XVSBridgeAdmin_Proxy, "setMaxDailyReceiveLimit(uint16,uint256)", CRITICAL_TIMELOCK],
},
{
target: ACM,
signature: "giveCallPermission(address,string,address)",
params: [XVSBridgeAdmin_Proxy, "pause()", CRITICAL_TIMELOCK],
},
{
target: ACM,
signature: "giveCallPermission(address,string,address)",
params: [XVSBridgeAdmin_Proxy, "unpause()", CRITICAL_TIMELOCK],
},
{
target: ACM,
signature: "giveCallPermission(address,string,address)",
params: [XVSBridgeAdmin_Proxy, "setTrustedRemote(uint16,bytes)", CRITICAL_TIMELOCK],
},
{
target: ACM,
signature: "giveCallPermission(address,string,address)",
params: [XVSBridgeAdmin_Proxy, "setTrustedRemoteAddress(uint16,bytes)", CRITICAL_TIMELOCK],
},
{
target: ACM,
signature: "giveCallPermission(address,string,address)",
params: [XVSBridgeAdmin_Proxy, "setPrecrime(address)", CRITICAL_TIMELOCK],
},
{
target: ACM,
signature: "giveCallPermission(address,string,address)",
params: [XVSBridgeAdmin_Proxy, "setMinDstGas(uint16,uint16,uint256)", CRITICAL_TIMELOCK],
},
{
target: ACM,
signature: "giveCallPermission(address,string,address)",
params: [XVSBridgeAdmin_Proxy, "setPayloadSizeLimit(uint16,uint256)", CRITICAL_TIMELOCK],
},
{
target: ACM,
signature: "giveCallPermission(address,string,address)",
params: [XVSBridgeAdmin_Proxy, "setWhitelist(address,bool)", CRITICAL_TIMELOCK],
params: [XVSBridgeAdmin_Proxy, "setTrustedRemoteAddress(uint16,bytes)", NORMAL_TIMELOCK],
},
{
target: ACM,
signature: "giveCallPermission(address,string,address)",
params: [XVSBridgeAdmin_Proxy, "setConfig(uint16,uint16,uint256,bytes)", CRITICAL_TIMELOCK],
params: [XVSBridgeAdmin_Proxy, "transferBridgeOwnership(address)", NORMAL_TIMELOCK],
},
{ target: XVSBridgeAdmin_Proxy, signature: "acceptOwnership()", params: [] },
{
target: XVSBridgeAdmin_Proxy,
signature: "setTrustedRemote(uint16,bytes)",
params: [DEST_CHAIN_ID, "0x000000000000000000000000000000000000000000E7C1cA08346f50910dB4484E29582b16eF13Db"], // To be revised
signature: "setTrustedRemoteAddress(uint16,bytes)",
params: [DEST_CHAIN_ID, "0x307C77D8606d7E486aC5D73d309e16996A336dbd"],
},
{
target: XVSBridgeAdmin_Proxy,
signature: "setMinDstGas(uint16,uint16,uint256)",
params: [DEST_CHAIN_ID, 0, MIN_DST_GAS],
},
{
target: XVSBridgeAdmin_Proxy,
signature: "setMaxSingleTransactionLimit(uint16,uint256)",
params: [DEST_CHAIN_ID, SINGLE_SEND_LIMIT],
params: [DEST_CHAIN_ID, 0, "200000"],
},
{
target: XVSBridgeAdmin_Proxy,
Expand All @@ -305,14 +143,19 @@ export const vip187Testnet = () => {
},
{
target: XVSBridgeAdmin_Proxy,
signature: "setMaxSingleReceiveTransactionLimit(uint16,uint256)",
params: [DEST_CHAIN_ID, SINGLE_RECEIVE_LIMIT],
signature: "setMaxSingleTransactionLimit(uint16,uint256)",
params: [DEST_CHAIN_ID, "10000000000000000000"],
},
{
target: XVSBridgeAdmin_Proxy,
signature: "setMaxDailyReceiveLimit(uint16,uint256)",
params: [DEST_CHAIN_ID, MAX_DAILY_RECEIVE_LIMIT],
},
{
target: XVSBridgeAdmin_Proxy,
signature: "setMaxSingleReceiveTransactionLimit(uint16,uint256)",
params: [DEST_CHAIN_ID, "10000000000000000000"],
},
],
meta,
ProposalType.REGULAR,
Expand Down

0 comments on commit 0637deb

Please sign in to comment.