-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5d7c58c
commit b3466b2
Showing
8 changed files
with
152 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
116 changes: 116 additions & 0 deletions
116
smart-contract/deploy/scripts/add-gatekeeper-to-default-network.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
import { sleep, getDeploymentSigner } from "../defender-utils"; | ||
import hre , { ethers, upgrades } from "hardhat"; | ||
import { Signer } from '@ethersproject/abstract-signer/src.ts' | ||
import { BNB_TESTNET_CONTRACT_ADDRESSES, ZERO_ADDRESS, gatekeeperOneTestnetWallet, gatekeeperTwoTestnetWallet, testNetworkName, testNetworkNameWithErc20Fees, testNetworkNameWithNativeFees, trustSwiftlyTestnetGatekeeperWallet } from "../utils"; | ||
import { GatewayNetwork, GatewayToken, IGatewayNetwork } from "../../typechain-types"; | ||
|
||
async function main() { | ||
let signer: Signer; | ||
if(process.env.SHOULD_USE_DEFENDER! == "true") { | ||
signer = await getDeploymentSigner(); | ||
} | ||
|
||
const gatewayNetworkContractAddress = BNB_TESTNET_CONTRACT_ADDRESSES.gatewayNetwork; | ||
const gatewayTokenContractAddress = BNB_TESTNET_CONTRACT_ADDRESSES.gatewayToken; | ||
const dummyERC20ContractAddress = BNB_TESTNET_CONTRACT_ADDRESSES.erc20; | ||
|
||
const provider = new ethers.providers.JsonRpcProvider(process.env.BNB_TESTNET_RPC_URL!); | ||
|
||
|
||
const GatewayTokenContractFactory = await ethers.getContractFactory("GatewayToken", signer!); | ||
|
||
|
||
// Refersh existing token | ||
const NetworkContractFactory = await ethers.getContractFactory("GatewayNetwork", signer!); | ||
const networkContract = NetworkContractFactory.attach(gatewayNetworkContractAddress) as GatewayNetwork; | ||
|
||
|
||
await networkContract.connect(signer!).addGatekeeper("0xa0Ee7A142d267C1f36714E4a8F75612F20a79720", testNetworkName); | ||
|
||
// const testNetworkOne: IGatewayNetwork.GatekeeperNetworkDataStruct = { | ||
// primaryAuthority: trustSwiftlyTestnetWallet.address, | ||
// name: testNetworkNameWithErc20Fees, | ||
// passExpireDurationInSeconds: 2628000, | ||
// networkFeatureMask: 0, | ||
// networkFee: { | ||
// issueFee: 100, | ||
// refreshFee: 100, | ||
// expireFee: 100, | ||
// freezeFee: 100 | ||
// }, | ||
// supportedToken: dummyERC20ContractAddress, | ||
// gatekeepers: [], | ||
// lastFeeUpdateTimestamp: 0 | ||
// } | ||
|
||
// console.log(`Creating testNetworkOne`); | ||
|
||
// await networkContract.connect(signer!).createNetwork(testNetworkOne); | ||
|
||
|
||
|
||
// await sleep(2000); | ||
|
||
// // Network 2: testNetworkNameWithNativeFees | ||
// // - Create | ||
// // - Add gatekeeper 2 as gatekeeper + primary authority | ||
// // Gatekeeper claim primary authority | ||
|
||
// const testNetworkTwo: IGatewayNetwork.GatekeeperNetworkDataStruct = { | ||
// primaryAuthority: gatekeeprTwo.address, | ||
// name: testNetworkNameWithNativeFees, | ||
// passExpireDurationInSeconds: 2628000, | ||
// networkFeatureMask: 0, | ||
// networkFee: { | ||
// issueFee: 100, | ||
// refreshFee: 100, | ||
// expireFee: 100, | ||
// freezeFee: 100 | ||
// }, | ||
// supportedToken: ZERO_ADDRESS, | ||
// gatekeepers: [], | ||
// lastFeeUpdateTimestamp: 0 | ||
// } | ||
|
||
// console.log(`Creating testNetworkTwo`); | ||
|
||
// await networkContract.connect(signer!).createNetwork(testNetworkTwo, {gasLimit: 500000}); | ||
|
||
|
||
// await sleep(2000); | ||
|
||
// // Network 3: identity.com | ||
// // - Create | ||
// // - Add defender relayer as gatekeeper + primary autority | ||
// // Gatekeeper claim primary authority | ||
// const defaultIdentityNetwork: IGatewayNetwork.GatekeeperNetworkDataStruct = { | ||
// primaryAuthority: await signer!.getAddress(), | ||
// name: testNetworkName, | ||
// passExpireDurationInSeconds: 2628000, | ||
// networkFeatureMask: 0, | ||
// networkFee: { | ||
// issueFee: 0, | ||
// refreshFee: 0, | ||
// expireFee: 0, | ||
// freezeFee: 0 | ||
// }, | ||
// supportedToken: ZERO_ADDRESS, | ||
// gatekeepers: [], | ||
// lastFeeUpdateTimestamp: 0 | ||
// } | ||
|
||
// console.log(`Creating defaultIdentityNetwork`); | ||
|
||
// await networkContract.connect(signer!).createNetwork(defaultIdentityNetwork, {gasLimit: 500000}); | ||
|
||
await sleep(2000); | ||
} | ||
|
||
|
||
// We recommend this pattern to be able to use async/await everywhere | ||
// and properly handle errors. | ||
main().catch((error) => { | ||
console.error(error); | ||
process.exitCode = 1; | ||
}); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters