Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Archive implementation #81

Merged
merged 3 commits into from
Apr 26, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 5 additions & 8 deletions imports/eosio.imports.in
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,9 @@ action_data_size
current_receiver
require_recipient
require_auth
weak_require_auth
require_auth2
weak_require_auth2
has_auth
is_account
is_domain
Expand Down Expand Up @@ -180,18 +182,13 @@ chaindb_next
chaindb_prev
chaindb_datasize
chaindb_data
chaindb_service
chaindb_available_primary_key
chaindb_insert
chaindb_update
chaindb_delete
chaindb_ram_state
send_event
get_bw_cpu_limit
get_bw_net_limit
is_provided_bw_confirmed
set_bw_limits
confirm_bw_limits
get_ram_provider
update_stake_proxied
recall_stake_proxied
save_record
lookup_record

21 changes: 20 additions & 1 deletion libraries/eosiolib/action.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,16 @@ extern "C" {
*/
void require_auth( capi_name name );

/**
/**
* Works like require_auth, but on fail returns bad result instead of breaking
*
* @brief Verify specified account exists in the set of provided auths
* @param name - name of the account to be verified
* @return result of checking
*/
bool weak_require_auth( capi_name name );

/**
* Verifies that name has auth.
*
* @brief Verifies that name has auth.
Expand All @@ -113,6 +122,16 @@ extern "C" {
*/
void require_auth2( capi_name name, capi_name permission );

/**
* Works like require_auth2, but on fail returns bad result instead of breaking
*
* @brief Verify specified account exists in the set of provided auths
* @param name - name of the account to be verified
* @param permission - permission level to be verified
* @return result of checking
*/
bool weak_require_auth2( capi_name name, capi_name permission );

/**
* Verifies that @ref name is an existing account.
*
Expand Down
23 changes: 23 additions & 0 deletions libraries/eosiolib/action.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,17 @@ namespace eosio {
::require_auth( n.value );
}

/**
* Works like require_auth, but on fail returns bad result instead of breaking
*
* @brief Verify specified account exists in the set of provided auths
* @param name - name of the account to be verified
* @return result of checking
*/
inline bool weak_require_auth( name n ) {
return ::weak_require_auth( n.value );
}

/**
* Packed representation of a permission level (Authorization)
*
Expand Down Expand Up @@ -158,6 +169,18 @@ namespace eosio {
::require_auth2( level.actor.value, level.permission.value );
}

/**
* Works like require_auth, but on fail returns bad result instead of breaking
*
* @brief Require the specified authorization for this action
*
* @param level - Authorization to be required
* @return result of checking
*/
inline bool weak_require_auth( const permission_level& level ) {
return ::weak_require_auth2( level.actor.value, level.permission.value );
}

/**
* Verifies that @ref n has auth.
*
Expand Down
42 changes: 0 additions & 42 deletions libraries/eosiolib/archive.h

This file was deleted.

68 changes: 0 additions & 68 deletions libraries/eosiolib/archive.hpp

This file was deleted.

66 changes: 0 additions & 66 deletions libraries/eosiolib/bandwith.hpp

This file was deleted.

9 changes: 6 additions & 3 deletions libraries/eosiolib/chaindb.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,15 @@ primary_key_t chaindb_prev(account_name_t code, cursor_t);

int32_t chaindb_datasize(account_name_t code, cursor_t);
primary_key_t chaindb_data(account_name_t code, cursor_t, void* data, const size_t size);
int32_t chaindb_service(account_name_t code, cursor_t, void* data, const size_t size);

primary_key_t chaindb_available_primary_key(account_name_t code, scope_t scope, table_name_t table);

primary_key_t chaindb_insert(account_name_t code, scope_t scope, account_name_t payer, table_name_t, primary_key_t, void* data, size_t);
primary_key_t chaindb_update(account_name_t code, scope_t scope, account_name_t payer, table_name_t, primary_key_t, void* data, size_t);
primary_key_t chaindb_delete(account_name_t code, scope_t scope, table_name_t, primary_key_t);
int32_t chaindb_insert(account_name_t code, scope_t scope, account_name_t payer, table_name_t, primary_key_t, void* data, size_t);
int32_t chaindb_update(account_name_t code, scope_t scope, account_name_t payer, table_name_t, primary_key_t, void* data, size_t);
int32_t chaindb_delete(account_name_t code, scope_t scope, table_name_t, primary_key_t);

void chaindb_ram_state(account_name_t code, scope_t scope, table_name_t, primary_key_t, bool);

#ifdef __cplusplus
}
Expand Down