Skip to content

Commit

Permalink
Merge pull request #131 from thematters/feat/tax
Browse files Browse the repository at this point in the history
feat(tax): change tax
  • Loading branch information
zeckli authored Mar 20, 2024
2 parents 93e7aa5 + 993e46a commit af30df8
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 19 deletions.
24 changes: 24 additions & 0 deletions .env.op-sepolia.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
ETHERSCAN_API_KEY=
DEPLOYER_PRIVATE_KEY=
DEPLOYER_ADDRESS=
ETH_RPC_URL=https://<NETWORK>.alchemy.com/v2/<API_KEY>
CHAIN_ID=11155420
LOGBOOK_CONTRACT_ADDRESS=
THESPACE_CURRENCY_ADDRESS=
THESPACE_REGISTRY_ADDRESS=
THESPACE_TOKEN_IMAGE_URI=
THESPACE_ACL_MANAGER_ADDRESS=
THESPACE_MARKET_ADMIN_ADDRESS=
THESPACE_TREASURY_ADMIN_ADDRESS=
THESPACE_TREASURY_ADDRESS=
THESPACE_TREASURY_TOKENS=
THESPACE_TEAM_ADDRESS=
THESPACE_TEAM_TOKENS=
THESPACE_INCENTIVES_ADDRESS=
THESPACE_INCENTIVES_TOKENS=
THESPACE_LP_ADDRESS=
THESPACE_LP_TOKENS=
BILLBOARD_ERC20_TOKEN=
BILLBOARD_REGISTRY_ADDRESS=0x0000000000000000000000000000000000000000
BILLBOARD_LEASE_TERM=900
BILLBOARD_ADMIN_ADDRESS=
32 changes: 16 additions & 16 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, μ: 519701, ~: 524563)
BillboardTest:testCannnotWithdrawTaxIfSmallAmount(uint8) (runs: 256, μ: 521197, ~: 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, ~: 754905)
BillboardTest:testCannotPlaceBidTwice(uint96) (runs: 256, μ: 748745, ~: 754899)
BillboardTest:testCannotRemoveToWhitelistByAttacker() (gas: 9104)
BillboardTest:testCannotSafeTransferByAttacker() (gas: 127438)
BillboardTest:testCannotSetBoardProprtiesByAttacker() (gas: 157292)
Expand All @@ -37,24 +37,24 @@ BillboardTest:testCannotWithdrawBidIfWon(uint96) (runs: 256, μ: 834282, ~: 8342
BillboardTest:testCannotWithdrawTaxByAttacker() (gas: 16687)
BillboardTest:testClearAuctionIfAuctionEnded(uint96) (runs: 256, μ: 837581, ~: 837581)
BillboardTest:testClearAuctionsIfAuctionEnded() (gas: 1379962)
BillboardTest:testGetBids(uint8,uint8,uint8) (runs: 256, μ: 4579559, ~: 2075259)
BillboardTest:testGetBids(uint8,uint8,uint8) (runs: 256, μ: 4728587, ~: 2077366)
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, μ: 618810, ~: 635089)
BillboardTest:testPlaceBidWithHigherPrice(uint96) (runs: 256, μ: 904936, ~: 913254)
BillboardTest:testPlaceBidWithSamePrices(uint96) (runs: 256, μ: 908100, ~: 918050)
BillboardTest:testPlaceBidOnNewBoard(uint96) (runs: 256, μ: 615079, ~: 635089)
BillboardTest:testPlaceBidWithHigherPrice(uint96) (runs: 256, μ: 903459, ~: 913254)
BillboardTest:testPlaceBidWithSamePrices(uint96) (runs: 256, μ: 905690, ~: 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: 3132522)
BillboardTest:testUpgradeRegistry() (gas: 3132722)
BillboardTest:testWithdrawBid(uint96) (runs: 256, μ: 1081415, ~: 1081415)
BillboardTest:testWithdrawTax(uint96) (runs: 256, μ: 597714, ~: 597714)
CurationTest:testCannotCurateERC20CurateZeroAmount() (gas: 12194)
Expand All @@ -74,8 +74,8 @@ DistributionTest:testCannotClaimIfAlreadyClaimed() (gas: 284835)
DistributionTest:testCannotClaimIfInsufficientBalance() (gas: 394264)
DistributionTest:testCannotClaimIfInvalidProof() (gas: 245236)
DistributionTest:testCannotClaimIfInvalidTreeId() (gas: 243332)
DistributionTest:testCannotDropIfInsufficientAllowance(uint256) (runs: 256, μ: 212265, ~: 212278)
DistributionTest:testCannotDropIfInsufficientBalance(uint256) (runs: 256, μ: 214502, ~: 214742)
DistributionTest:testCannotDropIfInsufficientAllowance(uint256) (runs: 256, μ: 212266, ~: 212285)
DistributionTest:testCannotDropIfInsufficientBalance(uint256) (runs: 256, μ: 214503, ~: 214742)
DistributionTest:testCannotDropIfZeroAmount() (gas: 148793)
DistributionTest:testCannotDropTwiceWithSameTreeId() (gas: 307260)
DistributionTest:testCannotSetAdminByAdmin() (gas: 17334)
Expand All @@ -86,13 +86,13 @@ DistributionTest:testClaim() (gas: 414576)
DistributionTest:testDrop() (gas: 568791)
DistributionTest:testSetAdmin() (gas: 20239)
DistributionTest:testSweep() (gas: 253087)
LogbookNFTSVGTest:testTokenURI(uint8,uint8,uint16) (runs: 256, μ: 2019505, ~: 1310779)
LogbookNFTSVGTest:testTokenURI(uint8,uint8,uint16) (runs: 256, μ: 2021610, ~: 1310779)
LogbookTest:testClaim() (gas: 135608)
LogbookTest:testDonate(uint96) (runs: 256, μ: 155485, ~: 156936)
LogbookTest:testDonateWithCommission(uint96,uint96) (runs: 256, μ: 150402, ~: 140444)
LogbookTest:testFork(uint96,string) (runs: 256, μ: 450748, ~: 453928)
LogbookTest:testForkRecursively(uint8,uint96) (runs: 256, μ: 4613856, ~: 1014389)
LogbookTest:testForkWithCommission(uint96,string,uint256) (runs: 256, μ: 469806, ~: 257636)
LogbookTest:testDonateWithCommission(uint96,uint96) (runs: 256, μ: 150646, ~: 140444)
LogbookTest:testFork(uint96,string) (runs: 256, μ: 450121, ~: 453928)
LogbookTest:testForkRecursively(uint8,uint96) (runs: 256, μ: 4402585, ~: 1014389)
LogbookTest:testForkWithCommission(uint96,string,uint256) (runs: 256, μ: 485550, ~: 257636)
LogbookTest:testMulticall() (gas: 284999)
LogbookTest:testPublicSale() (gas: 204837)
LogbookTest:testPublish(string) (runs: 256, μ: 264065, ~: 263590)
Expand All @@ -114,7 +114,7 @@ LogbookTest:testPublishZh5000() (gas: 607690)
LogbookTest:testSetDescription() (gas: 140760)
LogbookTest:testSetForkPrice() (gas: 153925)
LogbookTest:testSetTitle() (gas: 168680)
LogbookTest:testSplitRoyalty(uint8,uint8,uint96) (runs: 256, μ: 2012966, ~: 636792)
LogbookTest:testSplitRoyalty(uint8,uint8,uint96) (runs: 256, μ: 2005914, ~: 801064)
LogbookTest:testWithdraw() (gas: 7284400)
SnapperTest:testCannotInitRegionByNotOwner() (gas: 11365)
SnapperTest:testCannotReInitRegion() (gas: 14373)
Expand All @@ -125,7 +125,7 @@ SnapperTest:testCannotTakeSnapshotWrongSnapshotBlock() (gas: 23899)
SnapperTest:testInitRegion(uint256) (runs: 256, μ: 114408, ~: 114408)
SnapperTest:testTakeSnapshot() (gas: 47831)
TheSpaceTest:testBatchBid() (gas: 690308)
TheSpaceTest:testBatchSetPixels(uint16,uint8) (runs: 256, μ: 368699, ~: 370338)
TheSpaceTest:testBatchSetPixels(uint16,uint8) (runs: 256, μ: 368737, ~: 370338)
TheSpaceTest:testBidDefaultedToken() (gas: 409416)
TheSpaceTest:testBidExistingToken() (gas: 355023)
TheSpaceTest:testBidNewToken() (gas: 301184)
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ deploy-curation: clean

