Inherits: UUPSUpgradeable, AccessControlUpgradeable, Pausable
Author: Aria Protocol
Staking contract for IPRWA token
State Variables
STAKE_LOCK_SLOT
STATE VARIABLES ///
Slot for the stake lock
bytes32 private constant STAKE_LOCK_SLOT = 0xe750219e856dc1045ee53321d6403a2f5fd45d5721d9656823eb6ce52a38051a;
Address of the IPRWA token
IERC20 public iprwaToken;
stakedIPRWAToken
Address of the staked IPRWA token.
IStakedERC20 public stakedIPRWAToken;
Address of the legal contract that checks blacklist and license.
UD60x18_SCALE_PRECISION
Scale precision for the stIPRWA:IPRWA ratio - scaled by 10^27
usersNetIPRWADeposited
Amount of IPRWA solely deposited by users into the contract (not accounting for deposited rewards)
CONSTRUCTOR
Modifier to prevent staking/unstaking during the same transaction
CONSTRUCTOR
to avoid parity hack
Note: oz-upgrades-unsafe-allow: constructor
INITIALIZER
Initializer function needed to set values when called behind a proxy
Parameters
Address of the IPRWA token
Address of the Staked IPRWA token
Address of the legal contract that checks blacklist and license.
Address of the initial owner of the contract
STAKING FUNCTIONS
Stake IPRWA tokens
Assumes this contract has approval to move IPRWA tokens
Parameters
Number of IPRWA tokens to staking
Unstake stIPRWA token in exchange for IPRWA tokens
Assumes this contract has approval to move stIPRWA tokens
Parameters
Number of stIPRWA tokens to unstake, a.k.a. net user deposit w/o rewards
stIPRWAperIPRWA
EXTERNAL FUNCTIONS ///
Returns the stIPRWA:IPRWA ratio - scaled by 10^27
iprwaPerStIPRWA
Returns the IPRWA:stIPRWA ratio - scaled by 10^27
_stIPRWAPerIPRWA
INTERNAL FUNCTIONS
stIPRWA:IPRWA ratio = (total stIPRWA supply - stIPRWA contract balance) / (IPRWA in contract)
_iprwaPerStIPRWA
IPRWA:stIPRWA = (IPRWA in contract) / (total stIPRWA supply - stIPRWA contract balance)
_getStiprwaValue
ADMIN FUNCTIONS
Withdraw tokens from the contract.
A _tokenAddress of address(0) denotes ETH
Only callable by the contract owner
Parameters
Address of token to withdraw tokens for
Number of tokens to withdraw
Sets the address for the IPRWA token
Only callable by the contract owner
Parameters
Address for the IPRWA token
setStakedIPRWAToken
Sets the address for the stIPRWA token
Only callable by the contract owner
Parameters
Address for the stIPRWA token
_authorizeUpgrade
EVENTS
Event emitted when IPRWA tokens are staked
Event emitted when IPRWA tokens are unstaked
Event emitted when funds are withdrawn
CUSTOM ERRORS
Error thrown when trying to stake/unstake 0 tokens.
Error thrown when msg sender is unauthorized
Error thrown when user does not have enough balance
IncorrectSignatureLength
Error thrown when Signature length is incorrect