Skip to content

Farming


Calls


add_boost_pool_whitelist

Attributes

Name Type
whitelist Vec<PoolId>

Python

call = substrate.compose_call(
    'Farming', 'add_boost_pool_whitelist', {'whitelist': ['u32']}
)

charge

Attributes

Name Type
pid PoolId
rewards Vec<(CurrencyIdOf<T>, BalanceOf<T>)>

Python

call = substrate.compose_call(
    'Farming', 'charge', {
    'pid': 'u32',
    'rewards': [
        (
            {
                'Native': None,
                'Stellar': {
                    'AlphaNum12': {
                        'code': '[u8; 12]',
                        'issuer': '[u8; 32]',
                    },
                    'AlphaNum4': {
                        'code': '[u8; 4]',
                        'issuer': '[u8; 32]',
                    },
                    'StellarNative': None,
                },
                'Token': 'u64',
                'XCM': 'u8',
                'ZenlinkLPToken': (
                    'u8',
                    'u8',
                    'u8',
                    'u8',
                ),
            },
            'u128',
        ),
    ],
}
)

charge_boost

Attributes

Name Type
rewards Vec<(CurrencyIdOf<T>, BalanceOf<T>)>

Python

call = substrate.compose_call(
    'Farming', 'charge_boost', {
    'rewards': [
        (
            {
                'Native': None,
                'Stellar': {
                    'AlphaNum12': {
                        'code': '[u8; 12]',
                        'issuer': '[u8; 32]',
                    },
                    'AlphaNum4': {
                        'code': '[u8; 4]',
                        'issuer': '[u8; 32]',
                    },
                    'StellarNative': None,
                },
                'Token': 'u64',
                'XCM': 'u8',
                'ZenlinkLPToken': (
                    'u8',
                    'u8',
                    'u8',
                    'u8',
                ),
            },
            'u128',
        ),
    ],
}
)

claim

Attributes

Name Type
pid PoolId

Python

call = substrate.compose_call(
    'Farming', 'claim', {'pid': 'u32'}
)

close_pool

Attributes

Name Type
pid PoolId

Python

call = substrate.compose_call(
    'Farming', 'close_pool', {'pid': 'u32'}
)

create_farming_pool

Attributes

Name Type
tokens_proportion Vec<(CurrencyIdOf<T>, Perbill)>
basic_rewards Vec<(CurrencyIdOf<T>, BalanceOf<T>)>
gauge_init `Option<
(CurrencyIdOf, BlockNumberFor, Vec<
(CurrencyIdOf, BalanceOf)>,)>`
min_deposit_to_start BalanceOf<T>
after_block_to_start BlockNumberFor<T>
withdraw_limit_time BlockNumberFor<T>
claim_limit_time BlockNumberFor<T>
withdraw_limit_count u8

Python

