Skip to content

Commit 17698a5

Browse files
committed
[StandardToken][Core] token action interface change (remove 't'(token) param, 'qty'->'quantity', 'tag'->'memo' ) (compatibility to 'eosio.token' interface), renaming 'redeem_token' intrinsic to 'retire_token'
1 parent d1d398b commit 17698a5

File tree

13 files changed

+98
-116
lines changed

13 files changed

+98
-116
lines changed

contracts/contracts/sys.tokenabi/bin/sys.tokenabi.abi

Lines changed: 9 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -7,34 +7,30 @@
77
"name": "issue",
88
"base": "",
99
"fields": [
10-
{
11-
"name": "t",
12-
"type": "name"
13-
},
1410
{
1511
"name": "to",
1612
"type": "name"
1713
},
1814
{
19-
"name": "qty",
15+
"name": "quantity",
2016
"type": "asset"
2117
},
2218
{
23-
"name": "tag",
19+
"name": "memo",
2420
"type": "string"
2521
}
2622
]
2723
},
2824
{
29-
"name": "redeem",
25+
"name": "retire",
3026
"base": "",
3127
"fields": [
3228
{
33-
"name": "qty",
29+
"name": "quantity",
3430
"type": "asset"
3531
},
3632
{
37-
"name": "tag",
33+
"name": "memo",
3834
"type": "string"
3935
}
4036
]
@@ -61,10 +57,6 @@
6157
"name": "transfer",
6258
"base": "",
6359
"fields": [
64-
{
65-
"name": "t",
66-
"type": "name"
67-
},
6860
{
6961
"name": "from",
7062
"type": "name"
@@ -74,11 +66,11 @@
7466
"type": "name"
7567
},
7668
{
77-
"name": "qty",
69+
"name": "quantity",
7870
"type": "asset"
7971
},
8072
{
81-
"name": "tag",
73+
"name": "memo",
8274
"type": "string"
8375
}
8476
]
@@ -87,10 +79,6 @@
8779
"name": "txfee",
8880
"base": "",
8981
"fields": [
90-
{
91-
"name": "t",
92-
"type": "name"
93-
},
9482
{
9583
"name": "payer",
9684
"type": "name"
@@ -109,8 +97,8 @@
10997
"ricardian_contract": ""
11098
},
11199
{
112-
"name": "redeem",
113-
"type": "redeem",
100+
"name": "retire",
101+
"type": "retire",
114102
"ricardian_contract": ""
115103
},
116104
{
-180 Bytes
Binary file not shown.

infrablockchain-bios/local_testnet_boot_bios_infrablockchain.sh

Lines changed: 38 additions & 38 deletions
Large diffs are not rendered by default.

libraries/chain/apply_context.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -985,9 +985,9 @@ void apply_context::transfer_token( const account_name from, const account_name
985985
standard_token_manager.add_token_balance( *this, token_id, to, amount );
986986
}
987987

988-
void apply_context::redeem_token( const share_type amount ) {
988+
void apply_context::retire_token( const share_type amount ) {
989989

990-
/// Only the contract code of an token account or native built-in token action handler code can redeem(burn) its own (action receiver's) tokens
990+
/// Only the contract code of an token account or native built-in token action handler code can retire(burn) its own (action receiver's) tokens
991991
/// Authorization check(require_authorization) should be done outside(contract code or native action handler) of this function.
992992

993993
EOS_ASSERT( amount > 0, token_action_validate_exception, "amount of token redemption must be greater than 0" );
@@ -1006,7 +1006,7 @@ void apply_context::redeem_token( const share_type amount ) {
10061006
// update total supply
10071007
standard_token_manager.update_token_total_supply(token_meta_obj_ptr, -amount);
10081008

1009-
// redeem(burn) tokens
1009+
// retire(burn) tokens
10101010
standard_token_manager.subtract_token_balance( *this, token_account, token_account, amount );
10111011
}
10121012

libraries/chain/controller.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ struct controller_impl {
275275
/**
276276
* [InfraBlockchain Built-in Actions Feature]
277277
* predefined actions can be executed on every account even though an account doesn't have contract code.
278-
* InfraBlockchain Standard Token operations (issue,redeem,transfer,txfee,...) are built-in actions supported on every account
278+
* InfraBlockchain Standard Token operations (issue,retire,transfer,txfee,...) are built-in actions supported on every account
279279
*/
280280
map< action_name, apply_handler > built_in_action_apply_handlers;
281281

@@ -397,7 +397,7 @@ struct controller_impl {
397397
SET_INFRABLOCKCHAIN_BUILT_IN_ACTION_APPLY_HANDLER( issue );
398398
SET_INFRABLOCKCHAIN_BUILT_IN_ACTION_APPLY_HANDLER( transfer );
399399
SET_INFRABLOCKCHAIN_BUILT_IN_ACTION_APPLY_HANDLER( txfee );
400-
SET_INFRABLOCKCHAIN_BUILT_IN_ACTION_APPLY_HANDLER( redeem );
400+
SET_INFRABLOCKCHAIN_BUILT_IN_ACTION_APPLY_HANDLER( retire );
401401

402402
}
403403

@@ -3522,7 +3522,7 @@ void controller_impl::on_activation<builtin_protocol_feature_t::infrablockchain_
35223522
add_intrinsic_to_whitelist( ps.whitelisted_intrinsics, "get_token_balance" );
35233523
add_intrinsic_to_whitelist( ps.whitelisted_intrinsics, "issue_token" );
35243524
add_intrinsic_to_whitelist( ps.whitelisted_intrinsics, "transfer_token" );
3525-
add_intrinsic_to_whitelist( ps.whitelisted_intrinsics, "redeem_token" );
3525+
add_intrinsic_to_whitelist( ps.whitelisted_intrinsics, "retire_token" );
35263526
} );
35273527
}
35283528

libraries/chain/include/eosio/chain/apply_context.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -576,8 +576,8 @@ class apply_context {
576576
/// transfer token
577577
void transfer_token( const account_name from, const account_name to, const share_type amount );
578578

579-
/// redeem(burn) token
580-
void redeem_token( const share_type amount );
579+
/// retire(burn) token
580+
void retire_token( const share_type amount );
581581

582582

583583
/// InfraBlockchain Core API - Transaction-Fee Management

libraries/chain/include/eosio/chain/webassembly/eos-vm-oc/intrinsic_mapping.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ constexpr auto intrinsic_table = boost::hana::make_tuple(
254254
"env.get_token_balance"_s,
255255
"env.issue_token"_s,
256256
"env.transfer_token"_s,
257-
"env.redeem_token"_s,
257+
"env.retire_token"_s,
258258
"env.get_system_token_count"_s,
259259
"env.get_system_token_list_packed"_s,
260260
"env.set_system_token_list_packed"_s,

libraries/chain/include/infrablockchain/chain/standard_token_action_handlers.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ namespace infrablockchain { namespace chain {
2727

2828
void apply_infrablockchain_built_in_action_txfee( apply_context& context );
2929

30-
void apply_infrablockchain_built_in_action_redeem( apply_context& context );
30+
void apply_infrablockchain_built_in_action_retire( apply_context& context );
3131

3232

3333
///@} end action handlers

libraries/chain/include/infrablockchain/chain/standard_token_action_types.hpp

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ namespace infrablockchain { namespace chain { namespace standard_token {
1515
using namespace eosio::chain;
1616

1717
/**
18-
* Every account on InfraBlockchain can process built-in standard token actions (settokenmeta, issue, transfer, redeem)
18+
* Every account on InfraBlockchain can process built-in standard token actions (settokenmeta, issue, transfer, retire)
1919
* without custom smart contract code deployed to an account.
2020
* An account can have optional token contract code inheriting built-in token actions.
2121
*/
@@ -31,30 +31,27 @@ namespace infrablockchain { namespace chain { namespace standard_token {
3131
};
3232

3333
struct issue {
34-
account_name t; // token-id (token account name)
3534
account_name to; // token receiver account
36-
asset qty; // token quantity
37-
std::string tag;
35+
asset quantity; // token quantity
36+
std::string memo;
3837

3938
static action_name get_name() {
4039
return N(issue);
4140
}
4241
};
4342

4443
struct transfer {
45-
account_name t; // token-id (token account name)
4644
account_name from; // token sender account
4745
account_name to; // token receiver account
48-
asset qty; // token quantity
49-
std::string tag;
46+
asset quantity; // token quantity
47+
std::string memo;
5048

5149
static action_name get_name() {
5250
return N(transfer);
5351
}
5452
};
5553

5654
struct txfee {
57-
account_name t; // token-id (token account name)
5855
account_name payer; // transaction fee payer
5956
asset fee; // token quantity to pay tx fee
6057

@@ -63,20 +60,20 @@ namespace infrablockchain { namespace chain { namespace standard_token {
6360
}
6461
};
6562

66-
struct redeem {
67-
asset qty; // token quantity to redeem(burn)
68-
std::string tag;
63+
struct retire {
64+
asset quantity; // token quantity to retire(burn)
65+
std::string memo;
6966

7067
static action_name get_name() {
71-
return N(redeem);
68+
return N(retire);
7269
}
7370
};
7471

7572
struct utils {
7673
static bool is_infrablockchain_standard_token_action(action_name action) {
7774
return action == transfer::get_name()
7875
|| action == issue::get_name()
79-
|| action == redeem::get_name()
76+
|| action == retire::get_name()
8077
|| action == txfee::get_name()
8178
|| action == settokenmeta::get_name();
8279
}
@@ -85,7 +82,7 @@ namespace infrablockchain { namespace chain { namespace standard_token {
8582
} } } /// infrablockchain::chain::standard_token
8683

8784
FC_REFLECT( infrablockchain::chain::standard_token::settokenmeta , (sym)(url)(desc) )
88-
FC_REFLECT( infrablockchain::chain::standard_token::issue, (t)(to)(qty)(tag) )
89-
FC_REFLECT( infrablockchain::chain::standard_token::transfer, (t)(from)(to)(qty)(tag) )
90-
FC_REFLECT( infrablockchain::chain::standard_token::txfee, (t)(payer)(fee) )
91-
FC_REFLECT( infrablockchain::chain::standard_token::redeem, (qty)(tag) )
85+
FC_REFLECT( infrablockchain::chain::standard_token::issue, (to)(quantity)(memo) )
86+
FC_REFLECT( infrablockchain::chain::standard_token::transfer, (from)(to)(quantity)(memo) )
87+
FC_REFLECT( infrablockchain::chain::standard_token::txfee, (payer)(fee) )
88+
FC_REFLECT( infrablockchain::chain::standard_token::retire, (quantity)(memo) )

libraries/chain/include/infrablockchain/chain/standard_token_object.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ namespace infrablockchain { namespace chain {
2626
id_type id;
2727
token_id_type token_id; // token id = token account name
2828
symbol sym; // symbol name and precision
29-
share_type total_supply = 0; // total token supply amount issued(+) and redeemed(-) by token account
29+
share_type total_supply = 0; // total token supply amount issued(+) and retired(burned)(-) by token account
3030
shared_string url; // website url for token information managed by token issuer (owner of token account)
3131
shared_string desc; // token description
3232
};

0 commit comments

Comments
 (0)