Skip to content

Commit

Permalink
Merge pull request #10 from Transient-Labs/feature/2.5.0-event-update
Browse files Browse the repository at this point in the history
2.5.0 test update
  • Loading branch information
mpeyfuss authored Nov 21, 2024
2 parents 250ed70 + 4498132 commit 83d49e6
Show file tree
Hide file tree
Showing 9 changed files with 445 additions and 151 deletions.
10 changes: 9 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,13 @@
"royalty-registry-solidity/=lib/tl-creator-contracts/lib/tl-sol-tools/lib/royalty-registry-solidity/contracts/",
"tl-creator-contracts/=lib/tl-creator-contracts/src/",
"tl-sol-tools/=lib/tl-creator-contracts/lib/tl-sol-tools/src/"
]
],
"emeraldwalk.runonsave": {
"commands": [
{
"match": "\\.sol",
"cmd": "make fmt"
}
]
}
}
12 changes: 8 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
# (-include to ignore error if it does not exist)
-include .env

################################################################ Helpers ################################################################
fmt:
forge fmt

################################################################ Modules ################################################################
remove:
rm -rf .gitmodules && rm -rf .git/modules/* && rm -rf lib && touch .gitmodules
Expand All @@ -28,16 +32,16 @@ docs: clean_build
forge doc --build

################################################################ Tests ################################################################
default_test:
default_test: build
forge test

gas_test:
gas_test: build
forge test --gas-report

coverage_test:
coverage_test: build
forge coverage

fuzz_test:
fuzz_test: build
forge test --fuzz-runs 10000

################################################################ TLAuctionHouse Deployments ################################################################
Expand Down
162 changes: 84 additions & 78 deletions gas_results.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/TLStacks1155.sol
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ contract TLStacks1155 is
/// @param newFreeMintFeeSplit The new fee split for free mints
/// @param newReferralFeeSplit The new fee split for referrals
function setProtocolFeeSplits(uint256 newFreeMintFeeSplit, uint256 newReferralFeeSplit) external onlyOwner {
_setProtocolFeeSplits(newFreeMintFeeSplit,newReferralFeeSplit);
_setProtocolFeeSplits(newFreeMintFeeSplit, newReferralFeeSplit);
}

/// @notice Function to set the sanctions oracle
Expand Down
2 changes: 1 addition & 1 deletion src/TLStacks721.sol
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ contract TLStacks721 is
/// @param newFreeMintFeeSplit The new fee split for free mints
/// @param newReferralFeeSplit The new fee split for referrals
function setProtocolFeeSplits(uint256 newFreeMintFeeSplit, uint256 newReferralFeeSplit) external onlyOwner {
_setProtocolFeeSplits(newFreeMintFeeSplit,newReferralFeeSplit);
_setProtocolFeeSplits(newFreeMintFeeSplit, newReferralFeeSplit);
}

/// @notice Function to set the sanctions oracle
Expand Down
11 changes: 5 additions & 6 deletions test-coverage.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
| File | % Lines | % Statements | % Branches | % Funcs |
|--------------------------------|-------------------|-------------------|------------------|-----------------|
| src/TLAuctionHouse.sol | 100.00% (155/155) | 100.00% (231/231) | 100.00% (90/90) | 100.00% (25/25) |
| src/TLStacks1155.sol | 100.00% (166/166) | 100.00% (246/246) | 100.00% (92/92) | 100.00% (28/28) |
| src/TLStacks721.sol | 100.00% (161/161) | 100.00% (240/240) | 100.00% (92/92) | 100.00% (27/27) |
| Total | 98.80% (482/482) | 99.18% (717/717) | 99.64% (274/274) | 96.59% (80/80) |
| File | % Lines | % Statements | % Branches | % Funcs |
|--------------------------------|-------------------|-------------------|-------------------|-----------------|
| src/TLAuctionHouse.sol | 100.00% (157/157) | 100.00% (233/233) | 100.00% (90/90) | 100.00% (26/26) |
| src/TLStacks1155.sol | 100.00% (181/181) | 100.00% (271/271) | 100.00% (100/100) | 100.00% (32/32) |
| src/TLStacks721.sol | 100.00% (176/176) | 100.00% (265/265) | 100.00% (100/100) | 100.00% (31/31) |
57 changes: 55 additions & 2 deletions test/TLAuctionHouse.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import {MockERC20} from "test/utils/MockERC20.sol";
import {MaliciousERC721} from "test/utils/MaliciousERC721.sol";

contract TLAuctionHouseTest is Test, ITLAuctionHouseEvents, AuctionHouseErrors {
uint256 constant BASIS = 10_000;
address wethAddress;
TLAuctionHouse auctionHouse;
ERC721TL nft;
Expand Down Expand Up @@ -44,8 +45,17 @@ contract TLAuctionHouseTest is Test, ITLAuctionHouseEvents, AuctionHouseErrors {

function setUp() public {
wethAddress = address(new WETH9());
auctionHouse =
new TLAuctionHouse(address(this), address(0), wethAddress, royaltyEngine, tl, minBidIncreasePerc, minBidIncreaseLimit, feePerc, feeLimit);
auctionHouse = new TLAuctionHouse(
address(this),
address(0),
wethAddress,
royaltyEngine,
tl,
minBidIncreasePerc,
minBidIncreaseLimit,
feePerc,
feeLimit
);

address[] memory empty = new address[](0);

Expand Down Expand Up @@ -83,6 +93,49 @@ contract TLAuctionHouseTest is Test, ITLAuctionHouseEvents, AuctionHouseErrors {
assertFalse(auctionHouse.paused());
}

/// @dev test constructor
function test_constructor(
address initOwner,
address initSanctionsOracle,
address initWethAddress,
address initRoyaltyEngineAddress,
address initProtocolFeeReceiver,
uint256 initMinBidIncreasePerc,
uint256 initMinBidIncreaseLimit,
uint256 initProtocolFeePerc,
uint256 initProtocolFeeLimit
) public {
vm.assume(initOwner != address(0));
if (initMinBidIncreasePerc > BASIS) {
initMinBidIncreasePerc = initMinBidIncreasePerc % BASIS;
}
if (initProtocolFeePerc > BASIS) {
initProtocolFeePerc = initMinBidIncreasePerc % BASIS;
}

auctionHouse = new TLAuctionHouse(
initOwner,
initSanctionsOracle,
initWethAddress,
initRoyaltyEngineAddress,
initProtocolFeeReceiver,
initMinBidIncreasePerc,
initMinBidIncreaseLimit,
initProtocolFeePerc,
initProtocolFeeLimit
);

assertEq(auctionHouse.owner(), initOwner);
assertEq(auctionHouse.weth(), initWethAddress);
assertEq(address(auctionHouse.oracle()), initSanctionsOracle);
assertEq(address(auctionHouse.royaltyEngine()), initRoyaltyEngineAddress);
assertEq(auctionHouse.minBidIncreasePerc(), initMinBidIncreasePerc);
assertEq(auctionHouse.minBidIncreaseLimit(), initMinBidIncreaseLimit);
assertEq(auctionHouse.protocolFeePerc(), initProtocolFeePerc);
assertEq(auctionHouse.protocolFeeLimit(), initProtocolFeeLimit);
assertEq(auctionHouse.protocolFeeReceiver(), initProtocolFeeReceiver);
}

/// @dev test owner only acccess
function test_ownerOnlyAccess(address sender) public {
vm.assume(sender != address(this));
Expand Down
Loading

0 comments on commit 83d49e6

Please sign in to comment.