call = substrate.compose_call(
    'Farming', 'create_farming_pool', {
    'after_block_to_start': 'u32',
    'basic_rewards': [
        (
            {
                'Native': None,
                'Stellar': {
                    'AlphaNum12': {
                        'code': '[u8; 12]',
                        'issuer': '[u8; 32]',
                    },
                    'AlphaNum4': {
                        'code': '[u8; 4]',
                        'issuer': '[u8; 32]',
                    },
                    'StellarNative': None,
                },
                'Token': 'u64',
                'XCM': 'u8',
                'ZenlinkLPToken': (
                    'u8',
                    'u8',
                    'u8',
                    'u8',
                ),
            },
            'u128',
        ),
    ],
    'claim_limit_time': 'u32',
    'gauge_init': (
        None,
        (
            {
                'Native': None,
                'Stellar': {
                    'AlphaNum12': {
                        'code': '[u8; 12]',
                        'issuer': '[u8; 32]',
                    },
                    'AlphaNum4': {
                        'code': '[u8; 4]',
                        'issuer': '[u8; 32]',
                    },
                    'StellarNative': None,
                },
                'Token': 'u64',
                'XCM': 'u8',
                'ZenlinkLPToken': (
                    'u8',
                    'u8',
                    'u8',
                    'u8',
                ),
            },
            'u32',
            [
                (
                    {
                        'Native': None,
                        'Stellar': {
                            'AlphaNum12': 'InnerStruct',
                            'AlphaNum4': 'InnerStruct',
                            'StellarNative': None,
                        },
                        'Token': 'u64',
                        'XCM': 'u8',
                        'ZenlinkLPToken': (
                            'u8',
                            'u8',
                            'u8',
                            'u8',
                        ),
                    },
                    'u128',
                ),
            ],
        ),
    ),
    'min_deposit_to_start': 'u128',
    'tokens_proportion': [
        (
            {
                'Native': None,
                'Stellar': {
                    'AlphaNum12': {
                        'code': '[u8; 12]',
                        'issuer': '[u8; 32]',
                    },
                    'AlphaNum4': {
                        'code': '[u8; 4]',
                        'issuer': '[u8; 32]',
                    },
                    'StellarNative': None,
                },
                'Token': 'u64',
                'XCM': 'u8',
                'ZenlinkLPToken': (
                    'u8',
                    'u8',
                    'u8',
                    'u8',
                ),
            },
            'u32',
        ),
    ],
    'withdraw_limit_count': 'u8',
    'withdraw_limit_time': 'u32',
}
)

deposit

Attributes

Name Type
pid PoolId
add_value BalanceOf<T>
gauge_info Option<(BalanceOf<T>, BlockNumberFor<T>)>

Python

call = substrate.compose_call(
    'Farming', 'deposit', {
    'add_value': 'u128',
    'gauge_info': (
        None,
        ('u128', 'u32'),
    ),
    'pid': 'u32',
}
)

edit_pool

Attributes

Name Type
pid PoolId
basic_rewards Option<Vec<(CurrencyIdOf<T>, BalanceOf<T>)>>
withdraw_limit_time Option<BlockNumberFor<T>>
claim_limit_time Option<BlockNumberFor<T>>
gauge_basic_rewards Option<Vec<(CurrencyIdOf<T>, BalanceOf<T>)>>
withdraw_limit_count Option<u8>

Python

call = substrate.compose_call(
    'Farming', 'edit_pool', {
    'basic_rewards': (
        None,
        [
            (
                {
                    'Native': None,
                    'Stellar': {
                        'AlphaNum12': {
                            'code': '[u8; 12]',
                            'issuer': '[u8; 32]',
                        },
                        'AlphaNum4': {
                            'code': '[u8; 4]',
                            'issuer': '[u8; 32]',
                        },
                        'StellarNative': None,
                    },
                    'Token': 'u64',
                    'XCM': 'u8',
                    'ZenlinkLPToken': (
                        'u8',
                        'u8',
                        'u8',
                        'u8',
                    ),
                },
                'u128',
            ),
        ],
    ),
    'claim_limit_time': (None, 'u32'),
    'gauge_basic_rewards': (
        None,
        [
            (
                {
                    'Native': None,
                    'Stellar': {
                        'AlphaNum12': {
                            'code': '[u8; 12]',
                            'issuer': '[u8; 32]',
                        },
                        'AlphaNum4': {
                            'code': '[u8; 4]',
                            'issuer': '[u8; 32]',
                        },
                        'StellarNative': None,
                    },
                    'Token': 'u64',
                    'XCM': 'u8',
                    'ZenlinkLPToken': (
                        'u8',
                        'u8',
                        'u8',
                        'u8',
                    ),
                },
                'u128',
            ),
        ],
    ),
    'pid': 'u32',
    'withdraw_limit_count': (
        None,
        'u8',
    ),
    'withdraw_limit_time': (
        None,
        'u32',
    ),
}
)

end_boost_round

Attributes

