Interact With Ref Farming
Here we using near-cli as tools to demonstrate how to interact with ref-farming contract.
It's important for front-end developers to understand the interface logic from FE perspective.
assumption
export FARMING=ref-farming.testnet
export EX=ref-finance.testnet
export TOKEN=token.ref-finance.testnetviews
global info
contract metadata
% near view $FARMING get_metadata
# return statics
{
version: '1.0.0',
owner_id: 'ref_finance_owner.testnet',
farmer_count: '4',
farm_count: '7',
seed_count: '6',
reward_count: '1'
}all farms with pagination
Note:
outdated_farms are excluded;
There are three
farm_statusin contract, they are Created, Running, Ended;start_atis timestamp in seconds;session_intervalis timestamp in seconds;
all seeds with pagination
all rewards with pagination
per seed info
get single seed info
farms in a seed
per farm info
single farm info
per user
list rewards
get unclaimed
list user seeds
stake/unstake seeds
claim reward
withdraw reward token
create farm
To create a farm, you need prepare farming terms.
At this point, this is a farm with no reward deposited, farm status is Created.
To activate a farm, deposit some reward token into the farm with ft_transfer_call.
Note: Only owner of this contract can create farms.
Last updated
Was this helpful?