StakePrizePool

The Stake Prize Pool is a prize pool in which users can deposit an ERC-20 token. These tokens are simply held by the Stake Prize Pool and become eligible for prizes. Prizes are added manually by anyone (in our case they are added by the Lido protocol every 24 hours (at 12AM UTC)) and are distributed to users at the end of the prize period.

Write methods description

initialize()

Allows to initialize the contract during the deployment.

Parameters:

NameTypeDescription

_owner

address

An address of the Stake Prize Pool owner.

_stakeToken

address

An address of the stake token.

_rewardToken

address

The ASX token address.

_rewardPerSecond

uint256

The reward per second that will be used in time of distribution of ASX tokens. Can be updated by the admin after deployment of smart-contract.

_claimInterval

uint32

The reward claim interval, in seconds. Can be updated by the admin after deployment of smart-contract.

_freeExitDuration

uint32

A duration (in seconds) that will take place after each finished draw when all users are able to withdraw their stETH without paying an exit fee. An exit fee is calculated using Lido APR. Can be updated by the admin after deployment of smart-contract.

_firstLidoRebaseTimestamp

uint32

The closest 12 PM UTC timestamp in the future from now.

_lidoAPR

uint16

Annual percentage rate of Lido protocol. Should be specified with 2 decimal places (ex. 500 - 5.00%, 6000 - 60.00%). Maximum possible value is equal to 10000 - 100.00%. Can be updated by the admin after deployment of smart-contract.

award()

Called by the prize flush to award prizes. The amount awarded must be less than the awardBalance().

Parameters:

NameTypeDescription

_to

address

The address of the winner that receives the award.

_amount

uint256

The amount of assets to be awarded.

awardExternalERC20()

Called by the Prize Flush to award external ERC-20 prizes. Used to award any arbitrary tokens held by the Prize Pool.

Parameters:

NameTypeDescription

_to

address

The address of the winner that receives the award.

_externalToken

address

The address of the external asset token being awarded.

_amount

uint256

The amount of external assets to be awarded.

awardExternalERC721()

Called by the Prize Flush to award external ERC-721 prizes. Used to award any arbitrary NFTs held by the Prize Pool.

Parameters:

NameTypeDescription

_to

address

The address of the winner that receives the award.

_externalToken

address

The address of the external NFT token being awarded.

_tokenIds

uint256[]

An array of NFT token IDs to be transferred.

balance()

Returns the total underlying balance of all assets. This includes both principal and interest.

captureAwardBalance()

Captures any available interest as reward balance. This function also captures the reserve fees.

claim()

Claims reward in ASX tokens that distributes on users’ deposits.

Parameters:

NameTypeDescription

_user

address

The user for whom to claim reward.

compLikeDelegate()

Delegate the votes for a Compound COMP-like token held by the prize pool.

Parameters:

NameTypeDescription

_compLike

address

The COMP-like token held by the prize pool that should be delegated.

_to

address

The address to delegate to.

depositTo()

Deposit assets into the Prize Pool in exchange for tokens.

Parameters:

NameTypeDescription

_to

address

The address receiving the newly minted tokens.

_amount

uin256

The amount of assets to deposit.

depositToAndDelegate()

Deposit assets into the Prize Pool in exchange for tokens, then sets the delegate on behalf of the caller.

Parameters:

NameTypeDescription

_to

address

The address receiving the newly minted tokens.

_amount

uint256

The amount of assets to deposit.

_delegate

address

The address to delegate to for the caller.

setBalanceCap()

Allows the owner to set a balance cap per token for the pool. If a user wins, his balance can go over the cap. He will be able to withdraw the excess but not deposit. Needs to be called after deploying a prize pool to be able to deposit into it.

Parameters:

NameTypeDescription

_balanceCap

uint256

New balance cap.

Return:

NameTypeDescription

_success

bool

true if the new balance cap has been successfully set.

setClaimInterval()

Sets the claim interval for the prize pool that will be used in time of claiming of ASX tokens. Only callable by the owner.

Parameters:

NameTypeDescription

_claimInterval

uint32

The new claim interval, in seconds.

setFreeExitDuration()

Sets a new duration (in seconds) that will take place after each finished draw when all users are able to withdraw their stETH without paying an exit fee. Only callable by the owner.

Parameters:

NameTypeDescription

_freeExitDuration

uint32

A new free exit duration (in seconds).

setLidoAPR()

Sets a new annual percentage rate of Lido protocol. Should be specified with 2 decimal places (ex. 500 - 5.00%, 6000 - 60.00%). Maximum possible value is equal to 10000 - 100.00%. Only callable by the owner.

Parameters:

NameTypeDescription

_lidoAPR

uint16

A new Lido APR.

setDrawBeacon()

Sets the DrawBeacon contract address. Only callable by the owner.

Parameters:

NameTypeDescription

_drawBeacon

address

DrawBeacon contract address to set.

setLiquidityCap()

Allows the Governor to set a cap on the amount of liquidity that the pool can hold. Only callable by the owner.