No attributes

Python

call = substrate.compose_call(
    'Farming', 'end_boost_round', {}
)

force_gauge_claim

Attributes

Name Type
gid PoolId

Python

call = substrate.compose_call(
    'Farming', 'force_gauge_claim', {'gid': 'u32'}
)

force_retire_pool

Attributes

Name Type
pid PoolId

Python

call = substrate.compose_call(
    'Farming', 'force_retire_pool', {'pid': 'u32'}
)

gauge_withdraw

Attributes

Name Type
gid PoolId

Python

call = substrate.compose_call(
    'Farming', 'gauge_withdraw', {'gid': 'u32'}
)

kill_pool

Attributes

Name Type
pid PoolId

Python

call = substrate.compose_call(
    'Farming', 'kill_pool', {'pid': 'u32'}
)

reset_pool

Attributes

Name Type
pid PoolId
basic_rewards Option<Vec<(CurrencyIdOf<T>, BalanceOf<T>)>>
min_deposit_to_start Option<BalanceOf<T>>
after_block_to_start Option<BlockNumberFor<T>>
withdraw_limit_time Option<BlockNumberFor<T>>
claim_limit_time Option<BlockNumberFor<T>>
withdraw_limit_count Option<u8>
gauge_init `Option<
(CurrencyIdOf, BlockNumberFor, Vec<
(CurrencyIdOf, BalanceOf)>,)>`

Python

call = substrate.compose_call(
    'Farming', 'reset_pool', {
    'after_block_to_start': (
        None,
        'u32',
    ),
    'basic_rewards': (
        None,
        [
            (
                {
                    'Native': None,
                    'Stellar': {
                        'AlphaNum12': {
                            'code': '[u8; 12]',
                            'issuer': '[u8; 32]',
                        },
                        'AlphaNum4': {
                            'code': '[u8; 4]',
                            'issuer': '[u8; 32]',
                        },
                        'StellarNative': None,
                    },
                    'Token': 'u64',
                    'XCM': 'u8',
                    'ZenlinkLPToken': (
                        'u8',
                        'u8',
                        'u8',
                        'u8',
                    ),
                },
                'u128',
            ),
        ],
    ),
    'claim_limit_time': (None, 'u32'),
    'gauge_init': (
        None,
        (
            {
                'Native': None,
                'Stellar': {
                    'AlphaNum12': {
                        'code': '[u8; 12]',
                        'issuer': '[u8; 32]',
                    },
                    'AlphaNum4': {
                        'code': '[u8; 4]',
                        'issuer': '[u8; 32]',
                    },
                    'StellarNative': None,
                },
                'Token': 'u64',
                'XCM': 'u8',
                'ZenlinkLPToken': (
                    'u8',
                    'u8',
                    'u8',
                    'u8',
                ),
            },
            'u32',
            [
                (
                    {
                        'Native': None,
                        'Stellar': {
                            'AlphaNum12': 'InnerStruct',
                            'AlphaNum4': 'InnerStruct',
                            'StellarNative': None,
                        },
                        'Token': 'u64',
                        'XCM': 'u8',
                        'ZenlinkLPToken': (
                            'u8',
                            'u8',
                            'u8',
                            'u8',
                        ),
                    },
                    'u128',
                ),
            ],
        ),
    ),
    'min_deposit_to_start': (
        None,
        'u128',
    ),
    'pid': 'u32',
    'withdraw_limit_count': (
        None,
        'u8',
    ),
    'withdraw_limit_time': (
        None,
        'u32',
    ),
}
)

set_next_round_whitelist

Attributes

Name Type
whitelist Vec<PoolId>

Python

call = substrate.compose_call(
    'Farming', 'set_next_round_whitelist', {'whitelist': ['u32']}
)

set_retire_limit

Attributes

Name Type
limit u32

Python

call = substrate.compose_call(
    'Farming', 'set_retire_limit', {'limit': 'u32'}
)

