From e34ed11a8942301921f39681cc609ff1a17368a8 Mon Sep 17 00:00:00 2001 From: Tempe Techie <95053628+tempe-techie@users.noreply.github.com> Date: Wed, 31 Jan 2024 12:53:49 +0100 Subject: [PATCH] TEST token added, decimals formatting improved --- assets/data/tokens.json | 22 +++------------------- components/swap/SimpleSwap.vue | 8 +++++++- 2 files changed, 10 insertions(+), 20 deletions(-) diff --git a/assets/data/tokens.json b/assets/data/tokens.json index 1872078..efe28d5 100644 --- a/assets/data/tokens.json +++ b/assets/data/tokens.json @@ -18,26 +18,10 @@ }, { "chainId": 919, - "address": "0x6Dcf6809e0386A93323f8bde9Bf35E414a32a0CF", + "address": "0xfAE210dfa2AC6CaF9Aaf9AeaDbB00A9B339B1e47", "decimals": 18, - "name": "USDC", - "symbol": "USDC", - "swap": true - }, - { - "chainId": 919, - "address": "0xf60A79Bb58f9d365D64Ff6141FB3ba6166BDE21D", - "decimals": 18, - "name": "USDT", - "symbol": "USDT", - "swap": true - }, - { - "chainId": 919, - "address": "0x9e5AAC1Ba1a2e6aEd6b32689DFcF62A509Ca96f3", - "decimals": 18, - "name": "DAI", - "symbol": "DAI", + "name": "Test Token", + "symbol": "TEST", "swap": true } ] diff --git a/components/swap/SimpleSwap.vue b/components/swap/SimpleSwap.vue index cc932b0..58cced3 100644 --- a/components/swap/SimpleSwap.vue +++ b/components/swap/SimpleSwap.vue @@ -338,8 +338,14 @@ export default { return 0; } else if (amount > 100) { return Number(amount).toFixed(2); - } else { + } else if (amount > 1) { return Number(amount).toFixed(4); + } else if (amount > 0.01) { + return Number(amount).toFixed(6); + } else if (amount > 0.0001) { + return Number(amount).toFixed(8); + } else { + return Number(amount).toFixed(10); } }