Skip to content

Commit

Permalink
feat: adding claim function
Browse files Browse the repository at this point in the history
  • Loading branch information
kupermind committed Feb 20, 2025
1 parent 3f1584f commit 8d0b397
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions contracts/dual_token/DualStakingToken.sol
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,35 @@ contract DualStakingToken {
_withdraw(multisig, reward);
}

/// @dev Claims OLAS staking token rewards.
/// @param serviceId OLAS driven service Id.
function claim(uint256 serviceId) external {
StakerInfo storage stakerInfo = mapStakerStakerInfos[serviceId];
// Check for staker existence
if (stakerInfo.account == address(0)) {
revert();
}

// Get staking instance
address stakingInstance = stakerInfo.stakingInstance;

// Perform checkpoint first as there might be more rewards
checkpoint(stakingInstance);

// Get reward
uint256 reward = stakerInfo.reward;

// Get service multisig
(, address multisig, , , , , ) = IService(serviceRegistry).mapServices(serviceId);

// Claim OLAS
IStaking(stakingInstance).claim(serviceId);

// TODO Reward is sent to the service multisig or staker account?
// Transfer staking token reward to the service multisig
_withdraw(multisig, reward);
}

/// @dev Deposits funds for dual staking.
/// @param amount Token amount to deposit.
function deposit(uint256 amount) external {
Expand Down

0 comments on commit 8d0b397

Please sign in to comment.