Skip to content

Commit

Permalink
BLOCK-2575 - Sponsor account balance for uos.pool to avoid requiring …
Browse files Browse the repository at this point in the history
…its signature
  • Loading branch information
igor-sikachyna committed Nov 13, 2024
1 parent ea7d0c7 commit 609d666
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 11 deletions.
3 changes: 2 additions & 1 deletion include/evm_runtime/evm_contract.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,8 @@ class [[eosio::contract]] evm_contract : public contract
#endif

private:
void open_internal_balance(eosio::name owner);
/*ultra-igor-sikachyna---BLOCK-2575 review evm contract --- allow evm contract to sponsor ram for uos.pool account balance*/
void open_internal_balance(eosio::name owner, bool ram_sponsored = false);
std::shared_ptr<struct config_wrapper> _config;

enum class status_flags : uint32_t
Expand Down
8 changes: 4 additions & 4 deletions src/actions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ void evm_contract::init(const uint64_t chainid, const fee_parameters& fee_params
});

open_internal_balance(get_self());
open_internal_balance(uos_pool_account);
open_internal_balance(uos_pool_account, true);
}

void evm_contract::setfeeparams(const fee_parameters& fee_params)
Expand Down Expand Up @@ -594,17 +594,17 @@ void evm_contract::open(eosio::name owner) {
open_internal_balance(owner);
}

void evm_contract::open_internal_balance(eosio::name owner) {
void evm_contract::open_internal_balance(eosio::name owner, bool ram_sponsored) {
balances balance_table(get_self(), get_self().value);
if(balance_table.find(owner.value) == balance_table.end())
balance_table.emplace(owner, [&](balance& a) {
balance_table.emplace(ram_sponsored ? get_self() : owner, [&](balance& a) {
a.owner = owner;
a.balance.balance = eosio::asset(0, _config->get_token_symbol());
});

nextnonces nextnonce_table(get_self(), get_self().value);
if(nextnonce_table.find(owner.value) == nextnonce_table.end())
nextnonce_table.emplace(owner, [&](nextnonce& a) {
nextnonce_table.emplace(ram_sponsored ? get_self() : owner, [&](nextnonce& a) {
a.owner = owner;
});
}
Expand Down
6 changes: 0 additions & 6 deletions ultratests/eosevm.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -185,11 +185,6 @@ export default class Test extends UltraTest {
super();
}

// handled by genesis plugin
// requiredProducers() {
// return 1;
// }

async onChainStart(ultra: UltraTestAPI) {
ultra.addPlugins([genesis(ultra), system(ultra), ultraContracts(ultra), await ultraStartup(ultra)]);
}
Expand All @@ -205,7 +200,6 @@ export default class Test extends UltraTest {
return [{
account: EVM_CONTRACT,
contract: "../build/evm_runtime",
isPrivileged: true
}]
}

Expand Down

0 comments on commit 609d666

Please sign in to comment.