Skip to content
This repository has been archived by the owner on Apr 18, 2024. It is now read-only.

Commit

Permalink
Merge ee6087f into 74d2e0f
Browse files Browse the repository at this point in the history
  • Loading branch information
bleaker0x committed Jan 2, 2022
2 parents 74d2e0f + ee6087f commit 8a7fbf3
Show file tree
Hide file tree
Showing 8 changed files with 70 additions and 20 deletions.
3 changes: 2 additions & 1 deletion src/common/chainid.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export namespace ChainId {
export const MOONRIVER: number = 1285;
export const ARBITRUM: number = 42161;
export const AVALANCHE: number = 43114;
export const AURORA: number = 1313161554;
export const HARMONY: number = 1666600000;

export const asBigNumber = (n: BigNumberish): BigNumber => {
Expand All @@ -24,7 +25,7 @@ export namespace ChainId {
ETH, OPTIMISM, BSC,
POLYGON, FANTOM, BOBA,
MOONRIVER, ARBITRUM, AVALANCHE,
HARMONY,
AURORA, HARMONY,
]
}

Expand Down
7 changes: 7 additions & 0 deletions src/common/networks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,12 @@ export namespace Networks {
chainCurrency: "AVAX",
});

export const AURORA = new Network({
name: "Aurora",
chainId: ChainId.AURORA,
chainCurrency: "aETH",
});

