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

feature/73 added gov auth in unimplemented functon #80

Merged
merged 6 commits into from
Jan 9, 2024
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions contracts/eosio.bios.tonomy/src/eosio.bios.tonomy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ namespace eosiobiostonomy

void bios::newaccount(name creator, name name, ignore<authority> owner, ignore<authority> active)
{
// require_auth(creator); // this is done implicity in apply_eosio_newaccount() which checks the "active" permission...
require_auth(gov_name);
check_sender("id.tmy"_n);
}

Expand All @@ -21,14 +21,14 @@ namespace eosiobiostonomy
ignore<name> parent,
ignore<authority> auth)
{
// check(has_auth({account, permission}) || has_auth({account, parent}), "not authorized by parent or permission"); // this is done implicity in apply_eosio_updateauth()...
require_auth(gov_name);
check_sender("id.tmy"_n);
}

void bios::deleteauth(ignore<name> account,
ignore<name> permission)
{
// require_auth({account, permission}); // this is done implicity in apply_eosio_deleteauth()...
require_auth(gov_name);
check_sender("id.tmy"_n);
}

Expand All @@ -37,20 +37,23 @@ namespace eosiobiostonomy
ignore<name> type,
ignore<name> requirement)
{
require_auth(gov_name);
check_sender("id.tmy"_n);
}

void bios::unlinkauth(ignore<name> account,
ignore<name> code,
ignore<name> type)
{
require_auth(gov_name);
check_sender("id.tmy"_n);
}

// TODO need to change so that other functions can only be called by tonomy logic

void bios::setabi(name account, const std::vector<char> &abi)
{
require_auth(gov_name);
abi_hash_table table(get_self(), get_self().value);
auto itr = table.find(account.value);
if (itr == table.end())
Expand Down
22 changes: 15 additions & 7 deletions contracts/eosio.bios/include/eosio.bios/eosio.bios.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,8 @@ namespace eosiobios
[[eosio::action]] void newaccount(name creator,
name name,
ignore<authority> owner,
ignore<authority> active) {}
ignore<authority> active) {
}
/**
* Update authorization action updates pemission for an account.
*
Expand All @@ -111,7 +112,8 @@ namespace eosiobios
[[eosio::action]] void updateauth(ignore<name> account,
ignore<name> permission,
ignore<name> parent,
ignore<authority> auth) {}
ignore<authority> auth) {
}

/**
* Delete authorization action deletes the authorization for an account's permission.
Expand All @@ -120,7 +122,9 @@ namespace eosiobios
* @param permission - the permission name been deleted.
*/
[[eosio::action]] void deleteauth(ignore<name> account,
ignore<name> permission) {}
ignore<name> permission) {

}

/**
* Link authorization action assigns a specific action from a contract to a permission you have created. Five system
Expand All @@ -140,7 +144,8 @@ namespace eosiobios
[[eosio::action]] void linkauth(ignore<name> account,
ignore<name> code,
ignore<name> type,
ignore<name> requirement) {}
ignore<name> requirement) {
}

/**
* Unlink authorization action it's doing the reverse of linkauth action, by unlinking the given action.
Expand All @@ -151,15 +156,17 @@ namespace eosiobios
*/
[[eosio::action]] void unlinkauth(ignore<name> account,
ignore<name> code,
ignore<name> type) {}
ignore<name> type) {
}

/**
* Cancel delay action cancels a deferred transaction.
*
* @param canceling_auth - the permission that authorizes this action,
* @param trx_id - the deferred transaction id to be cancelled.
*/
[[eosio::action]] void canceldelay(ignore<permission_level> canceling_auth, ignore<checksum256> trx_id) {}
[[eosio::action]] void canceldelay(ignore<permission_level> canceling_auth, ignore<checksum256> trx_id) {
}

/**
* Set code action sets the contract code for an account.
Expand All @@ -169,7 +176,8 @@ namespace eosiobios
* @param vmversion - reserved, set it to zero.
* @param code - the code content to be set, in the form of a blob binary..
*/
[[eosio::action]] void setcode(name account, uint8_t vmtype, uint8_t vmversion, const std::vector<char> &code) {}
[[eosio::action]] void setcode(name account, uint8_t vmtype, uint8_t vmversion, const std::vector<char> &code) {
}

/**
* Set abi action sets the abi for contract identified by `account` name. Creates an entry in the abi_hash_table
Expand Down