Skip to content

Commit

Permalink
fix: Remove minimum bid limit (#257)
Browse files Browse the repository at this point in the history
  • Loading branch information
valiafetisov authored May 11, 2022
1 parent 9f06478 commit e2a52fa
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 24 deletions.
26 changes: 7 additions & 19 deletions frontend/components/transaction/BidTransactionTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@
<span v-else class="opacity-50">Unknown</span>
</div>
</div>
<div v-if="auctionTransaction.minimumBidDai" class="flex justify-between">
<div>Minimum leftover</div>
<div>
<format-currency :value="auctionTransaction.minimumBidDai" currency="DAI" />
</div>
</div>
<div class="flex justify-between">
<span v-if="!isActive || !auctionTransaction.debtDAI || isTooSmallToPartiallyTake">Auction debt</span>
<button v-else class="ClickableText" @click="setTransactionBidAmount(undefined)">Set maximum bid</button>
Expand All @@ -65,24 +71,6 @@
<span v-else class="opacity-50">Unknown</span>
</button>
</div>
<div class="flex justify-between">
<span v-if="!isActive || !auctionTransaction.minimumBidDai || isTooSmallToPartiallyTake">Minimum bid</span>
<button v-else class="ClickableText" @click="setTransactionBidAmount(auctionTransaction.minimumBidDai)">
Set minimum bid
</button>
<button
class="ClickableText"
:disabled="!isActive || !auctionTransaction.minimumBidDai || isTooSmallToPartiallyTake"
@click="setTransactionBidAmount(auctionTransaction.minimumBidDai)"
>
<format-currency
v-if="auctionTransaction.minimumBidDai"
:value="auctionTransaction.minimumBidDai"
currency="DAI"
/>
<div v-else class="opacity-50">Unknown</div>
</button>
</div>
<div class="flex justify-between items-center">
<div>The amount to bid</div>
<div class="flex w-1/2 items-center space-x-2 justify-end -mr-1">
Expand Down Expand Up @@ -153,7 +141,7 @@ export default Vue.extend({
return !!this.transactionBidAmount?.isNaN();
},
isTooSmallToPartiallyTake(): boolean {
return this.auctionTransaction.debtDAI.isLessThan(this.auctionTransaction.minimumBidDai.multipliedBy(2));
return this.auctionTransaction.debtDAI.isLessThanOrEqualTo(this.auctionTransaction.minimumBidDai);
},
},
watch: {
Expand Down
8 changes: 3 additions & 5 deletions frontend/components/utils/BidInput.vue
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,10 @@ export default Vue.extend({
return;
}
const bidTopLimit = maxValue?.minus(minValue);
if (currentValue?.isGreaterThan(bidTopLimit) || currentValue?.isLessThan(minValue)) {
throw new Error(
`The value can only be between ${minValue.toFixed(2)} and ${bidTopLimit.toFixed(2)} or the maximum`
);
if (currentValue?.isGreaterThan(bidTopLimit)) {
throw new Error(`The value can only be less than ${bidTopLimit.toFixed(2)} or the maximum`);
}
if (maxValue?.isLessThan(minValue.multipliedBy(2))) {
if (maxValue?.isLessThan(minValue)) {
throw new Error('The value can not be changed since the leftover part will be too small');
}
},
Expand Down

0 comments on commit e2a52fa

Please sign in to comment.