Rare Protocol
Search
βŒƒK

$RARE Curation Staking

IRareStakingRegistry

​Git Source​
Author: SuperRare Labs, koloz
The Staking Registry interface containing all functions, events, etc.

Functions

increaseAmountStaked

Increase amount staked when a user stakes.
function increaseAmountStaked(address _staker, address _stakedOn, uint256 _amount) external;
Parameters
Name
Type
Description
_staker
address
The user who is staking.
_stakedOn
address
The user who is being staked on.
_amount
uint256
The amount of $RARE that has been staked.

decreaseAmountStaked

Decrease the amount staked when a user unstakes.
function decreaseAmountStaked(address _staker, address _stakedOn, uint256 _amount) external;
Parameters
Name
Type
Description
_staker
address
The user who is unstaking.
_stakedOn
address
The user who was being staked on.
_amount
uint256
The amount of $RARE that has been unstaked.

setStakingAddresses

Set staking addresses for a target.
function setStakingAddresses(address _user, address _stakingAddress, address _rewardSwapAddress) external;
Parameters
Name
Type
Description
_user
address
Address of the target whose staking address is being set.
_stakingAddress
address
Address of the staking pool contract.
_rewardSwapAddress
address
Address of the reward swap contract.

setDefaultPayee

Set the default payee.
function setDefaultPayee(address _payee) external;
Parameters
Name
Type
Description
_payee
address
Address of the account to be the new default payee.

setDiscountPercentage

Set the reward swap discount percentage.
function setDiscountPercentage(uint256 _percentage) external;
Parameters
Name
Type
Description
_percentage
uint256
The new discount percentage.

setDeflationaryPercentage

Set the unstake deflationary percentage.
function setDeflationaryPercentage(uint256 _percentage) external;
Parameters
Name
Type
Description
_percentage
uint256
The new deflactionary percentage.

setPeriodLength

Set the round period length time.
function setPeriodLength(uint256 _periodLength) external;
Parameters
Name
Type
Description
_periodLength
uint256
The new period start.

setReverseRegistrar

Set the ENS reverse registrar address.
function setReverseRegistrar(address _reverseRegistrar) external;
Parameters
Name
Type
Description
_reverseRegistrar
address
The new period start.

setResolver

Set the ENS resolver address.
function setResolver(address _resolver) external;
Parameters
Name
Type
Description
_resolver
address
The new period start.

setSwapPool

Set the uniswap pool address for the given ERC20 token.
function setSwapPool(address _uniswapPool, address _token) external;
Parameters
Name
Type
Description
_uniswapPool
address
Address of uniswap pool.
_token
address
Address of ERC20 contract.

setStakeePercentage

Set stakee percentage.
function setStakeePercentage(uint256 _stakeePercentage) external;
Parameters
Name
Type
Description
_stakeePercentage
uint256
The new stakee percentage.

setClaimerPercentage

Set claimer percentage.
function setClaimerPercentage(uint256 _claimerPercentage) external;
Parameters
Name
Type
Description
_claimerPercentage
uint256
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.
function transferRareTo(address _from, address _to, uint256 _amount) external;
Parameters
Name
Type
Description
_from
address
Address to transfer the tokens from.
_to
address
Address to transfer the tokens to.
_amount
uint256
uint256 amount to transfer.

getDefaultPayee

Get the address for sending rewards if there are no stakers.
function getDefaultPayee() external view returns (address);
Returns
Name
Type
Description
<none>
address
address to send rewards to.

getSwapPool

Get the swap pool address for the ERC20 token.
function getSwapPool(address _token) external view returns (address);
Returns
Name
Type
Description
<none>
address
address of the swap pool associated with the token.

getRareAddress

Retrieve the address of $RARE.
function getRareAddress() external view returns (address);
Returns
Name
Type
Description
<none>
address
address Address of $RARE (the staking token to be used).

getWethAddress