start_boost_round

Attributes

Name Type
round_length BlockNumberFor<T>

Python

call = substrate.compose_call(
    'Farming', 'start_boost_round', {'round_length': 'u32'}
)

vote

Attributes

Name Type
vote_list Vec<(PoolId, Percent)>

Python

call = substrate.compose_call(
    'Farming', 'vote', {'vote_list': [('u32', 'u8')]}
)

withdraw

Attributes

Name Type
pid PoolId
remove_value Option<BalanceOf<T>>

Python

call = substrate.compose_call(
    'Farming', 'withdraw', {
    'pid': 'u32',
    'remove_value': (None, 'u128'),
}
)

withdraw_claim

Attributes

Name Type
pid PoolId

Python

call = substrate.compose_call(
    'Farming', 'withdraw_claim', {'pid': 'u32'}
)

Events


AllForceGaugeClaimed

Attributes

Name Type Composition
gid PoolId u32

AllRetired

Attributes

Name Type Composition
pid PoolId u32

BoostCharged

Attributes

Name Type Composition
who AccountIdOf<T> AccountId
rewards Vec<(CurrencyIdOf<T>, BalanceOf<T>)> [({'Native': None, 'XCM': 'u8', 'Stellar': {'StellarNative': None, 'AlphaNum4': {'code': '[u8; 4]', 'issuer': '[u8; 32]'}, 'AlphaNum12': {'code': '[u8; 12]', 'issuer': '[u8; 32]'}}, 'ZenlinkLPToken': ('u8', 'u8', 'u8', 'u8'), 'Token': 'u64'}, 'u128')]

Charged

Attributes

Name Type Composition
who AccountIdOf<T> AccountId
pid PoolId u32
rewards Vec<(CurrencyIdOf<T>, BalanceOf<T>)> [({'Native': None, 'XCM': 'u8', 'Stellar': {'StellarNative': None, 'AlphaNum4': {'code': '[u8; 4]', 'issuer': '[u8; 32]'}, 'AlphaNum12': {'code': '[u8; 12]', 'issuer': '[u8; 32]'}}, 'ZenlinkLPToken': ('u8', 'u8', 'u8', 'u8'), 'Token': 'u64'}, 'u128')]

Claimed

Attributes

Name Type Composition
who AccountIdOf<T> AccountId
pid PoolId u32

Deposited

Attributes

Name Type Composition
who AccountIdOf<T> AccountId
pid PoolId u32
add_value BalanceOf<T> u128
gauge_info Option<(BalanceOf<T>, BlockNumberFor<T>)> (None, ('u128', 'u32'))

FarmingPoolClosed

Attributes

Name Type Composition
pid PoolId u32

FarmingPoolCreated

Attributes

Name Type Composition
pid PoolId u32

FarmingPoolEdited

Attributes

Name Type Composition
pid PoolId u32

FarmingPoolKilled

Attributes

Name Type Composition
pid PoolId u32

FarmingPoolReset

Attributes

Name Type Composition
pid PoolId u32

GaugeWithdrawn

Attributes

Name Type Composition
who AccountIdOf<T> AccountId
gid PoolId u32

PartiallyForceGaugeClaimed

Attributes

Name Type Composition
gid PoolId u32

PartiallyRetired

Attributes

Name Type Composition
pid PoolId u32

RetireLimitSet

Attributes

Name Type Composition
limit u32 u32

RoundEnd

Attributes

Name Type Composition
total_votes BalanceOf<T> u128
start_round BlockNumberFor<T> u32
end_round BlockNumberFor<T> u32

RoundStart

Attributes

Name Type Composition
round_length BlockNumberFor<T> u32

RoundStartError

Attributes