## Billboard
deploy-billboard: clean
@forge create Billboard --rpc-url ${ETH_RPC_URL} --private-key ${DEPLOYER_PRIVATE_KEY} --constructor-args ${BILLBOARD_ERC20_TOKEN} ${BILLBOARD_REGISTRY_ADDRESS} ${BILLBOARD_ADMIN_ADDRESS} 7 ${BILLBOARD_LEASE_TERM} "Billboard" "BLBD" --legacy --verify --etherscan-api-key ${ETHERSCAN_API_KEY}
@forge create Billboard --rpc-url ${ETH_RPC_URL} --private-key ${DEPLOYER_PRIVATE_KEY} --constructor-args ${BILLBOARD_ERC20_TOKEN} ${BILLBOARD_REGISTRY_ADDRESS} ${BILLBOARD_ADMIN_ADDRESS} 504 ${BILLBOARD_LEASE_TERM} "Billboard" "BLBD" --legacy --verify --etherscan-api-key ${ETHERSCAN_API_KEY}

deploy-billboard-distribution: clean
@forge create Distribution --rpc-url ${ETH_RPC_URL} --private-key ${DEPLOYER_PRIVATE_KEY} --constructor-args ${BILLBOARD_ERC20_TOKEN} ${BILLBOARD_ADMIN_ADDRESS} --legacy --verify --etherscan-api-key ${ETHERSCAN_API_KEY}
2 changes: 1 addition & 1 deletion src/Billboard/Billboard.sol
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ contract Billboard is IBillboard {
}

function calculateTax(uint256 amount_) public view returns (uint256 tax) {
tax = (amount_ * registry.taxRate()) / 100;
tax = (amount_ * registry.taxRate()) / 1000;
}

/// @inheritdoc IBillboard
Expand Down
2 changes: 1 addition & 1 deletion src/test/Billboard/BillboardTest.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -804,7 +804,7 @@ contract BillboardTest is BillboardTestBase {
operator.setTaxRate(_taxRate);

uint256 _tax = operator.calculateTax(_amount);
assertEq(_tax, (_amount * _taxRate) / 100);
assertEq(_tax, (_amount * _taxRate) / 1000);
}

function testSetTaxRate() public {
Expand Down

0 comments on commit af30df8

Please sign in to comment.