add goerli deploy
This commit is contained in:
parent
70f3920a9e
commit
c5422021be
|
@ -0,0 +1 @@
|
|||
export const SNT_ADDRESS = '0x86e5C5c884740894644dAD30021aAaAdE2B7bAbd';
|
|
@ -1,15 +1,64 @@
|
|||
import {HardhatRuntimeEnvironment} from 'hardhat/types';
|
||||
import {DeployFunction} from 'hardhat-deploy/types';
|
||||
const {deployments, getNamedAccounts} = require('hardhat');
|
||||
import { DeployFunction, DeployResult} from 'hardhat-deploy/types';
|
||||
import { ethers, deployments, getNamedAccounts } from "hardhat";
|
||||
import { Bridge } from "../types/Bridge";
|
||||
import { ERC20Handler } from "../types/ERC20Handler";
|
||||
import { MintableERC20 } from "../types/MintableERC20";
|
||||
import {
|
||||
createResourceID,
|
||||
toWei,
|
||||
generateDepositMetaData,
|
||||
generateDepositDataHash,
|
||||
createERCDepositData,
|
||||
} from "../utils/helpers";
|
||||
import { getContractFromDeploy } from "../utils/deploy"
|
||||
import { SNT_ADDRESS } from "../constants/goerliAddress";
|
||||
import MintableErc20Artifacts from "../artifacts/contracts/tokens/MintableErc20.sol/MintableERC20.json";
|
||||
|
||||
|
||||
const ETHEREUM_CHAIN_ID: number = 1;
|
||||
const relayerThreshold: number = 1;
|
||||
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
|
||||
const { deploy, execute, read, log } = deployments;
|
||||
const { deployer } = await getNamedAccounts();
|
||||
const { deploy, execute, read, log } = deployments;
|
||||
const { deployer } = await getNamedAccounts();
|
||||
const [signer] = await ethers.getSigners();
|
||||
|
||||
await deploy("Bridge", {
|
||||
from: deployer,
|
||||
args: ["1", [], "1", "0", "0"],
|
||||
log: true
|
||||
});
|
||||
const initialRelayers = [deployer];
|
||||
let sntEthereum: MintableERC20 = new ethers.Contract(
|
||||
SNT_ADDRESS,
|
||||
MintableErc20Artifacts.abi,
|
||||
signer
|
||||
) as MintableERC20;
|
||||
|
||||
const bridgeDeploy: DeployResult = await deploy("Bridge", {
|
||||
from: deployer,
|
||||
args: [
|
||||
ETHEREUM_CHAIN_ID,
|
||||
initialRelayers,
|
||||
relayerThreshold,
|
||||
0,
|
||||
100
|
||||
],
|
||||
log: true
|
||||
});
|
||||
|
||||
const bridge: Bridge = getContractFromDeploy(bridgeDeploy, signer) as Bridge;
|
||||
const sntEthereumResourceId = createResourceID(SNT_ADDRESS, ETHEREUM_CHAIN_ID);
|
||||
const erc20HandlerDeploy: DeployResult = await deploy("ERC20Handler", {
|
||||
from: deployer,
|
||||
args: [
|
||||
bridge.address,
|
||||
[sntEthereumResourceId],
|
||||
[sntEthereum.address],
|
||||
[]
|
||||
],
|
||||
log: true
|
||||
});
|
||||
const erc20Handler: ERC20Handler = getContractFromDeploy(erc20HandlerDeploy, signer) as ERC20Handler;
|
||||
await bridge.adminSetResource(
|
||||
erc20Handler.address,
|
||||
sntEthereumResourceId,
|
||||
sntEthereum.address
|
||||
);
|
||||
};
|
||||
export default func;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { ethers, } from "hardhat";
|
||||
import { BigNumber, Bytes, BytesLike, Signer } from "ethers";
|
||||
import { ethers } from "hardhat";
|
||||
import { BigNumber, Signer } from "ethers";
|
||||
import chai from "chai";
|
||||
import { solidity } from "ethereum-waffle";
|
||||
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
import { Contract, Signer } from "ethers";
|
||||
import { DeployResult } from 'hardhat-deploy/types';
|
||||
|
||||
export function getContractFromDeploy(deploy: DeployResult, signer: Signer) {
|
||||
return new Contract(
|
||||
deploy.address,
|
||||
deploy.abi,
|
||||
signer
|
||||
);
|
||||
}
|
Loading…
Reference in New Issue