Skip to content

Commit

Permalink
Get rid of compiler warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
DrZoltanFazekas committed Dec 18, 2024
1 parent a1db3ed commit 0f49ee7
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 36 deletions.
2 changes: 1 addition & 1 deletion script/CheckVariant.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {console} from "forge-std/console.sol";
contract CheckVariant is Script {
using ERC165Checker for address;

function run(address proxy) external {
function run(address proxy) external view {

if (proxy.supportsInterface(type(ILiquidDelegation).interfaceId))
console.log("ILiquidDelegation");
Expand Down
18 changes: 9 additions & 9 deletions src/LiquidDelegation.sol
Original file line number Diff line number Diff line change
Expand Up @@ -57,40 +57,40 @@ contract LiquidDelegation is BaseDelegation, ILiquidDelegation {
bytes calldata,
bytes calldata,
bytes calldata
) public override {
) public pure override {
revert("not implemented");
}

function migrate(bytes calldata) public override {
function migrate(bytes calldata) public pure override {
revert("not implemented");
}

function stake() external override payable {
revert("not implemented");
}

function unstake(uint256) external override returns(uint256) {
function unstake(uint256) external pure override returns(uint256) {
revert("not implemented");
}

function claim() external override {
function claim() external pure override {
revert("not implemented");
}

function collectCommission() public override {
function collectCommission() public pure override {
revert("not implemented");
}

function stakeRewards() public override {
function stakeRewards() public pure override {
revert("not implemented");
}

function getPrice() public view returns(uint256) {
function getPrice() public pure returns(uint256) {
revert("not implemented");
}

function supportsInterface(bytes4 interfaceId) public view override returns (bool) {
return interfaceId == type(ILiquidDelegation).interfaceId || super.supportsInterface(interfaceId);
function supportsInterface(bytes4 _interfaceId) public view override returns (bool) {
return _interfaceId == type(ILiquidDelegation).interfaceId || super.supportsInterface(_interfaceId);
}

function interfaceId() public pure returns (bytes4) {
Expand Down
4 changes: 2 additions & 2 deletions src/LiquidDelegationV2.sol
Original file line number Diff line number Diff line change
Expand Up @@ -210,8 +210,8 @@ contract LiquidDelegationV2 is BaseDelegation, ILiquidDelegation {
return $.lst;
}

function supportsInterface(bytes4 interfaceId) public view override returns (bool) {
return interfaceId == type(ILiquidDelegation).interfaceId || super.supportsInterface(interfaceId);
function supportsInterface(bytes4 _interfaceId) public view override returns (bool) {
return _interfaceId == type(ILiquidDelegation).interfaceId || super.supportsInterface(_interfaceId);
}

function interfaceId() public pure returns (bytes4) {
Expand Down
30 changes: 15 additions & 15 deletions src/NonLiquidDelegation.sol
Original file line number Diff line number Diff line change
Expand Up @@ -52,64 +52,64 @@ contract NonLiquidDelegation is BaseDelegation, INonLiquidDelegation {
bytes calldata,
bytes calldata,
bytes calldata
) public override {
) public pure override {
revert("not implemented");
}

function migrate(bytes calldata) public override {
function migrate(bytes calldata) public pure override {
revert("not implemented");
}

function stake() external payable override {
revert("not implemented");
}

function unstake(uint256) external override returns(uint256) {
function unstake(uint256) external pure override returns(uint256) {
revert("not implemented");
}

function claim() external override {
function claim() external pure override {
revert("not implemented");
}

function collectCommission() public override {
function collectCommission() public pure override {
revert("not implemented");
}

function stakeRewards() public override {
function stakeRewards() public pure override {
revert("not implemented");
}

function rewards() public view returns(uint256) {
function rewards() public pure returns(uint256) {
revert("not implemented");
}

function rewards(uint64) public view returns(uint256) {
function rewards(uint64) public pure returns(uint256) {
revert("not implemented");
}

function getDelegatedStake() public view returns(uint256) {
function getDelegatedStake() public pure returns(uint256) {
revert("not implemented");
}

function withdrawRewards(uint256, uint64) public returns(uint256) {
function withdrawRewards(uint256, uint64) public pure returns(uint256) {
revert("not implemented");
}

function withdrawRewards(uint256) public returns(uint256) {
function withdrawRewards(uint256) public pure returns(uint256) {
revert("not implemented");
}

function withdrawAllRewards(uint64) public returns(uint256) {
function withdrawAllRewards(uint64) public pure returns(uint256) {
revert("not implemented");
}

function withdrawAllRewards() public returns(uint256) {
function withdrawAllRewards() public pure returns(uint256) {
revert("not implemented");
}

function supportsInterface(bytes4 interfaceId) public view override returns (bool) {
return interfaceId == type(INonLiquidDelegation).interfaceId || super.supportsInterface(interfaceId);
function supportsInterface(bytes4 _interfaceId) public view override returns (bool) {
return _interfaceId == type(INonLiquidDelegation).interfaceId || super.supportsInterface(_interfaceId);
}

function interfaceId() public pure returns (bytes4) {
Expand Down
4 changes: 2 additions & 2 deletions src/NonLiquidDelegationV2.sol
Original file line number Diff line number Diff line change
Expand Up @@ -367,8 +367,8 @@ contract NonLiquidDelegationV2 is BaseDelegation, INonLiquidDelegation {

function collectCommission() public override {}

function supportsInterface(bytes4 interfaceId) public view override returns (bool) {
return interfaceId == type(INonLiquidDelegation).interfaceId || super.supportsInterface(interfaceId);
function supportsInterface(bytes4 _interfaceId) public view override returns (bool) {
return _interfaceId == type(INonLiquidDelegation).interfaceId || super.supportsInterface(_interfaceId);
}

function interfaceId() public pure returns (bytes4) {
Expand Down
17 changes: 10 additions & 7 deletions test/BaseDelegation.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,9 @@ abstract contract BaseDelegationTest is Test {
vm.deal(address(delegation), address(delegation).balance + 10_000 ether);

uint256 totalUnstaked;
uint256 totalPending;
uint256[2][] memory claims;

for (uint256 j = 0; j < steps; j++) {
console.log("--------------------------------------------------------------------");
vm.startPrank(stakers[i-1]);
Expand All @@ -251,12 +254,12 @@ abstract contract BaseDelegationTest is Test {

//console.log("block number: %s", block.number);
console.log("claimable: %s", delegation.getClaimable());
uint256[2][] memory claims = delegation.getPendingClaims();
claims = delegation.getPendingClaims();
console.log("%s pending claims:", claims.length);
uint256 totalPending;
for (uint256 j = 0; j < claims.length; j++) {
console.log("%s can claim %s in block %s", stakers[i-1], claims[j][1], claims[j][0]);
totalPending += claims[j][1];
totalPending = 0;
for (uint256 k = 0; k < claims.length; k++) {
console.log("%s can claim %s in block %s", stakers[i-1], claims[k][1], claims[k][0]);
totalPending += claims[k][1];
}
assertEq(delegation.getClaimable() + totalPending, totalUnstaked, "claims must match unstaked amount");

Expand All @@ -271,9 +274,9 @@ abstract contract BaseDelegationTest is Test {
console.log("--------------------------------------------------------------------");
console.log("block number: %s", block.number);
console.log("claimable: %s", delegation.getClaimable());
uint256[2][] memory claims = delegation.getPendingClaims();
claims = delegation.getPendingClaims();
console.log("%s pending claims:", claims.length);
uint256 totalPending;
totalPending = 0;
for (uint256 j = 0; j < claims.length; j++) {
console.log("%s can claim %s in block %s", stakers[i-1], claims[j][1], claims[j][0]);
totalPending += claims[j][1];
Expand Down

0 comments on commit 0f49ee7

Please sign in to comment.