Skip to content

Commit

Permalink
fix: missing storage of rune address in stake call (#31)
Browse files Browse the repository at this point in the history
* fix: missing storage or rune address in stake call

* chore: added test coverage for rune address setting

---------

Co-authored-by: woodenfurniture <[email protected]>
  • Loading branch information
0xean and woodenfurniture authored Apr 16, 2024
1 parent d7b9920 commit b79dc92
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions foundry/src/FoxStakingV1.sol
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ contract FoxStakingV1 is

StakingInfo storage info = stakingInfo[msg.sender];
info.stakingBalance += amount;
info.runeAddress = runeAddress;

emit Stake(msg.sender, amount, runeAddress);
}
Expand Down
7 changes: 7 additions & 0 deletions foundry/test/FOXStakingTestStaking.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ pragma solidity ^0.8.25;
import "forge-std/Test.sol";
import {Pausable} from "@openzeppelin/contracts/utils/Pausable.sol";
import {FoxStakingV1} from "../src/FoxStakingV1.sol";
import {StakingInfo} from "../src/StakingInfo.sol";
import {MockFOXToken} from "./utils/MockFOXToken.sol";
import {FoxStakingTestDeployer} from "./utils/FoxStakingTestDeployer.sol";

Expand Down Expand Up @@ -228,6 +229,12 @@ contract FOXStakingTestStaking is Test {
// Verify each user's staked amount
uint256 total = foxStaking.balanceOf(users[i]);
assertEq(total, amounts[i]);

// Verify each user's rune address
(, , , string memory runeAddress) = foxStaking.stakingInfo(
users[i]
);
assertEq(runeAddress, runeAddresses[i]);
}
}
}

0 comments on commit b79dc92

Please sign in to comment.