Skip to content

Commit a3a88b3

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 da05af1 commit a3a88b3

File tree

16 files changed

+103
-121
lines changed

16 files changed

+103
-121
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
{
-36.7 KB
Binary file not shown.

infrablockchain-bios/.local_infrablockchain_env_vars

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
export INFRABLOCKCHAIN_HOME=/Users/bwlim/Documents/__InfraBlockchain__/infrablockchain-2-git
1+
export INFRABLOCKCHAIN_HOME=/Users/bwlim/Documents/__InfraBlockchain__/infrablockchain-2-merge-git
22

33
export INFRA_NODE_BIN_NAME=infra-node
44
export INFRA_CLI_BIN_NAME=infra-cli

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
@@ -1294,9 +1294,9 @@ void apply_context::transfer_token( const account_name from, const account_name
12941294
standard_token_manager.add_token_balance( *this, token_id, to, amount );
12951295
}
12961296

1297-
void apply_context::redeem_token( const share_type amount ) {
1297+
void apply_context::retire_token( const share_type amount ) {
12981298

1299-
/// 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
1299+
/// 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
13001300
/// Authorization check(require_authorization) should be done outside(contract code or native action handler) of this function.
13011301

13021302
EOS_ASSERT( amount > 0, token_action_validate_exception, "amount of token redemption must be greater than 0" );
@@ -1315,7 +1315,7 @@ void apply_context::redeem_token( const share_type amount ) {
13151315
// update total supply
13161316
standard_token_manager.update_token_total_supply(token_meta_obj_ptr, -amount);
13171317

1318-
// redeem(burn) tokens
1318+
// retire(burn) tokens
13191319
standard_token_manager.subtract_token_balance( *this, token_account, token_account, amount );
13201320
}
13211321

libraries/chain/controller.cpp

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

@@ -328,7 +328,7 @@ struct controller_impl {
328328
SET_INFRABLOCKCHAIN_BUILT_IN_ACTION_APPLY_HANDLER( issue );
329329
SET_INFRABLOCKCHAIN_BUILT_IN_ACTION_APPLY_HANDLER( transfer );
330330
SET_INFRABLOCKCHAIN_BUILT_IN_ACTION_APPLY_HANDLER( txfee );
331-
SET_INFRABLOCKCHAIN_BUILT_IN_ACTION_APPLY_HANDLER( redeem );
331+
SET_INFRABLOCKCHAIN_BUILT_IN_ACTION_APPLY_HANDLER( retire );
332332

333333
}
334334

@@ -3568,7 +3568,7 @@ void controller_impl::on_activation<builtin_protocol_feature_t::infrablockchain_
35683568
add_intrinsic_to_whitelist( ps.whitelisted_intrinsics, "get_token_balance" );
35693569
add_intrinsic_to_whitelist( ps.whitelisted_intrinsics, "issue_token" );
35703570
add_intrinsic_to_whitelist( ps.whitelisted_intrinsics, "transfer_token" );
3571-
add_intrinsic_to_whitelist( ps.whitelisted_intrinsics, "redeem_token" );
3571+
add_intrinsic_to_whitelist( ps.whitelisted_intrinsics, "retire_token" );
35723572
} );
35733573
}
35743574

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

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

489-
/// redeem(burn) token
490-
void redeem_token( const share_type amount );
489+
/// retire(burn) token
490+
void retire_token( const share_type amount );
491491

492492

493493
/// 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
@@ -283,7 +283,7 @@ inline constexpr auto get_intrinsic_table() {
283283
"env.get_token_balance",
284284
"env.issue_token",
285285
"env.transfer_token",
286-
"env.redeem_token",
286+
"env.retire_token",
287287
"env.get_system_token_count",
288288
"env.get_system_token_list_packed",
289289
"env.set_system_token_list_packed",

libraries/chain/include/eosio/chain/webassembly/interface.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1974,14 +1974,14 @@ namespace webassembly {
19741974
void transfer_token( account_name from, account_name to, int64_t amount );
19751975

19761976
/**
1977-
* Redeem(Burn) Token
1978-
* @brief redeem(burn) token from token owner account,
1977+
* Retire(Burn) Token
1978+
* @brief retire(burn) token from token owner account,
19791979
* token_id is implicitly the action receiver (token owner) account,
19801980
* the contract code of token owner account can burn its own token only.
19811981
*
1982-
* @param amount - amount of token to redeem(burn)
1982+
* @param amount - amount of token to retire(burn)
19831983
*/
1984-
void redeem_token( int64_t amount );
1984+
void retire_token( int64_t amount );
19851985

19861986

19871987
///////////////////////////////////////////////////////////////

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

0 commit comments

Comments
 (0)