Name Type Composition
info DispatchError {'Other': None, 'CannotLookup': None, 'BadOrigin': None, 'Module': {'index': 'u8', 'error': '[u8; 4]'}, 'ConsumerRemaining': None, 'NoProviders': None, 'TooManyConsumers': None, 'Token': ('FundsUnavailable', 'OnlyProvider', 'BelowMinimum', 'CannotCreate', 'UnknownAsset', 'Frozen', 'Unsupported', 'CannotCreateHold', 'NotExpendable'), 'Arithmetic': ('Underflow', 'Overflow', 'DivisionByZero'), 'Transactional': ('LimitReached', 'NoLayer'), 'Exhausted': None, 'Corruption': None, 'Unavailable': None}

Voted

Attributes

Name Type Composition
who AccountIdOf<T> AccountId
vote_list Vec<(PoolId, Percent)> [('u32', 'u8')]

WithdrawClaimed

Attributes

Name Type Composition
who AccountIdOf<T> AccountId
pid PoolId u32

Withdrawn

Attributes

Name Type Composition
who AccountIdOf<T> AccountId
pid PoolId u32
remove_value Option<BalanceOf<T>> (None, 'u128')

Storage functions


BoostBasicRewards

Python

result = substrate.query(
    'Farming', 'BoostBasicRewards', [
    'u32',
    {
        'Native': None,
        'Stellar': {
            'AlphaNum12': {
                'code': '[u8; 12]',
                'issuer': '[u8; 32]',
            },
            'AlphaNum4': {
                'code': '[u8; 4]',
                'issuer': '[u8; 32]',
            },
            'StellarNative': None,
        },
        'Token': 'u64',
        'XCM': 'u8',
        'ZenlinkLPToken': (
            'u8',
            'u8',
            'u8',
            'u8',
        ),
    },
]
)

Return value

'u128'

BoostNextRoundWhitelist

Python

result = substrate.query(
    'Farming', 'BoostNextRoundWhitelist', ['u32']
)

Return value

()

BoostPoolInfos

Python

result = substrate.query(
    'Farming', 'BoostPoolInfos', []
)

Return value

{
    'end_round': 'u32',
    'round_length': 'u32',
    'start_round': 'u32',
    'total_votes': 'u128',
}

BoostVotingPools

Python

result = substrate.query(
    'Farming', 'BoostVotingPools', ['u32']
)

Return value

'u128'

BoostWhitelist

Python

result = substrate.query(
    'Farming', 'BoostWhitelist', ['u32']
)

Return value

()

GaugeInfos

Python

result = substrate.query(
    'Farming', 'GaugeInfos', ['u32', 'AccountId']
)

Return value

{
    'claimed_time_factor': 'u128',
    'gauge_amount': 'u128',
    'gauge_last_block': 'u32',
    'gauge_start_block': 'u32',
    'gauge_stop_block': 'u32',
    'last_claim_block': 'u32',
    'latest_time_factor': 'u128',
    'total_time_factor': 'u128',
    'who': 'AccountId',
}

GaugePoolInfos

Record gauge farming pool info.

map PoolId => GaugePoolInfo

Python

result = substrate.query(
    'Farming', 'GaugePoolInfos', ['u32']
)

Return value

{
    'gauge_amount': 'u128',
    'gauge_basic_rewards': 'scale_info::604',
    'gauge_last_block': 'u32',
    'gauge_state': ('Unbond', 'Bonded'),
    'keeper': 'AccountId',
    'max_block': 'u32',
    'pid': 'u32',
    'reward_issuer': 'AccountId',
    'rewards': 'scale_info::610',
    'token': {
        'Native': None,
        'Stellar': {
            'AlphaNum12': {'code': '[u8; 12]', 'issuer': '[u8; 32]'},
            'AlphaNum4': {'code': '[u8; 4]', 'issuer': '[u8; 32]'},
            'StellarNative': None,
        },
        'Token': 'u64',
        'XCM': 'u8',
        'ZenlinkLPToken': ('u8', 'u8', 'u8', 'u8'),
    },
    'total_time_factor': 'u128',
}

