Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .env.template
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ CELO_ALFAJORES_TEST_ENDPOINT=https://alfajores-forno.celo-testnet.org
OASIS_EMERALD_TEST_ENDPOINT=https://testnet.emerald.oasis.dev
MOONBASE_ALPHA_TEST_ENDPOINT=https://rpc.api.moonbase.moonbeam.network
REI_TEST_ENDPOINT=https://rpc-testnet.rei.network/
MANDALA_TEST_ENDPOINT=https://tc7-eth.aca-dev.network

ETH_MAINNET_ENDPOINT=https://mainnet.infura.io/v3/INFURA-PROJECT-ID
BSC_ENDPOINT=https://bsc-dataseed.binance.org
Expand Down
37 changes: 31 additions & 6 deletions deploy/core/000_sgn_staking.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,26 @@
import * as dotenv from 'dotenv';
import { ethers } from 'hardhat';
import { DeployFunction } from 'hardhat-deploy/types';
import { HardhatRuntimeEnvironment } from 'hardhat/types';
import { calcEthereumTransactionParams } from '@acala-network/eth-providers';

dotenv.config();

const deployFunc: DeployFunction = async (hre: HardhatRuntimeEnvironment) => {
const { deployments, getNamedAccounts } = hre;
const { deploy } = deployments;
const { deployer } = await getNamedAccounts();
const blockNumber = await ethers.provider.getBlockNumber();
const storageByteDeposit = '100000000000000';
const txFeePerGas = '199999946752';

const ethParams = calcEthereumTransactionParams({
gasLimit: '31000000',
validUntil: (blockNumber + 100).toString(),
storageLimit: '64001',
txFeePerGas,
storageByteDeposit,
});

await deploy('Staking', {
from: deployer,
Expand All @@ -23,34 +36,46 @@ const deployFunc: DeployFunction = async (hre: HardhatRuntimeEnvironment) => {
process.env.ADVANCE_NOTICE_PERIOD,
process.env.VALIDATOR_BOND_INTERVAL,
process.env.MAX_SLASH_FACTOR
]
],
gasLimit: ethParams.txGasLimit, // Mandala
gasPrice: ethParams.txGasPrice, // Mandala
});
const staking = await deployments.get('Staking');
await deploy('SGN', {
from: deployer,
log: true,
args: [staking.address]
args: [staking.address],
gasLimit: ethParams.txGasLimit, // Mandala
gasPrice: ethParams.txGasPrice, // Mandala
});
await deploy('StakingReward', {
from: deployer,
log: true,
args: [staking.address]
args: [staking.address],
gasLimit: ethParams.txGasLimit, // Mandala
gasPrice: ethParams.txGasPrice, // Mandala
});
await deploy('FarmingRewards', {
from: deployer,
log: true,
args: [staking.address]
args: [staking.address],
gasLimit: ethParams.txGasLimit, // Mandala
gasPrice: ethParams.txGasPrice, // Mandala
});
const stakingReward = await deployments.get('StakingReward');
await deploy('Govern', {
from: deployer,
log: true,
args: [staking.address, process.env.CELR, stakingReward.address]
args: [staking.address, process.env.CELR, stakingReward.address],
gasLimit: ethParams.txGasLimit, // Mandala
gasPrice: ethParams.txGasPrice, // Mandala
});
await deploy('Viewer', {
from: deployer,
log: true,
args: [staking.address]
args: [staking.address],
gasLimit: ethParams.txGasLimit, // Mandala
gasPrice: ethParams.txGasPrice, // Mandala
});
};

Expand Down
18 changes: 17 additions & 1 deletion deploy/core/001_bridge.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,33 @@
import * as dotenv from 'dotenv';
import { ethers } from 'hardhat';
import { DeployFunction } from 'hardhat-deploy/types';
import { HardhatRuntimeEnvironment } from 'hardhat/types';
import { calcEthereumTransactionParams } from '@acala-network/eth-providers';

dotenv.config();

const deployFunc: DeployFunction = async (hre: HardhatRuntimeEnvironment) => {
const { deployments, getNamedAccounts } = hre;
const { deploy } = deployments;
const { deployer } = await getNamedAccounts();
const blockNumber = await ethers.provider.getBlockNumber();
const storageByteDeposit = '100000000000000';
const txFeePerGas = '199999946752';

console.log(storageByteDeposit, txFeePerGas)
const ethParams = calcEthereumTransactionParams({
gasLimit: '31000000',
validUntil: (blockNumber + 100).toString(),
storageLimit: '64001',
txFeePerGas,
storageByteDeposit,
});

await deploy('Bridge', {
from: deployer,
log: true
log: true,
gasLimit: ethParams.txGasLimit, // Mandala
gasPrice: ethParams.txGasPrice, // Mandala
});
};

