Skip to content

Commit

Permalink
feat(billboard): return tax on withdrawTax
Browse files Browse the repository at this point in the history
  • Loading branch information
robertu7 committed Feb 21, 2024
1 parent 9ba5d6a commit 4b0db89
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 12 deletions.
20 changes: 10 additions & 10 deletions .gas-snapshot
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ ACLManagerTest:testTransferRole() (gas: 21528)
BillboardTest:testAddToWhitelist() (gas: 35114)
BillboardTest:testApproveAndTransfer() (gas: 162468)
BillboardTest:testCalculateTax() (gas: 21760)
BillboardTest:testCannnotWithdrawTaxIfSmallAmount(uint8) (runs: 256, μ: 519318, ~: 524555)
BillboardTest:testCannnotWithdrawTaxIfZero() (gas: 490374)
BillboardTest:testCannnotWithdrawTaxIfSmallAmount(uint8) (runs: 256, μ: 519077, ~: 524563)
BillboardTest:testCannnotWithdrawTaxIfZero() (gas: 490384)
BillboardTest:testCannotAddToWhitelistByAttacker() (gas: 9037)
BillboardTest:testCannotApproveByAttacker() (gas: 130281)
BillboardTest:testCannotClearAuctionIfAuctionNotEnded() (gas: 700985)
BillboardTest:testCannotClearAuctionOnNewBoard() (gas: 136261)
BillboardTest:testCannotMintBoardByAttacker() (gas: 13321)
BillboardTest:testCannotPlaceBidByAttacker() (gas: 246293)
BillboardTest:testCannotPlaceBidTwice(uint96) (runs: 256, μ: 749802, ~: 754906)
BillboardTest:testCannotPlaceBidTwice(uint96) (runs: 256, μ: 749739, ~: 754904)
BillboardTest:testCannotRemoveToWhitelistByAttacker() (gas: 9104)
BillboardTest:testCannotSafeTransferByAttacker() (gas: 127438)
BillboardTest:testCannotSetBoardProprtiesByAttacker() (gas: 157292)
Expand All @@ -34,29 +34,29 @@ BillboardTest:testCannotWithdrawBidIfAuctionNotCleared(uint96) (runs: 256, μ: 9
BillboardTest:testCannotWithdrawBidIfAuctionNotEnded(uint96) (runs: 256, μ: 725782, ~: 725782)
BillboardTest:testCannotWithdrawBidIfNotFound() (gas: 428052)
BillboardTest:testCannotWithdrawBidIfWon(uint96) (runs: 256, μ: 834282, ~: 834282)
BillboardTest:testCannotWithdrawTaxByAttacker() (gas: 16677)
BillboardTest:testCannotWithdrawTaxByAttacker() (gas: 16687)
BillboardTest:testClearAuctionIfAuctionEnded(uint96) (runs: 256, μ: 837581, ~: 837581)
BillboardTest:testClearAuctionsIfAuctionEnded() (gas: 1379962)
BillboardTest:testGetBids(uint8,uint8,uint8) (runs: 256, μ: 4580822, ~: 2075259)
BillboardTest:testGetBids(uint8,uint8,uint8) (runs: 256, μ: 4390609, ~: 2070952)
BillboardTest:testGetTokenURI() (gas: 154936)
BillboardTest:testMintBoard() (gas: 225541)
BillboardTest:testMintBoardByWhitelist() (gas: 154942)
BillboardTest:testMintBoardIfOpened() (gas: 145715)
BillboardTest:testPlaceBidByWhitelist() (gas: 579179)
BillboardTest:testPlaceBidIfAuctionEnded() (gas: 1090700)
BillboardTest:testPlaceBidOnNewBoard(uint96) (runs: 256, μ: 618577, ~: 635089)
BillboardTest:testPlaceBidWithHigherPrice(uint96) (runs: 256, μ: 905402, ~: 913254)
BillboardTest:testPlaceBidWithSamePrices(uint96) (runs: 256, μ: 908177, ~: 918050)
BillboardTest:testPlaceBidOnNewBoard(uint96) (runs: 256, μ: 619044, ~: 635089)
BillboardTest:testPlaceBidWithHigherPrice(uint96) (runs: 256, μ: 905247, ~: 913254)
BillboardTest:testPlaceBidWithSamePrices(uint96) (runs: 256, μ: 908333, ~: 918050)
BillboardTest:testPlaceBidZeroPrice() (gas: 376947)
BillboardTest:testRemoveToWhitelist() (gas: 23188)
BillboardTest:testSafeTransferByOperator() (gas: 141193)
BillboardTest:testSetBoardProperties() (gas: 305972)
BillboardTest:testSetBoardPropertiesAfterTransfer() (gas: 335477)
BillboardTest:testSetIsOpened() (gas: 22661)
BillboardTest:testSetTaxRate() (gas: 22887)
BillboardTest:testUpgradeRegistry() (gas: 3131297)
BillboardTest:testUpgradeRegistry() (gas: 3132307)
BillboardTest:testWithdrawBid(uint96) (runs: 256, μ: 1081415, ~: 1081415)
BillboardTest:testWithdrawTax(uint96) (runs: 256, μ: 597638, ~: 597638)
BillboardTest:testWithdrawTax(uint96) (runs: 256, μ: 597714, ~: 597714)
CurationTest:testCannotCurateERC20CurateZeroAmount() (gas: 12194)
CurationTest:testCannotCurateERC20EmptyURI() (gas: 15797)
CurationTest:testCannotCurateERC20IfNotApproval() (gas: 21624)
Expand Down
4 changes: 3 additions & 1 deletion src/Billboard/Billboard.sol
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ contract Billboard is IBillboard {
}

/// @inheritdoc IBillboard
function withdrawTax() external {
function withdrawTax() external returns (uint256 tax) {
(uint256 _taxAccumulated, uint256 _taxWithdrawn) = registry.taxTreasury(msg.sender);

uint256 amount = _taxAccumulated - _taxWithdrawn;
Expand All @@ -354,6 +354,8 @@ contract Billboard is IBillboard {

// emit TaxWithdrawn
registry.emitTaxWithdrawn(msg.sender, amount);

return amount;
}

/// @inheritdoc IBillboard
Expand Down
2 changes: 1 addition & 1 deletion src/Billboard/IBillboard.sol
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ interface IBillboard {
* @notice Withdraw accumulated taxation of a board.
*
*/
function withdrawTax() external;
function withdrawTax() external returns (uint256 tax);

/**
* @notice Withdraw bid that were not won by auction id;
Expand Down

0 comments on commit 4b0db89

Please sign in to comment.