Skip to content

Commit

Permalink
chore: remove duplicate remapping + re-use already defined test variable
Browse files Browse the repository at this point in the history
  • Loading branch information
CJ42 committed Oct 21, 2024
1 parent f1ab0a2 commit bb2828c
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 61 deletions.
92 changes: 44 additions & 48 deletions foundry.toml
Original file line number Diff line number Diff line change
@@ -1,59 +1,55 @@
# Full reference https://github.com/foundry-rs/foundry/tree/master/crates/config

[profile.default]
auto_detect_solc = false
block_timestamp = 1_680_220_800 # March 31, 2023 at 00:00 GMT
bytecode_hash = "none"
evm_version = "shanghai"
fuzz = { runs = 1_000 }
gas_reports = ["*"]
optimizer = true
optimizer_runs = 10_000
out = "out"
script = "script"
solc = "0.8.25"
src = "src"
test = "test"

remappings = [
"forge-std/=node_modules/forge-std/src/"
]
auto_detect_solc = false
block_timestamp = 1_680_220_800 # March 31, 2023 at 00:00 GMT
bytecode_hash = "none"
evm_version = "shanghai"
fuzz = { runs = 1_000 }
gas_reports = ["*"]
optimizer = true
optimizer_runs = 10_000
out = "out"
script = "script"
solc = "0.8.25"
src = "src"
test = "test"

[profile.ci]
fuzz = { runs = 10_000 }
verbosity = 4
fuzz = { runs = 10_000 }
verbosity = 4

[etherscan]
arbitrum = { key = "${API_KEY_ARBISCAN}" }
avalanche = { key = "${API_KEY_SNOWTRACE}" }
base = { key = "${API_KEY_BASESCAN}" }
bnb_smart_chain = { key = "${API_KEY_BSCSCAN}" }
gnosis_chain = { key = "${API_KEY_GNOSISSCAN}" }
goerli = { key = "${API_KEY_ETHERSCAN}" }
mainnet = { key = "${API_KEY_ETHERSCAN}" }
optimism = { key = "${API_KEY_OPTIMISTIC_ETHERSCAN}" }
polygon = { key = "${API_KEY_POLYGONSCAN}" }
sepolia = { key = "${API_KEY_ETHERSCAN}" }
arbitrum = { key = "${API_KEY_ARBISCAN}" }
avalanche = { key = "${API_KEY_SNOWTRACE}" }
base = { key = "${API_KEY_BASESCAN}" }
bnb_smart_chain = { key = "${API_KEY_BSCSCAN}" }
gnosis_chain = { key = "${API_KEY_GNOSISSCAN}" }
goerli = { key = "${API_KEY_ETHERSCAN}" }
mainnet = { key = "${API_KEY_ETHERSCAN}" }
optimism = { key = "${API_KEY_OPTIMISTIC_ETHERSCAN}" }
polygon = { key = "${API_KEY_POLYGONSCAN}" }
sepolia = { key = "${API_KEY_ETHERSCAN}" }

[fmt]
bracket_spacing = true
int_types = "long"
line_length = 120
multiline_func_header = "all"
number_underscore = "thousands"
quote_style = "double"
tab_width = 4
wrap_comments = true
bracket_spacing = true
int_types = "long"
line_length = 120
multiline_func_header = "all"
number_underscore = "thousands"
quote_style = "double"
tab_width = 4
wrap_comments = true

