EditionStake

Methods

DEFAULT_ADMIN_ROLE

function DEFAULT_ADMIN_ROLE() external view returns (bytes32)

Returns

Name
Type
Description

_0

bytes32

undefined

claimRewards

function claimRewards(uint256 _tokenId) external nonpayable

Claim accumulated rewards.

See {_claimRewards}. Override that to implement custom logic. See {_calculateRewards} for reward-calculation logic.

Parameters

Name
Type
Description

_tokenId

uint256

Staked token Id.

contractType

function contractType() external pure returns (bytes32)

Returns the module type of the contract.

Returns

Name
Type
Description

_0

bytes32

undefined

contractURI

Returns the contract metadata URI.

Returns

Name
Type
Description

_0

string

undefined

contractVersion

Returns the version of the contract.

Returns

Name
Type
Description

_0

uint8

undefined

depositRewardTokens

Admin deposits reward tokens.

Parameters

Name
Type
Description

_amount

uint256

undefined

getDefaultRewardsPerUnitTime

Returns

Name
Type
Description

_rewardsPerUnitTime

uint256

undefined

getDefaultTimeUnit

Returns

Name
Type
Description

_timeUnit

uint256

undefined

getRewardTokenBalance

View total rewards available in the staking contract.

Returns

Name
Type
Description

_rewardsAvailableInContract

uint256

undefined

getRewardsPerUnitTime

Parameters

Name
Type
Description

_tokenId

uint256

undefined

Returns

Name
Type
Description

_rewardsPerUnitTime

uint256

undefined

getRoleAdmin

Returns the admin role that controls the specified role.

See {grantRole} and {revokeRole}. To change a role's admin, use {_setRoleAdmin}.

Parameters

Name
Type
Description

role

bytes32

keccak256 hash of the role. e.g. keccak256("TRANSFER_ROLE")

Returns

Name
Type
Description

_0

bytes32

undefined

getRoleMember

Returns the role-member from a list of members for a role, at a given index.

Returns member who has role, at index of role-members list. See struct {RoleMembers}, and mapping {roleMembers}

Parameters

Name
Type
Description

role

bytes32

keccak256 hash of the role. e.g. keccak256("TRANSFER_ROLE")

index

uint256

Index in list of current members for the role.

Returns

Name
Type
Description

member

address

Address of account that has role

getRoleMemberCount

Returns total number of accounts that have a role.

Returns count of accounts that have role. See struct {RoleMembers}, and mapping {roleMembers}

Parameters

Name
Type
Description

role

bytes32

keccak256 hash of the role. e.g. keccak256("TRANSFER_ROLE")

Returns

Name
Type
Description

count

uint256

Total number of accounts that have role

getStakeInfo

View all tokens staked and total rewards for a user.

Parameters

Name
Type
Description

_staker

address

Address for which to calculated rewards.

Returns

Name
Type
Description

_tokensStaked

uint256[]

List of token-ids staked.

_tokenAmounts

uint256[]

Amount of each token-id staked.

_totalRewards

uint256

Total rewards available.

getStakeInfoForToken

View amount staked and rewards for a user, for a given token-id.

Parameters

Name
Type
Description

_tokenId

uint256

undefined

_staker

address

Address for which to calculated rewards.

Returns

Name
Type
Description

_tokensStaked

uint256

Amount of tokens staked for given token-id.

_rewards

uint256

Available reward amount.

getTimeUnit

Parameters

Name
Type
Description

_tokenId

uint256

undefined

Returns

Name
Type
Description

_timeUnit

uint256

undefined

grantRole

Grants a role to an account, if not previously granted.

Caller must have admin role for the role. Emits {RoleGranted Event}.

Parameters

Name
Type
Description

role

bytes32

keccak256 hash of the role. e.g. keccak256("TRANSFER_ROLE")

account

address

Address of the account to which the role is being granted.

hasRole

Checks whether an account has a particular role.

Returns true if account has been granted role.

Parameters

Name
Type
Description

role

bytes32

keccak256 hash of the role. e.g. keccak256("TRANSFER_ROLE")

account

address

Address of the account for which the role is being checked.