Expand Down
16 changes: 16 additions & 0 deletions deploy/pegged/001_pegged_token_bridge.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,33 @@
import * as dotenv from 'dotenv';
import { DeployFunction } from 'hardhat-deploy/types';
import { HardhatRuntimeEnvironment } from 'hardhat/types';
import { ethers } from 'hardhat';
import { calcEthereumTransactionParams } from '@acala-network/eth-providers';

dotenv.config();

const deployFunc: DeployFunction = async (hre: HardhatRuntimeEnvironment) => {
const { deployments, getNamedAccounts } = hre;
const { deploy } = deployments;
const { deployer } = await getNamedAccounts();
const blockNumber = await ethers.provider.getBlockNumber();
const storageByteDeposit = '100000000000000';
const txFeePerGas = '199999946752';

console.log(storageByteDeposit, txFeePerGas)
const ethParams = calcEthereumTransactionParams({
gasLimit: '21000000',
validUntil: (blockNumber + 100).toString(),
storageLimit: '64001',
txFeePerGas,
storageByteDeposit,
});

await deploy('PeggedTokenBridge', {
from: deployer,
log: true,
gasLimit: ethParams.txGasLimit, // Mandala
gasPrice: ethParams.txGasPrice, // Mandala
args: [process.env.PEGGED_TOKEN_BRIDGE_SIGS_VERIFIER]
});
};
Expand Down
16 changes: 16 additions & 0 deletions deploy/pegged/tokens/000_single_bridge_token.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,33 @@
import * as dotenv from 'dotenv';
import { DeployFunction } from 'hardhat-deploy/types';
import { HardhatRuntimeEnvironment } from 'hardhat/types';
import { ethers } from 'hardhat';
import { calcEthereumTransactionParams } from '@acala-network/eth-providers';

dotenv.config();

const deployFunc: DeployFunction = async (hre: HardhatRuntimeEnvironment) => {
const { deployments, getNamedAccounts } = hre;
const { deploy } = deployments;
const { deployer } = await getNamedAccounts();
const blockNumber = await ethers.provider.getBlockNumber();
const storageByteDeposit = '100000000000000';
const txFeePerGas = '199999946752';

console.log(storageByteDeposit, txFeePerGas)
const ethParams = calcEthereumTransactionParams({
gasLimit: '21000000',
validUntil: (blockNumber + 100).toString(),
storageLimit: '64001',
txFeePerGas,
storageByteDeposit,
});

await deploy('SingleBridgeToken', {
from: deployer,
log: true,
gasLimit: ethParams.txGasLimit, // Mandala
gasPrice: ethParams.txGasPrice, // Mandala
args: [
process.env.SINGLE_BRIDGE_TOKEN_NAME,
process.env.SINGLE_BRIDGE_TOKEN_SYMBOL,
Expand Down
8 changes: 8 additions & 0 deletions hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ const moonbaseAlphaTestPrivateKey = process.env.MOONBASE_ALPHA_TEST_PRIVATE_KEY
const reiTestEndpoint = process.env.REI_TEST_ENDPOINT || DEFAULT_ENDPOINT;
const reiTestPrivateKey = process.env.REI_TEST_PRIVATE_KEY || DEFAULT_PRIVATE_KEY;

const mandalaTestEndpoint = process.env.MANDALA_TEST_ENDPOINT || DEFAULT_ENDPOINT;
const mandalaTestPrivateKey = process.env.MANDALA_TEST_PRIVATE_KEY || DEFAULT_PRIVATE_KEY;

// Mainnets
const ethMainnetEndpoint = process.env.ETH_MAINNET_ENDPOINT || DEFAULT_ENDPOINT;
const ethMainnetPrivateKey = process.env.ETH_MAINNET_PRIVATE_KEY || DEFAULT_PRIVATE_KEY;
Expand Down Expand Up @@ -154,6 +157,11 @@ const config: HardhatUserConfig = {
url: reiTestEndpoint,
accounts: [`0x${reiTestPrivateKey}`]
},
mandalaTest: {
timeout: 600000,
url: mandalaTestEndpoint,
accounts: [`0x${mandalaTestPrivateKey}`]
},
ethMainnet: {
url: ethMainnetEndpoint,
accounts: [`0x${ethMainnetPrivateKey}`]
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,10 @@
},
"homepage": "https://github.com/celer-network/sgn-v2-contracts#readme",
"devDependencies": {
"@acala-network/eth-providers": "^2.1.11",
"@nomiclabs/hardhat-ethers": "npm:hardhat-deploy-ethers",
"@nomiclabs/hardhat-waffle": "^2.0.1",
"@openzeppelin/contracts": "^4.2.0",
"@openzeppelin/contracts": "^4.4.2",
"@typechain/ethers-v5": "^7.0.1",
"@typechain/hardhat": "^2.3.1",
"@types/chai": "^4.2.21",
Expand Down
Loading