Skip to content

Commit

Permalink
add unregtoken
Browse files Browse the repository at this point in the history
  • Loading branch information
taokayan committed Oct 13, 2023
1 parent bbb40b3 commit 0895889
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
2 changes: 2 additions & 0 deletions antelope_contracts/contracts/erc20/include/erc20/erc20.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ class [[eosio::contract]] erc20 : public contract {
[[eosio::action]] void setingressfee(eosio::name token_contract, eosio::asset ingress_fee);
[[eosio::action]] void withdrawfee(eosio::name token_contract, eosio::asset quantity, eosio::name to, std::string memo);

[[eosio::action]] void unregtoken(eosio::name eos_contract_name, eosio::symbol_code token_symbol_code);

struct [[eosio::table("implcontract")]] impl_contract_t {
uint64_t id = 0;
bytes address;
Expand Down
11 changes: 11 additions & 0 deletions antelope_contracts/contracts/erc20/src/erc20.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,17 @@ void erc20::setegressfee(eosio::name token_contract, eosio::symbol_code token_sy
call_act.send(receiver_account(), token_table_iter->address, value_zero, call_data, evm_gaslimit);
}

void erc20::unregtoken(eosio::name token_contract, eosio::symbol_code token_symbol_code) {
require_auth(get_self());

token_table_t token_table(_self, _self.value);
auto index_symbol = token_table.get_index<"by.symbol"_n>();
auto token_table_iter = index_symbol.find(token_symbol_key(token_contract, token_symbol_code));
eosio::check(token_table_iter != index_symbol.end(), "token not registered");

index_symbol.erase(token_table_iter);
}

inline eosio::name erc20::receiver_account()const {
return get_self();
}
Expand Down
8 changes: 4 additions & 4 deletions antelope_contracts/tests/erc20/erc20_tester.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,11 @@ struct exec_output {

struct token_t {
uint64_t id = 0;
eosio::chain::name token_contract;
eosio::chain::name token_contract{};
bytes address; // <-- proxy contract addr
eosio::chain::asset ingress_fee;
eosio::chain::asset balance; // <-- total amount in EVM side
eosio::chain::asset fee_balance;
eosio::chain::asset ingress_fee{};
eosio::chain::asset balance{}; // <-- total amount in EVM side
eosio::chain::asset fee_balance{};
uint8_t erc20_precision = 0;

};
Expand Down

0 comments on commit 0895889

Please sign in to comment.