Skip to content

Commit

Permalink
feat: matic mOCEAN token (#494)
Browse files Browse the repository at this point in the history
  • Loading branch information
benjlevesque committed May 3, 2021
1 parent 7dbbd6d commit a38e26a
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 0 deletions.
3 changes: 3 additions & 0 deletions packages/currency/src/erc20/networks/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { RequestLogicTypes } from '@requestnetwork/types';
import { supportedRinkebyERC20, supportedRinkebyERC20Details } from './rinkeby';
import { supportedMainnetERC20, supportedMainnetERC20Details } from './mainnet';
import { supportedCeloERC20, supportedCeloERC20Details } from './celo';
import { supportedMaticERC20, supportedMaticERC20Details } from './matic';

/**
* ERC20 Symbol details type
Expand Down Expand Up @@ -33,10 +34,12 @@ export const supportedNetworks: ISupportedNetworksMap = {
celo: supportedCeloERC20,
rinkeby: supportedRinkebyERC20,
mainnet: supportedMainnetERC20,
matic: supportedMaticERC20,
};

export const supportedNetworksDetails: ISupportedNetworksDetails = {
celo: supportedCeloERC20Details,
rinkeby: supportedRinkebyERC20Details,
mainnet: supportedMainnetERC20Details,
matic: supportedMaticERC20Details,
};
22 changes: 22 additions & 0 deletions packages/currency/src/erc20/networks/matic.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { RequestLogicTypes } from '@requestnetwork/types';

// List of the supported matic network tokens
export const supportedMaticERC20 = new Map([
// mOCEAN https://explorer-mainnet.maticvigil.com/address/0x282d8efCe846A88B159800bd4130ad77443Fa1A1
[
'mOCEAN',
{
network: 'matic',
type: RequestLogicTypes.CURRENCY.ERC20,
value: '0x282d8efCe846A88B159800bd4130ad77443Fa1A1',
},
],
]);

export const supportedMaticERC20Details = {
mOCEAN: {
address: '0x282d8efCe846A88B159800bd4130ad77443Fa1A1',
decimals: 18,
name: 'Ocean Token (PoS)',
},
};
27 changes: 27 additions & 0 deletions packages/currency/test/token.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,33 @@ describe('api/currency Token', () => {
});
});

describe('matic', () => {
it('mOCEAN from mOCEAN', () => {
expect(Token.from('mOCEAN')).toMatchObject({
symbol: 'mOCEAN',
type: RequestLogicTypes.CURRENCY.ERC20,
value: '0x282d8efCe846A88B159800bd4130ad77443Fa1A1',
network: 'matic',
});
});
it('mOCEAN from mOCEAN-matic', () => {
expect(Token.from('mOCEAN-matic')).toMatchObject({
symbol: 'mOCEAN',
type: RequestLogicTypes.CURRENCY.ERC20,
value: '0x282d8efCe846A88B159800bd4130ad77443Fa1A1',
network: 'matic',
});
});
it('mOCEAN from address', () => {
expect(Token.from('0x282d8efCe846A88B159800bd4130ad77443Fa1A1')).toMatchObject({
symbol: 'mOCEAN',
type: RequestLogicTypes.CURRENCY.ERC20,
value: '0x282d8efCe846A88B159800bd4130ad77443Fa1A1',
network: 'matic',
});
});
});

describe('errors', () => {
it('Unsupported tokens should throw', () => {
expect(() => Token.from('UNSUPPORTED')).toThrow(
Expand Down

0 comments on commit a38e26a

Please sign in to comment.