-
Notifications
You must be signed in to change notification settings - Fork 9
/
get_methods.fc
14 lines (13 loc) · 985 Bytes
/
get_methods.fc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
(int, int, int, int, int, int) get_pool_data() method_id {
var (validator_address, total_active, total_locked,
_, _, validator_reward_share, validator_cover_ability, nominators, _, _, _) = load_data();
(int wc, int addr_hash) = validator_address.parse_std_addr();
int validator_balance = nominators.get_active_balance_by_address_slice(validator_address);
return (total_active, total_locked, validator_balance, validator_reward_share, validator_cover_ability, addr_hash);
}
(int, int, int) get_nominator(int workchain, int addr_hash) method_id {
var (_, _, _, reward_per_gram, _, _, _, nominators, _, _, _) = load_data();
(int active_amount, int locked_amount, int paid_reward_per_gram, int last_stake_utime) = nominators.get_nominator_data(workchain, addr_hash, reward_per_gram);
int after_reward_amount = active_amount + active_amount * (reward_per_gram - paid_reward_per_gram) / 1000000000;
return (after_reward_amount, locked_amount, last_stake_utime);
}