-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from kulapio/add-uni-sushi
Add UNI and SUSHI
- Loading branch information
Showing
5 changed files
with
109 additions
and
36 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,2 +1,2 @@ | ||
CMC_API_KEY=xxx // CoinMarketCap Key | ||
CMC_API_KEY=xxx // CoinMarketCap Key for unit test | ||
KULAP_API_BASH_URL=https://api.kulap.io/v1/api // Optional |
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,49 @@ | ||
require('dotenv').config() | ||
import { | ||
CMC_IDS_MAP, | ||
SUPPORTED_TOKENS, | ||
TOKEN_ADDRESSES, | ||
TOKEN_DECIMALS, | ||
KULAP_DEX_CONTRACT | ||
} from '../src/constants' | ||
|
||
function length(object: Object) { | ||
return Object.keys(object).length | ||
} | ||
|
||
describe('Asset', () => { | ||
test('Configure Asset Information correctly', async () => { | ||
// Number of assets | ||
expect(length(CMC_IDS_MAP) - 1).toEqual(SUPPORTED_TOKENS.length) // exclude BTC | ||
expect(length(TOKEN_ADDRESSES)).toEqual(SUPPORTED_TOKENS.length) | ||
expect(length(TOKEN_DECIMALS)).toEqual(SUPPORTED_TOKENS.length) | ||
|
||
// Asset informations | ||
const tokens = SUPPORTED_TOKENS.sort() | ||
const cmcIdAssets = Object.values(CMC_IDS_MAP).sort().filter(asset => asset !== 'BTC') | ||
const tokenAddressAssets = Object.keys(TOKEN_ADDRESSES).sort() | ||
const tokenDecimalsAssets = Object.keys(TOKEN_DECIMALS).sort() | ||
expect(cmcIdAssets).toEqual(tokens) | ||
expect(tokenAddressAssets).toEqual(tokens) | ||
expect(tokenDecimalsAssets).toEqual(tokens) | ||
|
||
// Token addresses | ||
Object.entries(TOKEN_ADDRESSES).forEach(([key, tokenAddress]) => { | ||
expect([tokenAddress, tokenAddress.length]).toEqual([tokenAddress, 42]) | ||
expect([tokenAddress, tokenAddress.slice(0, 2)]).toEqual([tokenAddress, '0x']) | ||
}) | ||
|
||
// Token decimals | ||
Object.entries(TOKEN_DECIMALS).forEach(([key, tokenDecimals]) => { | ||
expect(tokenDecimals).toBeGreaterThan(0) | ||
expect(tokenDecimals).toBeLessThanOrEqual(18) | ||
}) | ||
}) | ||
|
||
test('Dex', async () => { | ||
// Dex Contract Address | ||
expect(KULAP_DEX_CONTRACT).toEqual('0x3833cf2972394d636b1C5b80d34FeE1F17175b77') | ||
expect(KULAP_DEX_CONTRACT.length).toEqual(42) | ||
expect(KULAP_DEX_CONTRACT.slice(0, 2)).toEqual('0x') | ||
}) | ||
}) |
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