Retrieve the address of Wrapped Ethereum.
function getWethAddress() external view returns (address);
Returns
Name
Type
Description
<none>
address
address Address of Wrapped Ethereum.

getDiscountPercentage

Get reward swap discount percentage.
function getDiscountPercentage() external view returns (uint256);
Returns
Name
Type
Description
<none>
uint256
uint256 discount percentage.

getDeflationaryPercentage

Get the unstake deflationary percentage.
function getDeflationaryPercentage() external view returns (uint256);
Returns
Name
Type
Description
<none>
uint256
uint256 deflationary percentage.

getStakeePercentage

Get the stakee percentage.
function getStakeePercentage(address _user) external view returns (uint256);
Parameters
Name
Type
Description
_user
address
Address of the user being staked on.
Returns
Name
Type
Description
<none>
uint256
uint256 stakee percentage.

getClaimerPercentage

Get the claimer percentage.
function getClaimerPercentage(address _user) external view returns (uint256);
Parameters
Name
Type
Description
_user
address
Address of the user reawards are being claimed for.
Returns
Name
Type
Description
<none>
uint256
uint256 claimer percentage.

getPeriodLength

Get the round period length.
function getPeriodLength() external view returns (uint256);
Returns
Name
Type
Description
<none>
uint256
uint256 period length.

getStakingInfoForUser

Retrieves the staking info for a given user.
function getStakingInfoForUser(address _user) external view returns (Info memory);
Parameters
Name
Type
Description
_user
address
Address of user being queried.
Returns
Name
Type
Description
<none>
Info
Info struct containing name, symbol, and staking address.

getTotalAmountStakedByUser

Retrieves the total amount of rare staked by a given user.
function getTotalAmountStakedByUser(address _user) external view returns (uint256);
Parameters
Name
Type
Description
_user
address
Address of the user staking.
Returns
Name
Type
Description
<none>
uint256
uint256 Amount of rare the user is staking.

getTotalAmountStakedOnUser

Retrieves the total amount of rare being staked on a given user.
function getTotalAmountStakedOnUser(address _user) external view returns (uint256);
Parameters
Name
Type
Description
_user
address
Address of the user being staked on.
Returns
Name
Type
Description
<none>
uint256
uint256 Amount of rare being staked on the user.

getAllStakingContracts

Retrieves a list of all the ERC20 staking contracts.
function getAllStakingContracts() external view returns (address[] memory);
Returns
Name
Type
Description
<none>
address[]
list of contracts users can use to stake.

getAllStakers

Retrieves a list of all the users participating in staking.
function getAllStakers() external view returns (address[] memory);
Returns
Name
Type
Description
<none>
address[]
list of addresses of all the users who are currently staking.

getAllStakedOn

Retrieves a list of all the users being staked on.
function getAllStakedOn() external view returns (address[] memory);
Returns
Name
Type
Description
<none>
address[]
list of addresses of all the users who are being staked on.

getUsersForStakingAddresses

Query the users for the following staking addresseses.
function getUsersForStakingAddresses(address[] calldata _stakingAddrs) external view returns (address[] memory);
Parameters
Name
Type
Description
_stakingAddrs
address[]
Addresses of staking contracts being queried.

STAKING_INFO_SETTER_ROLE

Bytes32 representation of the role used for setting the staking address of a user.
function STAKING_INFO_SETTER_ROLE() external view returns (bytes32);
Returns
Name
Type
Description
<none>
bytes32
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.
function STAKING_STAT_SETTER_ADMIN_ROLE() external view returns (bytes32);
Returns
Name
Type
Description
<none>
bytes32
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.
function STAKING_STAT_SETTER_ROLE() external view returns (bytes32);
Returns
Name
Type
Description
<none>
bytes32
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.
function STAKING_CONFIG_SETTER_ROLE() external view returns (bytes32);
Returns
Name
Type
Description
<none>
bytes32
bytes32 value of the staking config setter role.

ENS_SETTER_ROLE

