Skip to content

Entrypoints

dexterslabor edited this page Apr 19, 2021 · 2 revisions

Entrypoints

%deposit(nat)

This entrypoint serves as a gateway to the farm. Users can deposit a certain amount of stakeable LP tokens to begin accumulating staking rewards, which can be claimed at a later point in time through manual interaction with the contract.

Parameters
  • nat

    A single value representing the amount of stakeable tokens being deposited. The user depositing must create an appropriate allowance by calling %approve on the underlying token contract beforehand. The farm itself will transfer the specified amount to its own KT1 address.

    This mechanism is important to maintain the farmTokenBalance in the storage.

%claim()

This entrypoint calculates the earned reward tokens for the user invoking it and pays it out.

Parameters
  • unit

%withdraw(nat)

This entrypoint unstakes the number of LP tokens the delegator specifies and pays out earned reward tokens.

Parameters
  • nat Number of staked LP tokens the user wants to withdraw.

%setAdmin(address)

This entrypoint is authenticated implicitly with Tezos.sender who has to match with the admin property in storage. The call sets the specified address as new admin.

Parameters
  • address The address of the new admin.

%updatePlan(pair (nat %rewardPerBlock nat %totalBlocks))

This entrypoint is authenticated implicitly with Tezos.sender who has to match with the admin property in storage. This call can be used to extend or shorten the reward payout scheme of the farm. It can be also used to "rehydrate" a "dry" farm.

  • nat %rewardPerBlock Number of reward tokens per block.
  • nat %totalBlock Number of total blocks in the payout scheme.

`%escape(unit)

Emergency withdraw function called escape is an extra layer of protection for users. Do not call this except the farm encounters a critical bug. Rewards are not being calculated for the user, but LP tokens are transferred back.