Skip to content

Commit

Permalink
added a/b symbol for PoolPairData (#332)
Browse files Browse the repository at this point in the history
  • Loading branch information
fuxingloh authored Aug 10, 2021
1 parent 19f396e commit dc84e03
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
6 changes: 5 additions & 1 deletion apps/whale/src/module.api/poolpair.controller.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,13 @@ describe('list', () => {
status: true,
tokenA: {
id: '2',
symbol: 'B',
reserve: '50',
blockCommission: '0'
},
tokenB: {
id: '0',
symbol: 'DFI',
reserve: '300',
blockCommission: '0'
},
Expand Down Expand Up @@ -171,11 +173,13 @@ describe('get', () => {
status: true,
tokenA: {
id: expect.any(String),
symbol: 'A',
reserve: '100',
blockCommission: '0'
},
tokenB: {
id: expect.any(String),
id: '0',
symbol: 'DFI',
reserve: '200',
blockCommission: '0'
},
Expand Down
6 changes: 5 additions & 1 deletion apps/whale/src/module.api/poolpair.controller.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,11 +128,13 @@ describe('list', () => {
status: true,
tokenA: {
id: '2',
symbol: 'B',
reserve: '50',
blockCommission: '0'
},
tokenB: {
id: '0',
symbol: 'DFI',
reserve: '300',
blockCommission: '0'
},
Expand Down Expand Up @@ -204,11 +206,13 @@ describe('get', () => {
status: true,
tokenA: {
id: expect.any(String),
symbol: 'USDT',
reserve: '100',
blockCommission: '0'
},
tokenB: {
id: expect.any(String),
id: '0',
symbol: 'DFI',
reserve: '200',
blockCommission: '0'
},
Expand Down
3 changes: 3 additions & 0 deletions apps/whale/src/module.api/poolpair.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,17 +63,20 @@ export class PoolPairController {
}

function mapPoolPair (id: string, info: PoolPairInfo, totalLiquidityUsd?: BigNumber, apr?: PoolPairData['apr']): PoolPairData {
const [symbolA, symbolB] = info.symbol.split('-')
return {
id: id,
symbol: info.symbol,
name: info.name,
status: info.status,
tokenA: {
symbol: symbolA,
id: info.idTokenA,
reserve: info.reserveA.toFixed(),
blockCommission: info.blockCommissionA.toFixed()
},
tokenB: {
symbol: symbolB,
id: info.idTokenB,
reserve: info.reserveB.toFixed(),
blockCommission: info.blockCommissionB.toFixed()
Expand Down

0 comments on commit dc84e03

Please sign in to comment.