GaugePoolNextId

Python

result = substrate.query(
    'Farming', 'GaugePoolNextId', []
)

Return value

'u32'

PoolInfos

Record reward pool info.

map PoolId => PoolInfo

Python

result = substrate.query(
    'Farming', 'PoolInfos', ['u32']
)

Return value

{
    'after_block_to_start': 'u32',
    'basic_rewards': 'scale_info::604',
    'basic_token': (
        {
            'Native': None,
            'Stellar': {
                'AlphaNum12': {'code': '[u8; 12]', 'issuer': '[u8; 32]'},
                'AlphaNum4': {'code': '[u8; 4]', 'issuer': '[u8; 32]'},
                'StellarNative': None,
            },
            'Token': 'u64',
            'XCM': 'u8',
            'ZenlinkLPToken': ('u8', 'u8', 'u8', 'u8'),
        },
        'u32',
    ),
    'block_startup': (None, 'u32'),
    'claim_limit_time': 'u32',
    'gauge': (None, 'u32'),
    'keeper': 'AccountId',
    'min_deposit_to_start': 'u128',
    'reward_issuer': 'AccountId',
    'rewards': 'scale_info::605',
    'state': ('UnCharged', 'Charged', 'Ongoing', 'Dead', 'Retired'),
    'tokens_proportion': 'scale_info::603',
    'total_shares': 'u128',
    'withdraw_limit_count': 'u8',
    'withdraw_limit_time': 'u32',
}

PoolNextId

Python

result = substrate.query(
    'Farming', 'PoolNextId', []
)

Return value

'u32'

RetireLimit

Python

result = substrate.query(
    'Farming', 'RetireLimit', []
)

Return value

'u32'

SharesAndWithdrawnRewards

Record share amount, reward currency and withdrawn reward amount for specific AccountId under PoolId.

double_map (PoolId, AccountId) => ShareInfo

Python

result = substrate.query(
    'Farming', 'SharesAndWithdrawnRewards', ['u32', 'AccountId']
)

Return value

{
    'claim_last_block': 'u32',
    'share': 'u128',
    'who': 'AccountId',
    'withdraw_list': [('u32', 'u128')],
    'withdrawn_rewards': 'scale_info::604',
}

UserBoostInfos

Python

result = substrate.query(
    'Farming', 'UserBoostInfos', ['AccountId']
)

Return value

{'last_vote': 'u32', 'vote_amount': 'u128', 'vote_list': [('u32', 'u8')]}

Constants


FarmingBoost

Value

'0x616d2f666d627374'

Python

constant = substrate.get_constant('Farming', 'FarmingBoost')

Keeper

ModuleID for creating sub account

Value

'0x616d2f666d6b7072'

Python

constant = substrate.get_constant('Farming', 'Keeper')

RewardIssuer

Value

'0x616d2f666d726972'

Python

constant = substrate.get_constant('Farming', 'RewardIssuer')

TreasuryAccount

Value

'6jM63XCmW5faKXcytHPdVb5iTg7nEumoeNNNz44GhEHVJVJf'

Python

constant = substrate.get_constant('Farming', 'TreasuryAccount')

WhitelistMaximumLimit

Value

10

Python

constant = substrate.get_constant('Farming', 'WhitelistMaximumLimit')

Errors


CanNotClaim

claim_limit_time exceeded


CanNotDeposit


GaugeInfoNotExist


GaugeMaxBlockOverflow

gauge pool max_block exceeded


GaugePoolNotExist


InvalidPoolState


LastGaugeNotClaim


NobodyVoting


NotInWhitelist


NotNullable


PercentOverflow


PoolDoesNotExist


PoolNotCleared


RoundLengthNotSet


RoundNotOver


ShareInfoNotExists


WhitelistEmpty


WhitelistLimitExceeded


WithdrawLimitCountExceeded

withdraw_limit_time exceeded