anchor-token-contracts
anchor-token-contracts copied to clipboard
Staking contract query - block_height from past
Hello guys! Found issue in my Staking contract (that was copypasted from yours): https://github.com/Nexus-Protocol/services-contracts/pull/17
Your code here: https://github.com/Anchor-Protocol/anchor-token-contracts/blob/cac5a72439190572a65f59cf7ea82997c72cec46/contracts/staking/src/contract.rs#L289 have the same issue
If you pass block_height
from the past this part:
let passed_blocks = std::cmp::min(s.1, block_height) - std::cmp::max(s.0, state.last_distributed);
will fail
@pronvis Thanks for the report, yes that causes a problem in the query. We will reflect this in our new update.