export const HARMONY = new Network({
name: "Harmony",
chainId: ChainId.HARMONY,
Expand All @@ -130,6 +136,7 @@ export namespace Networks {
[ChainId.MOONRIVER]: MOONRIVER,
[ChainId.ARBITRUM]: ARBITRUM,
[ChainId.AVALANCHE]: AVALANCHE,
[ChainId.AURORA]: AURORA,
[ChainId.HARMONY]: HARMONY,
}

Expand Down
5 changes: 5 additions & 0 deletions src/common/synapse_contracts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,11 @@ export namespace SynapseContracts {
bridge_zap: "0x407Bc506E6F262A0A1F2ea0cC4d66e3bEe29D577",
});

export const Aurora = new SynapseContract({
bridge: "0xaeD5b25BE1c3163c907a471082640450F928DDFE",
bridge_zap: "0x2D8Ee8d6951cB4Eecfe4a79eb9C2F973C02596Ed",
});

export const Harmony = new SynapseContract({
bridge: "0xAf41a65F786339e7911F4acDAD6BD49426F2Dc6b",
bridge_zap: "0x9354b54dFEa0f70ddAdfdB430f304e1CC4D422ab",
Expand Down
1 change: 1 addition & 0 deletions src/common/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ const CHAINID_CONTRACTS_MAP: {[c: number]: SynapseContracts.SynapseContract} = {
[ChainId.MOONRIVER]: SynapseContracts.Moonriver,
[ChainId.ARBITRUM]: SynapseContracts.Arbitrum,
[ChainId.AVALANCHE]: SynapseContracts.Avalanche,
[ChainId.AURORA]: SynapseContracts.Aurora,
[ChainId.HARMONY]: SynapseContracts.Harmony,
}

Expand Down
19 changes: 11 additions & 8 deletions src/rpcproviders/uris.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,17 @@ import {ChainId} from "../common";
dotenv.config()

const
ETH_RPC_URI_ENV: string = "ETH_RPC_URI",
OPTIMISM_RPC_URI_ENV: string = "OPTIMISM_RPC_URI",
BSC_RPC_URI_ENV: string = "BSC_RPC_URI",
POLYGON_RPC_URI_ENV: string = "POLYGON_RPC_URI",
FANTOM_RPC_URI_ENV: string = "FANTOM_RPC_URI",
BOBA_RPC_URI_ENV: string = "BOBA_RPC_URI",
ETH_RPC_URI_ENV: string = "ETH_RPC_URI",
OPTIMISM_RPC_URI_ENV: string = "OPTIMISM_RPC_URI",
BSC_RPC_URI_ENV: string = "BSC_RPC_URI",
POLYGON_RPC_URI_ENV: string = "POLYGON_RPC_URI",
FANTOM_RPC_URI_ENV: string = "FANTOM_RPC_URI",
BOBA_RPC_URI_ENV: string = "BOBA_RPC_URI",
MOONRIVER_RPC_URI_ENV: string = "MOONRIVER_RPC_URI",
ARBITRUM_RPC_URI_ENV: string = "ARBITRUM_RPC_URI",
ARBITRUM_RPC_URI_ENV: string = "ARBITRUM_RPC_URI",
AVALANCHE_RPC_URI_ENV: string = "AVALANCHE_RPC_URI",
HARMONY_RPC_URI_ENV: string = "HARMONY_RPC_URI";
AURORA_RPC_URI_ENV: string = "AURORA_RPC_URI",
HARMONY_RPC_URI_ENV: string = "HARMONY_RPC_URI";


const ENV_KEY_MAP: {[c: number]: string} = {
Expand All @@ -26,6 +27,7 @@ const ENV_KEY_MAP: {[c: number]: string} = {
[ChainId.MOONRIVER]: MOONRIVER_RPC_URI_ENV,
[ChainId.ARBITRUM]: ARBITRUM_RPC_URI_ENV,
[ChainId.AVALANCHE]: AVALANCHE_RPC_URI_ENV,
[ChainId.AURORA]: AURORA_RPC_URI_ENV,
[ChainId.HARMONY]: HARMONY_RPC_URI_ENV,
}

Expand All @@ -39,6 +41,7 @@ const CHAIN_RPC_URIS: {[c: number]: string} = {
[ChainId.MOONRIVER]: "https://rpc.moonriver.moonbeam.network",
[ChainId.ARBITRUM]: "https://arb1.arbitrum.io/rpc",
[ChainId.AVALANCHE]: "https://api.avax.network/ext/bc/C/rpc",
[ChainId.AURORA]: "https://mainnet.aurora.dev",
[ChainId.HARMONY]: "https://api.harmony.one/",
}

Expand Down
24 changes: 24 additions & 0 deletions src/swappools/swappools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,22 @@ export namespace SwapPools {
poolTokens: [Tokens.NUSD, Tokens.DAI, Tokens.USDC, Tokens.USDT],
});

export const AURORA_POOL_SWAP_TOKEN = new SwapToken({
addresses: {
[ChainId.AURORA]: '0xEAdC3524f3F007cdC5104BF28663b1141D3e3127',
},
decimals: 18,
symbol: 'nUSD-LP',
name: 'Synapse nUSD LP Token Aurora',
poolName: 'Aurora Stableswap Pool ',
poolId: 1,
poolType: 'USD',
swapAddresses: {
[ChainId.AURORA]: '0xcEf6C2e20898C2604886b888552CA6CcF66933B0',
},
poolTokens: [Tokens.NUSD, Tokens.USDC, Tokens.USDT],
})

export interface SwapGroupTokenMap {
[grp: string]: Token[]
}
Expand Down Expand Up @@ -380,6 +396,10 @@ export namespace SwapPools {
[SwapType.ETH]: [...AVALANCHE_ETH_SWAP_TOKEN.poolTokensForBridgeSwaps],
[SwapType.OHM]: [Tokens.GOHM],
},
[ChainId.AURORA]: {
[SwapType.USD]: [...AURORA_POOL_SWAP_TOKEN.poolTokensForBridgeSwaps],
[SwapType.SYN]: [Tokens.SYN],
},
[ChainId.HARMONY]: {
[SwapType.USD]: [...HARMONY_POOL_SWAP_TOKEN.poolTokensForBridgeSwaps],
[SwapType.SYN]: [Tokens.SYN],
Expand Down Expand Up @@ -454,6 +474,10 @@ export namespace SwapPools {
...nfdPoolTokens,
...ohmPoolTokens,
},
[ChainId.AURORA]: {
[SwapType.USD]: AURORA_POOL_SWAP_TOKEN,
...synPoolTokens,
},
[ChainId.HARMONY]: {
[SwapType.USD]: HARMONY_POOL_SWAP_TOKEN,
...synPoolTokens,
Expand Down
23 changes: 15 additions & 8 deletions src/tokens/tokens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ export namespace Tokens {
[ChainId.BOBA]: '0xf74195Bb8a5cf652411867c5C2C5b8C2a402be35',
[ChainId.ARBITRUM]: '0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1',
[ChainId.AVALANCHE]: '0xd586E7F844cEa2F87f50152665BCbc2C279D8d70',
[ChainId.HARMONY]: '0xef977d2f931c1978db5f6747666fa1eacb0d0339'
[ChainId.AURORA]: '0xe3520349F477A5F6EB06107066048508498A291b',
[ChainId.HARMONY]: '0xef977d2f931c1978db5f6747666fa1eacb0d0339',
},
swapType: SwapType.USD
});
Expand All @@ -57,6 +58,7 @@ export namespace Tokens {
[ChainId.BOBA]: 6,
[ChainId.AVALANCHE]: 6,
[ChainId.ARBITRUM]: 6,
[ChainId.AURORA]: 6,
[ChainId.HARMONY]: 6,
},
addresses: {
Expand All @@ -67,7 +69,8 @@ export namespace Tokens {
[ChainId.BOBA]: '0x66a2A913e447d6b4BF33EFbec43aAeF87890FBbc',
[ChainId.ARBITRUM]: '0xff970a61a04b1ca14834a43f5de4533ebddb5cc8',
[ChainId.AVALANCHE]: '0xA7D7079b0FEaD91F3e65f86E8915Cb59c1a4C664',
[ChainId.HARMONY]: '0x985458e523db3d53125813ed68c274899e9dfab4'
[ChainId.AURORA]: '0xB12BFcA5A55806AaF64E99521918A4bf0fC40802',
[ChainId.HARMONY]: '0x985458e523db3d53125813ed68c274899e9dfab4',
},
swapType: SwapType.USD
});
Expand All @@ -83,6 +86,7 @@ export namespace Tokens {
[ChainId.BOBA]: 6,
[ChainId.ARBITRUM]: 6,
[ChainId.AVALANCHE]: 6,
[ChainId.AURORA]: 6,
[ChainId.HARMONY]: 6,
},
addresses: {
Expand All @@ -93,7 +97,8 @@ export namespace Tokens {
[ChainId.BOBA]: '0x5DE1677344D3Cb0D7D465c10b72A8f60699C062d',
[ChainId.ARBITRUM]: '0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9',
[ChainId.AVALANCHE]: '0xc7198437980c041c805a1edcba50c1ce5db95118',
[ChainId.HARMONY]: '0x3c2b8be99c50593081eaa2a724f0b8285f5aba8f'
[ChainId.AURORA]: '0x4988a896b1227218e4A686fdE5EabdcAbd91571f',
[ChainId.HARMONY]: '0x3c2b8be99c50593081eaa2a724f0b8285f5aba8f',
},
swapType: SwapType.USD
});
Expand Down Expand Up @@ -189,7 +194,8 @@ export namespace Tokens {
[ChainId.MOONRIVER]: '0xd80d8688b02B3FD3afb81cDb124F188BB5aD0445',
[ChainId.ARBITRUM]: '0x080f6aed32fc474dd5717105dba5ea57268f46eb',
[ChainId.AVALANCHE]: '0x1f1E7c893855525b303f99bDF5c3c05Be09ca251',
[ChainId.HARMONY]: '0xE55e19Fb4F2D85af758950957714292DAC1e25B2'
[ChainId.AURORA]: '0xd80d8688b02B3FD3afb81cDb124F188BB5aD0445',
[ChainId.HARMONY]: '0xE55e19Fb4F2D85af758950957714292DAC1e25B2',
},
swapType: SwapType.SYN
});
Expand All @@ -209,7 +215,8 @@ export namespace Tokens {
[ChainId.BOBA]: '0x6B4712AE9797C199edd44F897cA09BC57628a1CF',
[ChainId.ARBITRUM]: '0x2913E812Cf0dcCA30FB28E6Cac3d2DCFF4497688',
[ChainId.AVALANCHE]: '0xCFc37A6AB183dd4aED08C204D1c2773c0b1BDf46',
[ChainId.HARMONY]: '0xED2a7edd7413021d440b09D654f3b87712abAB66'
[ChainId.AURORA]: '0x07379565cD8B0CaE7c60Dc78e7f601b34AF2A21c',
[ChainId.HARMONY]: '0xED2a7edd7413021d440b09D654f3b87712abAB66',
},
swapType: SwapType.USD,
});
Expand Down Expand Up @@ -249,8 +256,8 @@ export namespace Tokens {
symbol: "HIGH",
decimals: 18,
addresses: {
[ChainId.ETH]: "0x71Ab77b7dbB4fa7e017BC15090b2163221420282",
[ChainId.BSC]: "0x5f4bde007dc06b867f86ebfe4802e34a1ffeed63",
[ChainId.ETH]: "0x71Ab77b7dbB4fa7e017BC15090b2163221420282"
},
swapType: SwapType.HIGH
});
Expand Down Expand Up @@ -284,8 +291,8 @@ export namespace Tokens {
decimals: 18,
addresses: {
[ChainId.BSC]: "0x0fe9778c005a5a6115cbe12b0568a2d50b765a51", // redeem
[ChainId.AVALANCHE]: "0xf1293574ee43950e7a8c9f1005ff097a9a713959", // redeem
[ChainId.POLYGON]: "0x0a5926027d407222f8fe20f24cb16e103f617046", // deposit
[ChainId.AVALANCHE]: "0xf1293574ee43950e7a8c9f1005ff097a9a713959", // redeem
},
swapType: SwapType.NFD,
});
Expand Down Expand Up @@ -313,7 +320,7 @@ export namespace Tokens {
[ChainId.MOONRIVER]: "0x273508478e099Fdf953349e6B3704E7c3dEE91a5",
[ChainId.ARBITRUM]: "0x85662fd123280827e11C59973Ac9fcBE838dC3B4",
[ChainId.AVALANCHE]: "0xcc5672600B948dF4b665d9979357bEF3af56B300",
[ChainId.HARMONY]: "0xFa7191D292d5633f702B0bd7E3E3BcCC0e633200", // Coming soon ;)
[ChainId.HARMONY]: "0xFa7191D292d5633f702B0bd7E3E3BcCC0e633200",
},
swapType: SwapType.FRAX,
})
Expand Down
8 changes: 5 additions & 3 deletions test/basic/Basic-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,16 @@ import {
} from "../../src";

