-
Notifications
You must be signed in to change notification settings - Fork 75
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add official tokens address and contract wrapper
- Loading branch information
Showing
15 changed files
with
437 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
export * from './token' | ||
export * from './tokens' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) { | ||
console.warn('This contract is only available on mainnet') | ||
} else if (!isMainnet && network.chainId === CHAIN_ID.Mainnet) { | ||
console.warn('This contract is only available on buildnet') | ||
} | ||
}) | ||
} | ||
|
||
///////////////// MAINNET TOKENS ////////////////////// | ||
|
||
export class USDCe extends MRC20 { | ||
constructor(public provider: Provider) { | ||
checkNetwork(provider, true) | ||
super(provider, MAINNET_TOKENS.USDCe) | ||
} | ||
} | ||
|
||
export class USDTb extends MRC20 { | ||
constructor(public provider: Provider) { | ||
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) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
}) | ||
}) |
Oops, something went wrong.
f740ed4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Coverage report for experimental massa-web3
Test suite run success
131 tests passing in 14 suites.
Report generated by 🧪jest coverage report action from f740ed4