$RARE Curation Staking
IRareStakingRegistry
Author: SuperRare Labs, koloz
The Staking Registry interface containing all functions, events, etc.
Functions
increaseAmountStaked
Increase amount staked when a user stakes.
Parameters
Name | Type | Description |
---|---|---|
|
| The user who is staking. |
|
| The user who is being staked on. |
|
| The amount of $RARE that has been staked. |
decreaseAmountStaked
Decrease the amount staked when a user unstakes.
Parameters
Name | Type | Description |
---|---|---|
|
| The user who is unstaking. |
|
| The user who was being staked on. |
|
| The amount of $RARE that has been unstaked. |
setStakingAddresses
Set staking addresses for a target.
Parameters
Name | Type | Description |
---|---|---|
|
| Address of the target whose staking address is being set. |
|
| Address of the staking pool contract. |
|
| Address of the reward swap contract. |
setDefaultPayee
Set the default payee.
Parameters
Name | Type | Description |
---|---|---|
|
| Address of the account to be the new default payee. |
setDiscountPercentage
Set the reward swap discount percentage.
Parameters
Name | Type | Description |
---|---|---|
|
| The new discount percentage. |
setDeflationaryPercentage
Set the unstake deflationary percentage.
Parameters
Name | Type | Description |
---|---|---|
|
| The new deflactionary percentage. |
setPeriodLength
Set the round period length time.
Parameters
Name | Type | Description |
---|---|---|
|
| The new period start. |
setReverseRegistrar
Set the ENS reverse registrar address.
Parameters
Name | Type | Description |
---|---|---|
|
| The new period start. |
setResolver
Set the ENS resolver address.
Parameters
Name | Type | Description |
---|---|---|
|
| The new period start. |
setSwapPool
Set the uniswap pool address for the given ERC20 token.
Parameters
Name | Type | Description |
---|---|---|
|
| Address of uniswap pool. |
|
| Address of ERC20 contract. |
setStakeePercentage
Set stakee percentage.
Parameters
Name | Type | Description |
---|---|---|
|
| The new stakee percentage. |
setClaimerPercentage
Set claimer percentage.
Parameters
Name | Type | Description |
---|---|---|
|
| The new stakee percentage. |
transferRareTo
Pools to transfer $RARE tokens, usually into pools. This is so users only need to approve the registry when staking or performing reward swaps.
Parameters
Name | Type | Description |
---|---|---|
|
| Address to transfer the tokens from. |
|
| Address to transfer the tokens to. |
|
| uint256 amount to transfer. |
getDefaultPayee
Get the address for sending rewards if there are no stakers.
Returns
Name | Type | Description |
---|---|---|
|
| address to send rewards to. |
getSwapPool
Get the swap pool address for the ERC20 token.
Returns
Name | Type | Description |
---|---|---|
|
| address of the swap pool associated with the token. |
getRareAddress
Retrieve the address of $RARE.
Returns
Name | Type | Description |
---|---|---|
|
| address Address of $RARE (the staking token to be used). |
getWethAddress
Retrieve the address of Wrapped Ethereum.
Returns
Name | Type | Description |
---|---|---|
|
| address Address of Wrapped Ethereum. |
getDiscountPercentage
Get reward swap discount percentage.
Returns
Name | Type | Description |
---|---|---|
|
| uint256 discount percentage. |
getDeflationaryPercentage
Get the unstake deflationary percentage.
Returns
Name | Type | Description |
---|---|---|
|
| uint256 deflationary percentage. |
getStakeePercentage
Get the stakee percentage.
Parameters
Name | Type | Description |
---|---|---|
|
| Address of the user being staked on. |
Returns
Name | Type | Description |
---|---|---|
|
| uint256 stakee percentage. |
getClaimerPercentage
Get the claimer percentage.
Parameters
Name | Type | Description |
---|---|---|
|
| Address of the user reawards are being claimed for. |
Returns
Name | Type | Description |
---|---|---|
|
| uint256 claimer percentage. |
getPeriodLength
Get the round period length.
Returns
Name | Type | Description |
---|---|---|
|
| uint256 period length. |
getStakingInfoForUser
Retrieves the staking info for a given user.
Parameters
Name | Type | Description |
---|---|---|
|
| Address of user being queried. |
Returns
Name | Type | Description |
---|---|---|
|
| Info struct containing name, symbol, and staking address. |
getTotalAmountStakedByUser
Retrieves the total amount of rare staked by a given user.
Parameters
Name | Type | Description |
---|---|---|
|
| Address of the user staking. |
Returns
Name | Type | Description |
---|---|---|
|
| uint256 Amount of rare the user is staking. |
getTotalAmountStakedOnUser
Retrieves the total amount of rare being staked on a given user.
Parameters
Name | Type | Description |
---|---|---|
|
| Address of the user being staked on. |
Returns
Name | Type | Description |
---|---|---|
|
| uint256 Amount of rare being staked on the user. |
getAllStakingContracts
Retrieves a list of all the ERC20 staking contracts.
Returns
Name | Type | Description |
---|---|---|
|
| list of contracts users can use to stake. |
getAllStakers
Retrieves a list of all the users participating in staking.
Returns
Name | Type | Description |
---|---|---|
|
| list of addresses of all the users who are currently staking. |
getAllStakedOn
Retrieves a list of all the users being staked on.
Returns
Name | Type | Description |
---|---|---|
|
| list of addresses of all the users who are being staked on. |
getUsersForStakingAddresses
Query the users for the following staking addresseses.
Parameters
Name | Type | Description |
---|---|---|
|
| Addresses of staking contracts being queried. |
STAKING_INFO_SETTER_ROLE
Bytes32 representation of the role used for setting the staking address of a user.
Returns
Name | Type | Description |
---|---|---|
|
| bytes32 value of the staking info setter role. |
STAKING_STAT_SETTER_ADMIN_ROLE
Bytes32 representation of the admin role for granting the ability to set amount staked for a single user/total amount staked on a user.
Returns
Name | Type | Description |
---|---|---|
|
| bytes32 value of the staking stat setter admin role. |
STAKING_STAT_SETTER_ROLE
Bytes32 representation of the role used for updating the amount being staked on a user/amount a user is staking globally.
Returns
Name | Type | Description |
---|---|---|
|
| bytes32 value of the stat setter role. |
STAKING_CONFIG_SETTER_ROLE
Bytes32 representation of the role used for period length, deflationary percentages, and the default payee.
Returns
Name | Type | Description |
---|---|---|
|
| bytes32 value of the staking config setter role. |
ENS_SETTER_ROLE
Bytes32 representation of the role used for updating the ENS resolvers.
Returns
Name | Type | Description |
---|---|---|
|
| bytes32 value of the ens setter role. |
SWAP_POOL_SETTER_ROLE
Bytes32 representation of the role used for updating uniswap pools.
Returns
Name | Type | Description |
---|---|---|
|
| bytes32 value of the swap pool setter role. |
Events
StakeePercentageUpdated
Emitted via {setStakeePercentage} when the stakee update's their percentage.
ClaimerPercentageUpdated
Emitted via {setClaimerPercentage} when the stakee update's their percentage.
DefaultPayeeUpdated
Emitted via {setDefaultPayee} when the defaultPayee is updated.
DeflationaryPercentageUpdated
Emitted via {setDeflationaryPercentage} when the deflationaryPercentage is updated.
DiscountPercentageUpdated
Emitted via {setDiscountPercentage} when the discountedPercent is updated.
PeriodLengthUpdated
Emitted via {setPeriodLength} when the periodLength is updated.
ReverseRegistrarUpdated
Emitted via {setReverseRegistrar} when the ENS reverse registrar is updated.
ResolverUpdated
Emitted via {setResolver} when the ENS resolver is updated.
SetSwapPool
Emitted via {setSwapPool} when a new swap pool has been set.
Errors
Unauthorized
Emitted when guarded functions are called by users without the necessary permissions.
InvalidPool
Emitted via {setSwapPool} if the pool doesn't match the token and pairs with WETH.
StakingContractAlreadyExists
Emitted via {setStakingAddress} if the user already has a staking address.
ZeroAddressUnsupported
Emitted when Zero address provided where it is not allowed.
InsufficientRareAllowance
Error emitted in {transferRareTo} when a user performs an action that requires moving $RARE but has not made enough allowance for the registry.
PercentageBeyondLimit
Emitted when a percentage is beyond the specified limit.
PeriodLengthBeyondLimit
Emitted when a Period Length is beyond the specified limit.
Structs
Info
A struct holding the information about the target's staking contract.
Target being staked on is omitted as it's the key in the mapping used.
IRewardAccumulator
Author: SuperRare Labs, Koloz
The reward accumulator interface containing all functions, events, etc. for accumulating and swapping rewards.
Functions
initialize
rewardSwap
Swap RARE for a discounted price on tokens stored
Parameters
Name | Type | Description |
---|---|---|
|
| Address of the ERC20 to pay out with. If null address, then uses ETH. |
|
| Min amount one is willing to receive for the _rareIn. |
|
| The amount of RARE one is looking to trade. |
estimateRarePrice
Estimate the discounted $RARE price for a given token.
Parameters
Name | Type | Description |
---|---|---|
|
| Address of the ERC20 token to be swapped for. |
|
| uint128 amount of RARE to trade for the _tokenOut. |
Returns
Name | Type | Description |
---|---|---|
|
| uint256 amount of _tokenOut for the _rareAmountIn. |
Events
RewardAccumulator
Errors
Unauthorized
Error emitted when user doesnt meet the criteria for call.
InsufficientFunds
Error emitted via {rewardSwap} if reward swap doesn't have enough funds to perform the swap.
RarePriceTooLow
Error emitted via {rewardSwap} if the rare price is too low to handle the _minAmountOut requirement.
CannotSwapRareForRare
Error emitted via {rewardSwap} if _tokenOut is the $RARE address.
UnsupportedERC20Token
Emitted when an unsupported ERC20 token for reward swapping.
IRarityPool
Inherits: IERC20Upgradeable
Author: SuperRare Labs, koloz
The Rare Staking Pool ERC20 (Rarity Pool) interface containing all functions, events, etc.
Functions
initialize
addRewards
Allocates rewards for the current round with the given amount.
Parameters
Name | Type | Description |
---|---|---|
|
| Address of the account donating the $RARE. |
|
| Amount of $RARE being staked. |
takeSnapshot
Snapshots the rewards for the current round. Anyone can call this.
stake
Stake $RARE tokens to the target associated with the contract and receive synthetic tokens in return.
Parameters
Name | Type | Description |
---|---|---|
|
| Amount of $RARE being staked. |
unstake
Unstake by returning synthetic tokens and receiving previously staked $RARE in return.
Parameters
Name | Type | Description |
---|---|---|
|
| Amount of synthetic tokens to unstake. |
claimRewardsForRounds
Claim rewards due to the _user for the supplied rounds. Rewards are proportional to the synthetic tokens held during the snapshot associated with each round. Throws if user has already claimed for a given round. Throws if current round is being claimed.
Parameters
Name | Type | Description |
---|---|---|
|
| Address of user to claim on behalf of. |
|
| List of uint256 round Ids to claim a reward for. |
stakerHasClaimedForRound
Query if a user has claimed their reward for a given round.
Parameters
Name | Type | Description |
---|---|---|
|
| Address of user being checked. |
|
| The round being checked for. |
getAmountStakedByUser
Query total amount of $RARE a user has staked on this contract.
Parameters
Name | Type | Description |
---|---|---|
|
| Address of staker. |
Returns
Name | Type | Description |
---|---|---|
|
| uint256 Amount of $RARE staked. |
getCurrentRound
Query current round. The current round is accumulating rewards.
Returns
Name | Type | Description |
---|---|---|
|
| uint256 Claim round id. |
name
Name of the synthetic asset.
Returns
Name | Type | Description |
---|---|---|
|
| Name of the synthetic asset. |
symbol
Symbol of the synthetic asset.
Returns
Name | Type | Description |
---|---|---|
|
| Symbol of the synthetic asset. |
getTargetBeingStakedOn
Query the target being staked on by this contract.
Returns
Name | Type | Description |
---|---|---|
|
| Address of target being staked on; |
getAllStakers
Retrieves a list of all the users that have staked.
Returns
Name | Type | Description |
---|---|---|
|
| list of addresses of all the users who are being staked on. |
getRoundRewards
Total rewards available for the supplied round.
Returns
Name | Type | Description |
---|---|---|
|
| uint256 Amount of $RARE tokens allocated as rewards for round. |
getHistoricalRewardsForUserForRounds
Query rewards for the supplied user address for the round supplied rounds. Does not omit rewards for rounds that have already been claimed. Allows for easier historical lookups.
Parameters
Name | Type | Description |
---|---|---|
|
| Address of the user to get rewards. |
|
| List of uint256 round ids to look up the rewards. |
Returns
Name | Type | Description |
---|---|---|
|
| uint256 Amount of $RARE tokens rewarded. |
getClaimableRewardsForUserForRounds
Query rewards for the supplied user address for the round supplied rounds. Throws if any round has already been claimed.
Parameters
Name | Type | Description |
---|---|---|
|
| Address of the user to get rewards. |
|
| List of uint256 round ids to look up the rewards. |
Returns
Name | Type | Description |
---|---|---|
|
| uint256 Amount of $RARE tokens rewarded. |
calculatePurchaseReturn
Calculates the number of sRare yielded from staking.
Parameters
Name | Type | Description |
---|---|---|
|
| Current supply of sRare. |
|
| Amount of RARE being staked. |
Returns
Name | Type | Description |
---|---|---|
|
| uint256 Amount of synthetic tokens one would get for staking {_stakedAmount} given a totalSupply of {_totalSRare}. |
calculateSaleReturn
Calculates the number of rare yielded from unstaking.
Parameters
Name | Type | Description |
---|---|---|
|
| Current balance of sRARE held by the given user. |
|
| Total Amount of RARE staked by the given user. |
|
| Amount of sRare being traded in. |
Returns
Name | Type | Description |
---|---|---|
|
| uint256 Amount of $RARE tokens one would get for unstaking {_unstakeAmount} given {_totalSRareByUser} and {_totalRareStakedByUser}. |
getAllTimeRewards
Total rewards snapshotted since con.
Returns
Name | Type | Description |
---|---|---|
|
| uint256 Amount of $RARE tokens allocated as rewards. |
getClaimRounds
List of all rounds with claim associated with them.
Returns
Name | Type | Description |
---|---|---|
|
| uint256[] claim round ids. |
getCreationTime
Get the unix creation time of the staking contract.
Returns
Name | Type | Description |
---|---|---|
|
| uint256 unix creation time of the contract. |
getLastSnapshotTimestamp
Get the unix time of the most recent snapshot.
Returns
Name | Type | Description |
---|---|---|
|
| uint256 unix time of the most recent snapshot. |
getSumOfAllClaimed
Total amount of Rewards claimed.
Returns
Name | Type | Description |
---|---|---|
|
| uint256 amount of rewards claimed. |
Events
RewardClaimed
Stake
Unstake
StakingSnapshot
AddRewards
Errors
Unauthorized
Error emitted when user doesnt meet the criteria for call.
RewardAlreadyClaimed
Error emitted via {claimRewardsForRounds} if sender has already claimed their reward one of the supplied rounds.
ClaimingTooManyRounds
Error emitted via {claimRewardsForRounds} if too many rounds are supplied.
CannotClaimCurrentRound
Error emitted via {claimRewardsForRounds} if claiming current round.
ClaimingZeroRounds
Error emitted via {claimRewardsForRounds} if claiming no rounds.
InsufficientSyntheticRare
Error emitted via {unstake} when unstaking more synthetic tokens than is in their balance.
InsufficientStakedRare
Error emitted via {unstake} when the sale return proves greater than the amount staked. This should be impossible.
CannotAddZeroRewards
Error emitted via {addRewards} if adding 0 rewards.
IRewardAccumulatorFactory
Author: charlescrain
The RewardAccumulator Factory interface containing all functions, events, etc.
Functions
deployRewardSwap
Deploys a RewardAccumulator contract.
Parameters
Name | Type | Description |
---|---|---|
|
| Address of staking contract. |
Returns
Name | Type | Description |
---|---|---|
|
| address Address of the RewardAccumulator contract. |
setStakingRegistry
Set the staking registry address field to be used.
Parameters
Name | Type | Description |
---|---|---|
|
| Address of the new staking registry contract. |
setRewardSwapTemplate
Set the RewardAccumulator template address to be used.
Parameters
Name | Type | Description |
---|---|---|
|
| Address of the RewardAccumulator template. |
getStakingRegistryAddress
Retrieve the currently used staking registry address.
Returns
Name | Type | Description |
---|---|---|
|
| address Address of the staking registry contract. |
getRewardSwapTemplateAddress
Retrieve the template contract
Returns
Name | Type | Description |
---|---|---|
|
| address Address of the template. |
Events
RewardSwapContractCreated
Emitted via {deployRewardSwap} when a new RewardAccumulator contract is deployed.
IRarityPoolFactory
Author: SuperRare Labs, koloz
The Staking Factory interface containing all functions, events, etc.
Functions
deployStaking
Deploys a staking contract for the supplied target address. Reverts if address exists.
Parameters
Name | Type | Description |
---|---|---|
|
| Address of the target to deploy staking contract for. |
Returns
Name | Type | Description |
---|---|---|
|
| address Address of the staking contract. |
setStakingRegistry
Set the staking registry address field to be used.
Parameters
Name | Type | Description |
---|---|---|
|
| Address of the new staking registry contract. |
setRareStakingTemplate
Set the rare staking ERC20 template address to be used.
Parameters
Name | Type | Description |
---|---|---|
|
| Address of the staking ERC20 template. |
getStakingRegistryAddress
Retrieve the currently used staking registry address.
Returns
Name | Type | Description |
---|---|---|
|
| address Address of the staking registry contract. |
getRareStakingTemplateAddress
Retrieve the currently template of the staking ERC20 contract.
Returns
Name | Type | Description |
---|---|---|
|
| address Address of the staking ERC20 template to be used. |
Events
StakingContractCreated
Emitted via {deployStaking} when a new staking contract is deployed.
Last updated