Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
edf2c93
add stake on behalf of account functionality
daveroga Jan 19, 2026
2bcc499
fix solhint
daveroga Jan 19, 2026
7adef64
contract layout in comments
daveroga Jan 19, 2026
e96ff5a
simplify staking contract
daveroga Jan 19, 2026
21b638b
update comments and requirements
daveroga Jan 20, 2026
a495e46
allow users with stake locked to receive with stakeAndLockOnBehalf
daveroga Jan 20, 2026
34a9ba1
adjust lock period automatically to longer one
daveroga Jan 20, 2026
abf7107
remove unused _stakeAndLock
daveroga Jan 20, 2026
c8be7bd
add audits
daveroga Jan 30, 2026
301a35f
update readme with audit files
daveroga Jan 30, 2026
8a43afe
merge from main
daveroga Feb 3, 2026
545eda7
add function stakeOnBehalf
daveroga Feb 3, 2026
c4f1948
fix package-lock.json
daveroga Feb 3, 2026
f8a89cf
merge from main
daveroga Mar 12, 2026
345aecf
add only lock staking period not allowing get rewards and withdraw
daveroga Mar 15, 2026
a3630c5
add gap for future upgrades
daveroga Mar 16, 2026
b254570
allow different rewards distributors and other updates
daveroga Mar 16, 2026
bacaa1a
fixes from review
daveroga Mar 16, 2026
0a46b1a
fix typo
daveroga Mar 16, 2026
c1b0fc1
update verify
daveroga Mar 16, 2026
4b7e38f
remove condition that is not taken effect
daveroga Mar 17, 2026
646034f
initialLockPeriodStart -> initialLockPeriodFinish
daveroga Mar 17, 2026
307b70a
some fixes
daveroga Mar 18, 2026
91f6606
fix some issues
daveroga Mar 19, 2026
5250377
fixes from audit find-001, find-003, find-004, find-005
daveroga Mar 19, 2026
71b1b65
other fixes
daveroga Mar 19, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ artifacts/
.vscode
typechain-types
scripts/safe/*.json
scripts/deployStakingRewards/*testnet*.json
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -189,4 +189,4 @@ All upgrades go through the Timelock (2-day minimum delay):

## Security Audits
1. [HALBORN](https://www.halborn.com/audits) has performed a security audit of `BillionsNetworkToken` smart contract and compiled report on Dec 5, 2025: [billions-token-7661d8](https://github.com/BillionsNetwork/billions-token/blob/main/audits/Billions_Token_SSC.pdf).
2. [HALBORN](https://www.halborn.com/audits) has performed a security audit of `StakingRewards` smart contract and compiled report on Jan 5, 2026: [staking-rewards-0b472f](https://github.com/BillionsNetwork/billions-token/blob/main/audits/Staking_Rewards_SSC.pdf).
2. [HALBORN](https://www.halborn.com/audits) has performed a security audit of `StakingRewards` smart contract and compiled report on Jan 5, 2026: [staking-rewards-0b472f](https://github.com/BillionsNetwork/billions-token/blob/main/audits/Staking_Rewards_SSC.pdf).
238 changes: 154 additions & 84 deletions contracts/staking/StakingRewards.sol

Large diffs are not rendered by default.

27 changes: 22 additions & 5 deletions contracts/staking/interfaces/IStakingRewards.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
pragma solidity 0.8.30;

import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";

Expand All @@ -8,7 +8,7 @@
* @notice Interface for the StakingRewards contract
* @dev Based on Synthetix StakingRewards with token locking support
*/
interface IStakingRewards {

Check warning on line 11 in contracts/staking/interfaces/IStakingRewards.sol

View workflow job for this annotation

GitHub Actions / solhint

Missing @author tag in contract 'IStakingRewards'
/* ========== STRUCTS ========== */

struct LockedStake {
Expand All @@ -19,7 +19,7 @@

/* ========== VIEWS ========== */

function rewardsToken() external view returns (IERC20);

Check warning on line 22 in contracts/staking/interfaces/IStakingRewards.sol

View workflow job for this annotation

GitHub Actions / solhint

Mismatch in @return count for function 'rewardsToken'. Expected: 1, Found: 0

Check warning on line 22 in contracts/staking/interfaces/IStakingRewards.sol

View workflow job for this annotation

GitHub Actions / solhint

Missing @return tag in function 'rewardsToken'

Check warning on line 22 in contracts/staking/interfaces/IStakingRewards.sol

View workflow job for this annotation

GitHub Actions / solhint

Missing @notice tag in function 'rewardsToken'

function stakingToken() external view returns (IERC20);

Expand All @@ -33,10 +33,12 @@

function rewardPerTokenStored() external view returns (uint256);

function rewardsDistribution() external view returns (address);

function userRewardPerTokenPaid(address account) external view returns (uint256);

function initialLockPeriodFinish() external view returns (uint256);

function initialLockPeriodDuration() external view returns (uint256);

function rewards(address account) external view returns (uint256);

function totalSupply() external view returns (uint256);
Expand All @@ -61,6 +63,8 @@

function stake(uint256 amount) external;

function stakeOnBehalf(address account, uint256 amount) external;

function withdraw(uint256 amount) external;

function lockStake(uint256 amount, uint256 lockDuration) external;
Expand All @@ -71,6 +75,8 @@
uint256 lockDuration
) external;

function stakeAndLockOnBehalf(address account, uint256 amount, uint256 lockDuration) external;

function getReward() external;

function exit() external;
Expand All @@ -79,13 +85,24 @@

function notifyRewardAmount(uint256 reward) external;

function setRewardsDistribution(address _rewardsDistribution) external;

function recoverERC20(address tokenAddress, uint256 tokenAmount) external;

function setRewardsDuration(uint256 _rewardsDuration) external;

function pause() external;

function unpause() external;

function setInitialLockPeriod(uint256 duration) external;

/* ========== EVENTS ========== */

event RewardAdded(uint256 reward);
event Staked(address indexed user, uint256 amount);
event Withdrawn(address indexed user, uint256 amount);
event RewardPaid(address indexed user, uint256 reward);
event RewardsDurationUpdated(uint256 newDuration);
event Recovered(address token, uint256 amount);
event StakeLocked(address indexed user, uint256 amount, uint256 lockDuration);
event InitialLockPeriodUpdated(uint256 newDuration);
}
Loading
Loading