mirror of
https://github.com/oceanprotocol/ocean.js.git
synced 2024-11-26 20:39:05 +01:00
Merge pull request #267 from oceanprotocol/bug/fix_FixedRate_searchForDT
Fix/check in searchForDT
This commit is contained in:
commit
7373cff011
@ -347,10 +347,10 @@ export class OceanFixedRateExchange {
|
||||
for (let i = 0; i < events.length; i++) {
|
||||
const constituents = await this.getExchange(events[i].returnValues[0])
|
||||
constituents.exchangeID = events[i].returnValues[0]
|
||||
if (constituents.active === true) {
|
||||
const supply = new BigNumber(this.web3.utils.fromWei(constituents.supply))
|
||||
if (constituents.active === true && constituents.dataToken === dataTokenAddress) {
|
||||
const supply = new BigNumber(await this.getSupply(constituents.exchangeID))
|
||||
const required = new BigNumber(minSupply)
|
||||
if (supply >= required) {
|
||||
if (supply.gte(required)) {
|
||||
result.push(constituents)
|
||||
}
|
||||
}
|
||||
|
@ -173,6 +173,7 @@ describe('FixedRateExchange flow', () => {
|
||||
it('Bob should find the exchange', async () => {
|
||||
const exchangeDetails = await FixedRateClass.searchforDT(tokenAddress, '0')
|
||||
assert(exchangeDetails[0].exchangeID === aliceExchangeId)
|
||||
assert(exchangeDetails.length === 1)
|
||||
})
|
||||
it('Bob should get the exchange details', async () => {
|
||||
const exchangeDetails = await FixedRateClass.getExchange(aliceExchangeId)
|
||||
@ -221,4 +222,8 @@ describe('FixedRateExchange flow', () => {
|
||||
const exchangeDetails = await FixedRateClass.getExchange(aliceExchangeId)
|
||||
assert(exchangeDetails.active === true)
|
||||
})
|
||||
it('Bob should not find the exchange', async () => {
|
||||
const exchangeDetails = await FixedRateClass.searchforDT(tokenAddress, tokenAmount)
|
||||
assert(exchangeDetails.length === 0)
|
||||
})
|
||||
})
|
||||
|
Loading…
x
Reference in New Issue
Block a user