-
Notifications
You must be signed in to change notification settings - Fork 75
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
export * from './token' | ||
export * from './tokens' |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
/* eslint-disable @typescript-eslint/naming-convention */ | ||
import { Provider } from '../provider' | ||
import { CHAIN_ID, Network } from '../utils' | ||
import { MRC20 } from './token' | ||
|
||
export const MAINNET_TOKENS = { | ||
USDCe: 'AS1hCJXjndR4c9vekLWsXGnrdigp4AaZ7uYG3UKFzzKnWVsrNLPJ', | ||
USDTb: 'AS12LKs9txoSSy8JgFJgV96m8k5z9pgzjYMYSshwN67mFVuj3bdUV', | ||
DAIe: 'AS1ZGF1upwp9kPRvDKLxFAKRebgg7b3RWDnhgV7VvdZkZsUL7Nuv', | ||
WETHe: 'AS124vf3YfAJCSCQVYKczzuWWpXrximFpbTmX4rheLs5uNSftiiRY', | ||
WETHb: 'AS125oPLYRTtfVjpWisPZVTLjBhCFfQ1jDsi75XNtRm1NZux54eCj', | ||
PUR: 'AS133eqPPaPttJ6hJnk3sfoG5cjFFqBDi1VGxdo2wzWkq8AfZnan', | ||
} | ||
|
||
export const BUILDNET_TOKENS = { | ||
DAIs: 'AS12LpYyAjYRJfYhyu7fkrS224gMdvFHVEeVWoeHZzMdhis7UZ3Eb', | ||
WETHs: 'AS1gt69gqYD92dqPyE6DBRJ7KjpnQHqFzFs2YCkBcSnuxX5bGhBC', | ||
USDCs: 'AS12k8viVmqPtRuXzCm6rKXjLgpQWqbuMjc37YHhB452KSUUb9FgL', | ||
USDTbt: 'AS12ix1Qfpue7BB8q6mWVtjNdNE9UV3x4MaUo7WhdUubov8sJ3CuP', | ||
WETHbt: 'AS12RmCXTA9NZaTBUBnRJuH66AGNmtEfEoqXKxLdmrTybS6GFJPFs', | ||
} | ||
|
||
function checkNetwork(provider: Provider, isMainnet: boolean): void { | ||
provider.networkInfos().then((network: Network) => { | ||
if (isMainnet && network.chainId !== CHAIN_ID.Mainnet) { | ||
Check warning on line 25 in src/contracts-wrappers/tokens.ts GitHub Actions / Coverage annotations (🧪 jest-coverage-report-action)🌿 Branch is not covered
|
||
console.warn('This contract is only available on mainnet') | ||
} else if (!isMainnet && network.chainId === CHAIN_ID.Mainnet) { | ||
Check warning on line 27 in src/contracts-wrappers/tokens.ts GitHub Actions / Coverage annotations (🧪 jest-coverage-report-action)🌿 Branch is not covered
|
||
console.warn('This contract is only available on buildnet') | ||
} | ||
Check warning on line 29 in src/contracts-wrappers/tokens.ts GitHub Actions / Coverage annotations (🧪 jest-coverage-report-action)🧾 Statement is not covered
Check warning on line 29 in src/contracts-wrappers/tokens.ts GitHub Actions / Coverage annotations (🧪 jest-coverage-report-action)🧾 Statement is not covered
Check warning on line 29 in src/contracts-wrappers/tokens.ts GitHub Actions / Coverage annotations (🧪 jest-coverage-report-action)🌿 Branch is not covered
Check warning on line 29 in src/contracts-wrappers/tokens.ts GitHub Actions / Coverage annotations (🧪 jest-coverage-report-action)🌿 Branch is not covered
|
||
}) | ||
} | ||
|
||
///////////////// MAINNET TOKENS ////////////////////// | ||
|
||
export class USDCe extends MRC20 { | ||
constructor(public provider: Provider) { | ||
Check warning on line 36 in src/contracts-wrappers/tokens.ts GitHub Actions / Coverage annotations (🧪 jest-coverage-report-action)🧾 Statement is not covered
|
||
checkNetwork(provider, true) | ||
super(provider, MAINNET_TOKENS.USDCe) | ||
} | ||
} | ||
|
||
export class USDTb extends MRC20 { | ||
constructor(public provider: Provider) { | ||
Check warning on line 43 in src/contracts-wrappers/tokens.ts GitHub Actions / Coverage annotations (🧪 jest-coverage-report-action)🧾 Statement is not covered
|
||
checkNetwork(provider, true) | ||
super(provider, MAINNET_TOKENS.USDTb) | ||
} | ||
} | ||
|
||
export class DAIe extends MRC20 { | ||
constructor(public provider: Provider) { | ||
checkNetwork(provider, true) | ||
super(provider, MAINNET_TOKENS.DAIe) | ||
} | ||
} | ||
|
||
export class WETHe extends MRC20 { | ||
constructor(public provider: Provider) { | ||
checkNetwork(provider, true) | ||
super(provider, MAINNET_TOKENS.WETHe) | ||
} | ||
} | ||
|
||
export class WETHb extends MRC20 { | ||
constructor(public provider: Provider) { | ||
checkNetwork(provider, true) | ||
super(provider, MAINNET_TOKENS.WETHb) | ||
} | ||
} | ||
|
||
export class PUR extends MRC20 { | ||
constructor(public provider: Provider) { | ||
checkNetwork(provider, true) | ||
super(provider, MAINNET_TOKENS.PUR) | ||
} | ||
} | ||
|
||
///////////////// BUILDNET TOKENS ////////////////////// | ||
|
||
export class DAIs extends MRC20 { | ||
constructor(public provider: Provider) { | ||
checkNetwork(provider, false) | ||
super(provider, BUILDNET_TOKENS.DAIs) | ||
} | ||
} | ||
|
||
export class WETHs extends MRC20 { | ||
constructor(public provider: Provider) { | ||
checkNetwork(provider, false) | ||
super(provider, BUILDNET_TOKENS.WETHs) | ||
} | ||
} | ||
|
||
export class USDCs extends MRC20 { | ||
constructor(public provider: Provider) { | ||
checkNetwork(provider, false) | ||
super(provider, BUILDNET_TOKENS.USDCs) | ||
} | ||
} | ||
|
||
export class USDTbt extends MRC20 { | ||
constructor(public provider: Provider) { | ||
checkNetwork(provider, false) | ||
super(provider, BUILDNET_TOKENS.USDTbt) | ||
} | ||
} | ||
|
||
export class WETHbt extends MRC20 { | ||
constructor(public provider: Provider) { | ||
checkNetwork(provider, false) | ||
super(provider, BUILDNET_TOKENS.WETHbt) | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { DAIe } from '../../../src/contracts-wrappers' | ||
import { mainnetProvider } from './../setup' | ||
|
||
describe('DAIe wrapper tests', () => { | ||
let contract: DAIe | ||
beforeAll(async () => { | ||
contract = new DAIe(mainnetProvider) | ||
}) | ||
|
||
test('version', async () => { | ||
const version = await contract.version() | ||
expect(version).toBe('0.0.1') | ||
}) | ||
|
||
test('name', async () => { | ||
const name = await contract.name() | ||
expect(name).toBe('Dai Stablecoin') | ||
}) | ||
|
||
test('symbol', async () => { | ||
const symbol = await contract.symbol() | ||
expect(symbol).toBe('DAI.e') | ||
}) | ||
|
||
test('decimals', async () => { | ||
const decimals = await contract.decimals() | ||
expect(decimals).toBe(18) | ||
}) | ||
}) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { DAIs } from '../../../src/contracts-wrappers' | ||
import { provider } from './../setup' | ||
|
||
describe('DAIs wrapper tests', () => { | ||
let contract: DAIs | ||
beforeAll(async () => { | ||
contract = new DAIs(provider) | ||
}) | ||
|
||
test('version', async () => { | ||
const version = await contract.version() | ||
expect(version).toBe('0.0.1') | ||
}) | ||
|
||
test('name', async () => { | ||
const name = await contract.name() | ||
expect(name).toBe('Sepolia tDAI') | ||
}) | ||
|
||
test('symbol', async () => { | ||
const symbol = await contract.symbol() | ||
expect(symbol).toBe('tDAI.s') | ||
}) | ||
|
||
test('decimals', async () => { | ||
const decimals = await contract.decimals() | ||
expect(decimals).toBe(18) | ||
}) | ||
}) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { PUR } from '../../../src/contracts-wrappers' | ||
import { mainnetProvider } from './../setup' | ||
|
||
describe('PUR wrapper tests', () => { | ||
let contract: PUR | ||
beforeAll(async () => { | ||
contract = new PUR(mainnetProvider) | ||
}) | ||
|
||
test('version', async () => { | ||
const version = await contract.version() | ||
expect(version).toBe('0.0.1') | ||
}) | ||
|
||
test('name', async () => { | ||
const name = await contract.name() | ||
expect(name).toBe('Purrfect Universe') | ||
}) | ||
|
||
test('symbol', async () => { | ||
const symbol = await contract.symbol() | ||
expect(symbol).toBe('PUR') | ||
}) | ||
|
||
test('decimals', async () => { | ||
const decimals = await contract.decimals() | ||
expect(decimals).toBe(18) | ||
}) | ||
}) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { USDCe } from '../../../src/contracts-wrappers' | ||
import { mainnetProvider } from './../setup' | ||
|
||
describe('USDCe wrapper tests', () => { | ||
let contract: USDCe | ||
beforeAll(async () => { | ||
contract = new USDCe(mainnetProvider) | ||
}) | ||
|
||
test('version', async () => { | ||
const version = await contract.version() | ||
expect(version).toBe('0.0.1') | ||
}) | ||
|
||
test('name', async () => { | ||
const name = await contract.name() | ||
expect(name).toBe('USD Coin') | ||
}) | ||
|
||
test('symbol', async () => { | ||
const symbol = await contract.symbol() | ||
expect(symbol).toBe('USDC.e') | ||
}) | ||
|
||
test('decimals', async () => { | ||
const decimals = await contract.decimals() | ||
expect(decimals).toBe(6) | ||
}) | ||
}) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { USDCs } from '../../../src/contracts-wrappers' | ||
import { provider } from './../setup' | ||
|
||
describe('USDCs wrapper tests', () => { | ||
let contract: USDCs | ||
beforeAll(async () => { | ||
contract = new USDCs(provider) | ||
}) | ||
|
||
test('version', async () => { | ||
const version = await contract.version() | ||
expect(version).toBe('0.0.1') | ||
}) | ||
|
||
test('name', async () => { | ||
const name = await contract.name() | ||
expect(name).toBe('Sepolia USDC') | ||
}) | ||
|
||
test('symbol', async () => { | ||
const symbol = await contract.symbol() | ||
expect(symbol).toBe('USDC.s') | ||
}) | ||
|
||
test('decimals', async () => { | ||
const decimals = await contract.decimals() | ||
expect(decimals).toBe(6) | ||
}) | ||
}) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { USDTb } from '../../../src/contracts-wrappers' | ||
import { mainnetProvider } from './../setup' | ||
|
||
describe('USDTb wrapper tests', () => { | ||
let contract: USDTb | ||
beforeAll(async () => { | ||
contract = new USDTb(mainnetProvider) | ||
}) | ||
|
||
test('version', async () => { | ||
const version = await contract.version() | ||
expect(version).toBe('0.0.1') | ||
}) | ||
|
||
test('name', async () => { | ||
const name = await contract.name() | ||
expect(name).toBe('Bsc USDT') | ||
}) | ||
|
||
test('symbol', async () => { | ||
const symbol = await contract.symbol() | ||
expect(symbol).toBe('USDT.b') | ||
}) | ||
|
||
test('decimals', async () => { | ||
const decimals = await contract.decimals() | ||
expect(decimals).toBe(18) | ||
}) | ||
}) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { USDTbt } from '../../../src/contracts-wrappers' | ||
import { provider } from './../setup' | ||
|
||
describe('USDTbt wrapper tests', () => { | ||
let contract: USDTbt | ||
beforeAll(async () => { | ||
contract = new USDTbt(provider) | ||
}) | ||
|
||
test('version', async () => { | ||
const version = await contract.version() | ||
expect(version).toBe('0.0.1') | ||
}) | ||
|
||
test('name', async () => { | ||
const name = await contract.name() | ||
expect(name).toBe('Binance-peg USD') | ||
}) | ||
|
||
test('symbol', async () => { | ||
const symbol = await contract.symbol() | ||
expect(symbol).toBe('USDT.bt') | ||
}) | ||
|
||
test('decimals', async () => { | ||
const decimals = await contract.decimals() | ||
expect(decimals).toBe(18) | ||
}) | ||
}) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { WETHb } from '../../../src/contracts-wrappers' | ||
import { mainnetProvider } from './../setup' | ||
|
||
describe('WETH.b wrapper tests', () => { | ||
let contract: WETHb | ||
beforeAll(async () => { | ||
contract = new WETHb(mainnetProvider) | ||
}) | ||
|
||
test('version', async () => { | ||
const version = await contract.version() | ||
expect(version).toBe('0.0.1') | ||
}) | ||
|
||
test('name', async () => { | ||
const name = await contract.name() | ||
expect(name).toBe('Bsc ETH') | ||
}) | ||
|
||
test('symbol', async () => { | ||
const symbol = await contract.symbol() | ||
expect(symbol).toBe('WETH.b') | ||
}) | ||
|
||
test('decimals', async () => { | ||
const decimals = await contract.decimals() | ||
expect(decimals).toBe(18) | ||
}) | ||
}) |