Bytes32 representation of the role used for updating the ENS resolvers.
function ENS_SETTER_ROLE() external view returns (bytes32);
Returns
Name
Type
Description
<none>
bytes32
bytes32 value of the ens setter role.

SWAP_POOL_SETTER_ROLE

Bytes32 representation of the role used for updating uniswap pools.
function SWAP_POOL_SETTER_ROLE() external view returns (bytes32);
Returns
Name
Type
Description
<none>
bytes32
bytes32 value of the swap pool setter role.

Events

StakeePercentageUpdated

Emitted via {setStakeePercentage} when the stakee update's their percentage.
event StakeePercentageUpdated(address indexed _user, uint256 _percentage);

ClaimerPercentageUpdated

Emitted via {setClaimerPercentage} when the stakee update's their percentage.
event ClaimerPercentageUpdated(address indexed _user, uint256 _percentage);

DefaultPayeeUpdated

Emitted via {setDefaultPayee} when the defaultPayee is updated.
event DefaultPayeeUpdated(address _payee);

DeflationaryPercentageUpdated

Emitted via {setDeflationaryPercentage} when the deflationaryPercentage is updated.
event DeflationaryPercentageUpdated(uint256 _percentage);

DiscountPercentageUpdated

Emitted via {setDiscountPercentage} when the discountedPercent is updated.
event DiscountPercentageUpdated(uint256 _percentage);

PeriodLengthUpdated

Emitted via {setPeriodLength} when the periodLength is updated.
event PeriodLengthUpdated(uint256 _periodLength);

ReverseRegistrarUpdated

Emitted via {setReverseRegistrar} when the ENS reverse registrar is updated.
event ReverseRegistrarUpdated(address _percentage);

ResolverUpdated

Emitted via {setResolver} when the ENS resolver is updated.
event ResolverUpdated(address _resolver);

SetSwapPool

Emitted via {setSwapPool} when a new swap pool has been set.
event SetSwapPool(address _uniswapPool, address _token);

Errors

Unauthorized

Emitted when guarded functions are called by users without the necessary permissions.
error Unauthorized();

InvalidPool

Emitted via {setSwapPool} if the pool doesn't match the token and pairs with WETH.
error InvalidPool();

StakingContractAlreadyExists

Emitted via {setStakingAddress} if the user already has a staking address.
error StakingContractAlreadyExists();

ZeroAddressUnsupported

Emitted when Zero address provided where it is not allowed.
error ZeroAddressUnsupported();

InsufficientRareAllowance

Error emitted in {transferRareTo} when a user performs an action that requires moving $RARE but has not made enough allowance for the registry.
error InsufficientRareAllowance();

PercentageBeyondLimit

Emitted when a percentage is beyond the specified limit.
error PercentageBeyondLimit();

PeriodLengthBeyondLimit

Emitted when a Period Length is beyond the specified limit.
error PeriodLengthBeyondLimit();

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.
struct Info {
string name;
string symbol;
address stakingAddress;
address rewardSwapAddress;
}

IRewardAccumulator

​Git Source​
Author: SuperRare Labs, Koloz
The reward accumulator interface containing all functions, events, etc. for accumulating and swapping rewards.

Functions

initialize

function initialize(address _stakingRegistry, address _stakingPool) external;

rewardSwap

Swap RARE for a discounted price on tokens stored
function rewardSwap(address _tokenOut, uint256 _minAmountOut, uint128 _rareIn) external;
Parameters
Name
Type
Description
_tokenOut
address
Address of the ERC20 to pay out with. If null address, then uses ETH.
_minAmountOut
uint256
Min amount one is willing to receive for the _rareIn.
_rareIn
uint128
The amount of RARE one is looking to trade.

estimateRarePrice

Estimate the discounted $RARE price for a given token.
function estimateRarePrice(address _tokenOut, uint128 _rareAmountIn) external view returns (uint256);
Parameters
Name
Type
Description