Skip to content

Commit

Permalink
feat: add testnet deployments of xvs bridge
Browse files Browse the repository at this point in the history
  • Loading branch information
GitGuru7 committed Dec 22, 2023
1 parent da1310f commit 67dc312
Show file tree
Hide file tree
Showing 31 changed files with 10,518 additions and 599 deletions.
12 changes: 6 additions & 6 deletions deploy/001-xvs-bridge-local.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import { DeployFunction } from "hardhat-deploy/types";
import { HardhatRuntimeEnvironment } from "hardhat/types";

import {
NormalTimelockPermissions,
XVSBridgeAdminMethods,
bridgeConfig,
getPreConfiguredAddresses,
xvsBridgeMethods,
xvsBridgeMethodsSrc,
} from "../helpers/deploymentConfig";
import { toAddress } from "../helpers/utils";
import { getArgTypesFromSignature } from "../helpers/utils";
Expand Down Expand Up @@ -102,8 +102,8 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const bridge = await ethers.getContract("XVSProxyOFTSrc");
const bridgeAdmin = await ethers.getContract("XVSBridgeAdmin");

const removeArray = new Array(xvsBridgeMethods.length).fill(true);
let tx = await bridgeAdmin.upsertSignature(xvsBridgeMethods, removeArray);
const removeArray = new Array(xvsBridgeMethodsSrc.length).fill(true);
let tx = await bridgeAdmin.upsertSignature(xvsBridgeMethodsSrc, removeArray);
await tx.wait();

