提交 71040c49 编写于 作者: K Kevin Heifner

Revert "Move builtin types to types.hpp so that account_name can be name"

This reverts commit 3b5e03df.
上级 3b5e03df
...@@ -24,7 +24,7 @@ class dice : public eosio::contract { ...@@ -24,7 +24,7 @@ class dice : public eosio::contract {
public: public:
const uint32_t FIVE_MINUTES = 5*60; const uint32_t FIVE_MINUTES = 5*60;
dice(eosio::account_name self) dice(account_name self)
:eosio::contract(self), :eosio::contract(self),
offers(_self, _self), offers(_self, _self),
games(_self, _self), games(_self, _self),
...@@ -33,7 +33,7 @@ class dice : public eosio::contract { ...@@ -33,7 +33,7 @@ class dice : public eosio::contract {
{} {}
//@abi action //@abi action
void offerbet(const asset& bet, const eosio::account_name player, const checksum256& commitment) { void offerbet(const asset& bet, const account_name player, const checksum256& commitment) {
eosio_assert( bet.symbol == CORE_SYMBOL, "only core token allowed" ); eosio_assert( bet.symbol == CORE_SYMBOL, "only core token allowed" );
eosio_assert( bet.is_valid(), "invalid bet" ); eosio_assert( bet.is_valid(), "invalid bet" );
...@@ -213,7 +213,7 @@ class dice : public eosio::contract { ...@@ -213,7 +213,7 @@ class dice : public eosio::contract {
} }
//@abi action //@abi action
void deposit( const eosio::account_name from, const asset& quantity ) { void deposit( const account_name from, const asset& quantity ) {
eosio_assert( quantity.is_valid(), "invalid quantity" ); eosio_assert( quantity.is_valid(), "invalid quantity" );
eosio_assert( quantity.amount > 0, "must deposit positive quantity" ); eosio_assert( quantity.amount > 0, "must deposit positive quantity" );
...@@ -226,8 +226,8 @@ class dice : public eosio::contract { ...@@ -226,8 +226,8 @@ class dice : public eosio::contract {
} }
action( action(
permission_level{ from, NAME(active) }, permission_level{ from, N(active) },
NAME(eosio.token), NAME(transfer), N(eosio.token), N(transfer),
std::make_tuple(from, _self, quantity, std::string("")) std::make_tuple(from, _self, quantity, std::string(""))
).send(); ).send();
...@@ -237,7 +237,7 @@ class dice : public eosio::contract { ...@@ -237,7 +237,7 @@ class dice : public eosio::contract {
} }
//@abi action //@abi action
void withdraw( const eosio::account_name to, const asset& quantity ) { void withdraw( const account_name to, const asset& quantity ) {
require_auth( to ); require_auth( to );
eosio_assert( quantity.is_valid(), "invalid quantity" ); eosio_assert( quantity.is_valid(), "invalid quantity" );
...@@ -252,8 +252,8 @@ class dice : public eosio::contract { ...@@ -252,8 +252,8 @@ class dice : public eosio::contract {
}); });
action( action(
permission_level{ _self, NAME(active) }, permission_level{ _self, N(active) },
NAME(eosio.token), NAME(transfer), N(eosio.token), N(transfer),
std::make_tuple(_self, to, quantity, std::string("")) std::make_tuple(_self, to, quantity, std::string(""))
).send(); ).send();
...@@ -266,7 +266,7 @@ class dice : public eosio::contract { ...@@ -266,7 +266,7 @@ class dice : public eosio::contract {
//@abi table offer i64 //@abi table offer i64
struct offer { struct offer {
uint64_t id; uint64_t id;
eosio::account_name owner; account_name owner;
asset bet; asset bet;
checksum256 commitment; checksum256 commitment;
uint64_t gameid = 0; uint64_t gameid = 0;
...@@ -326,9 +326,9 @@ class dice : public eosio::contract { ...@@ -326,9 +326,9 @@ class dice : public eosio::contract {
//@abi table account i64 //@abi table account i64
struct account { struct account {
account( eosio::account_name o = eosio::account_name{} ):owner(o){} account( account_name o = account_name() ):owner(o){}
eosio::account_name owner; account_name owner;
asset eos_balance; asset eos_balance;
uint32_t open_offers = 0; uint32_t open_offers = 0;
uint32_t open_games = 0; uint32_t open_games = 0;
......
...@@ -28,8 +28,8 @@ namespace eosiosystem { ...@@ -28,8 +28,8 @@ namespace eosiosystem {
using std::map; using std::map;
using std::pair; using std::pair;
static constexpr uint32_t refund_delay = 3*24*3600; static constexpr time refund_delay = 3*24*3600;
static constexpr uint32_t refund_expiration_time = 3600; static constexpr time refund_expiration_time = 3600;
struct user_resources { struct user_resources {
account_name owner; account_name owner;
...@@ -62,7 +62,7 @@ namespace eosiosystem { ...@@ -62,7 +62,7 @@ namespace eosiosystem {
struct refund_request { struct refund_request {
account_name owner; account_name owner;
uint32_t request_time; time request_time;
eosio::asset net_amount; eosio::asset net_amount;
eosio::asset cpu_amount; eosio::asset cpu_amount;
...@@ -108,8 +108,8 @@ namespace eosiosystem { ...@@ -108,8 +108,8 @@ namespace eosiosystem {
eosio_assert( quant.amount > 0, "must purchase a positive amount" ); eosio_assert( quant.amount > 0, "must purchase a positive amount" );
if( payer != N(eosio) ) { if( payer != N(eosio) ) {
INLINE_ACTION_SENDER(eosio::token, transfer)( NAME(eosio.token), {payer,NAME(active)}, INLINE_ACTION_SENDER(eosio::token, transfer)( N(eosio.token), {payer,N(active)},
{ payer, NAME(eosio), quant, std::string("buy ram") } ); { payer, N(eosio), quant, std::string("buy ram") } );
} }
...@@ -175,8 +175,8 @@ namespace eosiosystem { ...@@ -175,8 +175,8 @@ namespace eosiosystem {
set_resource_limits( res_itr->owner, res_itr->ram_bytes, res_itr->net_weight.amount, res_itr->cpu_weight.amount ); set_resource_limits( res_itr->owner, res_itr->ram_bytes, res_itr->net_weight.amount, res_itr->cpu_weight.amount );
if( N(eosio) != account ) { if( N(eosio) != account ) {
INLINE_ACTION_SENDER(eosio::token, transfer)( NAME(eosio.token), {NAME(eosio),NAME(active)}, INLINE_ACTION_SENDER(eosio::token, transfer)( N(eosio.token), {N(eosio),N(active)},
{ NAME(eosio), account, asset(tokens_out), std::string("sell ram") } ); { N(eosio), account, asset(tokens_out), std::string("sell ram") } );
} }
} }
...@@ -307,7 +307,7 @@ namespace eosiosystem { ...@@ -307,7 +307,7 @@ namespace eosiosystem {
if ( need_deferred_trx ) { if ( need_deferred_trx ) {
eosio::transaction out; eosio::transaction out;
out.actions.emplace_back( permission_level{ from, NAME(active) }, _self, NAME(refund), from ); out.actions.emplace_back( permission_level{ from, N(active) }, _self, N(refund), from );
out.delay_sec = refund_delay; out.delay_sec = refund_delay;
out.send( from, receiver, true ); out.send( from, receiver, true );
} else { } else {
...@@ -316,8 +316,8 @@ namespace eosiosystem { ...@@ -316,8 +316,8 @@ namespace eosiosystem {
auto transfer_amount = net_balance + cpu_balance; auto transfer_amount = net_balance + cpu_balance;
if ( asset(0) < transfer_amount ) { if ( asset(0) < transfer_amount ) {
INLINE_ACTION_SENDER(eosio::token, transfer)( NAME(eosio.token), {from,NAME(active)}, INLINE_ACTION_SENDER(eosio::token, transfer)( N(eosio.token), {from,N(active)},
{ source_stake_from, NAME(eosio), asset(transfer_amount), std::string("stake bandwidth") } ); { source_stake_from, N(eosio), asset(transfer_amount), std::string("stake bandwidth") } );
} }
} }
...@@ -379,8 +379,8 @@ namespace eosiosystem { ...@@ -379,8 +379,8 @@ namespace eosiosystem {
// allow people to get their tokens earlier than the 3 day delay if the unstake happened immediately after many // allow people to get their tokens earlier than the 3 day delay if the unstake happened immediately after many
// consecutive missed blocks. // consecutive missed blocks.
INLINE_ACTION_SENDER(eosio::token, transfer)( NAME(eosio.token), {NAME(eosio),NAME(active)}, INLINE_ACTION_SENDER(eosio::token, transfer)( N(eosio.token), {N(eosio),N(active)},
{ NAME(eosio), req->owner, req->net_amount + req->cpu_amount, std::string("unstake") } ); { N(eosio), req->owner, req->net_amount + req->cpu_amount, std::string("unstake") } );
refunds_tbl.erase( req ); refunds_tbl.erase( req );
} }
......
...@@ -22,7 +22,7 @@ namespace eosiosystem { ...@@ -22,7 +22,7 @@ namespace eosiosystem {
auto itr = _rammarket.find(S(4,RAMCORE)); auto itr = _rammarket.find(S(4,RAMCORE));
if( itr == _rammarket.end() ) { if( itr == _rammarket.end() ) {
auto system_token_supply = eosio::token(NAME(eosio.token)).get_supply(eosio::symbol_type(system_token_symbol).name()).amount; auto system_token_supply = eosio::token(N(eosio.token)).get_supply(eosio::symbol_type(system_token_symbol).name()).amount;
if( system_token_supply > 0 ) { if( system_token_supply > 0 ) {
itr = _rammarket.emplace( _self, [&]( auto& m ) { itr = _rammarket.emplace( _self, [&]( auto& m ) {
m.supply.amount = 100000000000000ll; m.supply.amount = 100000000000000ll;
...@@ -84,8 +84,8 @@ namespace eosiosystem { ...@@ -84,8 +84,8 @@ namespace eosiosystem {
eosio_assert( bid.symbol == asset().symbol, "asset must be system token" ); eosio_assert( bid.symbol == asset().symbol, "asset must be system token" );
eosio_assert( bid.amount > 0, "insufficient bid" ); eosio_assert( bid.amount > 0, "insufficient bid" );
INLINE_ACTION_SENDER(eosio::token, transfer)( NAME(eosio.token), {bidder,NAME(active)}, INLINE_ACTION_SENDER(eosio::token, transfer)( N(eosio.token), {bidder,N(active)},
{ bidder, NAME(eosio), bid, std::string("bid name ")+(name{newname}).to_string() } ); { bidder, N(eosio), bid, std::string("bid name ")+(name{newname}).to_string() } );
name_bid_table bids(_self,_self); name_bid_table bids(_self,_self);
print( name{bidder}, " bid ", bid, " on ", name{newname}, "\n" ); print( name{bidder}, " bid ", bid, " on ", name{newname}, "\n" );
...@@ -102,8 +102,8 @@ namespace eosiosystem { ...@@ -102,8 +102,8 @@ namespace eosiosystem {
eosio_assert( bid.amount - current->high_bid > (current->high_bid / 10), "must increase bid by 10%" ); eosio_assert( bid.amount - current->high_bid > (current->high_bid / 10), "must increase bid by 10%" );
eosio_assert( current->high_bidder != bidder, "account is already high bidder" ); eosio_assert( current->high_bidder != bidder, "account is already high bidder" );
INLINE_ACTION_SENDER(eosio::token, transfer)( NAME(eosio.token), {NAME(eosio),NAME(active)}, INLINE_ACTION_SENDER(eosio::token, transfer)( N(eosio.token), {N(eosio),N(active)},
{ NAME(eosio), current->high_bidder, asset(current->high_bid), { N(eosio), current->high_bidder, asset(current->high_bid),
std::string("refund bid on name ")+(name{newname}).to_string() } ); std::string("refund bid on name ")+(name{newname}).to_string() } );
bids.modify( current, bidder, [&]( auto& b ) { bids.modify( current, bidder, [&]( auto& b ) {
...@@ -133,7 +133,7 @@ namespace eosiosystem { ...@@ -133,7 +133,7 @@ namespace eosiosystem {
const authority& active*/ ) { const authority& active*/ ) {
if( creator != _self ) { if( creator != _self ) {
uint64_t tmp = newact; auto tmp = newact;
bool has_dot = false; bool has_dot = false;
for( uint32_t i = 0; i < 13; ++i ) { for( uint32_t i = 0; i < 13; ++i ) {
has_dot |= (tmp >> 59); has_dot |= (tmp >> 59);
......
...@@ -15,7 +15,6 @@ ...@@ -15,7 +15,6 @@
namespace eosiosystem { namespace eosiosystem {
using eosio::account_name;
using eosio::asset; using eosio::asset;
using eosio::indexed_by; using eosio::indexed_by;
using eosio::const_mem_fun; using eosio::const_mem_fun;
...@@ -93,8 +92,8 @@ namespace eosiosystem { ...@@ -93,8 +92,8 @@ namespace eosiosystem {
}; };
struct voter_info { struct voter_info {
account_name owner = {}; /// the voter account_name owner = 0; /// the voter
account_name proxy = {}; /// the proxy set by the voter, if any account_name proxy = 0; /// the proxy set by the voter, if any
std::vector<account_name> producers; /// the producers approved by this voter if no proxy set std::vector<account_name> producers; /// the producers approved by this voter if no proxy set
int64_t staked = 0; int64_t staked = 0;
...@@ -114,7 +113,7 @@ namespace eosiosystem { ...@@ -114,7 +113,7 @@ namespace eosiosystem {
uint32_t deferred_trx_id = 0; /// the ID of the 3-day delay deferred transaction uint32_t deferred_trx_id = 0; /// the ID of the 3-day delay deferred transaction
uint32_t last_unstake_time = 0; /// the time when the deferred_trx_id was sent time last_unstake_time = 0; /// the time when the deferred_trx_id was sent
eosio::asset unstaking; /// the total unstaking (pending 3 day delay) eosio::asset unstaking; /// the total unstaking (pending 3 day delay)
uint64_t primary_key()const { return owner; } uint64_t primary_key()const { return owner; }
......
...@@ -14,10 +14,8 @@ ...@@ -14,10 +14,8 @@
#include <eosiolib/contract.hpp> #include <eosiolib/contract.hpp>
namespace eosiosystem { namespace eosiosystem {
using eosio::account_name;
using eosio::permission_level; using eosio::permission_level;
using eosio::public_key; using eosio::public_key;
using eosio::weight_type;
typedef std::vector<char> bytes; typedef std::vector<char> bytes;
......
...@@ -81,7 +81,7 @@ namespace eosiosystem { ...@@ -81,7 +81,7 @@ namespace eosiosystem {
eosio_assert( ct - prod.last_claim_time > useconds_per_day, "already claimed rewards within past day" ); eosio_assert( ct - prod.last_claim_time > useconds_per_day, "already claimed rewards within past day" );
const asset token_supply = token( NAME(eosio.token)).get_supply(symbol_type(system_token_symbol).name() ); const asset token_supply = token( N(eosio.token)).get_supply(symbol_type(system_token_symbol).name() );
const auto usecs_since_last_fill = ct - _gstate.last_pervote_bucket_fill; const auto usecs_since_last_fill = ct - _gstate.last_pervote_bucket_fill;
if( usecs_since_last_fill > 0 && _gstate.last_pervote_bucket_fill > 0 ) { if( usecs_since_last_fill > 0 && _gstate.last_pervote_bucket_fill > 0 ) {
...@@ -92,8 +92,8 @@ namespace eosiosystem { ...@@ -92,8 +92,8 @@ namespace eosiosystem {
auto to_per_block_pay = to_producers / 4; auto to_per_block_pay = to_producers / 4;
auto to_per_vote_pay = to_producers - to_per_block_pay; auto to_per_vote_pay = to_producers - to_per_block_pay;
INLINE_ACTION_SENDER(eosio::token, issue)( NAME(eosio.token), {{NAME(eosio),NAME(active)}}, INLINE_ACTION_SENDER(eosio::token, issue)( N(eosio.token), {{N(eosio),N(active)}},
{NAME(eosio), asset(new_tokens), std::string("issue tokens for producer pay and savings")} ); {N(eosio), asset(new_tokens), std::string("issue tokens for producer pay and savings")} );
_gstate.pervote_bucket += to_per_vote_pay; _gstate.pervote_bucket += to_per_vote_pay;
_gstate.perblock_bucket += to_per_block_pay; _gstate.perblock_bucket += to_per_block_pay;
...@@ -125,8 +125,8 @@ namespace eosiosystem { ...@@ -125,8 +125,8 @@ namespace eosiosystem {
}); });
if( total_pay > 0 ) { if( total_pay > 0 ) {
INLINE_ACTION_SENDER(eosio::token, transfer)( NAME(eosio.token), {NAME(eosio),NAME(active)}, INLINE_ACTION_SENDER(eosio::token, transfer)( N(eosio.token), {N(eosio),N(active)},
{ NAME(eosio), owner, asset(total_pay), std::string("producer pay") } ); { N(eosio), owner, asset(total_pay), std::string("producer pay") } );
} }
} }
......
...@@ -55,7 +55,7 @@ void token::issue( account_name to, asset quantity, string memo ) ...@@ -55,7 +55,7 @@ void token::issue( account_name to, asset quantity, string memo )
add_balance( st.issuer, quantity, st, st.issuer ); add_balance( st.issuer, quantity, st, st.issuer );
if( to != st.issuer ) { if( to != st.issuer ) {
SEND_INLINE_ACTION( *this, transfer, {st.issuer,NAME(active)}, {st.issuer, to, quantity, memo} ); SEND_INLINE_ACTION( *this, transfer, {st.issuer,N(active)}, {st.issuer, to, quantity, memo} );
} }
} }
......
...@@ -88,15 +88,15 @@ extern "C" { ...@@ -88,15 +88,15 @@ extern "C" {
* @brief Add the specified account to set of accounts to be notified * @brief Add the specified account to set of accounts to be notified
* @param name - name of the account to be verified * @param name - name of the account to be verified
*/ */
void require_recipient( uint64_t name ); void require_recipient( account_name name );
/** /**
* Verifies that @ref name exists in the set of provided auths on a action. Throws if not found * Verifies that @ref name exists in the set of provided auths on a action. Throws if not found
* @brief Verify specified account exists in the set of provided auths * @brief Verify specified account exists in the set of provided auths
* @param name - name of the account to be verified * @param name - name of the account to be verified
*/ */
void require_auth( uint64_t name ); void require_auth( account_name name );
bool has_auth( uint64_t name ); bool has_auth( account_name name );
/** /**
* Verifies that @ref name exists in the set of provided auths on a action. Throws if not found * Verifies that @ref name exists in the set of provided auths on a action. Throws if not found
...@@ -104,37 +104,37 @@ extern "C" { ...@@ -104,37 +104,37 @@ extern "C" {
* @param name - name of the account to be verified * @param name - name of the account to be verified
* @param permission - permission level to be verified * @param permission - permission level to be verified
*/ */
void require_auth2( uint64_t name, uint64_t permission ); void require_auth2( account_name name, permission_name permission );
bool is_account( uint64_t name ); bool is_account( account_name name );
/** /**
* Send an inline action in the context of this action's parent transaction * Send an inline action in the context of this action's parent transaction
* @param serialized_action - serialized action * @param serialized_action - serialized action
* @param size - size of serialized action in bytes * @param size - size of serialized action in bytes
*/ */
void send_inline(char* serialized_action, size_t size); void send_inline(char *serialized_action, size_t size);
/** /**
* Send an inline context free action in the context of this action's parent transaction * Send an inline context free action in the context of this action's parent transaction
* @param serialized_action - serialized action * @param serialized_action - serialized action
* @param size - size of serialized action in bytes * @param size - size of serialized action in bytes
*/ */
void send_context_free_inline(char* serialized_action, size_t size); void send_context_free_inline(char *serialized_action, size_t size);
/** /**
* Verifies that @ref name exists in the set of write locks held on a action. Throws if not found * Verifies that @ref name exists in the set of write locks held on a action. Throws if not found
* @brief Verifies that @ref name exists in the set of write locks held * @brief Verifies that @ref name exists in the set of write locks held
* @param name - name of the account to be verified * @param name - name of the account to be verified
*/ */
void require_write_lock( uint64_t name ); void require_write_lock( account_name name );
/** /**
* Verifies that @ref name exists in the set of read locks held on a action. Throws if not found * Verifies that @ref name exists in the set of read locks held on a action. Throws if not found
* @brief Verifies that @ref name exists in the set of read locks held * @brief Verifies that @ref name exists in the set of read locks held
* @param name - name of the account to be verified * @param name - name of the account to be verified
*/ */
void require_read_lock( uint64_t name ); void require_read_lock( account_name name );
/** /**
* Returns the time in microseconds from 1970 of the publication_time * Returns the time in microseconds from 1970 of the publication_time
...@@ -148,6 +148,6 @@ extern "C" { ...@@ -148,6 +148,6 @@ extern "C" {
* @brief Get the current receiver of the action * @brief Get the current receiver of the action
* @return the account which specifies the current receiver of the action * @return the account which specifies the current receiver of the action
*/ */
uint64_t current_receiver(); account_name current_receiver();
///@ } actioncapi ///@ } actioncapi
} }
...@@ -68,7 +68,7 @@ namespace eosio { ...@@ -68,7 +68,7 @@ namespace eosio {
* @endcode * @endcode
*/ */
template<typename... accounts> template<typename... accounts>
void require_recipient( uint64_t name, accounts... remaining_accounts ){ void require_recipient( account_name name, accounts... remaining_accounts ){
require_recipient( name ); require_recipient( name );
require_recipient( remaining_accounts... ); require_recipient( remaining_accounts... );
} }
...@@ -206,10 +206,10 @@ namespace eosio { ...@@ -206,10 +206,10 @@ namespace eosio {
template<typename T, uint64_t Name, typename... Args> template<typename T, uint64_t Name, typename... Args>
struct inline_dispatcher<void(T::*)(Args...), Name> { struct inline_dispatcher<void(T::*)(Args...), Name> {
static void call(account_name code, const permission_level& perm, std::tuple<Args...> args) { static void call(account_name code, const permission_level& perm, std::tuple<Args...> args) {
dispatch_inline(code, account_name{Name}, vector<permission_level>(1, perm), std::move(args)); dispatch_inline(code, Name, vector<permission_level>(1, perm), std::move(args));
} }
static void call(account_name code, vector<permission_level> perms, std::tuple<Args...> args) { static void call(account_name code, vector<permission_level> perms, std::tuple<Args...> args) {
dispatch_inline(code, account_name{Name}, std::move(perms), std::move(args)); dispatch_inline(code, Name, std::move(perms), std::move(args));
} }
}; };
......
...@@ -33,7 +33,7 @@ extern "C" { ...@@ -33,7 +33,7 @@ extern "C" {
* @endcode * @endcode
*/ */
uint32_t get_active_producers( uint64_t* producers, uint32_t datalen ); uint32_t get_active_producers( account_name* producers, uint32_t datalen );
///@ } chaincapi ///@ } chaincapi
} }
#pragma once #pragma once
#include <eosiolib/types.hpp>
namespace eosio { namespace eosio {
class contract { class contract {
public: public:
explicit contract( account_name n ):_self(n){} contract( account_name n ):_self(n){}
inline account_name get_self()const { return _self; } inline account_name get_self()const { return _self; }
......
...@@ -93,13 +93,13 @@ namespace eosio { ...@@ -93,13 +93,13 @@ namespace eosio {
return t.get(symbol).balance; return t.get(symbol).balance;
} }
static void inline_transfer( account_name from, account_name to, extended_asset amount, string memo = string(), permission_name perm = NAME(active) ) { static void inline_transfer( account_name from, account_name to, extended_asset amount, string memo = string(), permission_name perm = N(active) ) {
action act( permission_level( from, perm ), amount.contract, NAME(transfer), transfer{from,to,amount,memo} ); action act( permission_level( from, perm ), amount.contract, N(transfer), transfer{from,to,amount,memo} );
act.send(); act.send();
} }
void inline_transfer( account_name from, account_name to, asset amount, string memo = string(), permission_name perm = NAME(active) ) { void inline_transfer( account_name from, account_name to, asset amount, string memo = string(), permission_name perm = N(active) ) {
action act( permission_level( from, perm ), _contract, NAME(transfer), transfer{from,to,amount,memo} ); action act( permission_level( from, perm ), _contract, N(transfer), transfer{from,to,amount,memo} );
act.send(); act.send();
} }
......
...@@ -44,70 +44,70 @@ extern "C" { ...@@ -44,70 +44,70 @@ extern "C" {
* @ingroup database * @ingroup database
*/ */
int32_t db_store_i64(uint64_t scope, uint64_t table, uint64_t payer, uint64_t id, const void* data, uint32_t len); int32_t db_store_i64(account_name scope, table_name table, account_name payer, uint64_t id, const void* data, uint32_t len);
void db_update_i64(int32_t iterator, uint64_t payer, const void* data, uint32_t len); void db_update_i64(int32_t iterator, account_name payer, const void* data, uint32_t len);
void db_remove_i64(int32_t iterator); void db_remove_i64(int32_t iterator);
int32_t db_get_i64(int32_t iterator, const void* data, uint32_t len); int32_t db_get_i64(int32_t iterator, const void* data, uint32_t len);
int32_t db_next_i64(int32_t iterator, uint64_t* primary); int32_t db_next_i64(int32_t iterator, uint64_t* primary);
int32_t db_previous_i64(int32_t iterator, uint64_t* primary); int32_t db_previous_i64(int32_t iterator, uint64_t* primary);
int32_t db_find_i64(uint64_t code, uint64_t scope, uint64_t table, uint64_t id); int32_t db_find_i64(account_name code, account_name scope, table_name table, uint64_t id);
int32_t db_lowerbound_i64(uint64_t code, uint64_t scope, uint64_t table, uint64_t id); int32_t db_lowerbound_i64(account_name code, account_name scope, table_name table, uint64_t id);
int32_t db_upperbound_i64(uint64_t code, uint64_t scope, uint64_t table, uint64_t id); int32_t db_upperbound_i64(account_name code, account_name scope, table_name table, uint64_t id);
int32_t db_end_i64(uint64_t code, uint64_t scope, uint64_t table); int32_t db_end_i64(account_name code, account_name scope, table_name table);
int32_t db_idx64_store(uint64_t scope, uint64_t table, uint64_t payer, uint64_t id, const uint64_t* secondary); int32_t db_idx64_store(account_name scope, table_name table, account_name payer, uint64_t id, const uint64_t* secondary);
void db_idx64_update(int32_t iterator, uint64_t payer, const uint64_t* secondary); void db_idx64_update(int32_t iterator, account_name payer, const uint64_t* secondary);
void db_idx64_remove(int32_t iterator); void db_idx64_remove(int32_t iterator);
int32_t db_idx64_next(int32_t iterator, uint64_t* primary); int32_t db_idx64_next(int32_t iterator, uint64_t* primary);
int32_t db_idx64_previous(int32_t iterator, uint64_t* primary); int32_t db_idx64_previous(int32_t iterator, uint64_t* primary);
int32_t db_idx64_find_primary(uint64_t code, uint64_t scope, uint64_t table, uint64_t* secondary, uint64_t primary); int32_t db_idx64_find_primary(account_name code, account_name scope, table_name table, uint64_t* secondary, uint64_t primary);
int32_t db_idx64_find_secondary(uint64_t code, uint64_t scope, uint64_t table, const uint64_t* secondary, uint64_t* primary); int32_t db_idx64_find_secondary(account_name code, account_name scope, table_name table, const uint64_t* secondary, uint64_t* primary);
int32_t db_idx64_lowerbound(uint64_t code, uint64_t scope, uint64_t table, uint64_t* secondary, uint64_t* primary); int32_t db_idx64_lowerbound(account_name code, account_name scope, table_name table, uint64_t* secondary, uint64_t* primary);
int32_t db_idx64_upperbound(uint64_t code, uint64_t scope, uint64_t table, uint64_t* secondary, uint64_t* primary); int32_t db_idx64_upperbound(account_name code, account_name scope, table_name table, uint64_t* secondary, uint64_t* primary);
int32_t db_idx64_end(uint64_t code, uint64_t scope, uint64_t table); int32_t db_idx64_end(account_name code, account_name scope, table_name table);
int32_t db_idx128_store(uint64_t scope, uint64_t table, uint64_t payer, uint64_t id, const uint128_t* secondary); int32_t db_idx128_store(account_name scope, table_name table, account_name payer, uint64_t id, const uint128_t* secondary);
void db_idx128_update(int32_t iterator, uint64_t payer, const uint128_t* secondary); void db_idx128_update(int32_t iterator, account_name payer, const uint128_t* secondary);
void db_idx128_remove(int32_t iterator); void db_idx128_remove(int32_t iterator);
int32_t db_idx128_next(int32_t iterator, uint64_t* primary); int32_t db_idx128_next(int32_t iterator, uint64_t* primary);
int32_t db_idx128_previous(int32_t iterator, uint64_t* primary); int32_t db_idx128_previous(int32_t iterator, uint64_t* primary);
int32_t db_idx128_find_primary(uint64_t code, uint64_t scope, uint64_t table, uint128_t* secondary, uint64_t primary); int32_t db_idx128_find_primary(account_name code, account_name scope, table_name table, uint128_t* secondary, uint64_t primary);
int32_t db_idx128_find_secondary(uint64_t code, uint64_t scope, uint64_t table, const uint128_t* secondary, uint64_t* primary); int32_t db_idx128_find_secondary(account_name code, account_name scope, table_name table, const uint128_t* secondary, uint64_t* primary);
int32_t db_idx128_lowerbound(uint64_t code, uint64_t scope, uint64_t table, uint128_t* secondary, uint64_t* primary); int32_t db_idx128_lowerbound(account_name code, account_name scope, table_name table, uint128_t* secondary, uint64_t* primary);
int32_t db_idx128_upperbound(uint64_t code, uint64_t scope, uint64_t table, uint128_t* secondary, uint64_t* primary); int32_t db_idx128_upperbound(account_name code, account_name scope, table_name table, uint128_t* secondary, uint64_t* primary);
int32_t db_idx128_end(uint64_t code, uint64_t scope, uint64_t table); int32_t db_idx128_end(account_name code, account_name scope, table_name table);
int32_t db_idx256_store(uint64_t scope, uint64_t table, uint64_t payer, uint64_t id, const void* data, uint32_t data_len ); int32_t db_idx256_store(account_name scope, table_name table, account_name payer, uint64_t id, const void* data, uint32_t data_len );
void db_idx256_update(int32_t iterator, uint64_t payer, const void* data, uint32_t data_len); void db_idx256_update(int32_t iterator, account_name payer, const void* data, uint32_t data_len);
void db_idx256_remove(int32_t iterator); void db_idx256_remove(int32_t iterator);
int32_t db_idx256_next(int32_t iterator, uint64_t* primary); int32_t db_idx256_next(int32_t iterator, uint64_t* primary);
int32_t db_idx256_previous(int32_t iterator, uint64_t* primary); int32_t db_idx256_previous(int32_t iterator, uint64_t* primary);
int32_t db_idx256_find_primary(uint64_t code, uint64_t scope, uint64_t table, void* data, uint32_t data_len, uint64_t primary); int32_t db_idx256_find_primary(account_name code, account_name scope, table_name table, void* data, uint32_t data_len, uint64_t primary);
int32_t db_idx256_find_secondary(uint64_t code, uint64_t scope, uint64_t table, const void* data, uint32_t data_len, uint64_t* primary); int32_t db_idx256_find_secondary(account_name code, account_name scope, table_name table, const void* data, uint32_t data_len, uint64_t* primary);
int32_t db_idx256_lowerbound(uint64_t code, uint64_t scope, uint64_t table, void* data, uint32_t data_len, uint64_t* primary); int32_t db_idx256_lowerbound(account_name code, account_name scope, table_name table, void* data, uint32_t data_len, uint64_t* primary);
int32_t db_idx256_upperbound(uint64_t code, uint64_t scope, uint64_t table, void* data, uint32_t data_len, uint64_t* primary); int32_t db_idx256_upperbound(account_name code, account_name scope, table_name table, void* data, uint32_t data_len, uint64_t* primary);
int32_t db_idx256_end(uint64_t code, uint64_t scope, uint64_t table); int32_t db_idx256_end(account_name code, account_name scope, table_name table);
int32_t db_idx_double_store(uint64_t scope, uint64_t table, uint64_t payer, uint64_t id, const double* secondary); int32_t db_idx_double_store(account_name scope, table_name table, account_name payer, uint64_t id, const double* secondary);
void db_idx_double_update(int32_t iterator, uint64_t payer, const double* secondary); void db_idx_double_update(int32_t iterator, account_name payer, const double* secondary);
void db_idx_double_remove(int32_t iterator); void db_idx_double_remove(int32_t iterator);
int32_t db_idx_double_next(int32_t iterator, uint64_t* primary); int32_t db_idx_double_next(int32_t iterator, uint64_t* primary);
int32_t db_idx_double_previous(int32_t iterator, uint64_t* primary); int32_t db_idx_double_previous(int32_t iterator, uint64_t* primary);
int32_t db_idx_double_find_primary(uint64_t code, uint64_t scope, uint64_t table, double* secondary, uint64_t primary); int32_t db_idx_double_find_primary(account_name code, account_name scope, table_name table, double* secondary, uint64_t primary);
int32_t db_idx_double_find_secondary(uint64_t code, uint64_t scope, uint64_t table, const double* secondary, uint64_t* primary); int32_t db_idx_double_find_secondary(account_name code, account_name scope, table_name table, const double* secondary, uint64_t* primary);
int32_t db_idx_double_lowerbound(uint64_t code, uint64_t scope, uint64_t table, double* secondary, uint64_t* primary); int32_t db_idx_double_lowerbound(account_name code, account_name scope, table_name table, double* secondary, uint64_t* primary);
int32_t db_idx_double_upperbound(uint64_t code, uint64_t scope, uint64_t table, double* secondary, uint64_t* primary); int32_t db_idx_double_upperbound(account_name code, account_name scope, table_name table, double* secondary, uint64_t* primary);
int32_t db_idx_double_end(uint64_t code, uint64_t scope, uint64_t table); int32_t db_idx_double_end(account_name code, account_name scope, table_name table);
int32_t db_idx_long_double_store(uint64_t scope, uint64_t table, uint64_t payer, uint64_t id, const long double* secondary); int32_t db_idx_long_double_store(account_name scope, table_name table, account_name payer, uint64_t id, const long double* secondary);
void db_idx_long_double_update(int32_t iterator, uint64_t payer, const long double* secondary); void db_idx_long_double_update(int32_t iterator, account_name payer, const long double* secondary);
void db_idx_long_double_remove(int32_t iterator); void db_idx_long_double_remove(int32_t iterator);
int32_t db_idx_long_double_next(int32_t iterator, uint64_t* primary); int32_t db_idx_long_double_next(int32_t iterator, uint64_t* primary);
int32_t db_idx_long_double_previous(int32_t iterator, uint64_t* primary); int32_t db_idx_long_double_previous(int32_t iterator, uint64_t* primary);
int32_t db_idx_long_double_find_primary(uint64_t code, uint64_t scope, uint64_t table, long double* secondary, uint64_t primary); int32_t db_idx_long_double_find_primary(account_name code, account_name scope, table_name table, long double* secondary, uint64_t primary);
int32_t db_idx_long_double_find_secondary(uint64_t code, uint64_t scope, uint64_t table, const long double* secondary, uint64_t* primary); int32_t db_idx_long_double_find_secondary(account_name code, account_name scope, table_name table, const long double* secondary, uint64_t* primary);
int32_t db_idx_long_double_lowerbound(uint64_t code, uint64_t scope, uint64_t table, long double* secondary, uint64_t* primary); int32_t db_idx_long_double_lowerbound(account_name code, account_name scope, table_name table, long double* secondary, uint64_t* primary);
int32_t db_idx_long_double_upperbound(uint64_t code, uint64_t scope, uint64_t table, long double* secondary, uint64_t* primary); int32_t db_idx_long_double_upperbound(account_name code, account_name scope, table_name table, long double* secondary, uint64_t* primary);
int32_t db_idx_long_double_end(uint64_t code, uint64_t scope, uint64_t table); int32_t db_idx_long_double_end(account_name code, account_name scope, table_name table);
} }
...@@ -80,7 +80,7 @@ extern "C" { \ ...@@ -80,7 +80,7 @@ extern "C" { \
eosio_assert(code == N(eosio), "onerror action's are only valid from the \"eosio\" system account"); \ eosio_assert(code == N(eosio), "onerror action's are only valid from the \"eosio\" system account"); \
} \ } \
if( code == self || action == N(onerror) ) { \ if( code == self || action == N(onerror) ) { \
TYPE thiscontract( eosio::account_name{self} ); \ TYPE thiscontract( self ); \
switch( action ) { \ switch( action ) { \
EOSIO_API( TYPE, MEMBERS ) \ EOSIO_API( TYPE, MEMBERS ) \
} \ } \
......
...@@ -38,8 +38,8 @@ extern "C" { ...@@ -38,8 +38,8 @@ extern "C" {
* @return 1 if the permission is authorized, 0 otherwise * @return 1 if the permission is authorized, 0 otherwise
*/ */
int32_t int32_t
check_permission_authorization( uint64_t account, check_permission_authorization( account_name account,
uint64_t permission, permission_name permission,
const char* pubkeys_data, uint32_t pubkeys_size, const char* pubkeys_data, uint32_t pubkeys_size,
const char* perms_data, uint32_t perms_size, const char* perms_data, uint32_t perms_size,
uint64_t delay_us uint64_t delay_us
...@@ -53,7 +53,7 @@ extern "C" { ...@@ -53,7 +53,7 @@ extern "C" {
* *
* @return the last used time (in microseconds since Unix epoch) of the permission * @return the last used time (in microseconds since Unix epoch) of the permission
*/ */
int64_t get_permission_last_used( uint64_t account, uint64_t permission ); int64_t get_permission_last_used( account_name account, permission_name permission );
/** /**
...@@ -63,6 +63,6 @@ extern "C" { ...@@ -63,6 +63,6 @@ extern "C" {
* *
* @return the creation time (in microseconds since Unix epoch) of the account * @return the creation time (in microseconds since Unix epoch) of the account
*/ */
int64_t get_account_creation_time( uint64_t account ); int64_t get_account_creation_time( account_name account );
} }
...@@ -18,13 +18,13 @@ extern "C" { ...@@ -18,13 +18,13 @@ extern "C" {
* @{ * @{
*/ */
void set_resource_limits( uint64_t account, int64_t ram_bytes, int64_t net_weight, int64_t cpu_weight ); void set_resource_limits( account_name account, int64_t ram_bytes, int64_t net_weight, int64_t cpu_weight );
bool set_active_producers( char* producer_data, uint32_t producer_data_size ); bool set_active_producers( char *producer_data, uint32_t producer_data_size );
bool is_privileged( uint64_t account ); bool is_privileged( account_name account );
void set_privileged( uint64_t account, bool is_priv ); void set_privileged( account_name account, bool is_priv );
void set_blockchain_parameters_packed(char* data, uint32_t datalen); void set_blockchain_parameters_packed(char* data, uint32_t datalen);
......
...@@ -90,7 +90,7 @@ namespace eosio { ...@@ -90,7 +90,7 @@ namespace eosio {
struct extended_symbol : public symbol_type struct extended_symbol : public symbol_type
{ {
extended_symbol( symbol_name s = symbol_name{0}, account_name c = account_name{0} ):symbol_type{s},contract(c){} extended_symbol( symbol_name s = 0, account_name c = 0 ):symbol_type{s},contract(c){}
account_name contract; account_name contract;
......
...@@ -58,7 +58,7 @@ extern "C" { ...@@ -58,7 +58,7 @@ extern "C" {
* *
* @{ * @{
*/ */
void send_deferred(const uint128_t& sender_id, uint64_t payer, const char* serialized_transaction, size_t size, uint32_t replace_existing = 0); void send_deferred(const uint128_t& sender_id, account_name payer, const char *serialized_transaction, size_t size, uint32_t replace_existing = 0);
/** /**
* cancel deferred transaction * cancel deferred transaction
...@@ -73,7 +73,7 @@ extern "C" { ...@@ -73,7 +73,7 @@ extern "C" {
* @param size - the size of the buffer, 0 to return required size * @param size - the size of the buffer, 0 to return required size
* @return the size of the transaction written to the buffer, or number of bytes that can be copied if size==0 passed * @return the size of the transaction written to the buffer, or number of bytes that can be copied if size==0 passed
*/ */
size_t read_transaction(char* buffer, size_t size); size_t read_transaction(char *buffer, size_t size);
/** /**
* get the size of the currently executing transaction * get the size of the currently executing transaction
...@@ -94,7 +94,7 @@ extern "C" { ...@@ -94,7 +94,7 @@ extern "C" {
/** /**
* get the expiration of the currently executing transaction * get the expiration of the currently executing transaction
*/ */
uint32_t expiration(); time expiration();
/** /**
* Retrieve the indicated action from the active transaction. * Retrieve the indicated action from the active transaction.
......
...@@ -19,14 +19,15 @@ extern "C" { ...@@ -19,14 +19,15 @@ extern "C" {
* @{ * @{
*/ */
//typedef uint64_t account_name; typedef uint64_t account_name;
//typedef uint64_t permission_name; typedef uint64_t permission_name;
//typedef uint64_t table_name; typedef uint64_t table_name;
//typedef uint32_t time; typedef uint32_t time;
//typedef uint64_t scope_name; typedef uint64_t scope_name;
//typedef uint64_t action_name; typedef uint64_t action_name;
//
//typedef uint16_t weight_type; typedef int64_t share_type;
typedef uint16_t weight_type;
/* macro to align/overalign a type to ensure calls to intrinsics with pointers/references are properly aligned */ /* macro to align/overalign a type to ensure calls to intrinsics with pointers/references are properly aligned */
#define ALIGNED(X) __attribute__ ((aligned (16))) X #define ALIGNED(X) __attribute__ ((aligned (16))) X
...@@ -54,10 +55,10 @@ struct ALIGNED(checksum512) { ...@@ -54,10 +55,10 @@ struct ALIGNED(checksum512) {
typedef struct checksum256 transaction_id_type; typedef struct checksum256 transaction_id_type;
typedef struct checksum256 block_id_type; typedef struct checksum256 block_id_type;
//struct account_permission { struct account_permission {
// account_name account; account_name account;
// permission_name permission; permission_name permission;
//}; };
#ifdef __cplusplus #ifdef __cplusplus
} /// extern "C" } /// extern "C"
......
...@@ -10,16 +10,7 @@ ...@@ -10,16 +10,7 @@
namespace eosio { namespace eosio {
struct name; typedef std::vector<std::tuple<uint16_t,std::vector<char>>> extensions_type;
using account_name = name;
using permission_name = name;
using table_name = name;
using scope_name = name;
using action_name = name;
using weight_type = uint16_t;
using extensions_type = std::vector<std::tuple<uint16_t,std::vector<char>>>;
/** /**
* @brief Converts a base32 symbol into its binary representation, used by string_to_name() * @brief Converts a base32 symbol into its binary representation, used by string_to_name()
...@@ -35,46 +26,6 @@ namespace eosio { ...@@ -35,46 +26,6 @@ namespace eosio {
return 0; return 0;
} }
/**
* @brief wraps a uint64_t to ensure it is only passed to methods that expect a Name
* @details wraps a uint64_t to ensure it is only passed to methods that expect a Name and
* that no mathematical operations occur. It also enables specialization of print
* so that it is printed as a base32 string.
*
* @ingroup types
* @{
*/
struct name {
operator uint64_t()const { return value; }
// keep in sync with name::operator string() in eosio source code definition for name
std::string to_string() const {
static const char* charmap = ".12345abcdefghijklmnopqrstuvwxyz";
std::string str(13,'.');
uint64_t tmp = value;
for( uint32_t i = 0; i <= 12; ++i ) {
char c = charmap[tmp & (i == 0 ? 0x0f : 0x1f)];
str[12-i] = c;
tmp >>= (i == 0 ? 4 : 5);
}
trim_right_dots( str );
return str;
}
friend bool operator==( const name& a, const name& b ) { return a.value == b.value; }
uint64_t value = 0;
private:
static void trim_right_dots(std::string& str ) {
const auto last = str.find_last_not_of('.');
if (last != std::string::npos)
str = str.substr(0, last + 1);
}
};
/// @}
/** /**
* @brief Converts a base32 string to a uint64_t. * @brief Converts a base32 string to a uint64_t.
...@@ -114,7 +65,6 @@ namespace eosio { ...@@ -114,7 +65,6 @@ namespace eosio {
* @ingroup types * @ingroup types
*/ */
#define N(X) ::eosio::string_to_name(#X) #define N(X) ::eosio::string_to_name(#X)
#define NAME(X) eosio::name{N(X)}
static constexpr uint64_t name_suffix( uint64_t tmp ) { static constexpr uint64_t name_suffix( uint64_t tmp ) {
...@@ -139,6 +89,46 @@ namespace eosio { ...@@ -139,6 +89,46 @@ namespace eosio {
} }
return suffix; return suffix;
} }
/**
* @brief wraps a uint64_t to ensure it is only passed to methods that expect a Name
* @details wraps a uint64_t to ensure it is only passed to methods that expect a Name and
* that no mathematical operations occur. It also enables specialization of print
* so that it is printed as a base32 string.
*
* @ingroup types
* @{
*/
struct name {
operator uint64_t()const { return value; }
// keep in sync with name::operator string() in eosio source code definition for name
std::string to_string() const {
static const char* charmap = ".12345abcdefghijklmnopqrstuvwxyz";
std::string str(13,'.');
uint64_t tmp = value;
for( uint32_t i = 0; i <= 12; ++i ) {
char c = charmap[tmp & (i == 0 ? 0x0f : 0x1f)];
str[12-i] = c;
tmp >>= (i == 0 ? 4 : 5);
}
trim_right_dots( str );
return str;
}
friend bool operator==( const name& a, const name& b ) { return a.value == b.value; }
account_name value = 0;
private:
static void trim_right_dots(std::string& str ) {
const auto last = str.find_last_not_of('.');
if (last != std::string::npos)
str = str.substr(0, last + 1);
}
};
/// @}
} // namespace eosio } // namespace eosio
......
...@@ -206,7 +206,7 @@ namespace eosio { ...@@ -206,7 +206,7 @@ namespace eosio {
#define N(X) ::eosio::string_to_name(#X) #define N(X) ::eosio::string_to_name(#X)
void exchange::apply( account_name contract, action_name act ) { void exchange::apply( account_name contract, account_name act ) {
if( act == N(transfer) ) { if( act == N(transfer) ) {
on( unpack_action_data<currency::transfer>(), contract ); on( unpack_action_data<currency::transfer>(), contract );
...@@ -243,8 +243,8 @@ namespace eosio { ...@@ -243,8 +243,8 @@ namespace eosio {
extern "C" { extern "C" {
[[noreturn]] void apply( uint64_t receiver, uint64_t code, uint64_t action ) { [[noreturn]] void apply( uint64_t receiver, uint64_t code, uint64_t action ) {
eosio::exchange ex( eosio::account_name{receiver} ); eosio::exchange ex( receiver );
ex.apply( eosio::account_name{code}, eosio::action_name{action} ); ex.apply( code, action );
eosio_exit(0); eosio_exit(0);
} }
} }
{ {
"____comment": "This file was generated by eosio-abigen. DO NOT EDIT - 2018-05-23T19:06:26", "____comment": "This file was generated by eosio-abigen. DO NOT EDIT - 2018-05-23T14:17:25",
"version": "eosio::abi/1.0", "version": "",
"types": [{ "types": [],
"new_type_name": "account_name",
"type": "name"
}
],
"structs": [{ "structs": [{
"name": "hi", "name": "hi",
"base": "", "base": "",
"fields": [{ "fields": [{
"name": "user", "name": "user",
"type": "account_name" "type": "name"
} }
] ]
} }
......
...@@ -4,21 +4,21 @@ ...@@ -4,21 +4,21 @@
namespace identity { namespace identity {
bool identity_base::is_trusted_by( eosio::account_name trusted, eosio::account_name by ) { bool identity_base::is_trusted_by( account_name trusted, account_name by ) {
trust_table t( _self, by ); trust_table t( _self, by );
return t.find( trusted ) != t.end(); return t.find( trusted ) != t.end();
} }
bool identity_base::is_trusted( eosio::account_name acnt ) { bool identity_base::is_trusted( account_name acnt ) {
uint64_t active_producers[21]; account_name active_producers[21];
auto active_prod_size = get_active_producers( active_producers, sizeof(active_producers) ); auto active_prod_size = get_active_producers( active_producers, sizeof(active_producers) );
auto count = active_prod_size / sizeof(uint64_t); auto count = active_prod_size / sizeof(account_name);
for( size_t i = 0; i < count; ++i ) { for( size_t i = 0; i < count; ++i ) {
if( active_producers[i] == acnt ) if( active_producers[i] == acnt )
return true; return true;
} }
for( size_t i = 0; i < count; ++i ) { for( size_t i = 0; i < count; ++i ) {
if( is_trusted_by( acnt, eosio::name{active_producers[i]} ) ) if( is_trusted_by( acnt, active_producers[i] ) )
return true; return true;
} }
return false; return false;
......
...@@ -24,7 +24,7 @@ namespace identity { ...@@ -24,7 +24,7 @@ namespace identity {
uint64_t id; uint64_t id;
property_name property; property_name property;
uint64_t trusted; uint64_t trusted;
eosio::account_name certifier; account_name certifier;
uint8_t confidence = 0; uint8_t confidence = 0;
std::string type; std::string type;
std::vector<char> data; std::vector<char> data;
...@@ -46,7 +46,7 @@ namespace identity { ...@@ -46,7 +46,7 @@ namespace identity {
struct identrow { struct identrow {
uint64_t identity; uint64_t identity;
eosio::account_name creator; account_name creator;
uint64_t primary_key() const { return identity; } uint64_t primary_key() const { return identity; }
...@@ -54,7 +54,7 @@ namespace identity { ...@@ -54,7 +54,7 @@ namespace identity {
}; };
struct trustrow { struct trustrow {
eosio::account_name account; account_name account;
uint64_t primary_key() const { return account; } uint64_t primary_key() const { return account; }
...@@ -70,14 +70,14 @@ namespace identity { ...@@ -70,14 +70,14 @@ namespace identity {
class identity_base { class identity_base {
public: public:
identity_base( eosio::account_name acnt) : _self( acnt ) {} identity_base( account_name acnt) : _self( acnt ) {}
bool is_trusted_by( eosio::account_name trusted, eosio::account_name by ); bool is_trusted_by( account_name trusted, account_name by );
bool is_trusted( eosio::account_name acnt ); bool is_trusted( account_name acnt );
protected: protected:
eosio::account_name _self; account_name _self;
}; };
} }
......
...@@ -53,8 +53,8 @@ namespace identity { ...@@ -53,8 +53,8 @@ namespace identity {
using identity_base::identity_base; using identity_base::identity_base;
void settrust( const eosio::account_name trustor, ///< the account authorizing the trust void settrust( const account_name trustor, ///< the account authorizing the trust
const eosio::account_name trusting, ///< the account receiving the trust const account_name trusting, ///< the account receiving the trust
const uint8_t trust = 0 )/// 0 to remove, -1 to mark untrusted, 1 to mark trusted const uint8_t trust = 0 )/// 0 to remove, -1 to mark untrusted, 1 to mark trusted
{ {
require_auth( trustor ); require_auth( trustor );
...@@ -90,7 +90,7 @@ namespace identity { ...@@ -90,7 +90,7 @@ namespace identity {
* A 64 bit identity is used because the key is used frequently and it makes for more * A 64 bit identity is used because the key is used frequently and it makes for more
* effecient tables/scopes/etc. * effecient tables/scopes/etc.
*/ */
void create( const eosio::account_name creator, const uint64_t identity ) { void create( const account_name creator, const uint64_t identity ) {
require_auth( creator ); require_auth( creator );
idents_table t( _self, _self ); idents_table t( _self, _self );
auto itr = t.find( identity ); auto itr = t.find( identity );
...@@ -102,8 +102,8 @@ namespace identity { ...@@ -102,8 +102,8 @@ namespace identity {
}); });
} }
void certprop( const eosio::account_name bill_storage_to, ///< account which is paying for storage void certprop( const account_name bill_storage_to, ///< account which is paying for storage
const eosio::account_name certifier, const account_name certifier,
const identity_name identity, const identity_name identity,
const vector<certvalue>& values ) const vector<certvalue>& values )
{ {
...@@ -150,8 +150,8 @@ namespace identity { ...@@ -150,8 +150,8 @@ namespace identity {
//special handling for owner //special handling for owner
if (value.property == N(owner)) { if (value.property == N(owner)) {
eosio_assert(sizeof(eosio::account_name) == value.data.size(), "data size doesn't match account_name size"); eosio_assert(sizeof(account_name) == value.data.size(), "data size doesn't match account_name size");
eosio::account_name acnt = *reinterpret_cast<const eosio::account_name*>(value.data.data()); account_name acnt = *reinterpret_cast<const account_name*>(value.data.data());
if (certifier == acnt) { //only self-certitication affects accounts_table if (certifier == acnt) { //only self-certitication affects accounts_table
accounts_table( _self, acnt ).set( identity, acnt ); accounts_table( _self, acnt ).set( identity, acnt );
} }
...@@ -172,8 +172,8 @@ namespace identity { ...@@ -172,8 +172,8 @@ namespace identity {
} }
//special handling for owner //special handling for owner
if (value.property == N(owner)) { if (value.property == N(owner)) {
eosio_assert(sizeof(eosio::account_name) == value.data.size(), "data size doesn't match account_name size"); eosio_assert(sizeof(account_name) == value.data.size(), "data size doesn't match account_name size");
eosio::account_name acnt = *reinterpret_cast<const eosio::account_name*>(value.data.data()); account_name acnt = *reinterpret_cast<const account_name*>(value.data.data());
if (certifier == acnt) { //only self-certitication affects accounts_table if (certifier == acnt) { //only self-certitication affects accounts_table
accounts_table( _self, acnt ).remove(); accounts_table( _self, acnt ).remove();
} }
......
...@@ -2,21 +2,21 @@ ...@@ -2,21 +2,21 @@
namespace identity { namespace identity {
identity_name interface::get_claimed_identity( eosio::account_name acnt ) { identity_name interface::get_claimed_identity( account_name acnt ) {
return accounts_table( _self, acnt ).get_or_default(0); return accounts_table( _self, acnt ).get_or_default(0);
} }
eosio::account_name interface::get_owner_for_identity( uint64_t receiver, identity_name ident ) { account_name interface::get_owner_for_identity( uint64_t receiver, identity_name ident ) {
// for each trusted owner certification // for each trusted owner certification
// check to see if the certification is still trusted // check to see if the certification is still trusted
// check to see if the account has claimed it // check to see if the account has claimed it
certs_table certs( _self, ident ); certs_table certs( _self, ident );
auto idx = certs.template get_index<N(bytuple)>(); auto idx = certs.template get_index<N(bytuple)>();
auto itr = idx.lower_bound(certrow::key(N(owner), 1, 0)); auto itr = idx.lower_bound(certrow::key(N(owner), 1, 0));
eosio::account_name owner = {}; account_name owner = 0;
while (itr != idx.end() && itr->property == N(owner) && itr->trusted) { while (itr != idx.end() && itr->property == N(owner) && itr->trusted) {
if (sizeof(eosio::account_name) == itr->data.size()) { if (sizeof(account_name) == itr->data.size()) {
eosio::account_name account = *reinterpret_cast<const eosio::account_name*>(itr->data.data()); account_name account = *reinterpret_cast<const account_name*>(itr->data.data());
if (ident == get_claimed_identity(account)) { if (ident == get_claimed_identity(account)) {
if (is_trusted(itr->certifier) ) { if (is_trusted(itr->certifier) ) {
// the certifier is still trusted // the certifier is still trusted
...@@ -24,7 +24,7 @@ eosio::account_name interface::get_owner_for_identity( uint64_t receiver, identi ...@@ -24,7 +24,7 @@ eosio::account_name interface::get_owner_for_identity( uint64_t receiver, identi
owner = account; owner = account;
} else { } else {
//contradiction found: different owners certified for the same identity //contradiction found: different owners certified for the same identity
return eosio::account_name{0}; return 0;
} }
} else if (_self == receiver){ } else if (_self == receiver){
//the certifier is no longer trusted, need to unset the flag //the certifier is no longer trusted, need to unset the flag
...@@ -48,8 +48,8 @@ eosio::account_name interface::get_owner_for_identity( uint64_t receiver, identi ...@@ -48,8 +48,8 @@ eosio::account_name interface::get_owner_for_identity( uint64_t receiver, identi
// let's see if any untrusted certifications became trusted // let's see if any untrusted certifications became trusted
itr = idx.lower_bound(certrow::key(N(owner), 0, 0)); itr = idx.lower_bound(certrow::key(N(owner), 0, 0));
while (itr != idx.end() && itr->property == N(owner) && !itr->trusted) { while (itr != idx.end() && itr->property == N(owner) && !itr->trusted) {
if (sizeof(eosio::account_name) == itr->data.size()) { if (sizeof(account_name) == itr->data.size()) {
eosio::account_name account = *reinterpret_cast<const eosio::account_name*>(itr->data.data()); account_name account = *reinterpret_cast<const account_name*>(itr->data.data());
if (ident == get_claimed_identity(account) && is_trusted(itr->certifier)) { if (ident == get_claimed_identity(account) && is_trusted(itr->certifier)) {
if (_self == receiver) { if (_self == receiver) {
// the certifier became trusted and we have permissions to update the flag // the certifier became trusted and we have permissions to update the flag
...@@ -61,7 +61,7 @@ eosio::account_name interface::get_owner_for_identity( uint64_t receiver, identi ...@@ -61,7 +61,7 @@ eosio::account_name interface::get_owner_for_identity( uint64_t receiver, identi
owner = account; owner = account;
} else { } else {
//contradiction found: different owners certified for the same identity //contradiction found: different owners certified for the same identity
return eosio::account_name{0}; return 0;
} }
} }
} else { } else {
...@@ -72,7 +72,7 @@ eosio::account_name interface::get_owner_for_identity( uint64_t receiver, identi ...@@ -72,7 +72,7 @@ eosio::account_name interface::get_owner_for_identity( uint64_t receiver, identi
return owner; return owner;
} }
identity_name interface::get_identity_for_account( eosio::account_name receiver, eosio::account_name acnt ) { identity_name interface::get_identity_for_account( uint64_t receiver, account_name acnt ) {
// check what identity the account has self certified owner // check what identity the account has self certified owner
// verify that a trusted certifier has confirmed owner // verify that a trusted certifier has confirmed owner
auto identity = get_claimed_identity(acnt); auto identity = get_claimed_identity(acnt);
......
...@@ -8,11 +8,11 @@ namespace identity { ...@@ -8,11 +8,11 @@ namespace identity {
public: public:
using identity_base::identity_base; using identity_base::identity_base;
identity_name get_claimed_identity( eosio::account_name acnt ); identity_name get_claimed_identity( account_name acnt );
eosio::account_name get_owner_for_identity( uint64_t receiver, identity_name ident ); account_name get_owner_for_identity( uint64_t receiver, identity_name ident );
identity_name get_identity_for_account( eosio::account_name receiver, eosio::account_name acnt ); identity_name get_identity_for_account( uint64_t receiver, account_name acnt );
}; };
} }
...@@ -12,21 +12,21 @@ namespace identity_test { ...@@ -12,21 +12,21 @@ namespace identity_test {
class contract : public eosio::contract { class contract : public eosio::contract {
public: public:
static constexpr eosio::account_name code = NAME(identitytest); static constexpr uint64_t code = N(identitytest);
typedef singleton<N(result), uint64_t> result_table; typedef singleton<N(result), uint64_t> result_table;
using eosio::contract::contract; using eosio::contract::contract;
void getowner( const uint64_t identity ) { void getowner( const uint64_t identity ) {
identity::interface iface( NAME(identity) ); identity::interface iface( N(identity) );
eosio::account_name owner = iface.get_owner_for_identity(current_receiver(), identity); account_name owner = iface.get_owner_for_identity(current_receiver(), identity);
result_table( code, eosio::scope_name{0} ).set( owner, code ); //use scope = 0 for simplicity result_table( code, 0 ).set( owner, code ); //use scope = 0 for simplicity
} }
void getidentity( const eosio::account_name account ) { void getidentity( const account_name account ) {
identity::interface iface( NAME(identity) ); identity::interface iface( N(identity) );
identity::identity_name idnt = iface.get_identity_for_account(eosio::account_name{current_receiver()}, account); identity::identity_name idnt = iface.get_identity_for_account(current_receiver(), account);
result_table( code, eosio::scope_name{0} ).set(idnt, code ); //use scope = 0 for simplicity result_table( code, 0 ).set(idnt, code ); //use scope = 0 for simplicity
} }
}; };
......
...@@ -59,13 +59,13 @@ struct limit_order { ...@@ -59,13 +59,13 @@ struct limit_order {
orders.emplace( payer, [&]( auto& o ) { orders.emplace( payer, [&]( auto& o ) {
o.id = 1; o.id = 1;
o.expiration = 300; o.expiration = 300;
o.owner = NAME(dan); o.owner = N(dan);
}); });
auto order2 = orders.emplace( payer, [&]( auto& o ) { auto order2 = orders.emplace( payer, [&]( auto& o ) {
o.id = 2; o.id = 2;
o.expiration = 200; o.expiration = 200;
o.owner = NAME(alice); o.owner = N(alice);
}); });
print("Items sorted by primary key:\n"); print("Items sorted by primary key:\n");
......
...@@ -35,7 +35,7 @@ namespace proxy { ...@@ -35,7 +35,7 @@ namespace proxy {
template<typename T> template<typename T>
void apply_transfer(uint64_t receiver, account_name code, const T& transfer) { void apply_transfer(uint64_t receiver, account_name code, const T& transfer) {
config code_config; config code_config;
const eosio::account_name self = eosio::account_name{receiver}; const auto self = receiver;
auto get_res = configs::get(code_config, self); auto get_res = configs::get(code_config, self);
eosio_assert(get_res, "Attempting to use unconfigured proxy"); eosio_assert(get_res, "Attempting to use unconfigured proxy");
if (transfer.from == self) { if (transfer.from == self) {
...@@ -50,14 +50,14 @@ namespace proxy { ...@@ -50,14 +50,14 @@ namespace proxy {
configs::store(code_config, self); configs::store(code_config, self);
transaction out; transaction out;
out.actions.emplace_back(permission_level{self, NAME(active)}, NAME(eosio.token), NAME(transfer), new_transfer); out.actions.emplace_back(permission_level{self, N(active)}, N(eosio.token), N(transfer), new_transfer);
out.delay_sec = code_config.delay; out.delay_sec = code_config.delay;
out.send(id, self); out.send(id, self);
} }
} }
void apply_setowner(uint64_t receiver, set_owner params) { void apply_setowner(uint64_t receiver, set_owner params) {
const eosio::account_name self = eosio::account_name{receiver}; const auto self = receiver;
require_auth(params.owner); require_auth(params.owner);
config code_config; config code_config;
configs::get(code_config, self); configs::get(code_config, self);
...@@ -70,7 +70,7 @@ namespace proxy { ...@@ -70,7 +70,7 @@ namespace proxy {
template<size_t ...Args> template<size_t ...Args>
void apply_onerror(uint64_t receiver, const onerror& error ) { void apply_onerror(uint64_t receiver, const onerror& error ) {
eosio::print("starting onerror\n"); eosio::print("starting onerror\n");
const eosio::account_name self = eosio::account_name{receiver}; const auto self = receiver;
config code_config; config code_config;
eosio_assert(configs::get(code_config, self), "Attempting use of unconfigured proxy"); eosio_assert(configs::get(code_config, self), "Attempting use of unconfigured proxy");
...@@ -95,7 +95,7 @@ extern "C" { ...@@ -95,7 +95,7 @@ extern "C" {
apply_onerror( receiver, onerror::from_current_action() ); apply_onerror( receiver, onerror::from_current_action() );
} else if( code == N(eosio.token) ) { } else if( code == N(eosio.token) ) {
if( action == N(transfer) ) { if( action == N(transfer) ) {
apply_transfer(receiver, eosio::account_name{code}, unpack_action_data<eosio::token::transfer_args>()); apply_transfer(receiver, code, unpack_action_data<eosio::token::transfer_args>());
} }
} else if( code == receiver ) { } else if( code == receiver ) {
if( action == N(setowner) ) { if( action == N(setowner) ) {
......
...@@ -10,7 +10,7 @@ namespace proxy { ...@@ -10,7 +10,7 @@ namespace proxy {
//@abi action //@abi action
struct set_owner { struct set_owner {
eosio::account_name owner; account_name owner;
uint32_t delay; uint32_t delay;
EOSLIB_SERIALIZE( set_owner, (owner)(delay) ) EOSLIB_SERIALIZE( set_owner, (owner)(delay) )
...@@ -20,7 +20,7 @@ namespace proxy { ...@@ -20,7 +20,7 @@ namespace proxy {
struct config { struct config {
config(){} config(){}
constexpr static uint64_t key = N(config); constexpr static uint64_t key = N(config);
eosio::account_name owner = {}; account_name owner = 0;
uint32_t delay = 0; uint32_t delay = 0;
uint32_t next_id = 0; uint32_t next_id = 0;
}; };
......
...@@ -2,10 +2,10 @@ ...@@ -2,10 +2,10 @@
class simpletoken : public eosio::contract { class simpletoken : public eosio::contract {
public: public:
simpletoken( eosio::account_name self ) simpletoken( account_name self )
:contract(self),_accounts( _self, _self){} :contract(self),_accounts( _self, _self){}
void transfer( eosio::account_name from, eosio::account_name to, uint64_t quantity ) { void transfer( account_name from, account_name to, uint64_t quantity ) {
require_auth( from ); require_auth( from );
const auto& fromacnt = _accounts.get( from ); const auto& fromacnt = _accounts.get( from );
...@@ -15,14 +15,14 @@ class simpletoken : public eosio::contract { ...@@ -15,14 +15,14 @@ class simpletoken : public eosio::contract {
add_balance( from, to, quantity ); add_balance( from, to, quantity );
} }
void issue( eosio::account_name to, uint64_t quantity ) { void issue( account_name to, uint64_t quantity ) {
require_auth( _self ); require_auth( _self );
add_balance( _self, to, quantity ); add_balance( _self, to, quantity );
} }
private: private:
struct account { struct account {
eosio::account_name owner; account_name owner;
uint64_t balance; uint64_t balance;
uint64_t primary_key()const { return owner; } uint64_t primary_key()const { return owner; }
...@@ -30,7 +30,7 @@ class simpletoken : public eosio::contract { ...@@ -30,7 +30,7 @@ class simpletoken : public eosio::contract {
eosio::multi_index<N(accounts), account> _accounts; eosio::multi_index<N(accounts), account> _accounts;
void add_balance( eosio::account_name payer, eosio::account_name to, uint64_t q ) { void add_balance( account_name payer, account_name to, uint64_t q ) {
auto toitr = _accounts.find( to ); auto toitr = _accounts.find( to );
if( toitr == _accounts.end() ) { if( toitr == _accounts.end() ) {
_accounts.emplace( payer, [&]( auto& a ) { _accounts.emplace( payer, [&]( auto& a ) {
......
...@@ -252,7 +252,7 @@ namespace stltest { ...@@ -252,7 +252,7 @@ namespace stltest {
//std::cout << "STL test done." << std::endl; //std::cout << "STL test done." << std::endl;
} }
static void apply( uint64_t c, uint64_t act) { static void apply( account_name c, action_name act) {
eosio::dispatch<stltest::contract, message>(c,act); eosio::dispatch<stltest::contract, message>(c,act);
} }
}; };
......
...@@ -14,8 +14,8 @@ namespace eosio { ...@@ -14,8 +14,8 @@ namespace eosio {
void forward( action_name reqauth, account_name forward_code, account_name forward_auth ) { void forward( action_name reqauth, account_name forward_code, account_name forward_auth ) {
require_auth( reqauth ); require_auth( reqauth );
INLINE_ACTION_SENDER(testinline, reqauth)( forward_code, {forward_auth,NAME(active)}, {forward_auth} ); INLINE_ACTION_SENDER(testinline, reqauth)( forward_code, {forward_auth,N(active)}, {forward_auth} );
//SEND_INLINE_ACTION( testinline(forward_code), reqauth, {forward_auth,NAME(active)}, {forward_auth} ); //SEND_INLINE_ACTION( testinline(forward_code), reqauth, {forward_auth,N(active)}, {forward_auth} );
//eosio::dispatch_inline<account_name>( N(forward_code), N(reqauth), {{forward_auth, N(active)}}, {forward_auth} ); //eosio::dispatch_inline<account_name>( N(forward_code), N(reqauth), {{forward_auth, N(active)}}, {forward_auth} );
} }
}; };
......
...@@ -206,8 +206,8 @@ void test_action::test_publication_time() { ...@@ -206,8 +206,8 @@ void test_action::test_publication_time() {
void test_action::test_current_receiver(uint64_t receiver, uint64_t code, uint64_t action) { void test_action::test_current_receiver(uint64_t receiver, uint64_t code, uint64_t action) {
(void)code;(void)action; (void)code;(void)action;
eosio::account_name cur_rec; account_name cur_rec;
read_action_data(&cur_rec, sizeof(eosio::account_name)); read_action_data(&cur_rec, sizeof(account_name));
eosio_assert( receiver == cur_rec, "the current receiver does not match" ); eosio_assert( receiver == cur_rec, "the current receiver does not match" );
} }
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
#include "test_permission.cpp" #include "test_permission.cpp"
#include "test_datastream.cpp" #include "test_datastream.cpp"
eosio::account_name global_receiver; account_name global_receiver;
extern "C" { extern "C" {
void apply( uint64_t receiver, uint64_t code, uint64_t action ) { void apply( uint64_t receiver, uint64_t code, uint64_t action ) {
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
#pragma pack(push, 1) #pragma pack(push, 1)
struct producers { struct producers {
char len; char len;
uint64_t producers[21]; account_name producers[21];
}; };
#pragma pack(pop) #pragma pack(pop)
...@@ -21,7 +21,7 @@ void test_chain::test_activeprods() { ...@@ -21,7 +21,7 @@ void test_chain::test_activeprods() {
eosio_assert(act_prods.len == 21, "producers.len != 21"); eosio_assert(act_prods.len == 21, "producers.len != 21");
producers api_prods; producers api_prods;
get_active_producers(api_prods.producers, sizeof(eosio::account_name)*21); get_active_producers(api_prods.producers, sizeof(account_name)*21);
for( int i = 0; i < 21 ; ++i ) for( int i = 0; i < 21 ; ++i )
eosio_assert(api_prods.producers[i] == act_prods.producers[i], "Active producer"); eosio_assert(api_prods.producers[i] == act_prods.producers[i], "Active producer");
......
...@@ -16,8 +16,8 @@ ...@@ -16,8 +16,8 @@
#include <limits> #include <limits>
struct check_auth_msg { struct check_auth_msg {
eosio::account_name account; account_name account;
eosio::permission_name permission; permission_name permission;
std::vector<public_key> pubkeys; std::vector<public_key> pubkeys;
EOSLIB_SERIALIZE( check_auth_msg, (account)(permission)(pubkeys) ) EOSLIB_SERIALIZE( check_auth_msg, (account)(permission)(pubkeys) )
...@@ -51,8 +51,8 @@ void test_permission::check_authorization(uint64_t receiver, uint64_t code, uint ...@@ -51,8 +51,8 @@ void test_permission::check_authorization(uint64_t receiver, uint64_t code, uint
} }
struct test_permission_last_used_msg { struct test_permission_last_used_msg {
eosio::account_name account; account_name account;
eosio::permission_name permission; permission_name permission;
int64_t last_used_time; int64_t last_used_time;
EOSLIB_SERIALIZE( test_permission_last_used_msg, (account)(permission)(last_used_time) ) EOSLIB_SERIALIZE( test_permission_last_used_msg, (account)(permission)(last_used_time) )
......
...@@ -11,12 +11,12 @@ ...@@ -11,12 +11,12 @@
#pragma pack(push, 1) #pragma pack(push, 1)
template <uint64_t ACCOUNT, uint64_t NAME> template <uint64_t ACCOUNT, uint64_t NAME>
struct test_action_action { struct test_action_action {
static eosio::account_name get_account() { static account_name get_account() {
return eosio::account_name{ACCOUNT}; return account_name(ACCOUNT);
} }
static eosio::action_name get_name() { static action_name get_name() {
return eosio::action_name{NAME}; return action_name(NAME);
} }
eosio::vector<char> data; eosio::vector<char> data;
...@@ -38,12 +38,12 @@ struct test_action_action { ...@@ -38,12 +38,12 @@ struct test_action_action {
template <uint64_t ACCOUNT, uint64_t NAME> template <uint64_t ACCOUNT, uint64_t NAME>
struct test_dummy_action { struct test_dummy_action {
static eosio::account_name get_account() { static account_name get_account() {
return eosio::account_name{ACCOUNT}; return account_name(ACCOUNT);
} }
static eosio::action_name get_name() { static action_name get_name() {
return eosio::action_name{NAME}; return action_name(NAME);
} }
char a; char a;
unsigned long long b; unsigned long long b;
...@@ -75,7 +75,7 @@ void copy_data(char* data, size_t data_len, eosio::vector<char>& data_out) { ...@@ -75,7 +75,7 @@ void copy_data(char* data, size_t data_len, eosio::vector<char>& data_out) {
void test_transaction::send_action() { void test_transaction::send_action() {
using namespace eosio; using namespace eosio;
test_dummy_action<N(testapi), WASM_TEST_ACTION("test_action", "read_action_normal")> test_action = {DUMMY_ACTION_DEFAULT_A, DUMMY_ACTION_DEFAULT_B, DUMMY_ACTION_DEFAULT_C}; test_dummy_action<N(testapi), WASM_TEST_ACTION("test_action", "read_action_normal")> test_action = {DUMMY_ACTION_DEFAULT_A, DUMMY_ACTION_DEFAULT_B, DUMMY_ACTION_DEFAULT_C};
action act(eosio::vector<permission_level>{{NAME(testapi), NAME(active)}}, test_action); action act(eosio::vector<permission_level>{{N(testapi), N(active)}}, test_action);
act.send(); act.send();
} }
...@@ -83,7 +83,7 @@ void test_transaction::send_action_empty() { ...@@ -83,7 +83,7 @@ void test_transaction::send_action_empty() {
using namespace eosio; using namespace eosio;
test_action_action<N(testapi), WASM_TEST_ACTION("test_action", "assert_true")> test_action; test_action_action<N(testapi), WASM_TEST_ACTION("test_action", "assert_true")> test_action;
action act(eosio::vector<permission_level>{{NAME(testapi), NAME(active)}}, test_action); action act(eosio::vector<permission_level>{{N(testapi), N(active)}}, test_action);
act.send(); act.send();
} }
...@@ -96,7 +96,7 @@ void test_transaction::send_action_large() { ...@@ -96,7 +96,7 @@ void test_transaction::send_action_large() {
static char large_message[8 * 1024]; static char large_message[8 * 1024];
test_action_action<N(testapi), WASM_TEST_ACTION("test_action", "read_action_normal")> test_action; test_action_action<N(testapi), WASM_TEST_ACTION("test_action", "read_action_normal")> test_action;
copy_data(large_message, 8*1024, test_action.data); copy_data(large_message, 8*1024, test_action.data);
action act(vector<permission_level>{{NAME(testapi), NAME(active)}}, test_action); action act(vector<permission_level>{{N(testapi), N(active)}}, test_action);
act.send(); act.send();
eosio_assert(false, "send_message_large() should've thrown an error"); eosio_assert(false, "send_message_large() should've thrown an error");
} }
...@@ -111,7 +111,7 @@ void test_transaction::send_action_recurse() { ...@@ -111,7 +111,7 @@ void test_transaction::send_action_recurse() {
test_action_action<N(testapi), WASM_TEST_ACTION("test_transaction", "send_action_recurse")> test_action; test_action_action<N(testapi), WASM_TEST_ACTION("test_transaction", "send_action_recurse")> test_action;
copy_data(buffer, 1024, test_action.data); copy_data(buffer, 1024, test_action.data);
action act(vector<permission_level>{{NAME(testapi), NAME(active)}}, test_action); action act(vector<permission_level>{{N(testapi), N(active)}}, test_action);
act.send(); act.send();
} }
...@@ -123,7 +123,7 @@ void test_transaction::send_action_inline_fail() { ...@@ -123,7 +123,7 @@ void test_transaction::send_action_inline_fail() {
using namespace eosio; using namespace eosio;
test_action_action<N(testapi), WASM_TEST_ACTION("test_action", "assert_false")> test_action; test_action_action<N(testapi), WASM_TEST_ACTION("test_action", "assert_false")> test_action;
action act(vector<permission_level>{{NAME(testapi), NAME(active)}}, test_action); action act(vector<permission_level>{{N(testapi), N(active)}}, test_action);
act.send(); act.send();
} }
...@@ -170,8 +170,8 @@ void test_transaction::send_transaction(uint64_t receiver, uint64_t, uint64_t) { ...@@ -170,8 +170,8 @@ void test_transaction::send_transaction(uint64_t receiver, uint64_t, uint64_t) {
copy_data((char*)&payload, sizeof(dummy_action), test_action.data); copy_data((char*)&payload, sizeof(dummy_action), test_action.data);
auto trx = transaction(); auto trx = transaction();
trx.actions.emplace_back(vector<permission_level>{{NAME(testapi), NAME(active)}}, test_action); trx.actions.emplace_back(vector<permission_level>{{N(testapi), N(active)}}, test_action);
trx.send(0, eosio::account_name{receiver}); trx.send(0, receiver);
} }
void test_transaction::send_action_sender(uint64_t receiver, uint64_t, uint64_t) { void test_transaction::send_action_sender(uint64_t receiver, uint64_t, uint64_t) {
...@@ -182,14 +182,14 @@ void test_transaction::send_action_sender(uint64_t receiver, uint64_t, uint64_t) ...@@ -182,14 +182,14 @@ void test_transaction::send_action_sender(uint64_t receiver, uint64_t, uint64_t)
copy_data((char*)&cur_send, sizeof(account_name), test_action.data); copy_data((char*)&cur_send, sizeof(account_name), test_action.data);
auto trx = transaction(); auto trx = transaction();
trx.actions.emplace_back(vector<permission_level>{{NAME(testapi), NAME(active)}}, test_action); trx.actions.emplace_back(vector<permission_level>{{N(testapi), N(active)}}, test_action);
trx.send(0, eosio::account_name{receiver}); trx.send(0, receiver);
} }
void test_transaction::send_transaction_empty(uint64_t receiver, uint64_t, uint64_t) { void test_transaction::send_transaction_empty(uint64_t receiver, uint64_t, uint64_t) {
using namespace eosio; using namespace eosio;
auto trx = transaction(); auto trx = transaction();
trx.send(0, eosio::account_name{receiver}); trx.send(0, receiver);
eosio_assert(false, "send_transaction_empty() should've thrown an error"); eosio_assert(false, "send_transaction_empty() should've thrown an error");
} }
...@@ -198,8 +198,8 @@ void test_transaction::send_transaction_trigger_error_handler(uint64_t receiver, ...@@ -198,8 +198,8 @@ void test_transaction::send_transaction_trigger_error_handler(uint64_t receiver,
using namespace eosio; using namespace eosio;
auto trx = transaction(); auto trx = transaction();
test_action_action<N(testapi), WASM_TEST_ACTION("test_action", "assert_false")> test_action; test_action_action<N(testapi), WASM_TEST_ACTION("test_action", "assert_false")> test_action;
trx.actions.emplace_back(vector<permission_level>{{NAME(testapi), NAME(active)}}, test_action); trx.actions.emplace_back(vector<permission_level>{{N(testapi), N(active)}}, test_action);
trx.send(0, eosio::account_name{receiver}); trx.send(0, receiver);
} }
void test_transaction::assert_false_error_handler(const eosio::transaction& dtrx) { void test_transaction::assert_false_error_handler(const eosio::transaction& dtrx) {
...@@ -221,10 +221,10 @@ void test_transaction::send_transaction_large(uint64_t receiver, uint64_t, uint6 ...@@ -221,10 +221,10 @@ void test_transaction::send_transaction_large(uint64_t receiver, uint64_t, uint6
char large_message[1024]; char large_message[1024];
test_action_action<N(testapi), WASM_TEST_ACTION("test_action", "read_action_normal")> test_action; test_action_action<N(testapi), WASM_TEST_ACTION("test_action", "read_action_normal")> test_action;
copy_data(large_message, 1024, test_action.data); copy_data(large_message, 1024, test_action.data);
trx.actions.emplace_back(vector<permission_level>{{NAME(testapi), NAME(active)}}, test_action); trx.actions.emplace_back(vector<permission_level>{{N(testapi), N(active)}}, test_action);
} }
trx.send(0, eosio::account_name{receiver}); trx.send(0, receiver);
eosio_assert(false, "send_transaction_large() should've thrown an error"); eosio_assert(false, "send_transaction_large() should've thrown an error");
} }
...@@ -240,18 +240,18 @@ void test_transaction::send_deferred_transaction(uint64_t receiver, uint64_t, ui ...@@ -240,18 +240,18 @@ void test_transaction::send_deferred_transaction(uint64_t receiver, uint64_t, ui
using namespace eosio; using namespace eosio;
auto trx = transaction(); auto trx = transaction();
test_action_action<N(testapi), WASM_TEST_ACTION("test_transaction", "deferred_print")> test_action; test_action_action<N(testapi), WASM_TEST_ACTION("test_transaction", "deferred_print")> test_action;
trx.actions.emplace_back(vector<permission_level>{{NAME(testapi), NAME(active)}}, test_action); trx.actions.emplace_back(vector<permission_level>{{N(testapi), N(active)}}, test_action);
trx.delay_sec = 2; trx.delay_sec = 2;
trx.send( 0xffffffffffffffff, eosio::account_name{receiver} ); trx.send( 0xffffffffffffffff, receiver );
} }
void test_transaction::send_deferred_transaction_replace(uint64_t receiver, uint64_t, uint64_t) { void test_transaction::send_deferred_transaction_replace(uint64_t receiver, uint64_t, uint64_t) {
using namespace eosio; using namespace eosio;
auto trx = transaction(); auto trx = transaction();
test_action_action<N(testapi), WASM_TEST_ACTION("test_transaction", "deferred_print")> test_action; test_action_action<N(testapi), WASM_TEST_ACTION("test_transaction", "deferred_print")> test_action;
trx.actions.emplace_back(vector<permission_level>{{NAME(testapi), NAME(active)}}, test_action); trx.actions.emplace_back(vector<permission_level>{{N(testapi), N(active)}}, test_action);
trx.delay_sec = 2; trx.delay_sec = 2;
trx.send( 0xffffffffffffffff, eosio::account_name{receiver}, true ); trx.send( 0xffffffffffffffff, receiver, true );
} }
void test_transaction::send_deferred_tx_with_dtt_action() { void test_transaction::send_deferred_tx_with_dtt_action() {
...@@ -260,14 +260,14 @@ void test_transaction::send_deferred_tx_with_dtt_action() { ...@@ -260,14 +260,14 @@ void test_transaction::send_deferred_tx_with_dtt_action() {
read_action_data(&dtt_act, action_data_size()); read_action_data(&dtt_act, action_data_size());
action deferred_act; action deferred_act;
deferred_act.account = eosio::account_name{dtt_act.deferred_account}; deferred_act.account = dtt_act.deferred_account;
deferred_act.name = eosio::action_name{dtt_act.deferred_action}; deferred_act.name = dtt_act.deferred_action;
deferred_act.authorization = vector<permission_level>{{NAME(testapi), eosio::permission_name{dtt_act.permission_name}}}; deferred_act.authorization = vector<permission_level>{{N(testapi), dtt_act.permission_name}};
auto trx = transaction(); auto trx = transaction();
trx.actions.emplace_back(deferred_act); trx.actions.emplace_back(deferred_act);
trx.delay_sec = dtt_act.delay_sec; trx.delay_sec = dtt_act.delay_sec;
trx.send( 0xffffffffffffffff, eosio::account_name{dtt_act.payer}, true ); trx.send( 0xffffffffffffffff, dtt_act.payer, true );
} }
...@@ -293,7 +293,7 @@ void test_transaction::send_cf_action() { ...@@ -293,7 +293,7 @@ void test_transaction::send_cf_action() {
void test_transaction::send_cf_action_fail() { void test_transaction::send_cf_action_fail() {
using namespace eosio; using namespace eosio;
test_action_action<N(dummy), N(event1)> cfa; test_action_action<N(dummy), N(event1)> cfa;
action act(vector<permission_level>{{NAME(dummy), NAME(active)}}, cfa); action act(vector<permission_level>{{N(dummy), N(active)}}, cfa);
act.send_context_free(); act.send_context_free();
eosio_assert(false, "send_cfa_action_fail() should've thrown an error"); eosio_assert(false, "send_cfa_action_fail() should've thrown an error");
} }
......
...@@ -16,8 +16,9 @@ void test_types::types_size() { ...@@ -16,8 +16,9 @@ void test_types::types_size() {
eosio_assert( sizeof(int128_t) == 16, "int128_t size != 16"); eosio_assert( sizeof(int128_t) == 16, "int128_t size != 16");
eosio_assert( sizeof(uint8_t) == 1, "uint8_t size != 1"); eosio_assert( sizeof(uint8_t) == 1, "uint8_t size != 1");
eosio_assert( sizeof(eosio::account_name) == 8, "account_name size != 8"); eosio_assert( sizeof(account_name) == 8, "account_name size != 8");
eosio_assert( sizeof(eosio::table_name) == 8, "table_name size != 8"); eosio_assert( sizeof(table_name) == 8, "table_name size != 8");
eosio_assert( sizeof(time) == 4, "time size != 4");
eosio_assert( sizeof(eosio::key256) == 32, "key256 size != 32" ); eosio_assert( sizeof(eosio::key256) == 32, "key256 size != 32" );
} }
......
...@@ -21,7 +21,7 @@ int tertiary_ub[11] = {1,2,3,5,3,6,7,8,9,-1,1}; ...@@ -21,7 +21,7 @@ int tertiary_ub[11] = {1,2,3,5,3,6,7,8,9,-1,1};
#pragma pack(push, 1) #pragma pack(push, 1)
struct test_model { struct test_model {
eosio::account_name name; account_name name;
unsigned char age; unsigned char age;
uint64_t phone; uint64_t phone;
}; };
......
...@@ -12,12 +12,12 @@ class test_ram_limit : public eosio::contract { ...@@ -12,12 +12,12 @@ class test_ram_limit : public eosio::contract {
public: public:
const uint32_t FIVE_MINUTES = 5*60; const uint32_t FIVE_MINUTES = 5*60;
test_ram_limit(eosio::account_name self) test_ram_limit(account_name self)
:eosio::contract(self) :eosio::contract(self)
{} {}
//@abi action //@abi action
void setentry(eosio::account_name payer, uint64_t from, uint64_t to, uint64_t size) { void setentry(account_name payer, uint64_t from, uint64_t to, uint64_t size) {
const auto self = get_self(); const auto self = get_self();
eosio::print("test_ram_limit::setentry ", eosio::name{self}, "\n"); eosio::print("test_ram_limit::setentry ", eosio::name{self}, "\n");
test_table table(self, self); test_table table(self, self);
......
...@@ -78,10 +78,10 @@ struct impl { ...@@ -78,10 +78,10 @@ struct impl {
} }
} }
if (is_board_full) { if (is_board_full) {
return NAME(draw); return N(draw);
} }
} }
return NAME(none); return N(none);
} }
/** /**
......
...@@ -43,8 +43,8 @@ ...@@ -43,8 +43,8 @@
*/ */
namespace tic_tac_toe { namespace tic_tac_toe {
static const uint64_t games_account = N(games); static const account_name games_account = N(games);
static const uint64_t code_account = N(tic.tac.toe); static const account_name code_account = N(tic.tac.toe);
/** /**
* @brief Data structure to hold game information * @brief Data structure to hold game information
...@@ -52,15 +52,15 @@ namespace tic_tac_toe { ...@@ -52,15 +52,15 @@ namespace tic_tac_toe {
static const uint32_t board_len = 9; static const uint32_t board_len = 9;
struct game { struct game {
game() { initialize_board(); } game() { initialize_board(); }
game(eosio::account_name challenger_account, eosio::account_name host_account) game(account_name challenger_account, account_name host_account)
: challenger(challenger_account), host(host_account), turn(host_account) { : challenger(challenger_account), host(host_account), turn(host_account) {
// Initialize board // Initialize board
initialize_board(); initialize_board();
} }
eosio::account_name challenger; account_name challenger;
eosio::account_name host; account_name host;
eosio::account_name turn; // = account name of host/ challenger account_name turn; // = account name of host/ challenger
eosio::account_name winner = NAME(none); // = none/ draw/ account name of host/ challenger account_name winner = N(none); // = none/ draw/ account name of host/ challenger
uint8_t board[board_len]; uint8_t board[board_len];
// Initialize board with empty cell // Initialize board with empty cell
...@@ -74,7 +74,7 @@ namespace tic_tac_toe { ...@@ -74,7 +74,7 @@ namespace tic_tac_toe {
void reset_game() { void reset_game() {
initialize_board(); initialize_board();
turn = host; turn = host;
winner = NAME(none); winner = N(none);
} }
auto primary_key() const { return challenger; } auto primary_key() const { return challenger; }
...@@ -86,8 +86,8 @@ namespace tic_tac_toe { ...@@ -86,8 +86,8 @@ namespace tic_tac_toe {
* @brief Action to create new game * @brief Action to create new game
*/ */
struct create { struct create {
eosio::account_name challenger; account_name challenger;
eosio::account_name host; account_name host;
EOSLIB_SERIALIZE( create, (challenger)(host) ) EOSLIB_SERIALIZE( create, (challenger)(host) )
}; };
...@@ -96,9 +96,9 @@ namespace tic_tac_toe { ...@@ -96,9 +96,9 @@ namespace tic_tac_toe {
* @brief Action to restart new game * @brief Action to restart new game
*/ */
struct restart { struct restart {
eosio::account_name challenger; account_name challenger;
eosio::account_name host; account_name host;
eosio::account_name by; // the account who wants to restart the game account_name by; // the account who wants to restart the game
EOSLIB_SERIALIZE( restart, (challenger)(host)(by) ) EOSLIB_SERIALIZE( restart, (challenger)(host)(by) )
}; };
...@@ -107,8 +107,8 @@ namespace tic_tac_toe { ...@@ -107,8 +107,8 @@ namespace tic_tac_toe {
* @brief Action to close new game * @brief Action to close new game
*/ */
struct close { struct close {
eosio::account_name challenger; account_name challenger;
eosio::account_name host; account_name host;
EOSLIB_SERIALIZE( close, (challenger)(host) ) EOSLIB_SERIALIZE( close, (challenger)(host) )
}; };
...@@ -127,9 +127,9 @@ namespace tic_tac_toe { ...@@ -127,9 +127,9 @@ namespace tic_tac_toe {
* @brief Action to make movement * @brief Action to make movement
*/ */
struct move { struct move {
eosio::account_name challenger; account_name challenger;
eosio::account_name host; account_name host;
eosio::account_name by; // the account who wants to make the move account_name by; // the account who wants to make the move
movement mvt; movement mvt;
EOSLIB_SERIALIZE( move, (challenger)(host)(by)(mvt) ) EOSLIB_SERIALIZE( move, (challenger)(host)(by)(mvt) )
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册