Liquidity Staking (Farming)
Contract Interface
1. Notations & Structs
1.1. Payment
1.2. FarmTokenAttributes
#[derive(TopEncode, TopDecode, NestedEncode, NestedDecode, PartialEq, TypeAbi, Clone, ManagedVecItem, Debug)]
pub struct FarmTokenAttributes<M: ManagedTypeApi> {
pub reward_per_share: BigUint<M>,
pub slope_used: BigUint<M>,
pub booster: ManagedAddress<M>,
pub initial_farm_amount: BigUint<M>,
pub initial_farming_amount: BigUint<M>,
pub reward_tokens: ManagedVec<M, RewardTokens<M>>,
}
fn get_farm_token_attributes<T: TopDecode>(&self, token_id: &TokenIdentifier, token_nonce: u64) -> T {
let token_info = self.blockchain().get_esdt_token_data(&self.blockchain().get_sc_address(), token_id, token_nonce);
token_info.decode_attributes()
}1.3. InteractFarmEvent
2. Write functions
2.1. enterFarm
2.2. exitFarm
2.3. claimRewards
3. Read functions
3.1. getState
3.2. getRewardPerShare
3.3. getFarmTokenSupply
3.4 calculateRewardsForGivenPosition
4. Events
4.1. Interact farm event
Last updated