Parameters:

NameTypeDescription

_liquidityCap

uint256

The new liquidity cap for the prize pool.

setPrizeFlush()

Sets the PrizeFlush contract address. Only callable by the owner.

Parameters:

NameTypeDescription

_prizeFlush

address

PrizeFlush contract address to set.

setRewardPerSecond()

Sets the reward per second for the prize pool that will be used for ASX tokens distribution. Only callable by the owner.

Parameters:

NameTypeDescription

_rewardPerSecond

uint256

The new reward per second.

setTicket()

Sets the prize pool Ticket contract address. Only callable by the owner.

Parameters:

NameTypeDescription

_ticket

address

Address of the Ticket to set.

Return:

NameTypeDescription

_success

bool

true if the ticket has been successfully set.

transferExternalERC20()

Called by the PrizeFlush to transfer out external ERC-20 tokens. Used to transfer out tokens held by the Prize Pool. Could be liquidated, or anything.

Parameters:

NameTypeDescription

_to

address

The address of the winner that receives the award.

_externalToken

address

The address of the external asset token being awarded.

_amount

uint256

The amount of external assets to be awarded.

updateUserRewardAndFormer()

Called by the ticket to update the user's reward and former in time of transfer.

Parameters:

NameTypeDescription

_user

address

The user where need to update reward and former.

_beforeBalance

uint256

The balance of the user before transfer.

_afterBalance

uint256

The balance of the user after transfer.

withdrawFrom()

Withdraw assets from the PrizePool instantly. The withdrawn amount can be less than specified in the parameters. This is due to the fact that if the user withdraws funds after the free exit window, a fee is deducted from him, which is equal to the amount that the Lido protocol would distribute for this user during the rebasing operation.

Parameters:

NameTypeDescription

_from

address

The address to redeem tokens from.

_amount

uint256

The amount of tokens to redeem for assets.

Return:

NameTypeDescription

_amount

uint256

The actual amount withdrawn.

claimOwnership()

Allows the pendingOwner address to claim the owner role. This function is only callable by the pendingOwner.

renounceOwnership()

Leaves the contract without owner. It will not be possible to call the owner's functions anymore. Can only be called by the current owner. The method does not take any parameters. Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner.

transferOwnership()

Transfers ownership of the contract to a _pendingOwner. Can only be called by the current owner.

Parameters:

NameTypeDescription

_newOwner

address

An account that will become the _pendingOwner.

Read methods description

VERSION()

Semver version.

awardBalance()

Called by the Prize Flush to award prizes. The amount awarded must be less than the awardBalance().

canAwardExternal()

Checks with the Prize Pool if a specific token type may be awarded as an external prize.

Parameters:

NameTypeDescription

_externalToken

address

The address of the token to check.

Return:

NameTypeDescription

_canAward

bool

true if the token may be awarded, false otherwise.

getAccountedBalance()

Read internal Ticket accounted balance.

getBalanceCap()

Read internal balanceCap variable.

getClaimInterval()

Read claimInterval variable.

getFreeExitDuration()

Read freeExitDuration variable.

getDeploymentTimestamp()

Read deploymentTimestamp variable.

getFirstLidoRebaseTimestamp()

Read firstLidoRebaseTimestamp variable.

getLidoAPR()

Read lidoAPR variable.

getClaimableReward()

Calculates actual claimable amount of ASX tokens for the user.

getDistributionEnd()

Read distributionEnd variable.

getLastUpdated()

Read lastUpdated variable.

getLiquidityCap()

Read internal liquidityCap variable.

getPrizeFlush()

Read prizeFlush variable.

getRewardPerSecond()

Read rewardPerSecond variable.

getRewardPerShare()

Read rewardPerShare variable.

getRewardToken()

Read rewardToken variable.

getTicket()

Read ticket variable.

getDrawBeacon()

Read drawBeacon variable.

getToken()

Read token variable.

getUserStakelnfo()

Read userStakeInfo variable.

Parameters:

NameTypeDescription

_user

address

The address of the user to retrieve stake info about.

isControlled()

Checks if a specific token is controlled by the Prize Pool.

Parameters:

NameTypeDescription

_controlledToken

address

The address of the token to check.

Return:

NameTypeDescription

_isControlled

bool

true if the token is a controlled token, false otherwise.

onERC721Received()

Whenever an {IERC721} _tokenId token is transferred to this contract via {IERC721-safeTransferFrom} by _operator from _from, this function is called. It must return its Solidity selector to confirm the token transfer. If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted. The selector can be obtained in Solidity with IERC721Receiver.onERC721Received.selector.

Parameters:

NameTypeDescription

_operator

address

An operator.

_from

address

An address from where token was transferred.

_tokenId

uint256

Token ID.

_data

bytes

Additional data.

owner()

Role that can be granted exclusive access to specific functions with the modifier onlyOwner.

pendingOwner()

Address that can claim the owner role. It is used to transfer the owner.

Last updated