Skip to content

Commit

Permalink
Merge pull request #25 from ducthotran2010/init-config
Browse files Browse the repository at this point in the history
Update mainnet configs
  • Loading branch information
hosyvietanh authored Jun 22, 2022
2 parents c62c70f + 3b24b83 commit 9a3c509
Show file tree
Hide file tree
Showing 3 changed files with 182 additions and 22 deletions.
18 changes: 15 additions & 3 deletions hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ dotenv.config();

const DEFAULT_MNEMONIC = 'title spike pink garlic hamster sorry few damage silver mushroom clever window';

const { TESTNET_PK, TESTNET_URL, ROPSTEN_PK, ROPSTEN_URL, MAINNET_PK, MAINNET_URL } = process.env;
const { TESTNET_PK, TESTNET_URL, ROPSTEN_PK, ROPSTEN_URL, MAINNET_PK, MAINNET_URL, ETHEREUM_PK, ETHEREUM_URL } =
process.env;

if (!TESTNET_PK) {
console.warn('TESTNET_PK is unset. Using DEFAULT_MNEMONIC');
Expand All @@ -25,6 +26,10 @@ if (!MAINNET_PK) {
console.warn('MAINNET_PK is unset. Using DEFAULT_MNEMONIC');
}

if (!ETHEREUM_PK) {
console.warn('ETHEREUM_PK is unset. Using DEFAULT_MNEMONIC');
}

const testnet: NetworkUserConfig = {
chainId: 2021,
url: TESTNET_URL || 'https://testnet.skymavis.one/rpc',
Expand All @@ -41,11 +46,17 @@ const mainnet: NetworkUserConfig = {

const ropsten: NetworkUserConfig = {
chainId: 3,
url: ROPSTEN_URL || 'https://api.roninchain.com/rpc',
url: ROPSTEN_URL || 'http://localhost:8545',
accounts: ROPSTEN_PK ? [ROPSTEN_PK] : { mnemonic: DEFAULT_MNEMONIC },
blockGasLimit: 8000000,
};

const ethereum: NetworkUserConfig = {
chainId: 1,
url: ETHEREUM_URL || 'http://localhost:8545',
accounts: ETHEREUM_PK ? [ETHEREUM_PK] : { mnemonic: DEFAULT_MNEMONIC },
};

const compilerConfig: SolcUserConfig = {
version: '0.5.17',
settings: {
Expand Down Expand Up @@ -77,8 +88,9 @@ const config: HardhatUserConfig = {
},
},
'ronin-testnet': testnet,
ropsten: ropsten,
ropsten,
'ronin-mainnet': mainnet,
ethereum,
},
gasReporter: {
currency: 'usd',
Expand Down
94 changes: 85 additions & 9 deletions src/addresses.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ export enum Network {
Hardhat = 'hardhat',
Testnet = 'ronin-testnet',
Ropsten = 'ropsten',
Mainnet = 'ronin-mainnet',
RoninMainnet = 'ronin-mainnet',
Ethereum = 'ethereum',
}

export type LiteralNetwork = Network | string;
Expand All @@ -18,19 +19,38 @@ export const accountSet: AccountSet = {
[Network.Hardhat]: undefined,
[Network.Testnet]: ['0x968D0Cd7343f711216817E617d3f92a23dC91c07'],
[Network.Ropsten]: ['0x968D0Cd7343f711216817E617d3f92a23dC91c07'],
[Network.Mainnet]: undefined,
[Network.RoninMainnet]: [], // no relayer on ronin
[Network.Ethereum]: [
'0xbb772579dfe08f7c7c73daca0a414fca4c9e57ac',
'0xE5EB222996967BE79468C28bA39D665fd96E8b30',
'0x25c54079263cbFA7f095F7119Ee8EC01D1Da6534',
'0xaaBD1f9bA401F4C56F7717c71C4fD9369Dacf7cE',
'0x1FE5F98A40602Fc002d57EA803C2d6951649d637',
],
},
withdrawalUnlockers: {
[Network.Hardhat]: undefined,
[Network.Testnet]: ['0x968D0Cd7343f711216817E617d3f92a23dC91c07'],
[Network.Ropsten]: ['0x968D0Cd7343f711216817E617d3f92a23dC91c07'],
[Network.Mainnet]: undefined,
[Network.RoninMainnet]: [
'0x58a8dcfdef9bb5e164382562317c13d6f2a706f4',
'0xE5EB222996967BE79468C28bA39D665fd96E8b30',
'0x6bfc8f9096446d350713c4eb9d9b68866f87a9d0',
'0xad99fc4d593bae582c2ca83acd98ae6fcdb36192',
],
[Network.Ethereum]: [
'0x58a8dcfdef9bb5e164382562317c13d6f2a706f4',
'0xE5EB222996967BE79468C28bA39D665fd96E8b30',
'0x6bfc8f9096446d350713c4eb9d9b68866f87a9d0',
'0xad99fc4d593bae582c2ca83acd98ae6fcdb36192',
],
},
withdrawalMigrators: {
[Network.Hardhat]: undefined,
[Network.Testnet]: ['0x968D0Cd7343f711216817E617d3f92a23dC91c07'],
[Network.Ropsten]: ['0x968D0Cd7343f711216817E617d3f92a23dC91c07'],
[Network.Mainnet]: undefined,
[Network.RoninMainnet]: ['0xae8DB4D9D3067A33A8241e415e65f0c69cFbb8e1'], // Thor's address
[Network.Ethereum]: undefined,
},
};

Expand All @@ -51,36 +71,92 @@ const validatorTestNetConfig: WeightedValidatorStruct[] = [
},
];

const validatorMainnetConfig: WeightedValidatorStruct[] = [
{
validator: '0x87ef0bc2ab6951792c01f615d9ce99a166c8489c',
governor: '0xe880802580a1fbdef67ace39d1b21c5b2c74f059',
weight: 100,
},
{
validator: '0xd3b5a9a14effcda494fbb87d91c2f9b88987a12a',
governor: '0xb251044819e95a6deb9502761721d0040291d7c1',
weight: 100,
},
{
validator: '0xd67ed84e06a970ce228073659b255c664cb0b12c',
governor: '0x4d84e41b94f65ee15772fe124b930bb3ed4cf2a8',
weight: 100,
},
{
validator: '0x25333cd2741e48a692ea0dcc0655513e989691c9',
governor: '0x6d623b138fcca660be0ee1cb36f17a9d107310bd',
weight: 100,
},
{
validator: '0x9d5d175c7d7dfdc7038420eb2725d4601a41b751',
governor: '0x6ba0f914f3c9af612f3d645a42d3551409a3abdf',
weight: 100,
},
{
validator: '0x6E46924371d0e910769aaBE0d867590deAC20684',
governor: '0xfA4E8B10c8181EDD70db8305c7923f5cE5dba3f6',
weight: 100,
},
{
validator: '0xe70cbf18114822c0e32c6b35d2478f02a8ac78a9',
governor: '0xac4085f9696ae8365cd7aa1580764ea00ed1d196',
weight: 100,
},
{
validator: '0xee11d2016e9f2fae606b2f12986811f4abbe6215',
governor: '0x77Ab649Caa7B4b673C9f2cF069900DF48114d79D',
weight: 100,
},
{
validator: '0x210744c64eea863cf0f972e5aebc683b98fb1984',
governor: '0x4620fb95eabdab4bf681d987e116e0aaef1adef2',
weight: 100,
},
{
validator: '0xd11d9842babd5209b9b1155e46f5878c989125b7',
governor: '0x5832c3219c1da998e828e1a2406b73dbfc02a70c',
weight: 100,
},
];

// TODO: fill mainnet config
export const validatorSet: ValidatorSet = {
[Network.Hardhat]: undefined,
[Network.Testnet]: validatorTestNetConfig,
[Network.Ropsten]: validatorTestNetConfig,
[Network.Mainnet]: undefined,
[Network.RoninMainnet]: validatorMainnetConfig,
[Network.Ethereum]: validatorMainnetConfig,
};

interface ContractAddress {
[name: string]: { [network in LiteralNetwork]: undefined | string };
}

// TODO: fill mainnet config
export const namedAddresses: ContractAddress = {
weth: {
[Network.Hardhat]: undefined,
[Network.Testnet]: undefined,
[Network.Ropsten]: '0xc778417e063141139fce010982780140aa0cd5ab',
[Network.Mainnet]: undefined,
[Network.RoninMainnet]: undefined,
[Network.Ethereum]: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
},
gatewayRoleSetter: {
[Network.Hardhat]: undefined,
[Network.Testnet]: '0x968D0Cd7343f711216817E617d3f92a23dC91c07',
[Network.Ropsten]: '0x968D0Cd7343f711216817E617d3f92a23dC91c07',
[Network.Mainnet]: undefined,
[Network.RoninMainnet]: '0xed4a9f48a62fb6fdcfb45bb00c9f61d1a436e58c', // https://explorer.roninchain.com/address/ronin:ed4a9f48a62fb6fdcfb45bb00c9f61d1a436e58c admin address
[Network.Ethereum]: '0x2DA02aC5f19Ae362a4121718d990e655eB628D96', // https://etherscan.io/address/skymavis.eth
},
governanceAdminRoleSetter: {
[Network.Hardhat]: undefined,
[Network.Testnet]: '0x968D0Cd7343f711216817E617d3f92a23dC91c07',
[Network.Ropsten]: '0x968D0Cd7343f711216817E617d3f92a23dC91c07',
[Network.Mainnet]: undefined,
[Network.RoninMainnet]: '0xed4a9f48a62fb6fdcfb45bb00c9f61d1a436e58c', // https://explorer.roninchain.com/address/ronin:ed4a9f48a62fb6fdcfb45bb00c9f61d1a436e58c admin address
[Network.Ethereum]: '0x2DA02aC5f19Ae362a4121718d990e655eB628D96', // https://etherscan.io/address/skymavis.eth
},
};
92 changes: 82 additions & 10 deletions src/configs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ interface RoninMappedToken {
};
}

// TODO: fill mainnet config
export const validatorThreshold: NetworkThreshold = {
[Network.Hardhat]: undefined,
[Network.Testnet]: {
Expand All @@ -59,10 +58,16 @@ export const validatorThreshold: NetworkThreshold = {
numerator: 1,
denominator: 2,
},
[Network.Mainnet]: undefined,
[Network.RoninMainnet]: {
numerator: 70,
denominator: 100,
},
[Network.Ethereum]: {
numerator: 70,
denominator: 100,
},
};

// TODO: fill mainnet config
export const gatewayThreshold: NetworkThreshold = {
[Network.Hardhat]: undefined,
[Network.Testnet]: {
Expand All @@ -75,25 +80,34 @@ export const gatewayThreshold: NetworkThreshold = {
highTierVoteWeightNumerator: 2,
denominator: 2,
},
[Network.Mainnet]: undefined,
[Network.RoninMainnet]: {
numerator: 70,
highTierVoteWeightNumerator: 90,
denominator: 100,
},
[Network.Ethereum]: {
numerator: 70,
highTierVoteWeightNumerator: 90,
denominator: 100,
},
};

// TODO: fill mainnet config
export const mainnetChainId: MapNetworkNumberSet = {
[Network.Hardhat]: undefined,
[Network.Testnet]: [3],
[Network.Ropsten]: [3],
[Network.Mainnet]: undefined,
[Network.RoninMainnet]: [1],
[Network.Ethereum]: [1],
};

export const roninChainId: MapNetworkNumber = {
[Network.Hardhat]: undefined,
[Network.Testnet]: 2021,
[Network.Ropsten]: 2021,
[Network.Mainnet]: 2020,
[Network.RoninMainnet]: 2020,
[Network.Ethereum]: 2020,
};

// TODO: fill testnet & mainnet config
export const mainchainMappedToken: MainchainMappedToken = {
[Network.Hardhat]: undefined,
[Network.Ropsten]: {
Expand Down Expand Up @@ -130,7 +144,43 @@ export const mainchainMappedToken: MainchainMappedToken = {
BigNumber.from(10).pow(18).mul(5),
],
},
[Network.Mainnet]: undefined,
[Network.Ethereum]: {
// WETH, SLP, AXS, USDC
mainchainTokens: [
'0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', // https://etherscan.io/address/0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2
'0xcc8fa225d80b9c7d42f96e9570156c65d6caaa25', // https://etherscan.io/token/0xcc8fa225d80b9c7d42f96e9570156c65d6caaa25
'0xbb0e17ef65f82ab018d8edd776e8dd940327b28b', // https://etherscan.io/address/0xbb0e17ef65f82ab018d8edd776e8dd940327b28b
'0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', // https://etherscan.io/token/0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48
],
roninTokens: [
'0xc99a6a985ed2cac1ef41640596c5a5f9f4e19ef5', // https://explorer.roninchain.com/address/ronin:c99a6a985ed2cac1ef41640596c5a5f9f4e19ef5
'0xa8754b9fa15fc18bb59458815510e40a12cd2014', // https://explorer.roninchain.com/address/ronin:a8754b9fa15fc18bb59458815510e40a12cd2014
'0x97a9107c1793bc407d6f527b77e7fff4d812bece', // https://explorer.roninchain.com/address/ronin:97a9107c1793bc407d6f527b77e7fff4d812bece
'0x0b7007c13325c48911f73a2dad5fa5dcbf808adc', // https://explorer.roninchain.com/address/ronin:0b7007c13325c48911f73a2dad5fa5dcbf808adc
],
standards: [0, 0, 0, 0], // ERC20s
highTierThresholds: [
BigNumber.from(918).mul(BigNumber.from(10).pow(18)), // 918 WETH, 18 decimals
BigNumber.from(273_972_602), // 273_972_602 SLP, 0 decimals
BigNumber.from(71_429).mul(BigNumber.from(10).pow(18)), // 71_429 AXS, 18 decimals
BigNumber.from(1_000_000).mul(BigNumber.from(10).pow(6)), // 1M USDC, 6 decimals
],
lockedThresholds: [
// x10 tier-2
BigNumber.from(918).mul(BigNumber.from(10).pow(18)).mul(10),
BigNumber.from(273_972_602).mul(10),
BigNumber.from(71_429).mul(BigNumber.from(10).pow(18)).mul(10),
BigNumber.from(1_000_000).mul(BigNumber.from(10).pow(6)).mul(10),
],
unlockFeePercentages: [10, 10, 10, 10], // 0.001%
dailyWithdrawalLimits: [
// x50 tier-2
BigNumber.from(918).mul(BigNumber.from(10).pow(18)).mul(50),
BigNumber.from(273_972_602).mul(50),
BigNumber.from(71_429).mul(BigNumber.from(10).pow(18)).mul(50),
BigNumber.from(1_000_000).mul(BigNumber.from(10).pow(6)).mul(50),
],
},
};

// TODO: fill mainnet config
Expand Down Expand Up @@ -158,5 +208,27 @@ export const roninMappedToken: RoninMappedToken = {
BigNumber.from(10).pow(6).mul(2), // 20 USDT
],
},
[Network.Mainnet]: undefined,
[Network.RoninMainnet]: {
roninTokens: [
'0xc99a6a985ed2cac1ef41640596c5a5f9f4e19ef5', // https://explorer.roninchain.com/address/ronin:c99a6a985ed2cac1ef41640596c5a5f9f4e19ef5
'0xa8754b9fa15fc18bb59458815510e40a12cd2014', // https://explorer.roninchain.com/address/ronin:a8754b9fa15fc18bb59458815510e40a12cd2014
'0x97a9107c1793bc407d6f527b77e7fff4d812bece', // https://explorer.roninchain.com/address/ronin:97a9107c1793bc407d6f527b77e7fff4d812bece
'0x0b7007c13325c48911f73a2dad5fa5dcbf808adc', // https://explorer.roninchain.com/address/ronin:0b7007c13325c48911f73a2dad5fa5dcbf808adc
],
mainchainTokens: [
'0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', // https://etherscan.io/address/0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2
'0xcc8fa225d80b9c7d42f96e9570156c65d6caaa25', // https://etherscan.io/token/0xcc8fa225d80b9c7d42f96e9570156c65d6caaa25
'0xbb0e17ef65f82ab018d8edd776e8dd940327b28b', // https://etherscan.io/address/0xbb0e17ef65f82ab018d8edd776e8dd940327b28b
'0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', // https://etherscan.io/token/0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48
],
standards: [0, 0, 0, 0], // ERC20s
chainIds: [1, 1, 1, 1],
minimumThresholds: [
// WETH, SLP, AXS, USDC
BigNumber.from(10).pow(16), // 0.01 WETH
BigNumber.from(2_739), // 2_739 SLP
BigNumber.from('710000000000000000'), // 0.71 AXS
BigNumber.from(10).pow(6).mul(10), // 10 USDT
],
},
};

0 comments on commit 9a3c509

Please sign in to comment.