tx = await bridge.transferOwnership(XVSBridgeAdmin.address);
Expand All @@ -117,14 +117,14 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {

const commands = [
...(await configureAccessControls(
xvsBridgeMethods,
xvsBridgeMethodsSrc,
accessControlManager.address,
normalTimelock.address,
XVSBridgeAdmin.address,
hre,
)),
...(await configureAccessControls(
NormalTimelockPermissions,
XVSBridgeAdminMethods,
accessControlManager.address,
normalTimelock.address,
XVSBridgeAdmin.address,
Expand Down
19 changes: 10 additions & 9 deletions deploy/002-xvs-bridge-remote.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ import { DeployFunction } from "hardhat-deploy/types";
import { HardhatRuntimeEnvironment } from "hardhat/types";

import {
NormalTimelockPermissions,
XVSBridgeAdminMethods,
XVSTokenDestMethods,
bridgeConfig,
getPreConfiguredAddresses,
xvsBridgeMethods,
xvsBridgeMethodsDest,
xvsTokenPermissions,
} from "../helpers/deploymentConfig";
import { toAddress } from "../helpers/utils";
Expand Down Expand Up @@ -129,8 +130,8 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {

await executeBridgeCommands(bridge, hre, deployer);

const removeArray = new Array(xvsBridgeMethods.length).fill(true);
let tx = await bridgeAdmin.upsertSignature(xvsBridgeMethods, removeArray);
const removeArray = new Array(xvsBridgeMethodsDest.length).fill(true);
let tx = await bridgeAdmin.upsertSignature(xvsBridgeMethodsDest, removeArray);
await tx.wait();

tx = await xvs.transferOwnership(preconfiguredAddresses.NormalTimelock);
Expand All @@ -147,7 +148,7 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {

const commands = [
...(await configureAccessControls(
xvsBridgeMethods,
xvsBridgeMethodsDest,
accessControlManager.address,
preconfiguredAddresses.NormalTimelock,
XVSBridgeAdmin.address,
Expand All @@ -163,18 +164,18 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
)),

...(await configureAccessControls(
["setMintCap(address,uint256)"],
XVSBridgeAdminMethods,
accessControlManager.address,
preconfiguredAddresses.NormalTimelock,
XVS.address,
XVSBridgeAdmin.address,
hre,
)),

...(await configureAccessControls(
NormalTimelockPermissions,
XVSTokenDestMethods,
accessControlManager.address,
preconfiguredAddresses.NormalTimelock,
XVSBridgeAdmin.address,
XVS.address,
hre,
)),

Expand Down
34 changes: 17 additions & 17 deletions deployments/bsctestnet/DefaultProxyAdmin.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"address": "0x43fd9F2DAcB36853dBfBa269A7539706e787cFce",
"address": "0x7877ffd62649b6a1557b55d4c20fcbab17344c91",
"abi": [
{
"inputs": [
Expand Down Expand Up @@ -162,34 +162,34 @@
"type": "function"
}
],
"transactionHash": "0x76b6fb18b7a99edd9d398e0d6cfb597db7efa396e74c1aca97c26d0d91180324",
"transactionHash": "0xf94cc086d3edcb7da8edef0fae2cd35afc4257e5a9655b948ae1f1da7e94f185",
"receipt": {
"to": null,
"from": "0x03862dFa5D0be8F64509C001cb8C6188194469DF",
"contractAddress": "0x43fd9F2DAcB36853dBfBa269A7539706e787cFce",
"transactionIndex": 0,
"gasUsed": "643971",
"logsBloom": "0x00000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000001000000000000000000000000000000000000020000000000000000000800000000000000000000000000000000400000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000020000000000000000000040000000000040000000000000000000000004000000000",
"blockHash": "0xdf8497572a0c38e95670082f9c6f4d498df2ced893df7aa8f3a131b219f7050d",
"transactionHash": "0x76b6fb18b7a99edd9d398e0d6cfb597db7efa396e74c1aca97c26d0d91180324",
"from": "0xFEA1c651A47FE29dB9b1bf3cC1f224d8D9CFF68C",
"contractAddress": "0x7877ffd62649b6a1557b55d4c20fcbab17344c91",
"transactionIndex": 5,
"gasUsed": "642671",
"logsBloom": "0x00000000000000000000000000000000000000000000040000800000000400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000020000000000000000000800000000000000000000000000000000400000000000000000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000020000000000000000000000000000000040000000000000000000000004000000000",
"blockHash": "0xf4b9323108cb30aeb942d5215bb0e76bdae569250f5c6fd60dd4f11a68ed6b86",
"transactionHash": "0xf94cc086d3edcb7da8edef0fae2cd35afc4257e5a9655b948ae1f1da7e94f185",
"logs": [
{
"transactionIndex": 0,
"blockNumber": 34907910,
"transactionHash": "0x76b6fb18b7a99edd9d398e0d6cfb597db7efa396e74c1aca97c26d0d91180324",
"address": "0x43fd9F2DAcB36853dBfBa269A7539706e787cFce",
"transactionIndex": 5,
"blockNumber": 30883288,
"transactionHash": "0xf94cc086d3edcb7da8edef0fae2cd35afc4257e5a9655b948ae1f1da7e94f185",
"address": "0x7877ffd62649b6a1557b55d4c20fcbab17344c91",
"topics": [
"0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0",
"0x0000000000000000000000000000000000000000000000000000000000000000",
"0x000000000000000000000000ce10739590001705f7ff231611ba4a48b2820327"
],
"data": "0x",
"logIndex": 0,
"blockHash": "0xdf8497572a0c38e95670082f9c6f4d498df2ced893df7aa8f3a131b219f7050d"
"logIndex": 17,
"blockHash": "0xf4b9323108cb30aeb942d5215bb0e76bdae569250f5c6fd60dd4f11a68ed6b86"
}
],
"blockNumber": 34907910,
"cumulativeGasUsed": "643971",
"blockNumber": 30883288,
"cumulativeGasUsed": "4838707",
"status": 1,
"byzantium": true
},
Expand Down
86 changes: 43 additions & 43 deletions deployments/bsctestnet/XVSBridgeAdmin.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"address": "0x5D08D49A2e43aC4c72C60754d1550BA12e846d66",
"address": "0xB164Cb262328Ca44a806bA9e3d4094931E658513",
"abi": [
{
"anonymous": false,
Expand Down Expand Up @@ -458,82 +458,82 @@
"type": "constructor"
}
],
"transactionHash": "0x8ad916f861582381e1e03672b2cadb4001c97205bfbd605671134c610ea1cf0d",
"transactionHash": "0xc6ac501d8e241a2f373e642e038a24992debb0db00f02a39207c38308be3b580",
"receipt": {
"to": null,
"from": "0x03862dFa5D0be8F64509C001cb8C6188194469DF",
"contractAddress": "0x5D08D49A2e43aC4c72C60754d1550BA12e846d66",
"transactionIndex": 2,
"gasUsed": "796607",
"logsBloom": "0x00000000000000000000000000000000400000000000000000800000000000000000002000000000000000000000000000000000000000000000000000008000000000000000000000000000000002000001000000000000000000000000000001000000020000000000000000000800000000800000000000000000000000400000000000000000000100000000000000000000000080000000000000800000000000001000000000000000000400000000000000880000000000000000000000000020000000000000000200040000000000000400000000c00000000020000000000000000000000000000000000000000800200000000000000000000000",
"blockHash": "0x157207a05a6692d53e40eaba4b7cd6a69ad3b51e21eccda71f2fcec636349ca4",
"transactionHash": "0x8ad916f861582381e1e03672b2cadb4001c97205bfbd605671134c610ea1cf0d",
"contractAddress": "0xB164Cb262328Ca44a806bA9e3d4094931E658513",
"transactionIndex": 3,
"gasUsed": "796839",
"logsBloom": "0x00000000000000000000000000000000400000000000000000800000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000002000001000000000000000000000000000000000000020000000000000000000800000000800000000000000000000000400000000000000000000000000000000000000000400080000000000000800000000000001010000000000000000400000000000000820000000080800000000000000020000000000000000200040000000000000400000000400000000020000000000000000000010000000000000000000800000000000000000000000000",
"blockHash": "0x636d847bcb5295b7bb2c72e801898d6dbeb12735204cdf103ed41d117fb24165",
"transactionHash": "0xc6ac501d8e241a2f373e642e038a24992debb0db00f02a39207c38308be3b580",
"logs": [
{
"transactionIndex": 2,
"blockNumber": 35486114,
"transactionHash": "0x8ad916f861582381e1e03672b2cadb4001c97205bfbd605671134c610ea1cf0d",
"address": "0x5D08D49A2e43aC4c72C60754d1550BA12e846d66",
"transactionIndex": 3,
"blockNumber": 36176481,
"transactionHash": "0xc6ac501d8e241a2f373e642e038a24992debb0db00f02a39207c38308be3b580",
"address": "0xB164Cb262328Ca44a806bA9e3d4094931E658513",
"topics": [
"0xbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b",
"0x0000000000000000000000008a4c5090d972c83c44e8132a1fc2ff3e948e9a71"
"0x0000000000000000000000000923693522f43743af28bb61632fd680dbb4f9ba"
],
"data": "0x",
"logIndex": 0,
"blockHash": "0x157207a05a6692d53e40eaba4b7cd6a69ad3b51e21eccda71f2fcec636349ca4"
"logIndex": 1,
"blockHash": "0x636d847bcb5295b7bb2c72e801898d6dbeb12735204cdf103ed41d117fb24165"
},
{
"transactionIndex": 2,
"blockNumber": 35486114,
"transactionHash": "0x8ad916f861582381e1e03672b2cadb4001c97205bfbd605671134c610ea1cf0d",
"address": "0x5D08D49A2e43aC4c72C60754d1550BA12e846d66",
"transactionIndex": 3,
"blockNumber": 36176481,
"transactionHash": "0xc6ac501d8e241a2f373e642e038a24992debb0db00f02a39207c38308be3b580",
"address": "0xB164Cb262328Ca44a806bA9e3d4094931E658513",
"topics": [
"0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0",
"0x0000000000000000000000000000000000000000000000000000000000000000",
"0x00000000000000000000000003862dfa5d0be8f64509c001cb8c6188194469df"
],
"data": "0x",
"logIndex": 1,
"blockHash": "0x157207a05a6692d53e40eaba4b7cd6a69ad3b51e21eccda71f2fcec636349ca4"
"logIndex": 2,
"blockHash": "0x636d847bcb5295b7bb2c72e801898d6dbeb12735204cdf103ed41d117fb24165"
},
{
"transactionIndex": 2,
"blockNumber": 35486114,
"transactionHash": "0x8ad916f861582381e1e03672b2cadb4001c97205bfbd605671134c610ea1cf0d",
"address": "0x5D08D49A2e43aC4c72C60754d1550BA12e846d66",
"transactionIndex": 3,
"blockNumber": 36176481,
"transactionHash": "0xc6ac501d8e241a2f373e642e038a24992debb0db00f02a39207c38308be3b580",
"address": "0xB164Cb262328Ca44a806bA9e3d4094931E658513",
"topics": ["0x66fd58e82f7b31a2a5c30e0888f3093efe4e111b00cd2b0c31fe014601293aa0"],
"data": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000045f8a08f534f34a97187626e05d4b6648eeaa9aa",
"logIndex": 2,
"blockHash": "0x157207a05a6692d53e40eaba4b7cd6a69ad3b51e21eccda71f2fcec636349ca4"
"logIndex": 3,
"blockHash": "0x636d847bcb5295b7bb2c72e801898d6dbeb12735204cdf103ed41d117fb24165"
},
{
"transactionIndex": 2,
"blockNumber": 35486114,
"transactionHash": "0x8ad916f861582381e1e03672b2cadb4001c97205bfbd605671134c610ea1cf0d",
"address": "0x5D08D49A2e43aC4c72C60754d1550BA12e846d66",
"transactionIndex": 3,
"blockNumber": 36176481,
"transactionHash": "0xc6ac501d8e241a2f373e642e038a24992debb0db00f02a39207c38308be3b580",
"address": "0xB164Cb262328Ca44a806bA9e3d4094931E658513",
"topics": ["0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498"],
"data": "0x0000000000000000000000000000000000000000000000000000000000000001",
"logIndex": 3,
"blockHash": "0x157207a05a6692d53e40eaba4b7cd6a69ad3b51e21eccda71f2fcec636349ca4"
"logIndex": 4,
"blockHash": "0x636d847bcb5295b7bb2c72e801898d6dbeb12735204cdf103ed41d117fb24165"
},
{
"transactionIndex": 2,
"blockNumber": 35486114,
"transactionHash": "0x8ad916f861582381e1e03672b2cadb4001c97205bfbd605671134c610ea1cf0d",
"address": "0x5D08D49A2e43aC4c72C60754d1550BA12e846d66",
"transactionIndex": 3,
"blockNumber": 36176481,
"transactionHash": "0xc6ac501d8e241a2f373e642e038a24992debb0db00f02a39207c38308be3b580",
"address": "0xB164Cb262328Ca44a806bA9e3d4094931E658513",
"topics": ["0x7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f"],
"data": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ef480a5654b231ff7d80a0681f938f3db71a6ca6",
"logIndex": 4,
"blockHash": "0x157207a05a6692d53e40eaba4b7cd6a69ad3b51e21eccda71f2fcec636349ca4"
"logIndex": 5,
"blockHash": "0x636d847bcb5295b7bb2c72e801898d6dbeb12735204cdf103ed41d117fb24165"
}
],
"blockNumber": 35486114,
"cumulativeGasUsed": "848848",
"blockNumber": 36176481,
"cumulativeGasUsed": "878679",
"status": 1,
"byzantium": true
},
"args": [
"0x8a4C5090d972C83C44E8132a1Fc2Ff3E948E9A71",
"0x0923693522F43743Af28bb61632fD680dbb4f9bA",
"0xef480a5654b231ff7d80A0681F938f3Db71a6Ca6",
"0xc4d66de800000000000000000000000045f8a08f534f34a97187626e05d4b6648eeaa9aa"
],
Expand All @@ -546,7 +546,7 @@
"methodName": "initialize",
"args": ["0x45f8a08F534f34A97187626E05d4b6648Eeaa9AA"]
},
"implementation": "0x8a4C5090d972C83C44E8132a1Fc2Ff3E948E9A71",
"implementation": "0x0923693522F43743Af28bb61632fD680dbb4f9bA",
"devdoc": {
"details": "This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \"admin cannot fallback to proxy target\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.",
"kind": "dev",
Expand Down
79 changes: 45 additions & 34 deletions deployments/bsctestnet/XVSBridgeAdmin_Implementation.json

Large diffs are not rendered by default.

Loading

0 comments on commit 67dc312

Please sign in to comment.