diff --git a/src/modules/pair/mocks/pair.constants.ts b/src/modules/pair/mocks/pair.constants.ts index eafdc3c6d..51d61f9b7 100644 --- a/src/modules/pair/mocks/pair.constants.ts +++ b/src/modules/pair/mocks/pair.constants.ts @@ -94,6 +94,35 @@ export const Tokens = (tokenID: string): EsdtToken => { price: '1', roles: new RolesModel(), }); + case 'USDT-123456': + return new EsdtToken({ + identifier: 'USDT-123456', + name: 'TetherUSD', + ticker: 'USDT', + owner: Address.fromHex( + '0000000000000000000000000000000000000000000000000000000000000001', + ).bech32(), + supply: '1000000000000', + decimals: 6, + isPaused: false, + canUpgrade: true, + canMint: true, + canBurn: true, + canChangeOwner: true, + canPause: true, + canFreeze: true, + canWipe: true, + type: 'Core', + minted: '1', + burnt: '1', + circulatingSupply: '1', + accounts: 1, + transactions: 1, + assets: new AssetsModel(), + initialMinted: '1', + price: '1', + roles: new RolesModel(), + }); case 'TOK4-123456': return new EsdtToken({ identifier: 'TOK4-123456', @@ -304,6 +333,87 @@ export const Tokens = (tokenID: string): EsdtToken => { price: '10', roles: new RolesModel(), }); + case 'TOK5USDCLP-abcdef': + return new EsdtToken({ + identifier: 'TOK5USDCLP-abcdef', + name: 'TOK5USDCLP', + ticker: 'TOK5USDCLP', + type: 'FungibleESDT', + owner: scAddress.routerAddress, + supply: '1000000000000000000000000', + decimals: 18, + isPaused: false, + canUpgrade: true, + canMint: true, + canBurn: true, + canChangeOwner: true, + canPause: true, + canFreeze: true, + canWipe: true, + minted: '900000000000000000000000', + burnt: '1', + circulatingSupply: '1', + accounts: 1, + transactions: 1, + assets: new AssetsModel(), + initialMinted: '1', + price: '10', + roles: new RolesModel(), + }); + case 'TOK5USDTLP-abcdef': + return new EsdtToken({ + identifier: 'TOK5USDTLP-abcdef', + name: 'TOK5USDTLP', + ticker: 'TOK5USDTLP', + type: 'FungibleESDT', + owner: scAddress.routerAddress, + supply: '1000000000000000000000000', + decimals: 18, + isPaused: false, + canUpgrade: true, + canMint: true, + canBurn: true, + canChangeOwner: true, + canPause: true, + canFreeze: true, + canWipe: true, + minted: '900000000000000000000000', + burnt: '1', + circulatingSupply: '1', + accounts: 1, + transactions: 1, + assets: new AssetsModel(), + initialMinted: '1', + price: '10', + roles: new RolesModel(), + }); + case 'EGLDUSDTLP-abcdef': + return new EsdtToken({ + identifier: 'EGLDUSDTLP-abcdef', + name: 'EGLDUSDTLP', + ticker: 'EGLDUSDTLP', + type: 'FungibleESDT', + owner: scAddress.routerAddress, + supply: '1000000000000000000000000', + decimals: 18, + isPaused: false, + canUpgrade: true, + canMint: true, + canBurn: true, + canChangeOwner: true, + canPause: true, + canFreeze: true, + canWipe: true, + minted: '900000000000000000000000', + burnt: '1', + circulatingSupply: '1', + accounts: 1, + transactions: 1, + assets: new AssetsModel(), + initialMinted: '1', + price: '10', + roles: new RolesModel(), + }); case 'EGLDMEXFL-abcdef': return { identifier: 'EGLDMEXFL-abcdef', @@ -545,6 +655,75 @@ export const pairs = [ totalFeePercent: 0.003, state: 'Active', }, + { + address: Address.fromHex( + '0000000000000000000000000000000000000000000000000000000000000017', + ).bech32(), + firstToken: Tokens('TOK5-123456'), + secondToken: Tokens('USDC-123456'), + liquidityPoolToken: Tokens('TOK5USDCLP-abcdef'), + info: { + reserves0: '10000000000000000000', + reserves1: '1000000', + totalSupply: '1000000000000000000000', + }, + firstTokenPrice: '0.1', + firstTokenPriceUSD: '0.1', + secondTokenPrice: '10', + secondTokenPriceUSD: '1', + liquidityPoolTokenPriceUSD: '20', + firstTokenLockedValueUSD: '10000', + secondTokenLockedValueUSD: '10000', + lockedValueUSD: '20000', + totalFeePercent: 0.003, + state: 'Active', + }, + { + address: Address.fromHex( + '0000000000000000000000000000000000000000000000000000000000000018', + ).bech32(), + firstToken: Tokens('TOK5-123456'), + secondToken: Tokens('USDT-123456'), + liquidityPoolToken: Tokens('TOK5USDTLP-abcdef'), + info: { + reserves0: '990000000000000000000000', + reserves1: '100000000000', + totalSupply: '1000000000000000000000', + }, + firstTokenPrice: '0.1010101010101010101010101', + firstTokenPriceUSD: '0.101', + secondTokenPrice: '9.9', + secondTokenPriceUSD: '1', + liquidityPoolTokenPriceUSD: '20', + firstTokenLockedValueUSD: '10000', + secondTokenLockedValueUSD: '10000', + lockedValueUSD: '20000', + totalFeePercent: 0.003, + state: 'Active', + }, + { + address: Address.fromHex( + '0000000000000000000000000000000000000000000000000000000000000019', + ).bech32(), + firstToken: Tokens('WEGLD-123456'), + secondToken: Tokens('USDT-123456'), + liquidityPoolToken: Tokens('EGLDUSDTLP-abcdef'), + info: { + reserves0: '1000000000000000000000', + reserves1: '10000000000', + totalSupply: '10000000000', + }, + firstTokenPrice: '10', + firstTokenPriceUSD: '10', + secondTokenPrice: '0.1', + secondTokenPriceUSD: '1', + liquidityPoolTokenPriceUSD: '20', + firstTokenLockedValueUSD: '10000', + secondTokenLockedValueUSD: '10000', + lockedValueUSD: '20000', + totalFeePercent: 0.003, + state: 'Active', + }, ]; export async function PairsMap(): Promise> { diff --git a/src/modules/router/specs/router.service.spec.ts b/src/modules/router/specs/router.service.spec.ts index d897585c8..0d59bfa8d 100644 --- a/src/modules/router/specs/router.service.spec.ts +++ b/src/modules/router/specs/router.service.spec.ts @@ -71,6 +71,21 @@ describe('RouterService', () => { '0000000000000000000000000000000000000000000000000000000000000016', ).bech32(), }), + new PairModel({ + address: Address.fromHex( + '0000000000000000000000000000000000000000000000000000000000000017', + ).bech32(), + }), + new PairModel({ + address: Address.fromHex( + '0000000000000000000000000000000000000000000000000000000000000018', + ).bech32(), + }), + new PairModel({ + address: Address.fromHex( + '0000000000000000000000000000000000000000000000000000000000000019', + ).bech32(), + }), ]); }); @@ -100,6 +115,11 @@ describe('RouterService', () => { '0000000000000000000000000000000000000000000000000000000000000015', ).bech32(), }), + new PairModel({ + address: Address.fromHex( + '0000000000000000000000000000000000000000000000000000000000000019', + ).bech32(), + }), ]); }); }); diff --git a/src/modules/tokens/specs/token.compute.service.spec.ts b/src/modules/tokens/specs/token.compute.service.spec.ts index dfeea9172..e01a07e61 100644 --- a/src/modules/tokens/specs/token.compute.service.spec.ts +++ b/src/modules/tokens/specs/token.compute.service.spec.ts @@ -53,6 +53,7 @@ describe('TokenComputeService', () => { module.get(TokenComputeService); const price = await service.computeTokenPriceDerivedEGLD( tokenProviderUSD, + [], ); expect(price).toEqual('1'); }); @@ -60,28 +61,40 @@ describe('TokenComputeService', () => { it('should compute token price derived EGLD for MEX-123456', async () => { const service: TokenComputeService = module.get(TokenComputeService); - const price = await service.computeTokenPriceDerivedEGLD('MEX-123456'); + const price = await service.computeTokenPriceDerivedEGLD( + 'MEX-123456', + [], + ); expect(price).toEqual('0.001'); }); it('should compute token price derived EGLD for TOK4-123456', async () => { const service: TokenComputeService = module.get(TokenComputeService); - const price = await service.computeTokenPriceDerivedEGLD('TOK4-123456'); + const price = await service.computeTokenPriceDerivedEGLD( + 'TOK4-123456', + [], + ); expect(price).toEqual('0.01'); }); it('should compute token price derived EGLD for TOK5-123456', async () => { const service: TokenComputeService = module.get(TokenComputeService); - const price = await service.computeTokenPriceDerivedEGLD('TOK5-123456'); - expect(price).toEqual('0.01'); + const price = await service.computeTokenPriceDerivedEGLD( + 'TOK5-123456', + [], + ); + expect(price).toEqual('0.01010101010101010101010101'); }); it('should compute token price derived EGLD for TOK6-123456', async () => { const service: TokenComputeService = module.get(TokenComputeService); - const price = await service.computeTokenPriceDerivedEGLD('TOK6-123456'); - expect(price).toEqual('0.01'); + const price = await service.computeTokenPriceDerivedEGLD( + 'TOK6-123456', + [], + ); + expect(price).toEqual('0.01010101010101010101010101'); }); });