Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/dutch auction cb bid #1027

Merged
merged 15 commits into from
Jan 15, 2024
Prev Previous commit
Next Next commit
always return full amt
  • Loading branch information
jankjr committed Jan 9, 2024
commit 2ba9deeb0e47589e36d421593551f1fd7ed2bf58
4 changes: 2 additions & 2 deletions contracts/plugins/trading/DutchTradeRouter.sol
Original file line number Diff line number Diff line change
@@ -77,10 +77,10 @@ contract DutchTradeRouter is IDutchTradeCallee {

function _sendBalanceTo(IERC20 token, address to) internal {
uint256 bal = token.balanceOf(address(this));
if (bal <= 1) {
if (bal == 0) {
return;
}
token.safeTransfer(to, bal - 1);
token.safeTransfer(to, bal);
}

// Places a bid on a Dutch auction
2 changes: 1 addition & 1 deletion test/Recollateralization.test.ts
Original file line number Diff line number Diff line change
@@ -3309,7 +3309,7 @@ describe(`Recollateralization - P${IMPLEMENTATION}`, () => {
expect(await trade1.canSettle()).to.equal(false)
expect(await trade1.status()).to.equal(2) // Status.CLOSED
expect(await trade1.bidder()).to.equal(router.address)
expect(await token0.balanceOf(addr1.address)).to.equal(initialBal.sub(1))
expect(await token0.balanceOf(addr1.address)).to.equal(initialBal)

const expected = divCeil(
await dutchBuyAmount(
4 changes: 1 addition & 3 deletions test/Revenues.test.ts
Original file line number Diff line number Diff line change
@@ -3639,9 +3639,7 @@ describe(`Revenues - P${IMPLEMENTATION}`, () => {
expect(await trade.canSettle()).to.equal(false)
expect(await trade.status()).to.equal(2) // Status.CLOSED
expect(await trade.bidder()).to.equal(router.address)
expect(await token0.balanceOf(addr1.address)).to.equal(
initialBal.sub(issueAmount.div(4)).sub(1)
)
expect(await token0.balanceOf(addr1.address)).to.equal(initialBal.sub(issueAmount.div(4)))

const expected = await dutchBuyAmount(
fp(auctionLength).div(auctionLength), // last possible second