Skip to content

Commit

Permalink
Add deny_warnings flag and address all warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
Phanco committed Jun 14, 2024
1 parent e966fa4 commit a4e9a3d
Show file tree
Hide file tree
Showing 10 changed files with 22 additions and 17 deletions.
5 changes: 4 additions & 1 deletion foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,14 @@ remappings = [
'ds-test/=lib/forge-std/lib/ds-test/src/',
'erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/',
'forge-std/=lib/forge-std/src/',
'@openzeppelin/=lib/openzeppelin-contracts/',
'@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/',
'openzeppelin-contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/',
'openzeppelin-contracts/=lib/openzeppelin-contracts/',
'@openzeppelin/contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts/',
'openzeppelin-foundry-upgrades/=lib/openzeppelin-foundry-upgrades/src/',
'solidity-stringutils/=lib/openzeppelin-foundry-upgrades/lib/solidity-stringutils/',
]
deny_warnings = true

[fmt]
line_length = 120
Expand Down
3 changes: 2 additions & 1 deletion script/example/L2ClaimTokens.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ contract L2ClaimTokensScript is Script {
/// @notice merkle-leaves.json in string format.
string public merkleLeavesJson;

/// @notice The contract address created by default mnemonic in Anvil/Ganache when nonce=0.
/// @notice The destination address for claims as `address(uint160(uint256(keccak256("foundry default caller"))))`
/// and `nonce=2`.
address public constant destination = address(0x34A1D3fff3958843C43aD80F30b94c510645C316);

/// @notice 1 Beddows in LSK Chain = 10 * 10 Beddows in L2 Chain
Expand Down
4 changes: 2 additions & 2 deletions test/L1/L1LiskToken.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ contract L1LiskTokenTest is Test {
l1LiskToken = new L1LiskToken();
}

function test_Initialize() public {
function test_Initialize() public view {
assertEq(l1LiskToken.name(), NAME);
assertEq(l1LiskToken.symbol(), SYMBOL);
assertEq(l1LiskToken.totalSupply(), TOTAL_SUPPLY);
Expand Down Expand Up @@ -199,7 +199,7 @@ contract L1LiskTokenTest is Test {
assertEq(l1LiskToken.pendingOwner(), alice);
}

function test_DefaultAdminRoleIsRoleAdminForBurnerRole() public {
function test_DefaultAdminRoleIsRoleAdminForBurnerRole() public view {
assertEq(l1LiskToken.DEFAULT_ADMIN_ROLE(), l1LiskToken.getRoleAdmin(l1LiskToken.BURNER_ROLE()));
}
}
2 changes: 1 addition & 1 deletion test/L1/L1VestingWallet.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ contract L1VestingWalletTest is Test {
mockToken.transfer(address(l1VestingWallet), vestAmount);
}

function test_Initialize() public {
function test_Initialize() public view {
assertEq(l1VestingWallet.name(), name);
assertEq(l1VestingWallet.start(), startTimestamp);
assertEq(l1VestingWallet.duration(), durationSeconds);
Expand Down
9 changes: 5 additions & 4 deletions test/L2/L2Claim.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,12 @@ contract L2ClaimV2Mock is L2Claim {
contract L2ClaimTest is Test {
using stdJson for string;

// recover LSK tokens after 2 years
/// @notice recover LSK tokens after 2 years
uint256 public constant RECOVER_PERIOD = 730 days;

// pre-set destination address for claims
address public constant RECIPIENT_ADDRESS = 0x34A1D3fff3958843C43aD80F30b94c510645C316;
/// @notice The destination address for claims as `address(uint160(uint256(keccak256("foundry default caller"))))`
/// and `nonce=2`.
address public constant RECIPIENT_ADDRESS = address(0x34A1D3fff3958843C43aD80F30b94c510645C316);

ERC20 public lsk;
L2Claim public l2ClaimImplementation;
Expand Down Expand Up @@ -190,7 +191,7 @@ contract L2ClaimTest is Test {
l2ClaimImplementation.initialize(address(lsk), bytes32(0), block.timestamp + RECOVER_PERIOD);
}

function test_Version() public {
function test_Version() public view {
assertEq(l2Claim.version(), "1.0.0");
}

Expand Down
6 changes: 3 additions & 3 deletions test/L2/L2LiskToken.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ contract L2LiskTokenTest is Test {
new L2LiskToken(address(0));
}

function test_Initialize() public {
function test_Initialize() public view {
assertEq(l2LiskToken.name(), "Lisk");
assertEq(l2LiskToken.symbol(), "LSK");
assertEq(l2LiskToken.decimals(), 18);
Expand Down Expand Up @@ -176,12 +176,12 @@ contract L2LiskTokenTest is Test {
assertNotEq(address(l2LiskTokenSalted), l2LiskTokenAddressCalculated);
}

function test_GetBridge() public {
function test_GetBridge() public view {
assertEq(l2LiskToken.bridge(), bridge);
assertEq(l2LiskToken.BRIDGE(), bridge);
}

function test_GetRemoteToken() public {
function test_GetRemoteToken() public view {
assertEq(l2LiskToken.remoteToken(), remoteToken);
assertEq(l2LiskToken.REMOTE_TOKEN(), remoteToken);
}
Expand Down
2 changes: 1 addition & 1 deletion test/L2/L2LockingPosition.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,7 @@ contract L2LockingPositionTest is Test {
l2LockingPosition.removeLockingPosition(positionId);
}

function test_GetLockingPosition_PositionDoesNotExist() public {
function test_GetLockingPosition_PositionDoesNotExist() public view {
IL2LockingPosition.LockingPosition memory position = l2LockingPosition.getLockingPosition(1);
assertEq(position.creator, address(0));
assertEq(position.amount, 0);
Expand Down
2 changes: 1 addition & 1 deletion test/L2/L2Reward.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ contract L2RewardTest is Test {
l2Staking.addCreator(address(l2Reward));
}

function test_initialize() public {
function test_initialize() public view {
assertEq(l2Reward.lastTrsDate(), deploymentDate);
assertEq(l2Reward.OFFSET(), 150);
assertEq(l2Reward.REWARD_DURATION(), 30);
Expand Down
2 changes: 1 addition & 1 deletion test/L2/L2VestingWallet.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ contract L2VestingWalletTest is Test {
mockToken.transfer(address(l2VestingWallet), vestAmount);
}

function test_Initialize() public {
function test_Initialize() public view {
assertEq(l2VestingWallet.name(), name);
assertEq(l2VestingWallet.start(), startTimestamp);
assertEq(l2VestingWallet.duration(), durationSeconds);
Expand Down
4 changes: 2 additions & 2 deletions test/L2/L2VotingPower.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ contract L2VotingPowerTest is Test {
);
}

function test_Version() public {
function test_Version() public view {
assertEq(l2VotingPower.version(), "1.0.0");
}

Expand Down Expand Up @@ -329,7 +329,7 @@ contract L2VotingPowerTest is Test {
assertEq(l2VotingPower.clock(), blockTimestamp + 1);
}

function test_ClockMode() public {
function test_ClockMode() public view {
assertEq(l2VotingPower.CLOCK_MODE(), "mode=timestamp");
}

Expand Down

0 comments on commit a4e9a3d

Please sign in to comment.