mirror of
https://github.com/ton-blockchain/ton
synced 2025-03-09 15:40:10 +00:00
[FunC] Deprecate method_id
specifier, introduce get
keyword
`get` keyword behaves exactly like `method_id` (auto-calc hash), but it's placed on the left, similar to Tact: `get T name()`. `method_id(n)` is still valid, considering it can't be invoked by name, since a client will compute another hash. It's supposed it will be still used in tests and in low-level code (not to be called externally, but to be called after replacing c3). `get(hash)` is invalid, this keyword does not accept anything.
This commit is contained in:
parent
7afa9292c3
commit
7b8268d99f
16 changed files with 103 additions and 72 deletions
|
@ -2,17 +2,17 @@
|
|||
;; Related contracts
|
||||
;;
|
||||
|
||||
_ get_proxy() method_id {
|
||||
get _ get_proxy() {
|
||||
load_base_data();
|
||||
return ctx_proxy;
|
||||
}
|
||||
|
||||
_ get_owner() method_id {
|
||||
get _ get_owner() {
|
||||
load_base_data();
|
||||
return ctx_owner;
|
||||
}
|
||||
|
||||
_ get_controller() method_id {
|
||||
get _ get_controller() {
|
||||
load_base_data();
|
||||
return ctx_controller;
|
||||
}
|
||||
|
@ -21,13 +21,13 @@ _ get_controller() method_id {
|
|||
;; Balances for controller
|
||||
;;
|
||||
|
||||
_ get_unowned() method_id {
|
||||
get _ get_unowned() {
|
||||
load_base_data();
|
||||
var [balance, extra] = get_balance();
|
||||
return max(balance - owned_balance(), 0);
|
||||
}
|
||||
|
||||
_ get_available() method_id {
|
||||
get _ get_available() {
|
||||
load_base_data();
|
||||
return ctx_balance - ctx_balance_sent;
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ _ get_available() method_id {
|
|||
;; Pool and staking status
|
||||
;;
|
||||
|
||||
_ get_staking_status() method_id {
|
||||
get _ get_staking_status() {
|
||||
load_base_data();
|
||||
load_validator_data();
|
||||
|
||||
|
@ -50,7 +50,7 @@ _ get_staking_status() method_id {
|
|||
return (proxy_stake_at, until_val, proxy_stake_sent, querySent, unlocked, ctx_locked);
|
||||
}
|
||||
|
||||
_ get_pool_status() method_id {
|
||||
get _ get_pool_status() {
|
||||
load_base_data();
|
||||
load_member(owner_id());
|
||||
return (ctx_balance, ctx_balance_sent, ctx_balance_pending_deposits, ctx_balance_pending_withdraw, ctx_balance_withdraw);
|
||||
|
@ -59,7 +59,7 @@ _ get_pool_status() method_id {
|
|||
;;
|
||||
;; Params
|
||||
;;
|
||||
_ get_params() method_id {
|
||||
get _ get_params() {
|
||||
load_base_data();
|
||||
var (enabled, udpates_enabled, min_stake, deposit_fee, withdraw_fee, pool_fee, receipt_price) = ctx_extras;
|
||||
return (enabled, udpates_enabled, min_stake, deposit_fee, withdraw_fee, pool_fee, receipt_price);
|
||||
|
@ -69,7 +69,7 @@ _ get_params() method_id {
|
|||
;; Members
|
||||
;;
|
||||
|
||||
_ get_member_balance(slice address) method_id {
|
||||
get _ get_member_balance(slice address) {
|
||||
load_base_data();
|
||||
load_member(parse_work_addr(address));
|
||||
|
||||
|
@ -77,12 +77,12 @@ _ get_member_balance(slice address) method_id {
|
|||
return (ctx_member_balance, ctx_member_pending_deposit, ctx_member_pending_withdraw, ctx_member_withdraw);
|
||||
}
|
||||
|
||||
_ get_members_raw() method_id {
|
||||
get _ get_members_raw() {
|
||||
load_base_data();
|
||||
return ctx_nominators;
|
||||
}
|
||||
|
||||
_ get_members() method_id {
|
||||
get _ get_members() {
|
||||
load_base_data();
|
||||
|
||||
;; Init with owner
|
||||
|
@ -110,16 +110,16 @@ _ get_members() method_id {
|
|||
return list;
|
||||
}
|
||||
|
||||
_ get_member(slice address) method_id {
|
||||
get _ get_member(slice address) {
|
||||
load_base_data();
|
||||
load_member(parse_work_addr(address));
|
||||
member_update_balance();
|
||||
return (ctx_member_balance, ctx_member_pending_deposit, ctx_member_pending_withdraw, ctx_member_withdraw);
|
||||
}
|
||||
|
||||
_ supported_interfaces() method_id {
|
||||
get _ supported_interfaces() {
|
||||
return (
|
||||
123515602279859691144772641439386770278, ;; org.ton.introspection.v0
|
||||
256184278959413194623484780286929323492 ;; com.tonwhales.nominators:v0
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue