Skip to content

Commit

Permalink
Merge pull request #82 from Tonomy-Foundation/feature/73-disable-unused
Browse files Browse the repository at this point in the history
fix the contract according to gov name
  • Loading branch information
sadiabbasi authored Jan 10, 2024
2 parents 27637aa + 1bcb77e commit 53b1a4a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,9 @@ namespace eosiobiostonomy
* @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) {
require_auth(gov_name);
}

/**
* Set code action sets the contract code for an account.
Expand All @@ -171,7 +173,10 @@ namespace eosiobiostonomy
* @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) {
require_auth(gov_name);

}

/**
* Set abi action sets the abi for contract identified by `account` name. Creates an entry in the abi_hash_table
Expand Down
18 changes: 7 additions & 11 deletions contracts/eosio.bios.tonomy/src/eosio.bios.tonomy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,41 +12,36 @@ namespace eosiobiostonomy

void bios::newaccount(name creator, name name, ignore<authority> owner, ignore<authority> active)
{
require_auth(gov_name);
check_sender("id.tmy"_n);
check_sender(idtmy_name);
}

void bios::updateauth(ignore<name> account,
ignore<name> permission,
ignore<name> parent,
ignore<authority> auth)
{
require_auth(gov_name);
check_sender("id.tmy"_n);
check_sender(idtmy_name);
}

void bios::deleteauth(ignore<name> account,
ignore<name> permission)
{
require_auth(gov_name);
check_sender("id.tmy"_n);
check_sender(idtmy_name);
}

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

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

// TODO need to change so that other functions can only be called by tonomy logic
Expand Down Expand Up @@ -112,6 +107,7 @@ namespace eosiobiostonomy

void bios::reqactivated(const eosio::checksum256 &feature_digest)
{
require_auth(gov_name);
check(is_feature_activated(feature_digest), "protocol feature is not activated");
}

Expand Down Expand Up @@ -204,7 +200,7 @@ void bios::sellram(eosio::name dao_owner, eosio::name app, eosio::asset quant) {
require_auth(app); // Check that the app has the necessary authorization

// Access the account table from id.tmy.hpp
idtmy::id::account_type_table account_type("id.tmy"_n, "id.tmy"_n.value);
idtmy::id::account_type_table account_type(idtmy_name, idtmy_name.value);
// Check the account type of the app
auto itr = account_type.find(app.value);
eosio::check(itr != account_type.end(), "Could not find account");
Expand Down

0 comments on commit 53b1a4a

Please sign in to comment.