Bennyfi Smart Contract API Docs
Current Contract: https://eosauthority.com/account/dapp.beny?network=telos
Actions
setsetting(const eosio::name &setter, const string &key, const Setting::FlexValue &value)
Description
Enables the creation or editing of a setting
Parameters
setter: account that is requesting the change to the setting key: String value that identifies the setting value: The value to set the setting to. Can be any of the following types: [eosio::name, std::string, eosio::asset, eosio::time_point, std::int64_t, eosio::checksum256]
appndsetting(const eosio::name &setter, const string &key, const Setting::FlexValue &value)
Description
Enables the appending of a value to a setting
Parameters
setter: account that is requesting the change to the setting key: String value that identifies the setting value: The value to append to the setting. Can be any of the following types: [eosio::name, std::string, eosio::asset, eosio::time_point, std::int64_t, eosio::checksum256]
clipsetting(const eosio::name &setter, const string &key, const Setting::FlexValue &value)
Description
Enables the removal of a value from a setting
Parameters
setter: account that is requesting the change to the setting key: String value that identifies the setting value: The value to remove from the setting. Can be any of the following types: [eosio::name, std::string, eosio::asset, eosio::time_point, std::int64_t, eosio::checksum256]
erasesetting(const eosio::name &setter, const string &key)
Description
Enables the erasing of a setting
Parameters
setter: account that is requesting the change to the setting key: String value that identifies the setting to erase
setauth(const eosio::name &authorizer, const eosio::name &account, const uint64_t auth_level, const string ¬es)
Description
Enables the adding or editing of an authority for user in the authority table
Parameters
authorizer: account that authorizes the adding or editing of the authority account: account to which the authority is being given auth_level: Authority level to be given to the account, the lower the value the greater the authority notes: Notes associated to the authority
eraseauth(const eosio::name &authorizer, const eosio::name &account)
Description
Enables the erasing of an authority from the authority table
Parameters
authorizer: account that authorizes the erasing of the authority account: account from which the authority is being removed
settoken(const eosio::name &authorizer, const eosio::symbol &symbol, const eosio::name &token_contract, const map<eosio::name, AuthToken::TokenLimits> &token_roles)
Description
Enables the adding or editing of a token in the authorized tokens table, the token roles are replaced by the new value
Parameters
authorizer: account that authorizes the operation symbol: the symbol of the token token_contract: The token contract of the token token_roles: Map that contains the role or roles the token is going to play, the key of the map is the role and can be one of ["stake": Used for staking only, "reward": Used for rewards only] and the Value is a TokenLimits object that specifies the Min and Max Values for the token in the role.
settokenrole(const eosio::name &authorizer, const eosio::symbol &symbol, const eosio::name &token_contract, const eosio::name &token_role, const eosio::asset &min_value, const eosio::asset &max_value)
Description
Enables the adding or updating of a token in the authorized tokens table, it adds or updates the token role with the specified parameters
Parameters
authorizer: account that authorizes the operation symbol: the symbol of the token token_contract: The token contract of the token token_role: Token role to add or update min_value: Min value that the token can take when playing the specified role max_value: Max value that the token can take when playing the specified role
erasetoken(const eosio::name &authorizer, const eosio::symbol &symbol)
Description
Enables the erasing of a token from the authorized tokens table
Parameters
authorizer: account that authorizes the operation symbol: the symbol of the token to erase
erasetknrole(const eosio::name &authorizer, const eosio::symbol &symbol, const eosio::name &token_role)
Description
Enables the erasing of a token role from the specified token
Parameters
authorizer: account that authorizes the operation symbol: the symbol of the token to erase token_role: Token role to add or update
newterm(const name &round_manager, const std::string &term_name, const uint32_t all_participants_perc_x100000, const name& beneficiary, const uint32_t beneficiary_perc_x100000)
Description
Creates a new set of terms to create rounds from
Parameters
round_manager: account of the round manager creating the terms term_name: name to associate with the terms all_participants_perc_x100000: The percentage of the total reward that is distributed among all the participants, it must be indicated as an integer, by multiplying it by 100000 beneficiary:The account of the beneficiary beneficiary_perc_x100000: The percentage of the total reward that is given to the beneficiary account
newround(const name &round_manager, const uint64_t &term_id, const asset &entry_stake, const asset &total_reward, const uint8_t num_participants, const uint32_t staking_period_hrs, const uint32_t enrollment_time_out_hrs)
Description
Creates a new round based on the specified terms and parameters
Parameters
round_manager: account of the round manager creating the round, this is also the account that funds the round term_id: The id of the terms to be used to create the round entry_stake: The amount a participant has to stake to participate on the round total_reward: The total reward that is distributed between the winner, participants and beneficiary num_participants: The number of participants that must join the round for it to be closed staking_period_hrs: The amount of time specified in hrs that the participants must stake their entry enrollment_time_out_hrs: Time limit specified in hrs in which the number of participants for a round has to be reached, before being canceled
enterround(const uint64_t &round_id, const name &participant)
Description
Enters a participant to a round
Parameters
round_id: The id of the round the participant wants to enter to participant: The account of the participant
claimreturn(const uint64_t entry_id)
Description
Enables a participant to claim return on an entry once the round is unlocked
Parameters
entry_id: The id of the entry the participant wants to claim return from
unstake(const uint64_t entry_id)
Description
Enables a participant to claim return and unstake on an entry once the round is unlocked, or unstake when a round has timed out
Parameters
entry_id: The id of the entry the participant wants to unstake from
timedevents(const name &caller)
Description
Looks for timed events that have lapsed and performs actions accordingly
Parameters
caller: The account of the caller
receiverand(const uint64_t assoc_id, const vectorvrf::Proof& proofs)
Description
Receives the response from a VRF random number request
Parameters
assoc_id: The id of the round associated to the VRF random number request proofs: A vector of VRF random number proofs, the proofs include a random number and the proof of its generation. The number of proofs depends on the number of random numbers requested.
deposit(const name &from, const name &to, const asset &quantity, const string &memo)
Description
Executed every time a tranfer of tokens is made into the bennyfi contract, it validates the transfer, and updates the balance of the "from" account accordingly
Parameters
from: The account transfering tokens into the contract to: The account of the bennyfi contract quantity: The amount transfered into the contract memo: Note specified as part of the transfer
withdrawtot(const name &from, const symbol &symbol)
Description
Withdraws the total balance from the specified account for a specified token from the bennyfi contract
Parameters
from: The account from which the tokens are to be withdrawn symbol: The symbol of the token from which to withdraw the tokens
withdraw(const name &from, const asset &quantity)
Description
Withdraws the specified quantity from the specified account from the bennyfi contract
Parameters
from: The account from which the tokens are to be withdrawn quantity: The quantity to withdraw
Tables
Table Name: settings
Description
Stores configuration settings
Columns
uint64_t id std::string key std::vector values eosio::time_point created_date eosio::time_point updated_date
id: Table ID [Primary Key] key: The string that identifies the setting values: The values stored for the setting created_date: The date the setting was created on updated_date: The date the setting was updated on
Table Name: auths
Description
Stores user authorities
Columns
eosio::name account eosio::name authorizer uint64_t auth_level std::string notes
account: The account associated to the authority [Primary Key] authorizer: The account that authorized the authorization auth_level: The authority level given to the account. The lower the value the greater the authority. notes: Notes associated to the authority
Additional Indexes
by_authorizer: authorizer by_level: auth_level
Table Name: authtokens
Description
Stores authorized tokens
Columns
eosio::symbol symbol eosio::name token_contract eosio::name authorizer map<eosio::name, TokenLimits> token_roles
TokenLimits:
eosio::asset min_value eosio::asset max_value
symbol: The symbol of the token [Primary Key] token_contract: The account of the token contract authorizer: The account that authorized the token token_roles: Map that contains the role or roles the token is going to play, the key of the map is the role and can be one of ["stake": Used for staking only, "reward": Used for rewards only] and the Value is a TokenLimits object that specifies the Min and Max Values for the token in the role.
Additional Indexes
by_authorizer: authorizer
Table Name: balances
Description
Stores account balances, supports multiple tokens
Columns
uint64_t id eosio::name token_holder eosio::symbol symbol asset liquid_balance asset staked_balance name token_contract
id: Table ID [Primary Key] token_holder: The account who owns the balance symbol: The symbol of the token on which the balances are specified liquid_balance: The balance that the account can withdraw (not staked) staked_balance: The balance that is staked token_contract: The account of the token contract on which the balances are specified
Additional Indexes
by_holder_symbol: token_holder + symbol by_holder: token_holder by_symbol: symbol
Table Name: terms
Description
Stores terms to create rounds from
Columns
uint64_t term_id std::string term_name uint32_t all_participants_perc_x100000 eosio::name round_manager eosio::name beneficiary uint32_t beneficiary_perc_x100000 eosio::time_point created_date eosio::time_point updated_date
term_id: Table ID [Primary Key] term_name: Name associated with the terms all_participants_perc_x100000: The percentage of the total reward that is distributed among all the participants, it must be indicated as an integer, by multiplying it by 100000 round_manager: account of the round manager that created the terms beneficiary:The account of the beneficiary beneficiary_perc_x100000: The percentage of the total reward that is given to the beneficiary account created_date: The date the setting was created on updated_date: The date the setting was updated on
Additional Indexes
by_manager: round_manager
Table Name: rounds
Description
Stores rounds
Columns
uint64_t round_id uint64_t term_id eosio::microseconds staking_period eosio::microseconds enrollment_time_out uint32_t num_participants eosio::asset entry_stake eosio::asset total_reward eosio::name reward_token_contract uint32_t num_participants_entered uint32_t num_claimed_returns uint32_t num_unstaked name current_state eosio::asset total_deposits eosio::asset winner_prize eosio::asset beneficiary_reward eosio::asset min_participant_reward name round_manager eosio::time_point staked_time eosio::time_point created_date eosio::time_point updated_date
round_id: Table ID [Primary Key] term_id: The id of the term used as basis to create the round staking_period: The amount of time that the participants must stake their entry enrollment_time_out: Time limit in which the number of participants for a round has to be reached, before being canceled num_participants: The number of participants that must join the round for it to be closed entry_stake: The amount a participant has to stake to participate on the round total_reward: The total reward that is distributed between the winner, participants and beneficiary reward_token_contract: The account of the token contract used as reward num_participants_entered: The number of participants that have entered the round current_state: The current state of the round:
Accepting entries: acceptentrys
Drawing random numbers: rounddrawing
Closed: roundclosed
Unlocked: rndunlocked
Timed out: rndtimedout
total_deposits: The sum of all entries winner_prize: The amount the winner took beneficiary_reward: The amount that went to the beneficiary min_participant_reward: The amount that goes to all participants round_manager: account of the round manager creating the round, this is also the account that funds the round staked_time: The date on which the staking period started, which is also the time the round closed created_date: The date the setting was created on updated_date: The date the setting was updated on
Additional Indexes
by_manager: round_manager by_term: term_id by_state: current_state by_entry: entry_stake by_reward: total_reward
Table Name: entries
Description
Stores round entries
Columns
uint64_t entry_id uint64_t round_id name participant uint64_t position eosio::asset entry_stake eosio::asset return_amount name entry_status eosio::time_point entered_date
entry_id: Table ID [Primary Key] round_id: The id of the round the entry belongs to participant: The account of the participant position: The position on which the participant entered the round entry_stake: The amount staked by the participant return_amount: The amount of the reward that went to the participant entry_status: The status of the entry
Entry has been staked: entrystaked
Return has been set: returnset
Return has been paid: paidtoliq
entered_date: The date the participant entered the round
Additional Indexes
by_status: entry_status by_entered: entered_date by_user: participant by_round: round_id by_round_participant: round_id + participant by_round_position: round_id + position
Auth Permissions Table
Contract Account
X
X
X
X
X
X
X
Sudo(0)
X
X
X
X
X
X
X
Admin(10)
X
X
X
X
X
X
X
Pool Manager(40)
X
X
X
X
X
Player(50)
X
Beneficiary(60)
X
Disabled(70)
Account Permission
X
X
X
X
Open Permission
Last updated