describe("Basic tests", function(this: Mocha.Suite) {
const numChains: number = 11;

describe("Check networks", function(this: Mocha.Suite) {
const
supportedChains = ChainId.supportedChainIds(),
supportedNetworks = Networks.supportedNetworks();

it("supportedChainIds should return 10 chains", () => expect(supportedChains).to.have.a.lengthOf(10))
it(`supportedChainIds should return ${numChains} chains`, () => expect(supportedChains).to.have.a.lengthOf(numChains))

it("supportedNetworks should return 10 networks", () => expect(supportedNetworks).to.have.a.lengthOf(10))
it(`supportedNetworks should return ${numChains} networks`, () => expect(supportedNetworks).to.have.a.lengthOf(numChains))
})

describe("Check swappableTokens", function(this: Mocha.Suite) {
Expand Down Expand Up @@ -50,7 +52,7 @@ describe("Basic tests", function(this: Mocha.Suite) {
})

describe("Check result of swappableTokensAllNetworks", function(this: Mocha.Suite) {
it("should have 10 map entries", () => expect(Object.keys(resC)).to.have.a.lengthOf(10))
it(`should have ${numChains} map entries`, () => expect(Object.keys(resC)).to.have.a.lengthOf(numChains))
})
})
})

0 comments on commit 8a7fbf3

Please sign in to comment.