[rpc_endpoints]
arbitrum = "https://arbitrum-mainnet.infura.io/v3/${API_KEY_INFURA}"
avalanche = "https://avalanche-mainnet.infura.io/v3/${API_KEY_INFURA}"
base = "https://mainnet.base.org"
bnb_smart_chain = "https://bsc-dataseed.binance.org"
gnosis_chain = "https://rpc.gnosischain.com"
goerli = "https://goerli.infura.io/v3/${API_KEY_INFURA}"
localhost = "http://localhost:8545"
mainnet = "https://eth-mainnet.g.alchemy.com/v2/${API_KEY_ALCHEMY}"
optimism = "https://optimism-mainnet.infura.io/v3/${API_KEY_INFURA}"
polygon = "https://polygon-mainnet.infura.io/v3/${API_KEY_INFURA}"
sepolia = "https://sepolia.infura.io/v3/${API_KEY_INFURA}"
arbitrum = "https://arbitrum-mainnet.infura.io/v3/${API_KEY_INFURA}"
avalanche = "https://avalanche-mainnet.infura.io/v3/${API_KEY_INFURA}"
base = "https://mainnet.base.org"
bnb_smart_chain = "https://bsc-dataseed.binance.org"
gnosis_chain = "https://rpc.gnosischain.com"
goerli = "https://goerli.infura.io/v3/${API_KEY_INFURA}"
localhost = "http://localhost:8545"
mainnet = "https://eth-mainnet.g.alchemy.com/v2/${API_KEY_ALCHEMY}"
optimism = "https://optimism-mainnet.infura.io/v3/${API_KEY_INFURA}"
polygon = "https://polygon-mainnet.infura.io/v3/${API_KEY_INFURA}"
sepolia = "https://sepolia.infura.io/v3/${API_KEY_INFURA}"
23 changes: 10 additions & 13 deletions test/HypLSP7.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ abstract contract HypTokenTest is Test {
remoteToken.enrollRemoteRouter(ORIGIN, address(localToken).addressToBytes32());
}

function _expectRemoteBalance(address _user, uint256 _balance) internal {
function _expectRemoteBalance(address _user, uint256 _balance) internal view {
assertEq(remoteToken.balanceOf(_user), _balance);
}

Expand Down Expand Up @@ -143,38 +143,35 @@ contract HypLSP7Test is HypTokenTest {

HypLSP7 internal lsp7Token;

address internal owner = makeAddr("owner");

function setUp() public override {
super.setUp();

localToken = new HypLSP7(DECIMALS, address(localMailbox));
lsp7Token = HypLSP7(payable(address(localToken)));

vm.prank(owner);
lsp7Token.initialize(TOTAL_SUPPLY, NAME, SYMBOL, address(noopHook), address(0), owner);
vm.prank(OWNER);
lsp7Token.initialize(TOTAL_SUPPLY, NAME, SYMBOL, address(noopHook), address(0), OWNER);

vm.prank(owner);
vm.prank(OWNER);
lsp7Token.enrollRemoteRouter(DESTINATION, address(remoteToken).addressToBytes32());

// from, to, amount, force, data
vm.prank(owner);

lsp7Token.transfer(owner, ALICE, 1000e18, true, "");
vm.prank(OWNER);
lsp7Token.transfer(OWNER, ALICE, 1000e18, true, "");

_enrollRemoteTokenRouter();
}

function testInitialize_revert_ifAlreadyInitialized() public {
vm.expectRevert("Initializable: contract is already initialized");
lsp7Token.initialize(TOTAL_SUPPLY, NAME, SYMBOL, address(noopHook), address(0), owner);
lsp7Token.initialize(TOTAL_SUPPLY, NAME, SYMBOL, address(noopHook), address(0), OWNER);
}

function testTotalSupply() public {
function testTotalSupply() public view {
assertEq(lsp7Token.totalSupply(), TOTAL_SUPPLY);
}

function testDecimals() public {
function testDecimals() public view {
assertEq(lsp7Token.decimals(), DECIMALS);
}

Expand All @@ -189,7 +186,7 @@ contract HypLSP7Test is HypTokenTest {
}

function testRemoteTransfer() public {
vm.prank(owner);
vm.prank(OWNER);
remoteToken.enrollRemoteRouter(ORIGIN, address(localToken).addressToBytes32());
uint256 balanceBefore = lsp7Token.balanceOf(ALICE);

Expand Down

0 comments on commit bb2828c

Please sign in to comment.