Contract API
Bribe
Seven-day reward streams for the allocators of one strategy.
Loading…
Browse documentation
Contract API
Seven-day reward streams for the allocators of one strategy.
Loading…
Contract API
Seven-day reward streams for the allocators of one strategy.
This reference is generated from the repository contracts. Check the deployed version before using a signature or constant. The audit covers a specific source revision.
Source: src/core/Bribe.sol
Artifact: out/Bribe.sol/Bribe.json
Streams up to sixteen registered reward tokens to accounts signaling this Bribe's Strategy.
Resonance is the sole writer of virtual signal weights and the append-only token registry. Each token uses an independent Synthetix-style seven-day stream and a cumulative reward-per-signal index scaled by 1e36. Saved rate-division remainders join the next qualifying stream. Index and account rounding leaves unallocated contract surplus. Time still elapses when total signal weight is zero, so rewards emitted during that interval are likewise unclaimable. Killing the Strategy does not stop Bribe streams or remove its recorded weights: existing positions keep earning until moved or withdrawn. Claims are authorized for the beneficiary or immutable Resonance, notifications remain permissionless, and Resonance may still register rewards. Reward transfers assume standard, non-rebasing ERC-20 behavior.
Public ABI: 22 functions, 5 events, 12 custom errors, 1 constructor, 0 receive entries, 0 fallback entries.
constructor(address)constructor(address resonance_);Creates an empty, bounded reward stream controlled by one Resonance contract. Requires a nonzero, deployed Resonance contract.
Parameters
resonance_: Resonance exclusively authorized to maintain signal weights and register reward tokens.MAX_LIFETIME_REWARD_AMOUNT()function MAX_LIFETIME_REWARD_AMOUNT() external view returns (uint256 arg0);Maximum cumulative raw units accepted for one reward token over this Bribe's lifetime.
MAX_REWARD_TOKENS()function MAX_REWARD_TOKENS() external view returns (uint256 arg0);Maximum number of registered reward tokens and iterations in mandatory all-token loops.
REWARD_DURATION()function REWARD_DURATION() external view returns (uint256 arg0);Fixed duration of each reward stream, in seconds.
REWARD_PRECISION()function REWARD_PRECISION() external view returns (uint256 arg0);Fixed-point scale used by cumulative reward-per-signal accounting.
accountRewardPerSignalPaid(address,address)function accountRewardPerSignalPaid(address account, address token) external view returns (uint256 paid);Scaled cumulative index already incorporated for an account and reward token.
addRewardToken(address)function addRewardToken(address rewardToken) external;Appends a reward token to this Bribe's permanent registry. Callable only by Resonance. The token must be a unique, nonzero contract and the resulting registry length cannot exceed MAX_REWARD_TOKENS. Registration does not fund or start a stream.
Parameters
rewardToken: ERC-20 contract address to register.addSignalWeight(address,uint256)function addSignalWeight(address account, uint256 amount) external;Adds signal weight for account after checkpointing every registered reward under the prior weights. Callable only by Resonance. The checkpoint loop is bounded by MAX_REWARD_TOKENS.
Parameters
account: Nonzero account whose paired-Auction signal weight increases.amount: Nonzero raw signal units added to both the account weight and total weight.claimReward(address,address)function claimReward(address account, address rewardToken) external returns (uint256 amount);Checkpoints and pays one registered reward token earned by account directly to that account. Callable only by account or Resonance. Leaves other tokens unchanged. A failed transfer reverts the checkpoint and claim reset, preserving the unpaid reward.
Parameters
account: Account whose reward is checkpointed and paid; cannot be zero.rewardToken: Registered token to checkpoint and pay.Returns
amount: Raw token units transferred, or zero when the account has no whole-unit reward.claimRewards(address)function claimRewards(address account) external;Checkpoints and pays every registered reward token earned by account directly to that account. Callable only by account or Resonance. The loop is bounded by MAX_REWARD_TOKENS. A failed transfer reverts the complete claim; claimReward allows a healthy token to be claimed separately.
Parameters
account: Account whose accrued raw-token rewards are checkpointed and paid; cannot be zero.earned(address,address)function earned(address account, address rewardToken) external view returns (uint256 amount);Returns one account's checkpointed plus pending reward for one token in whole raw units. Uses the live index and rounds down. Unregistered reward tokens return zero.
Parameters
account: Account whose entitlement is queried.rewardToken: Reward token whose entitlement is queried.Returns
amount: Raw token units currently payable after checkpointing.isRewardToken(address)function isRewardToken(address token) external view returns (bool isReward);Whether a token belongs to the append-only reward-token registry.
lifetimeRewardNotified(address)function lifetimeRewardNotified(address token) external view returns (uint256 amount);Cumulative raw units accepted through notifications for a reward token.
notifyReward(address,uint256)function notifyReward(address rewardToken, uint256 amount) external;Pulls fresh funding from the caller and restarts a registered token's seven-day reward stream. Permissionless. Fresh amount must meet REWARD_DURATION and remainingReward and fit the lifetime cap. These checks precede checkpointing and transfer. The new budget combines fresh funding, remaining scheduled rewards, and the saved rate-division remainder. Division by REWARD_DURATION sets the whole-unit rate and saves a new remainder for the next qualifying stream's signalers. The remainder stays pending if no further funding qualifies. The period restarts; only fresh deposits increase the lifetime counter.
Parameters
amount: Fresh raw token units pulled from the caller and counted toward the lifetime cap.rewardToken: Registered standard ERC-20 token to pull and stream.remainingReward(address)function remainingReward(address rewardToken) external view returns (uint256 amount);Returns the raw token units still scheduled in a reward token's active stream. Computes (periodFinish - block.timestamp) * rewardRate while active and zero afterward. The result excludes elapsed rewards, direct donations, and the saved rate-division remainder. Unregistered tokens return zero.
Parameters
rewardToken: Reward token whose current stream is queried.Returns
amount: Raw token units remaining at the stored whole-unit-per-second rate.removeSignalWeight(address,uint256)function removeSignalWeight(address account, uint256 amount) external;Removes signal weight for account after checkpointing every registered reward under the prior weights. Callable only by Resonance. Removing more than the account or total weight reverts by checked arithmetic.
Parameters
account: Nonzero account whose paired-Auction signal weight decreases.amount: Nonzero raw signal units removed from both the account weight and total weight.resonance()function resonance() external view returns (address arg0);Immutable Resonance authorized to maintain signal weights and register reward tokens.
rewardData(address)function rewardData(address token) external view returns (uint256 periodFinish, uint256 rewardRate, uint256 lastUpdateTime, uint256 rewardPerSignalStored);Current stream timestamps, raw-unit rate, and scaled index for a reward token.
rewardPerSignal(address)function rewardPerSignal(address rewardToken) external view returns (uint256 accumulatedReward);Returns the live cumulative reward allocated per raw signal unit for one reward token. The result is scaled by REWARD_PRECISION and each index increment rounds down. Accrual stops at periodFinish. If total signal weight is zero, the index remains unchanged and elapsed rewards cannot be captured by accounts that add weight later.
Parameters
rewardToken: Reward token whose cumulative index is queried; unregistered tokens return zero.Returns
accumulatedReward: Cumulative reward-per-signal index scaled by REWARD_PRECISION.rewardTokens()function rewardTokens() external view returns (address[] tokens);Returns registered reward-token addresses in insertion order.
Returns
tokens: Copy of the append-only registry, containing at most MAX_REWARD_TOKENS entries.rewards(address,address)function rewards(address account, address token) external view returns (uint256 amount);An account's checkpointed, unclaimed reward in raw token units.
signalWeightOf(address)function signalWeightOf(address account) external view returns (uint256 weight);An account's raw signal weight assigned to this Bribe's Strategy.
totalSignalWeight()function totalSignalWeight() external view returns (uint256 arg0);Total raw signal weight assigned to this Bribe's Strategy.
RewardNotified(address,uint256)event RewardNotified(address indexed rewardToken, uint256 amount);Emitted when a caller funds and restarts a registered token's seven-day stream.
Parameters
amount: Fresh raw token units pulled, excluding remaining scheduled rewards and the saved remainder.rewardToken: Registered token pulled from the caller.RewardPaid(address,address,uint256)event RewardPaid(address indexed account, address indexed rewardToken, uint256 amount);Emitted when one account's checkpointed reward is paid.
Parameters
account: Account that receives the token transfer regardless of who initiated the claim.amount: Raw token units transferred.rewardToken: Registered token paid to account.RewardTokenAdded(address)event RewardTokenAdded(address indexed rewardToken);Emitted when Resonance appends a token to the reward registry.
Parameters
rewardToken: Token that became eligible for funding and streaming.SignalWeightAdded(address,uint256)event SignalWeightAdded(address indexed account, uint256 amount);Emitted when Resonance adds signal weight for an account.
Parameters
account: Account whose weight in the paired Auction increased.amount: Raw signal units added.SignalWeightRemoved(address,uint256)event SignalWeightRemoved(address indexed account, uint256 amount);Emitted when Resonance removes signal weight for an account.
Parameters
account: Account whose weight in the paired Auction decreased.amount: Raw signal units removed.NotResonance(address)error NotResonance(address caller);No additional NatSpec notice is present in the compiled artifact.
NotRewardToken(address)error NotRewardToken(address token);No additional NatSpec notice is present in the compiled artifact.
ReentrancyGuardReentrantCall()error ReentrancyGuardReentrantCall();No additional NatSpec notice is present in the compiled artifact.
RewardAlreadyAdded(address)error RewardAlreadyAdded(address token);No additional NatSpec notice is present in the compiled artifact.
RewardBelowDuration(uint256)error RewardBelowDuration(uint256 amount);No additional NatSpec notice is present in the compiled artifact.
RewardBelowRemaining(uint256,uint256)error RewardBelowRemaining(uint256 amount, uint256 remaining);No additional NatSpec notice is present in the compiled artifact.
RewardLifetimeCapExceeded(address,uint256,uint256,uint256)error RewardLifetimeCapExceeded(address token, uint256 notified, uint256 requested, uint256 maximum);No additional NatSpec notice is present in the compiled artifact.
RewardTokenLimitReached(uint256)error RewardTokenLimitReached(uint256 maximum);No additional NatSpec notice is present in the compiled artifact.
SafeERC20FailedOperation(address)error SafeERC20FailedOperation(address token);No additional NatSpec notice is present in the compiled artifact.
UnauthorizedClaimCaller(address,address)error UnauthorizedClaimCaller(address caller, address account);No additional NatSpec notice is present in the compiled artifact.
ZeroAddress()error ZeroAddress();No additional NatSpec notice is present in the compiled artifact.
ZeroAmount()error ZeroAmount();No additional NatSpec notice is present in the compiled artifact.