Returns

Name
Type
Description

_0

bool

undefined

hasRoleWithSwitch

Checks whether an account has a particular role; role restrictions can be swtiched on and off.

Returns true if account has been granted role. Role restrictions can be swtiched on and off: - If address(0) has ROLE, then the ROLE restrictions don't apply. - If address(0) does not have ROLE, then the ROLE restrictions will apply.

Parameters

Name
Type
Description

role

bytes32

keccak256 hash of the role. e.g. keccak256("TRANSFER_ROLE")

account

address

Address of the account for which the role is being checked.

Returns

Name
Type
Description

_0

bool

undefined

indexedTokens

Parameters

Name
Type
Description

_0

uint256

undefined

Returns

Name
Type
Description

_0

uint256

undefined

initialize

Initiliazes the contract, like a constructor.

Parameters

Name
Type
Description

_defaultAdmin

address

undefined

_contractURI

string

undefined

_trustedForwarders

address[]

undefined

_rewardToken

address

undefined

_stakingToken

address

undefined

_defaultTimeUnit

uint256

undefined

_defaultRewardsPerUnitTime

uint256

undefined

isIndexed

Parameters

Name
Type
Description

_0

uint256

undefined

Returns

Name
Type
Description

_0

bool

undefined

isTrustedForwarder

Parameters

Name
Type
Description

forwarder

address

undefined

Returns

Name
Type
Description

_0

bool

undefined

multicall

Receives and executes a batch of function calls on this contract.

Parameters

Name
Type
Description

data

bytes[]

undefined

Returns

Name
Type
Description

results

bytes[]

undefined

onERC1155BatchReceived

Handles the receipt of a multiple ERC1155 token types. This function is called at the end of a safeBatchTransferFrom after the balances have been updated. NOTE: To accept the transfer(s), this must return bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)")) (i.e. 0xbc197c81, or its own function selector).

Parameters

Name
Type
Description

operator

address

The address which initiated the batch transfer (i.e. msg.sender)

from

address

The address which previously owned the token

ids

uint256[]

An array containing ids of each token being transferred (order and length must match values array)

values

uint256[]

An array containing amounts of each token being transferred (order and length must match ids array)

data

bytes

Additional data with no specified format

Returns

Name
Type
Description

_0

bytes4

bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)")) if transfer is allowed

onERC1155Received

Parameters

Name
Type
Description

_0

address

undefined

_1

address

undefined

_2

uint256

undefined

_3

uint256

undefined

_4

bytes

undefined

Returns

Name
Type
Description

_0

bytes4

undefined

renounceRole

Revokes role from the account.

Caller must have the role, with caller being the same as account. Emits {RoleRevoked Event}.

Parameters

Name
Type
Description

role

bytes32

keccak256 hash of the role. e.g. keccak256("TRANSFER_ROLE")

account

address

Address of the account from which the role is being revoked.

revokeRole

Revokes role from an account.

Caller must have admin role for the role. Emits {RoleRevoked Event}.

Parameters

Name
Type
Description

role

bytes32

keccak256 hash of the role. e.g. keccak256("TRANSFER_ROLE")

account

address

Address of the account from which the role is being revoked.

rewardToken

ERC20 Reward Token address. See {_mintRewards} below.

Returns

Name
Type
Description

_0

address

undefined

setContractURI

Lets a contract admin set the URI for contract-level metadata.

Caller should be authorized to setup contractURI, e.g. contract admin. See {_canSetContractURI}. Emits {ContractURIUpdated Event}.

Parameters

Name
Type
Description

_uri

string

keccak256 hash of the role. e.g. keccak256("TRANSFER_ROLE")

setDefaultRewardsPerUnitTime

Set rewards per unit of time. Interpreted as x rewards per second/per day/etc based on time-unit.

Only admin/authorized-account can call it.

Parameters

Name
Type
Description

_defaultRewardsPerUnitTime

uint256

New rewards per unit time.

setDefaultTimeUnit

Set time unit. Set as a number of seconds. Could be specified as -- x * 1 hours, x * 1 days, etc.

Only admin/authorized-account can call it.

Parameters

