Staking
Contains all staking related interfaces and contracts.
Contracts
IStaking
import "@etherisc/gif-next/contracts/staking/IStaking.sol";
-
[
initializeTokenHandler()
] -
[
setSupportInfo(targetType, isSupported, allowNewTargets, allowCrossChain, minStakingAmount, maxStakingAmount, minLockingPeriod, maxLockingPeriod, minRewardRate, maxRewardRate)
] -
[
setUpdateTriggers(tvlUpdatesTrigger, minTvlRatioTrigger)
] -
[
setProtocolLockingPeriod(lockingPeriod)
] -
[
setProtocolRewardRate(rewardRate)
] -
[
setStakingRate(chainId, token, stakingRate)
] -
[
setStakingService(release)
] -
[
setStakingReader(stakingReader)
] -
[
addToken(chainId, token)
] -
[
approveTokenHandler(token, amount)
] -
[
refillRewardReserves(targetNftId, dipAmount)
] -
[
withdrawRewardReserves(targetNftId, dipAmount)
] -
[
registerTarget(targetNftId, expectedObjectType, initialLockingPeriod, initialRewardRate)
] -
[
setLockingPeriod(targetNftId, lockingPeriod)
] -
[
setRewardRate(targetNftId, rewardRate)
] -
[
setTargetLimits(targetNftId, marginAmount, limitAmount)
] -
[
setMaxStakedAmount(targetNftId, stakeLimitAmount)
] -
[
addTargetToken(targetNftId, token)
] -
[
increaseTotalValueLocked(targetNftId, token, amount)
] -
[
decreaseTotalValueLocked(targetNftId, token, amount)
] -
[
updateRemoteTvl(targetNftId, token, amount)
] -
[
refillRewardReservesByService(targetNftId, dipAmount, transferFrom)
] -
[
withdrawRewardReservesByService(targetNftId, dipAmount, transferTo)
] -
[
updateTargetLimit(targetNftId)
] -
[
createStake(targetNftId, dipAmount, stakeOwner)
] -
[
stake(stakeNftId, dipAmount)
] -
[
unstake(stakeNftId)
] -
[
restake(stakeNftId, newTargetNftId)
] -
[
updateRewards(stakeNftId)
] -
[
claimRewards(stakeNftId)
] -
[
getTargetHandler()
] -
[
getStakingStore()
] -
[
getStakingReader()
]
-
[
initializeVersionable(activatedBy, activationData)
] -
[
upgradeVersionable(upgradeData)
] -
[
getVersion()
]
-
[
getName()
] -
[
getToken()
] -
[
getTokenHandler()
] -
[
getWallet()
] -
[
isNftInterceptor()
] -
[
isRegistered()
] -
[
getComponentInfo()
] -
[
getInitialComponentInfo()
]
-
[
nftTransferFrom(from, to, tokenId, operator)
]
-
[
isActive()
] -
[
getInitialInfo()
]
-
[
getRelease()
]
-
[
linkToRegisteredNftId()
] -
[
getNftId()
] -
[
getOwner()
]
-
[
getRegistry()
]
-
[
supportsInterface(interfaceId)
]
-
[
authority()
] -
[
setAuthority()
] -
[
isConsumingScheduledOp()
]
-
[
LogStakingStakingRateSet(chainId, token, newStakingRate, oldStakingRate, lastUpdateIn)
] -
[
LogStakingStakingServiceSet(stakingService, release, oldStakingService)
] -
[
LogStakingStakingReaderSet(stakingReader, oldStakingReader)
] -
[
LogStakingTargetHandlerSet(targetManager, oldTargetHandler)
] -
[
LogStakingTokenHandlerApproved(token, approvalAmount, oldApprovalAmount)
] -
[
LogStakingTokenAdded(chainId, token)
] -
[
LogStakingTargetTokenAdded(targetNftId, chainId, token)
] -
[
LogStakingTvlIncreased(targetNftId, token, amount, newBalance, lastUpdateIn)
] -
[
LogStakingTvlDecreased(targetNftId, token, amount, newBalance, lastUpdateIn)
] -
[
LogStakingSupportInfoSet(objectType, isSupported, allowNewTargets, allowCrossChain, minStakingAmount, maxStakingAmount, minLockingPeriod, maxLockingPeriod, minRewardRate, maxRewardRate, lastUpdateIn)
] -
[
LogStakingTargetCreated(targetNftId, objectType, lockingPeriod, rewardRate)
] -
[
LogStakingLimitsSet(targetNftId, marginAmount, hardLimitAmount, lastUpdateIn)
] -
[
LogStakingTargetLimitsUpdated(targetNftId, marginAmount, hardLimitAmount, lastUpdateIn)
] -
[
LogStakingTargetLimitUpdated(targetNftId, limitAmount, hardLimitAmount, requiredStakeAmount, actualStakeAmount, lastUpdateIn)
] -
[
LogStakingTargetLockingPeriodSet(targetNftId, oldLockingPeriod, lockingPeriod, lastUpdateIn)
] -
[
LogStakingTargetRewardRateSet(targetNftId, rewardRate, oldRewardRate, lastUpdateIn)
] -
[
LogStakingTargetMaxStakedAmountSet(targetNftId, stakeLimitAmount, lastUpdateIn)
] -
[
LogStakingTargetLimitsSet(targetNftId, stakeLimitAmount, marginAmount, limitAmount)
] -
[
LogStakingRewardReservesRefilled(targetNftId, dipAmount, targetOwner, reserveBalance, lastUpdateIn)
] -
[
LogStakingRewardReservesWithdrawn(targetNftId, dipAmount, targetOwner, reserveBalance, lastUpdateIn)
] -
[
LogStakingRewardReservesSpent(targetNftId, dipAmount, reserveBalance, lastUpdateIn)
] -
[
LogStakingStakeCreated(stakeNftId, targetNftId, stakeAmount, lockedUntil, stakeOwner)
] -
[
LogStakingStakeRewardsUpdated(stakeNftId, rewardIncrementAmount, stakeBalance, rewardBalance, lockedUntil, lastUpdateIn)
] -
[
LogStakingRewardsRestaked(stakeNftId, restakedAmount, stakeBalance, rewardBalance, lockedUntil, lastUpdateIn)
] -
[
LogStakingStaked(stakeNftId, stakedAmount, stakeBalance, rewardBalance, lockedUntil, lastUpdateIn)
] -
[
LogStakingUnstaked(stakeNftId, unstakedAmount, stakeBalance, rewardBalance, lockedUntil, lastUpdateIn)
] -
[
LogStakingRewardsClaimed(stakeNftId, claimedAmount, stakeBalance, rewardBalance, lockedUntil, lastUpdateIn)
] -
[
LogStakingStakeRestaked(stakeNftId, targetNftId, stakeAmount, owner, oldStakeNftId)
]
-
[
LogComponentWalletAddressChanged(oldWallet, newWallet)
] -
[
LogComponentWalletTokensTransferred(from, to, amount)
] -
[
LogComponentTokenHandlerApproved(tokenHandler, token, limit, isMaxAmount)
]
-
[
LogNftOwnableNftLinkedToAddress(nftId, owner)
]
-
[
AuthorityUpdated(authority)
]
setSupportInfo(ObjectType targetType, bool isSupported, bool allowNewTargets, bool allowCrossChain, Amount minStakingAmount, Amount maxStakingAmount, Seconds minLockingPeriod, Seconds maxLockingPeriod, UFixed minRewardRate, UFixed maxRewardRate)
external
Enable/disable the staking support for the specified target type. Defines the degrees of freedom for creating staking targets per target type.
setUpdateTriggers(uint16 tvlUpdatesTrigger, UFixed minTvlRatioTrigger)
external
Set the trigger values to determine when to update limit amount in TargetInfo. Changes in the TvlInfo may trigger an update of the limit amount in the TargetInfo based on these settings. The value tvlUpdatesTrigger suppresses any updates if the number of TVL updates is below this value. The value minTvlRatioTrigger defines the minimal TVL ratio above which the limit amount is updated. The ratio is calulated as current TVL / baseline TVL (or baseline TVL / current TVL).
setProtocolLockingPeriod(Seconds lockingPeriod)
external
Set the stake locking period for protocol stakes to the specified duration.
setStakingRate(ChainId chainId, address token, UFixed stakingRate)
external
Set the staking rate for the specified chain and token. The staking rate defines the amount of staked dips required to back up 1 token of total value locked.
setStakingService(VersionPart release)
external
Sets/updates the staking service contract to the staking service of the specified release.
addToken(ChainId chainId, address token)
external
Registers a token for recording staking rate and total value locked.
approveTokenHandler(contract IERC20Metadata token, Amount amount)
external
Set the approval to the token handler. Defines the max allowance from the staking wallet to the token handler.
refillRewardReserves(NftId targetNftId, Amount dipAmount) → Amount newBalance
external
(Re)fills the staking reward reserves for the specified target Unpermissioned: anybody may fill up staking reward reserves
withdrawRewardReserves(NftId targetNftId, Amount dipAmount) → Amount newBalance
external
Defunds the staking reward reserves for the specified target Permissioned: only the owner may call this function
registerTarget(NftId targetNftId, ObjectType expectedObjectType, Seconds initialLockingPeriod, UFixed initialRewardRate)
external
Register a new target for staking. Permissioned: only the staking service may call this function
setLockingPeriod(NftId targetNftId, Seconds lockingPeriod)
external
Set the stake locking period to the specified duration. Permissioned: only the staking service may call this function
setRewardRate(NftId targetNftId, UFixed rewardRate)
external
Update the target specific reward rate. Permissioned: only the staking service may call this function
setTargetLimits(NftId targetNftId, Amount marginAmount, Amount limitAmount)
external
Set the staking limits for the specified target. The margin amount allows staker to stake over the current required stakes by this amount. The limit amount restricts stakers to ever stake more than this amount. Permissioned: only the target owner may call this function
setMaxStakedAmount(NftId targetNftId, Amount stakeLimitAmount)
external
Set the maximum staked amount for the specified target. Permissioned: only the staking service may call this function
addTargetToken(NftId targetNftId, address token)
external
Register a token for the specified target. Used for instance targets. Each product may introduce its own token. Permissioned: only the staking service may call this function
increaseTotalValueLocked(NftId targetNftId, address token, Amount amount)
external
Increases the total value locked amount for the specified target by the provided token amount. function is called when a new policy is collateralized. function restricted to the pool service.
decreaseTotalValueLocked(NftId targetNftId, address token, Amount amount)
external
Decreases the total value locked amount for the specified target by the provided token amount. function is called when a new policy is closed or payouts are executed. function restricted to the pool service.
refillRewardReservesByService(NftId targetNftId, Amount dipAmount, address transferFrom) → Amount newBalance
external
(Re)fills the staking reward reserves for the specified target Unpermissioned: anybody may fill up staking reward reserves
withdrawRewardReservesByService(NftId targetNftId, Amount dipAmount, address transferTo) → Amount newBalance
external
Defunds the staking reward reserves for the specified target Permissioned: only the owner may call this function
updateTargetLimit(NftId targetNftId)
external
Updates the current limit amount for the specified target. The function takes into account the current TVL amount per token and the current staking rate for the token to calculate the required stake amount. Based on this required stake amount and the targets margin and hard limit (from LimitInfo) the function updates the target limit amount (in the target info)
createStake(NftId targetNftId, Amount dipAmount, address stakeOwner) → NftId stakeNftId
external
Creates a new stake to the specified target over the given DIP amount. The stake owner is provided as an argument and becomes the stake NFT holder. This function is permissionless and may be called by any user.
stake(NftId stakeNftId, Amount dipAmount) → Amount newStakeBalance
external
Increase the staked DIP by dipAmount for the specified stake. Staking rewards are updated and added to the staked DIP amount as well. The function returns the new total amount of staked dips.
unstake(NftId stakeNftId) → Amount unstakedAmount
external
Pays the specified DIP amount to the holder of the stake NFT ID. permissioned: only staking service may call this function.
restake(NftId stakeNftId, NftId newTargetNftId) → NftId newStakeNftId, Amount newStakeBalance
external
restakes the dips to a new target. the sum of the staked dips and the accumulated rewards will be restaked. permissioned: only staking service may call this function.
updateRewards(NftId stakeNftId) → Amount newRewardAmount
external
update stake rewards for current time. may be called before an announement of a decrease of a reward rate reduction. calling this functions ensures that reward balance is updated using the current (higher) reward rate. unpermissioned.
claimRewards(NftId stakeNftId) → Amount rewardsClaimedAmount
external
transfers all rewards accumulated so far to the holder of the specified stake nft. permissioned: only staking service may call this function.
LogStakingStakingRateSet(ChainId chainId, address token, UFixed newStakingRate, UFixed oldStakingRate, Blocknumber lastUpdateIn)
event
LogStakingStakingServiceSet(address stakingService, VersionPart release, address oldStakingService)
event
LogStakingTokenHandlerApproved(address token, Amount approvalAmount, Amount oldApprovalAmount)
event
LogStakingTvlIncreased(NftId targetNftId, address token, Amount amount, Amount newBalance, Blocknumber lastUpdateIn)
event
LogStakingTvlDecreased(NftId targetNftId, address token, Amount amount, Amount newBalance, Blocknumber lastUpdateIn)
event
LogStakingSupportInfoSet(ObjectType objectType, bool isSupported, bool allowNewTargets, bool allowCrossChain, Amount minStakingAmount, Amount maxStakingAmount, Seconds minLockingPeriod, Seconds maxLockingPeriod, UFixed minRewardRate, UFixed maxRewardRate, Blocknumber lastUpdateIn)
event
LogStakingTargetCreated(NftId targetNftId, ObjectType objectType, Seconds lockingPeriod, UFixed rewardRate)
event
LogStakingLimitsSet(NftId targetNftId, Amount marginAmount, Amount hardLimitAmount, Blocknumber lastUpdateIn)
event
LogStakingTargetLimitsUpdated(NftId targetNftId, Amount marginAmount, Amount hardLimitAmount, Blocknumber lastUpdateIn)
event
LogStakingTargetLimitUpdated(NftId targetNftId, Amount limitAmount, Amount hardLimitAmount, Amount requiredStakeAmount, Amount actualStakeAmount, Blocknumber lastUpdateIn)
event
LogStakingTargetLockingPeriodSet(NftId targetNftId, Seconds oldLockingPeriod, Seconds lockingPeriod, Blocknumber lastUpdateIn)
event
LogStakingTargetRewardRateSet(NftId targetNftId, UFixed rewardRate, UFixed oldRewardRate, Blocknumber lastUpdateIn)
event
LogStakingTargetMaxStakedAmountSet(NftId targetNftId, Amount stakeLimitAmount, Blocknumber lastUpdateIn)
event
LogStakingTargetLimitsSet(NftId targetNftId, Amount stakeLimitAmount, Amount marginAmount, Amount limitAmount)
event
LogStakingRewardReservesRefilled(NftId targetNftId, Amount dipAmount, address targetOwner, Amount reserveBalance, Blocknumber lastUpdateIn)
event
LogStakingRewardReservesWithdrawn(NftId targetNftId, Amount dipAmount, address targetOwner, Amount reserveBalance, Blocknumber lastUpdateIn)
event
LogStakingRewardReservesSpent(NftId targetNftId, Amount dipAmount, Amount reserveBalance, Blocknumber lastUpdateIn)
event
LogStakingStakeCreated(NftId stakeNftId, NftId targetNftId, Amount stakeAmount, Timestamp lockedUntil, address stakeOwner)
event
LogStakingStakeRewardsUpdated(NftId stakeNftId, Amount rewardIncrementAmount, Amount stakeBalance, Amount rewardBalance, Timestamp lockedUntil, Blocknumber lastUpdateIn)
event
LogStakingRewardsRestaked(NftId stakeNftId, Amount restakedAmount, Amount stakeBalance, Amount rewardBalance, Timestamp lockedUntil, Blocknumber lastUpdateIn)
event
LogStakingStaked(NftId stakeNftId, Amount stakedAmount, Amount stakeBalance, Amount rewardBalance, Timestamp lockedUntil, Blocknumber lastUpdateIn)
event
LogStakingUnstaked(NftId stakeNftId, Amount unstakedAmount, Amount stakeBalance, Amount rewardBalance, Timestamp lockedUntil, Blocknumber lastUpdateIn)
event
IStakingService
import "@etherisc/gif-next/contracts/staking/IStakingService.sol";
-
[
createInstanceTarget(targetNftId, initialLockingPeriod, initialRewardRate)
] -
[
setInstanceLockingPeriod(instanceNftId, lockingPeriod)
] -
[
setInstanceRewardRate(instanceNftId, rewardRate)
] -
[
setInstanceMaxStakedAmount(instanceNftId, maxStakingAmount)
] -
[
refillInstanceRewardReserves(instanceNftId, rewardProvider, dipAmount)
] -
[
withdrawInstanceRewardReserves(instanceNftId, dipAmount)
] -
[
setTotalValueLocked(targetNftId, token, amount)
] -
[
createStakeObject(targetNftId, initialOwner)
] -
[
pullDipToken(dipAmount, stakeOwner)
] -
[
pushDipToken(dipAmount, stakeOwner)
] -
[
approveTokenHandler(token, amount)
] -
[
getDipToken()
] -
[
getTokenHandler()
] -
[
getStaking()
]
-
[
getDomain()
] -
[
getRoleId()
]
-
[
initializeVersionable(activatedBy, activationData)
] -
[
upgradeVersionable(upgradeData)
] -
[
getVersion()
]
-
[
isActive()
] -
[
getInitialInfo()
]
-
[
getRelease()
]
-
[
linkToRegisteredNftId()
] -
[
getNftId()
] -
[
getOwner()
]
-
[
getRegistry()
]
-
[
supportsInterface(interfaceId)
]
-
[
authority()
] -
[
setAuthority()
] -
[
isConsumingScheduledOp()
]
-
[
LogStakingServiceProtocolTargetRegistered(protocolNftId)
] -
[
LogStakingServiceInstanceTargetRegistered(instanceNftId, chainId)
] -
[
LogStakingServiceLockingPeriodSet(targetNftId, oldLockingDuration, lockingDuration)
] -
[
LogStakingServiceRewardRateSet(targetNftId, oldRewardRate, rewardRate)
] -
[
LogStakingServiceRewardReservesIncreased(targetNftId, rewardProvider, dipAmount, newBalance)
] -
[
LogStakingServiceRewardReservesDecreased(targetNftId, targetOwner, dipAmount, newBalance)
] -
[
LogStakingServiceStakeObjectCreated(stakeNftId, targetNftId, stakeOwner)
] -
[
LogStakingServiceStakeCreated(stakeNftId, targetNftId, owner, stakedAmount)
] -
[
LogStakingServiceStakeIncreased(stakeNftId, owner, stakedAmount, stakeBalance)
] -
[
LogStakingServiceUnstaked(stakeNftId, stakeOwner, totalAmount)
] -
[
LogStakingServiceStakeRestaked(stakeOwner, stakeNftId, newStakeNftId, newTargetNftId, newStakeBalance)
] -
[
LogStakingServiceRewardsUpdated(stakeNftId)
] -
[
LogStakingServiceRewardsClaimed(stakeNftId, stakeOwner, rewardsClaimedAmount)
]
-
[
LogNftOwnableNftLinkedToAddress(nftId, owner)
]
-
[
AuthorityUpdated(authority)
]
createInstanceTarget(NftId targetNftId, Seconds initialLockingPeriod, UFixed initialRewardRate)
external
Creates/registers an on-chain instance staking target. Permissioned: Only instance service
setInstanceLockingPeriod(NftId instanceNftId, Seconds lockingPeriod)
external
Set the instance stake locking period to the specified duration. Permissioned: Only instance service
setInstanceRewardRate(NftId instanceNftId, UFixed rewardRate)
external
Set the instance reward rate to the specified value. Permissioned: Only instance service
setInstanceMaxStakedAmount(NftId instanceNftId, Amount maxStakingAmount)
external
Set the instance max staked amount to the specified value. Permissioned: Only instance service
refillInstanceRewardReserves(NftId instanceNftId, address rewardProvider, Amount dipAmount) → Amount newBalance
external
(Re)fills the staking reward reserves for the specified target using the dips provided by the reward provider. Permissioned: Only instance service
withdrawInstanceRewardReserves(NftId instanceNftId, Amount dipAmount) → Amount newBalance
external
Defunds the staking reward reserves for the specified target Permissioned: Only instance service
setTotalValueLocked(NftId targetNftId, address token, Amount amount)
external
Sets total value locked data for a target contract on a different chain. this is done via CCIP (cross chain communication)
createStakeObject(NftId targetNftId, address initialOwner) → NftId stakeNftId
external
Creates a new stake object for the specified target via the registry service. Permissioned: only the staking component may call this function
pullDipToken(Amount dipAmount, address stakeOwner)
external
Collect DIP token from stake owner. Permissioned: only the staking component may call this function
pushDipToken(Amount dipAmount, address stakeOwner)
external
Transfer DIP token to stake owner. Permissioned: only the staking component may call this function
approveTokenHandler(contract IERC20Metadata token, Amount amount)
external
Approves the staking token handler. Permissioned: only the staking component may call this function
LogStakingServiceLockingPeriodSet(NftId targetNftId, Seconds oldLockingDuration, Seconds lockingDuration)
event
LogStakingServiceRewardReservesIncreased(NftId targetNftId, address rewardProvider, Amount dipAmount, Amount newBalance)
event
LogStakingServiceRewardReservesDecreased(NftId targetNftId, address targetOwner, Amount dipAmount, Amount newBalance)
event
LogStakingServiceStakeCreated(NftId stakeNftId, NftId targetNftId, address owner, Amount stakedAmount)
event
LogStakingServiceStakeIncreased(NftId stakeNftId, address owner, Amount stakedAmount, Amount stakeBalance)
event
Staking
import "@etherisc/gif-next/contracts/staking/Staking.sol";
-
[
initializeTokenHandler()
] -
[
setSupportInfo(targetType, isSupported, allowNewTargets, allowCrossChain, minStakingAmount, maxStakingAmount, minLockingPeriod, maxLockingPeriod, minRewardRate, maxRewardRate)
] -
[
setUpdateTriggers(tvlUpdatesTrigger, minTvlRatioTrigger)
] -
[
setProtocolLockingPeriod(newLockingPeriod)
] -
[
setProtocolRewardRate(newRewardRate)
] -
[
setStakingRate(chainId, token, stakingRate)
] -
[
setStakingService(release)
] -
[
setStakingReader(reader)
] -
[
addToken(chainId, token)
] -
[
approveTokenHandler(token, amount)
] -
[
refillRewardReserves(targetNftId, dipAmount)
] -
[
withdrawRewardReserves(targetNftId, dipAmount)
] -
[
refillRewardReservesByService(targetNftId, dipAmount, transferFrom)
] -
[
withdrawRewardReservesByService(targetNftId, dipAmount, transferTo)
] -
[
registerTarget(targetNftId, expectedObjectType, initialLockingPeriod, initialRewardRate)
] -
[
setLockingPeriod(targetNftId, lockingPeriod)
] -
[
setRewardRate(targetNftId, rewardRate)
] -
[
setMaxStakedAmount(targetNftId, stakeLimitAmount)
] -
[
setTargetLimits(targetNftId, marginAmount, limitAmount)
] -
[
addTargetToken(targetNftId, token)
] -
[
increaseTotalValueLocked(targetNftId, token, amount)
] -
[
decreaseTotalValueLocked(targetNftId, token, amount)
] -
[
registerRemoteTarget(targetNftId, targetInfo)
] -
[
updateRemoteTvl(targetNftId, token, amount)
] -
[
updateTargetLimit(targetNftId)
] -
[
createStake(targetNftId, stakeAmount, stakeOwner)
] -
[
stake(stakeNftId, stakeAmount)
] -
[
unstake(stakeNftId)
] -
[
restake(stakeNftId, newTargetNftId)
] -
[
updateRewards(stakeNftId)
] -
[
claimRewards(stakeNftId)
] -
[
getStakingReader()
] -
[
getTargetHandler()
] -
[
getStakingStore()
] -
[
getTokenRegistryAddress()
] -
[
getTokenHandler()
] -
[
getRelease()
] -
[
getVersion()
] -
[
_refillRewardReserves(targetNftId, dipAmount, transferFrom)
] -
[
_withdrawRewardReserves(targetNftId, dipAmount, transferTo)
] -
[
_addToken($, chainId, token)
] -
[
_initialize(owner, data)
] -
[
_checkTypeAndOwner(nftId, expectedObjectType, checkOwner)
]
-
[
initializeVersionable(activatedBy, data)
] -
[
upgradeVersionable(data)
] -
[
_upgrade(data)
]
-
[
__Component_init(authority, registry, parentNftId, name, componentType, isInterceptor, initialOwner, registryData)
] -
[
nftTransferFrom(from, to, tokenId, operator)
] -
[
getWallet()
] -
[
getToken()
] -
[
getName()
] -
[
getComponentInfo()
] -
[
getInitialComponentInfo()
] -
[
isNftInterceptor()
] -
[
isRegistered()
] -
[
_approveTokenHandler(token, amount)
] -
[
_nftTransferFrom(from, to, tokenId, operator)
] -
[
_setWallet(newWallet)
] -
[
_setLocked(locked)
] -
[
_getComponentInfo()
] -
[
_getServiceAddress(domain)
]
-
[
__Registerable_init(authority, registry, parentNftId, objectType, isInterceptor, initialOwner, data)
] -
[
isActive()
] -
[
getInitialInfo()
]
-
[
_checkNftType(nftId, expectedObjectType)
] -
[
__NftOwnable_init(registry, initialOwner)
] -
[
linkToRegisteredNftId()
] -
[
getNftId()
] -
[
getOwner()
] -
[
_linkToNftOwnable(nftOwnableAddress)
]
-
[
__RegistryLinked_init(registry)
] -
[
getRegistry()
]
-
[
__ERC165_init()
] -
[
_initializeERC165()
] -
[
_registerInterface(interfaceId)
] -
[
_registerInterfaceNotInitializing(interfaceId)
] -
[
supportsInterface(interfaceId)
]
-
[
__AccessManaged_init(initialAuthority)
] -
[
__AccessManaged_init_unchained(initialAuthority)
] -
[
authority()
] -
[
setAuthority(newAuthority)
] -
[
isConsumingScheduledOp()
] -
[
_setAuthority(newAuthority)
] -
[
_checkCanCall(caller, data)
]
-
[
__Context_init()
] -
[
__Context_init_unchained()
] -
[
_msgSender()
] -
[
_msgData()
] -
[
_contextSuffixLength()
]
-
[
_checkInitializing()
] -
[
_disableInitializers()
] -
[
_getInitializedVersion()
] -
[
_isInitializing()
]
-
[
LogStakingStakingRateSet(chainId, token, newStakingRate, oldStakingRate, lastUpdateIn)
] -
[
LogStakingStakingServiceSet(stakingService, release, oldStakingService)
] -
[
LogStakingStakingReaderSet(stakingReader, oldStakingReader)
] -
[
LogStakingTargetHandlerSet(targetManager, oldTargetHandler)
] -
[
LogStakingTokenHandlerApproved(token, approvalAmount, oldApprovalAmount)
] -
[
LogStakingTokenAdded(chainId, token)
] -
[
LogStakingTargetTokenAdded(targetNftId, chainId, token)
] -
[
LogStakingTvlIncreased(targetNftId, token, amount, newBalance, lastUpdateIn)
] -
[
LogStakingTvlDecreased(targetNftId, token, amount, newBalance, lastUpdateIn)
] -
[
LogStakingSupportInfoSet(objectType, isSupported, allowNewTargets, allowCrossChain, minStakingAmount, maxStakingAmount, minLockingPeriod, maxLockingPeriod, minRewardRate, maxRewardRate, lastUpdateIn)
] -
[
LogStakingTargetCreated(targetNftId, objectType, lockingPeriod, rewardRate)
] -
[
LogStakingLimitsSet(targetNftId, marginAmount, hardLimitAmount, lastUpdateIn)
] -
[
LogStakingTargetLimitsUpdated(targetNftId, marginAmount, hardLimitAmount, lastUpdateIn)
] -
[
LogStakingTargetLimitUpdated(targetNftId, limitAmount, hardLimitAmount, requiredStakeAmount, actualStakeAmount, lastUpdateIn)
] -
[
LogStakingTargetLockingPeriodSet(targetNftId, oldLockingPeriod, lockingPeriod, lastUpdateIn)
] -
[
LogStakingTargetRewardRateSet(targetNftId, rewardRate, oldRewardRate, lastUpdateIn)
] -
[
LogStakingTargetMaxStakedAmountSet(targetNftId, stakeLimitAmount, lastUpdateIn)
] -
[
LogStakingTargetLimitsSet(targetNftId, stakeLimitAmount, marginAmount, limitAmount)
] -
[
LogStakingRewardReservesRefilled(targetNftId, dipAmount, targetOwner, reserveBalance, lastUpdateIn)
] -
[
LogStakingRewardReservesWithdrawn(targetNftId, dipAmount, targetOwner, reserveBalance, lastUpdateIn)
] -
[
LogStakingRewardReservesSpent(targetNftId, dipAmount, reserveBalance, lastUpdateIn)
] -
[
LogStakingStakeCreated(stakeNftId, targetNftId, stakeAmount, lockedUntil, stakeOwner)
] -
[
LogStakingStakeRewardsUpdated(stakeNftId, rewardIncrementAmount, stakeBalance, rewardBalance, lockedUntil, lastUpdateIn)
] -
[
LogStakingRewardsRestaked(stakeNftId, restakedAmount, stakeBalance, rewardBalance, lockedUntil, lastUpdateIn)
] -
[
LogStakingStaked(stakeNftId, stakedAmount, stakeBalance, rewardBalance, lockedUntil, lastUpdateIn)
] -
[
LogStakingUnstaked(stakeNftId, unstakedAmount, stakeBalance, rewardBalance, lockedUntil, lastUpdateIn)
] -
[
LogStakingRewardsClaimed(stakeNftId, claimedAmount, stakeBalance, rewardBalance, lockedUntil, lastUpdateIn)
] -
[
LogStakingStakeRestaked(stakeNftId, targetNftId, stakeAmount, owner, oldStakeNftId)
]
-
[
LogComponentWalletAddressChanged(oldWallet, newWallet)
] -
[
LogComponentWalletTokensTransferred(from, to, amount)
] -
[
LogComponentTokenHandlerApproved(tokenHandler, token, limit, isMaxAmount)
]
-
[
LogNftOwnableNftLinkedToAddress(nftId, owner)
]
-
[
AuthorityUpdated(authority)
]
-
[
Initialized(version)
]
setSupportInfo(ObjectType targetType, bool isSupported, bool allowNewTargets, bool allowCrossChain, Amount minStakingAmount, Amount maxStakingAmount, Seconds minLockingPeriod, Seconds maxLockingPeriod, UFixed minRewardRate, UFixed maxRewardRate)
external
Enable/disable the staking support for the specified target type. Defines the degrees of freedom for creating staking targets per target type.
setUpdateTriggers(uint16 tvlUpdatesTrigger, UFixed minTvlRatioTrigger)
external
Set the trigger values to determine when to update limit amount in TargetInfo. Changes in the TvlInfo may trigger an update of the limit amount in the TargetInfo based on these settings. The value tvlUpdatesTrigger suppresses any updates if the number of TVL updates is below this value. The value minTvlRatioTrigger defines the minimal TVL ratio above which the limit amount is updated. The ratio is calulated as current TVL / baseline TVL (or baseline TVL / current TVL).
setProtocolLockingPeriod(Seconds newLockingPeriod)
external
Set the stake locking period for protocol stakes to the specified duration.
setStakingRate(ChainId chainId, address token, UFixed stakingRate)
external
Set the staking rate for the specified chain and token. The staking rate defines the amount of staked dips required to back up 1 token of total value locked.
setStakingService(VersionPart release)
external
Sets/updates the staking service contract to the staking service of the specified release.
addToken(ChainId chainId, address token)
external
Registers a token for recording staking rate and total value locked.
approveTokenHandler(contract IERC20Metadata token, Amount amount)
public
Set the approval to the token handler. Defines the max allowance from the staking wallet to the token handler.
refillRewardReserves(NftId targetNftId, Amount dipAmount) → Amount newBalance
external
(Re)fills the staking reward reserves for the specified target Unpermissioned: anybody may fill up staking reward reserves
withdrawRewardReserves(NftId targetNftId, Amount dipAmount) → Amount newBalance
external
Defunds the staking reward reserves for the specified target Permissioned: only the owner may call this function
refillRewardReservesByService(NftId targetNftId, Amount dipAmount, address transferFrom) → Amount newBalance
external
(Re)fills the staking reward reserves for the specified target Unpermissioned: anybody may fill up staking reward reserves
withdrawRewardReservesByService(NftId targetNftId, Amount dipAmount, address transferTo) → Amount newBalance
external
Defunds the staking reward reserves for the specified target Permissioned: only the owner may call this function
registerTarget(NftId targetNftId, ObjectType expectedObjectType, Seconds initialLockingPeriod, UFixed initialRewardRate)
external
Register a new target for staking. Permissioned: only the staking service may call this function
setLockingPeriod(NftId targetNftId, Seconds lockingPeriod)
external
Set the stake locking period to the specified duration. Permissioned: only the staking service may call this function
setRewardRate(NftId targetNftId, UFixed rewardRate)
external
Update the target specific reward rate. Permissioned: only the staking service may call this function
setMaxStakedAmount(NftId targetNftId, Amount stakeLimitAmount)
external
Set the maximum staked amount for the specified target. Permissioned: only the staking service may call this function
setTargetLimits(NftId targetNftId, Amount marginAmount, Amount limitAmount)
external
Set the staking limits for the specified target. The margin amount allows staker to stake over the current required stakes by this amount. The limit amount restricts stakers to ever stake more than this amount. Permissioned: only the target owner may call this function
addTargetToken(NftId targetNftId, address token)
external
Register a token for the specified target. Used for instance targets. Each product may introduce its own token. Permissioned: only the staking service may call this function
increaseTotalValueLocked(NftId targetNftId, address token, Amount amount)
external
Increases the total value locked amount for the specified target by the provided token amount. function is called when a new policy is collateralized. function restricted to the pool service.
decreaseTotalValueLocked(NftId targetNftId, address token, Amount amount)
external
Decreases the total value locked amount for the specified target by the provided token amount. function is called when a new policy is closed or payouts are executed. function restricted to the pool service.
updateTargetLimit(NftId targetNftId)
external
Updates the current limit amount for the specified target. The function takes into account the current TVL amount per token and the current staking rate for the token to calculate the required stake amount. Based on this required stake amount and the targets margin and hard limit (from LimitInfo) the function updates the target limit amount (in the target info)
createStake(NftId targetNftId, Amount stakeAmount, address stakeOwner) → NftId stakeNftId
external
Creates a new stake to the specified target over the given DIP amount. The stake owner is provided as an argument and becomes the stake NFT holder. This function is permissionless and may be called by any user.
stake(NftId stakeNftId, Amount stakeAmount) → Amount newStakeBalance
external
Increase the staked DIP by dipAmount for the specified stake. Staking rewards are updated and added to the staked DIP amount as well. The function returns the new total amount of staked dips.
unstake(NftId stakeNftId) → Amount unstakedAmount
external
Pays the specified DIP amount to the holder of the stake NFT ID. permissioned: only staking service may call this function.
restake(NftId stakeNftId, NftId newTargetNftId) → NftId newStakeNftId, Amount newStakedAmount
external
restakes the dips to a new target. the sum of the staked dips and the accumulated rewards will be restaked. permissioned: only staking service may call this function.
updateRewards(NftId stakeNftId) → Amount newRewardAmount
external
update stake rewards for current time. may be called before an announement of a decrease of a reward rate reduction. calling this functions ensures that reward balance is updated using the current (higher) reward rate. unpermissioned.
claimRewards(NftId stakeNftId) → Amount claimedAmount
external
transfers all rewards accumulated so far to the holder of the specified stake nft. permissioned: only staking service may call this function.
_refillRewardReserves(NftId targetNftId, Amount dipAmount, address transferFrom) → Amount newBalance
internal
StakingStore
import "@etherisc/gif-next/contracts/staking/StakingStore.sol";
-
[
constructor(registry, reader)
] -
[
_createInitialSetup()
] -
[
initialize(targetLimitHandler)
] -
[
setStakingReader(reader)
] -
[
setTargetLimitHandler(targetLimitHandler)
] -
[
setSupportInfo(targetType, isSupported, allowNewTargets, allowCrossChain, minStakingAmount, maxStakingAmount, minLockingPeriod, maxLockingPeriod, minRewardRate, maxRewardRate)
] -
[
getSupportInfo(targetType)
] -
[
addToken(chainId, token)
] -
[
setStakingRate(chainId, token, stakingRate)
] -
[
createTarget(targetNftId, objectType, lockingPeriod, rewardRate)
] -
[
setLockingPeriod(targetNftId, lockingPeriod)
] -
[
setRewardRate(targetNftId, rewardRate)
] -
[
setMaxStakedAmount(targetNftId, stakeLimitAmount)
] -
[
setTargetLimits(targetNftId, marginAmount, hardLimitAmount)
] -
[
addTargetToken(targetNftId, token)
] -
[
refillRewardReserves(targetNftId, dipAmount)
] -
[
withdrawRewardReserves(targetNftId, dipAmount)
] -
[
increaseTotalValueLocked(targetNftId, token, amount)
] -
[
decreaseTotalValueLocked(targetNftId, token, amount)
] -
[
updateTargetLimit(targetNftId)
] -
[
_checkAndUpdateTargetLimit(targetNftId, token, tvlInfo)
] -
[
_updateTargetLimit(targetNftId)
] -
[
createStake(stakeNftId, targetNftId, stakeOwner, stakeAmount)
] -
[
stake(stakeNftId, updateRewards, restakeRewards, additionalLockingPeriod, stakeAmount)
] -
[
unstake(stakeNftId, updateRewards, restakeRewards, maxUnstakeAmount)
] -
[
updateRewards(stakeNftId)
] -
[
restakeRewards(stakeNftId, updateRewards)
] -
[
claimRewards(stakeNftId, updateRewards, maxClaimAmount)
] -
[
getStakingReader()
] -
[
getTargetManager()
] -
[
exists(stakeNftId)
] -
[
getRequiredStakeBalance(targetNftId, includeTargetTypeRequirements)
] -
[
isStakeLocked(stakeNftId)
] -
[
getStakeInfo(stakeNftId)
] -
[
getStakeTarget(stakeNftId)
] -
[
getTargetInfo(targetNftId)
] -
[
getLimitInfo(targetNftId)
] -
[
getTvlInfo(targetNftId, token)
] -
[
getTokenInfo(chainId, token)
] -
[
hasTokenInfo(chainId, token)
] -
[
getTargetSet()
] -
[
_updateRewards(stakeNftId, stakeInfo, targetInfo)
] -
[
_restakeRewards(stakeNftId, stakeInfo, targetInfo)
] -
[
_stake(stakeNftId, stakeInfo, targetInfo, maxAdditionalLockingPeriod, stakeAmount)
] -
[
_claimRewards(stakeNftId, stakeInfo, targetInfo, maxClaimAmount)
] -
[
_unstake(stakeNftId, stakeInfo, targetInfo, maxUnstakeAmount)
] -
[
_setLastUpdatesToCurrent(stakeInfo, targetInfo)
] -
[
_setStakeLastUpdatesToCurrent(stakeInfo)
]
-
[
authority()
] -
[
setAuthority(newAuthority)
] -
[
isConsumingScheduledOp()
] -
[
_setAuthority(newAuthority)
] -
[
_checkCanCall(caller, data)
]
-
[
_checkInitializing()
] -
[
_disableInitializers()
] -
[
_getInitializedVersion()
] -
[
_isInitializing()
]
-
[
AuthorityUpdated(authority)
]
-
[
Initialized(version)
]
setSupportInfo(ObjectType targetType, bool isSupported, bool allowNewTargets, bool allowCrossChain, Amount minStakingAmount, Amount maxStakingAmount, Seconds minLockingPeriod, Seconds maxLockingPeriod, UFixed minRewardRate, UFixed maxRewardRate)
external
Generic setter for support info. Any change in any of the parameters requires to set all parameters.
getSupportInfo(ObjectType targetType) → struct IStaking.SupportInfo supportInfo
external
Returns the support info for the specified target type.
setStakingRate(ChainId chainId, address token, UFixed stakingRate) → UFixed oldStakingRate, Blocknumber lastUpdatedIn
external
Sets the staking rate for the token.
createTarget(NftId targetNftId, ObjectType objectType, Seconds lockingPeriod, UFixed rewardRate)
external
setMaxStakedAmount(NftId targetNftId, Amount stakeLimitAmount) → Amount oldLimitAmount, Blocknumber lastUpdatedIn
external
increaseTotalValueLocked(NftId targetNftId, address token, Amount amount) → Amount newBalance
external
decreaseTotalValueLocked(NftId targetNftId, address token, Amount amount) → Amount newBalance
external
_checkAndUpdateTargetLimit(NftId targetNftId, address token, struct IStaking.TvlInfo tvlInfo)
internal
createStake(NftId stakeNftId, NftId targetNftId, address stakeOwner, Amount stakeAmount) → Timestamp lockedUntil
external
stake(NftId stakeNftId, bool updateRewards, bool restakeRewards, Seconds additionalLockingPeriod, Amount stakeAmount)
external
unstake(NftId stakeNftId, bool updateRewards, bool restakeRewards, Amount maxUnstakeAmount) → Amount unstakedAmount
external
claimRewards(NftId stakeNftId, bool updateRewards, Amount maxClaimAmount) → Amount claimedAmount
external
getRequiredStakeBalance(NftId targetNftId, bool includeTargetTypeRequirements) → Amount requiredStakeAmount
public
getStakeInfo(NftId stakeNftId) → struct IStaking.StakeInfo stakeInfo
external
Returns the stake infos for the specified stake.
getStakeTarget(NftId stakeNftId) → NftId targetNftId
external
Returns the stake infos for the specified stake.
getTargetInfo(NftId targetNftId) → struct IStaking.TargetInfo targetInfo
external
Returns the target infos for the specified target.
getLimitInfo(NftId targetNftId) → struct IStaking.LimitInfo limitInfo
external
Returns the target limit infos for the specified target.
getTvlInfo(NftId targetNftId, address token) → struct IStaking.TvlInfo tvlInfo
external
Returns the tvl infos for the specified target.
getTokenInfo(ChainId chainId, address token) → struct IStaking.TokenInfo tokenInfo
external
Returns the tvl infos for the specified target.
_updateRewards(NftId stakeNftId, struct IStaking.StakeInfo stakeInfo, struct IStaking.TargetInfo targetInfo) → Amount rewardIncreaseAmount
internal
_restakeRewards(NftId stakeNftId, struct IStaking.StakeInfo stakeInfo, struct IStaking.TargetInfo targetInfo) → Amount restakeAmount
internal
_stake(NftId stakeNftId, struct IStaking.StakeInfo stakeInfo, struct IStaking.TargetInfo targetInfo, Seconds maxAdditionalLockingPeriod, Amount stakeAmount)
internal
_claimRewards(NftId stakeNftId, struct IStaking.StakeInfo stakeInfo, struct IStaking.TargetInfo targetInfo, Amount maxClaimAmount) → Amount claimAmount
internal
_unstake(NftId stakeNftId, struct IStaking.StakeInfo stakeInfo, struct IStaking.TargetInfo targetInfo, Amount maxUnstakeAmount) → Amount unstakedAmount
internal
StakingReader
import "@etherisc/gif-next/contracts/staking/StakingReader.sol";
-
[
constructor(registry)
] -
[
initialize(stakingAddress, stakingStoreAddress)
] -
[
getRegistry()
] -
[
getStaking()
] -
[
getProtocolNftId()
] -
[
isTarget(targetNftId)
] -
[
targets()
] -
[
getTargetNftId(idx)
] -
[
getTargetNftId(stakeNftId)
] -
[
getStakeInfo(stakeNftId)
] -
[
getTargetInfo(targetNftId)
] -
[
getLimitInfo(targetNftId)
] -
[
getTvlInfo(targetNftId, token)
] -
[
getTokenInfo(chainId, token)
] -
[
isSupportedTargetType(targetType)
] -
[
getSupportInfo(targetType)
] -
[
getTargetLockingPeriod(stakeNftId)
] -
[
getTargetRewardRate(stakeNftId)
] -
[
getTargetMaxStakedAmount(targetNftId)
] -
[
getLockingPeriod(targetNftId)
] -
[
getRewardRate(targetNftId)
] -
[
getReserveBalance(targetNftId)
] -
[
getTotalValueLocked(targetNftId, token)
] -
[
getRequiredStakeBalance(targetNftId)
] -
[
getRequiredStakeBalance(targetNftId, includeTargetTypeRequirements)
]
-
[
_checkInitializing()
] -
[
_disableInitializers()
] -
[
_getInitializedVersion()
] -
[
_isInitializing()
]
-
[
Initialized(version)
]
getTargetLockingPeriod(NftId stakeNftId) → NftId targetNftId, Seconds lockingPeriod
external
Get the locking period that applies to the specified stake NFT ID.
getTargetRewardRate(NftId stakeNftId) → NftId targetNftId, UFixed rewardRate
external
Get the reward rate that applies to the specified stake NFT ID.
getTargetMaxStakedAmount(NftId targetNftId) → Amount maxStakedAmount
external
Get the max staked amount allowed for the specified target NFT ID.
getLockingPeriod(NftId targetNftId) → Seconds lockingPeriod
external
Get the reward rate for the specified target NFT ID.
getRewardRate(NftId targetNftId) → UFixed rewardRate
external
Get the reward rate for the specified target NFT ID.
StakingService
import "@etherisc/gif-next/contracts/staking/StakingService.sol";
-
[
createInstanceTarget(targetNftId, initialLockingPeriod, initialRewardRate)
] -
[
setInstanceLockingPeriod(instanceNftId, lockingPeriod)
] -
[
setInstanceRewardRate(instanceNftId, rewardRate)
] -
[
setInstanceMaxStakedAmount(instanceNftId, maxStakingAmount)
] -
[
refillInstanceRewardReserves(instanceNftId, rewardProvider, dipAmount)
] -
[
withdrawInstanceRewardReserves(instanceNftId, dipAmount)
] -
[
createStakeObject(targetNftId, stakeOwner)
] -
[
pullDipToken(dipAmount, stakeOwner)
] -
[
pushDipToken(dipAmount, stakeOwner)
] -
[
approveTokenHandler(token, amount)
] -
[
setTotalValueLocked(targetNftId, token, amount)
] -
[
getDipToken()
] -
[
getTokenHandler()
] -
[
getStaking()
] -
[
_initialize(owner, data)
] -
[
_registerStaking(stakingAddress)
] -
[
_getDomain()
]
-
[
__Service_init(authority, registry, initialOwner)
] -
[
getDomain()
] -
[
getVersion()
] -
[
getRoleId()
] -
[
_getServiceAddress(domain)
]
-
[
__ReentrancyGuard_init()
] -
[
__ReentrancyGuard_init_unchained()
] -
[
_reentrancyGuardEntered()
]
-
[
initializeVersionable(activatedBy, data)
] -
[
upgradeVersionable(data)
] -
[
_upgrade(data)
]
-
[
__Registerable_init(authority, registry, parentNftId, objectType, isInterceptor, initialOwner, data)
] -
[
isActive()
] -
[
getRelease()
] -
[
getInitialInfo()
]
-
[
_checkNftType(nftId, expectedObjectType)
] -
[
__NftOwnable_init(registry, initialOwner)
] -
[
linkToRegisteredNftId()
] -
[
getNftId()
] -
[
getOwner()
] -
[
_linkToNftOwnable(nftOwnableAddress)
]
-
[
__RegistryLinked_init(registry)
] -
[
getRegistry()
]
-
[
__ERC165_init()
] -
[
_initializeERC165()
] -
[
_registerInterface(interfaceId)
] -
[
_registerInterfaceNotInitializing(interfaceId)
] -
[
supportsInterface(interfaceId)
]
-
[
__AccessManaged_init(initialAuthority)
] -
[
__AccessManaged_init_unchained(initialAuthority)
] -
[
authority()
] -
[
setAuthority(newAuthority)
] -
[
isConsumingScheduledOp()
] -
[
_setAuthority(newAuthority)
] -
[
_checkCanCall(caller, data)
]
-
[
__Context_init()
] -
[
__Context_init_unchained()
] -
[
_msgSender()
] -
[
_msgData()
] -
[
_contextSuffixLength()
]
-
[
_checkInitializing()
] -
[
_disableInitializers()
] -
[
_getInitializedVersion()
] -
[
_isInitializing()
]
-
[
LogStakingServiceProtocolTargetRegistered(protocolNftId)
] -
[
LogStakingServiceInstanceTargetRegistered(instanceNftId, chainId)
] -
[
LogStakingServiceLockingPeriodSet(targetNftId, oldLockingDuration, lockingDuration)
] -
[
LogStakingServiceRewardRateSet(targetNftId, oldRewardRate, rewardRate)
] -
[
LogStakingServiceRewardReservesIncreased(targetNftId, rewardProvider, dipAmount, newBalance)
] -
[
LogStakingServiceRewardReservesDecreased(targetNftId, targetOwner, dipAmount, newBalance)
] -
[
LogStakingServiceStakeObjectCreated(stakeNftId, targetNftId, stakeOwner)
] -
[
LogStakingServiceStakeCreated(stakeNftId, targetNftId, owner, stakedAmount)
] -
[
LogStakingServiceStakeIncreased(stakeNftId, owner, stakedAmount, stakeBalance)
] -
[
LogStakingServiceUnstaked(stakeNftId, stakeOwner, totalAmount)
] -
[
LogStakingServiceStakeRestaked(stakeOwner, stakeNftId, newStakeNftId, newTargetNftId, newStakeBalance)
] -
[
LogStakingServiceRewardsUpdated(stakeNftId)
] -
[
LogStakingServiceRewardsClaimed(stakeNftId, stakeOwner, rewardsClaimedAmount)
]
-
[
LogNftOwnableNftLinkedToAddress(nftId, owner)
]
-
[
AuthorityUpdated(authority)
]
-
[
Initialized(version)
]
createInstanceTarget(NftId targetNftId, Seconds initialLockingPeriod, UFixed initialRewardRate)
external
Creates/registers an on-chain instance staking target. Permissioned: Only instance service
setInstanceLockingPeriod(NftId instanceNftId, Seconds lockingPeriod)
external
Set the instance stake locking period to the specified duration. Permissioned: Only instance service
setInstanceRewardRate(NftId instanceNftId, UFixed rewardRate)
external
Set the instance reward rate to the specified value. Permissioned: Only instance service
setInstanceMaxStakedAmount(NftId instanceNftId, Amount maxStakingAmount)
external
Set the instance max staked amount to the specified value. Permissioned: Only instance service
refillInstanceRewardReserves(NftId instanceNftId, address rewardProvider, Amount dipAmount) → Amount newBalance
external
(Re)fills the staking reward reserves for the specified target using the dips provided by the reward provider. Permissioned: Only instance service
withdrawInstanceRewardReserves(NftId instanceNftId, Amount dipAmount) → Amount newBalance
external
Defunds the staking reward reserves for the specified target Permissioned: Only instance service
createStakeObject(NftId targetNftId, address stakeOwner) → NftId stakeNftId
external
Creates a new stake object for the specified target via the registry service. Permissioned: only the staking component may call this function
pullDipToken(Amount dipAmount, address stakeOwner)
external
Collect DIP token from stake owner. Permissioned: only the staking component may call this function
pushDipToken(Amount dipAmount, address stakeOwner)
external
Transfer DIP token to stake owner. Permissioned: only the staking component may call this function
approveTokenHandler(contract IERC20Metadata token, Amount amount)
external
Approves the staking token handler. Permissioned: only the staking component may call this function
StakingLib
import "@etherisc/gif-next/contracts/staking/StakingLib.sol";
-
[
checkCreateParameters(stakingReader, targetNftId, dipAmount)
] -
[
_checkCreateParameters(stakingReader, targetNftId, dipAmount)
] -
[
checkStakeParameters(stakingReader, stakeNftId)
] -
[
checkUnstakeParameters(stakingReader, stakeNftId)
] -
[
checkTarget(stakingReader, targetNftId)
] -
[
checkAndGetStakingService(registry, release)
] -
[
checkDipAmount(stakingReader, targetNftId, dipAmount)
] -
[
calculateRewardIncrease(stakingReader, stakeNftId, rewardRate)
] -
[
calculateRewardAmount(rewardRate, duration, stakeAmount)
] -
[
getYearFraction(duration)
]
checkCreateParameters(contract StakingReader stakingReader, NftId targetNftId, Amount dipAmount) → Timestamp lockedUntil
external
_checkCreateParameters(contract StakingReader stakingReader, NftId targetNftId, Amount dipAmount) → Timestamp lockedUntil
internal
checkStakeParameters(contract StakingReader stakingReader, NftId stakeNftId) → UFixed rewardRate, Seconds lockingPeriod
public
checkUnstakeParameters(contract StakingReader stakingReader, NftId stakeNftId) → Seconds lockingPeriod
public
checkAndGetStakingService(contract IRegistry registry, VersionPart release) → contract IStakingService stakingService
public
calculateRewardIncrease(contract StakingReader stakingReader, NftId stakeNftId, UFixed rewardRate) → Amount rewardIncreaseAmount
public
TargetManagerLib
import "@etherisc/gif-next/contracts/staking/TargetManagerLib.sol";
-
[
updateLockingPeriod(staking, targetNftId, lockingPeriod)
] -
[
updateRewardRate(staking, targetNftId, rewardRate)
] -
[
checkTargetParameters(registry, stakingReader, targetNftId, expectedObjectType, lockingPeriod, rewardRate)
] -
[
checkLockingPeriod(reader, targetNftId, targetType, lockingPeriod)
] -
[
checkRewardRate(reader, targetNftId, targetType, rewardRate)
] -
[
calculateRequiredDipAmount(tokenAmount, stakingRate)
] -
[
calculateStakingRate(dipToken, token, requiredDipPerToken)
] -
[
getMaxLockingPeriod()
] -
[
getDefaultLockingPeriod()
] -
[
getMinimumLockingPeriod()
] -
[
getMaxRewardRate()
] -
[
getDefaultRewardRate()
] -
[
toTargetKey(targetNftId)
]
updateLockingPeriod(contract IStaking staking, NftId targetNftId, Seconds lockingPeriod) → Seconds oldLockingPeriod, struct IStaking.TargetInfo targetInfo
external
updateRewardRate(contract IStaking staking, NftId targetNftId, UFixed rewardRate) → UFixed oldRewardRate, struct IStaking.TargetInfo targetInfo
external
checkTargetParameters(contract IRegistry registry, contract StakingReader stakingReader, NftId targetNftId, ObjectType expectedObjectType, Seconds lockingPeriod, UFixed rewardRate)
external
checkLockingPeriod(contract StakingReader reader, NftId targetNftId, ObjectType targetType, Seconds lockingPeriod)
public
checkRewardRate(contract StakingReader reader, NftId targetNftId, ObjectType targetType, UFixed rewardRate)
public
StakingManager
import "@etherisc/gif-next/contracts/staking/StakingManager.sol";
-
[
constructor(registry, targetHandler, stakingStore, tokenRegistry, initialOwner, salt)
] -
[
getStaking()
]
-
[
initialize(registry, implementation, data, salt)
] -
[
deploy(registry, initialImplementation, initializationData)
] -
[
deployDetermenistic(registry, initialImplementation, initializationData, salt)
] -
[
upgrade(newImplementation)
] -
[
upgrade(newImplementation, upgradeData)
] -
[
linkToProxy()
] -
[
getDeployData(proxyOwner, deployData)
] -
[
getUpgradeData(upgradeData)
] -
[
getProxy()
] -
[
getVersion()
] -
[
getVersionCount()
] -
[
getVersion(idx)
] -
[
getVersionInfo(_version)
]
-
[
_checkNftType(nftId, expectedObjectType)
] -
[
__NftOwnable_init(registry, initialOwner)
] -
[
linkToRegisteredNftId()
] -
[
getNftId()
] -
[
getOwner()
] -
[
_linkToNftOwnable(nftOwnableAddress)
]
-
[
__RegistryLinked_init(registry)
] -
[
getRegistry()
]
-
[
__ERC165_init()
] -
[
_initializeERC165()
] -
[
_registerInterface(interfaceId)
] -
[
_registerInterfaceNotInitializing(interfaceId)
] -
[
supportsInterface(interfaceId)
]
-
[
_checkInitializing()
] -
[
_disableInitializers()
] -
[
_getInitializedVersion()
] -
[
_isInitializing()
]
-
[
LogProxyManagerVersionableDeployed(proxy, initialImplementation)
] -
[
LogProxyManagerVersionableUpgraded(proxy, upgradedImplementation)
]
-
[
LogNftOwnableNftLinkedToAddress(nftId, owner)
]
-
[
Initialized(version)
]
StakingServiceManager
import "@etherisc/gif-next/contracts/staking/StakingServiceManager.sol";
-
[
constructor(authority, registry, salt)
] -
[
getStakingService()
]
-
[
initialize(registry, implementation, data, salt)
] -
[
deploy(registry, initialImplementation, initializationData)
] -
[
deployDetermenistic(registry, initialImplementation, initializationData, salt)
] -
[
upgrade(newImplementation)
] -
[
upgrade(newImplementation, upgradeData)
] -
[
linkToProxy()
] -
[
getDeployData(proxyOwner, deployData)
] -
[
getUpgradeData(upgradeData)
] -
[
getProxy()
] -
[
getVersion()
] -
[
getVersionCount()
] -
[
getVersion(idx)
] -
[
getVersionInfo(_version)
]
-
[
_checkNftType(nftId, expectedObjectType)
] -
[
__NftOwnable_init(registry, initialOwner)
] -
[
linkToRegisteredNftId()
] -
[
getNftId()
] -
[
getOwner()
] -
[
_linkToNftOwnable(nftOwnableAddress)
]
-
[
__RegistryLinked_init(registry)
] -
[
getRegistry()
]
-
[
__ERC165_init()
] -
[
_initializeERC165()
] -
[
_registerInterface(interfaceId)
] -
[
_registerInterfaceNotInitializing(interfaceId)
] -
[
supportsInterface(interfaceId)
]
-
[
_checkInitializing()
] -
[
_disableInitializers()
] -
[
_getInitializedVersion()
] -
[
_isInitializing()
]
-
[
LogProxyManagerVersionableDeployed(proxy, initialImplementation)
] -
[
LogProxyManagerVersionableUpgraded(proxy, upgradedImplementation)
]
-
[
LogNftOwnableNftLinkedToAddress(nftId, owner)
]
-
[
Initialized(version)
]