Name
Type
Description

_defaultTimeUnit

uint256

New time unit.

setRewardsPerUnitTime

Set rewards per unit of time. Interpreted as x rewards per second/per day/etc based on time-unit.

Only admin/authorized-account can call it.

Parameters

Name
Type
Description

_tokenId

uint256

ERC1155 token Id.

_rewardsPerUnitTime

uint256

New rewards per unit time.

setTimeUnit

Set time unit. Set as a number of seconds. Could be specified as -- x * 1 hours, x * 1 days, etc.

Only admin/authorized-account can call it.

Parameters

Name
Type
Description

_tokenId

uint256

ERC1155 token Id.

_timeUnit

uint256

New time unit.

stake

Stake ERC721 Tokens.

See {_stake}. Override that to implement custom logic.

Parameters

Name
Type
Description

_tokenId

uint256

ERC1155 token-id to stake.

_amount

uint256

Amount to stake.

stakers

Parameters

Name
Type
Description

_0

uint256

undefined

_1

address

undefined

Returns

Name
Type
Description

amountStaked

uint256

undefined

timeOfLastUpdate

uint256

undefined

unclaimedRewards

uint256

undefined

conditionIdOflastUpdate

uint256

undefined

stakersArray

Parameters

Name
Type
Description

_0

uint256

undefined

_1

uint256

undefined

Returns

Name
Type
Description

_0

address

undefined

stakingToken

Returns

Name
Type
Description

_0

address

undefined

supportsInterface

Parameters

Name
Type
Description

interfaceId

bytes4

undefined

Returns

Name
Type
Description

_0

bool

undefined

withdraw

Withdraw staked tokens.

See {_withdraw}. Override that to implement custom logic.

Parameters

Name
Type
Description

_tokenId

uint256

ERC1155 token-id to withdraw.

_amount

uint256

Amount to withdraw.

withdrawRewardTokens

Admin can withdraw excess reward tokens.

Parameters

Name
Type
Description

_amount

uint256

undefined

Events

ContractURIUpdated

Parameters

Name
Type
Description

prevURI

string

undefined

newURI

string

undefined

Initialized

Parameters

Name
Type
Description

version

uint8

undefined

RewardTokensDepositedByAdmin

Parameters

Name
Type
Description

_amount

uint256

undefined

RewardTokensWithdrawnByAdmin

Parameters

Name
Type
Description

_amount

uint256

undefined

RewardsClaimed

Parameters

Name
Type
Description

staker indexed

address

undefined

rewardAmount

uint256

undefined

RoleAdminChanged

Parameters

Name
Type
Description

role indexed

bytes32

undefined

previousAdminRole indexed

bytes32

undefined

newAdminRole indexed

bytes32

undefined

RoleGranted

Parameters

Name
Type
Description

role indexed

bytes32

undefined

account indexed

address

undefined

sender indexed

address

undefined

RoleRevoked

Parameters

Name
Type
Description

role indexed

bytes32

undefined

account indexed

address

undefined

sender indexed

address

undefined

TokensStaked

Parameters

Name
Type
Description

staker indexed

address

undefined

tokenId indexed

uint256

undefined

amount

uint256

undefined

TokensWithdrawn

Parameters

Name
Type
Description

staker indexed

address

undefined

tokenId indexed

uint256

undefined

amount

uint256

undefined

UpdatedDefaultRewardsPerUnitTime

Parameters

Name
Type
Description

oldRewardsPerUnitTime

uint256

undefined

newRewardsPerUnitTime

uint256

undefined

UpdatedDefaultTimeUnit

Parameters

Name
Type
Description

oldTimeUnit

uint256

undefined

newTimeUnit

uint256

undefined

UpdatedRewardsPerUnitTime

Parameters

Name
Type
Description

_tokenId indexed

uint256

undefined

oldRewardsPerUnitTime

uint256

undefined

newRewardsPerUnitTime

uint256

undefined

UpdatedTimeUnit

Parameters

Name
Type
Description

_tokenId indexed

uint256

undefined

oldTimeUnit

uint256

undefined

newTimeUnit

uint256

undefined

Last updated