@@ -1055,6 +1055,51 @@ try {
1055
1055
evm_address = gold_evm_acc->address_0x ();
1056
1056
bal = balanceOf (evm2.address_0x ().c_str ());
1057
1057
BOOST_REQUIRE (bal == 634'000'000'000'000'000 );
1058
+
1059
+ // set egress fee to 0.5 EOS
1060
+ constexpr intx::uint256 minimum_natively_representable = intx::exp (10_u256, intx::uint256 (18 - 4 ));
1061
+ evm_address = proxy_address;
1062
+ push_action (erc20_account, " setegressfee" _n, erc20_account,
1063
+ mvo ()(" token_contract" , gold_token_account_name)(" token_symbol_code" , " GOLD" )(" egress_fee" , make_asset (5000 )));
1064
+ BOOST_REQUIRE (5000 * minimum_natively_representable == egressFee ());
1065
+
1066
+ // EVM -> native with old fee, should not work
1067
+ evm_address = proxy_address;
1068
+ bridgeTransferERC20 (evm2, addr_alice, (uint64_t )100'000'000'000'000'000 , " hello world" , fee);
1069
+ produce_block ();
1070
+
1071
+ evm_address = gold_evm_acc->address_0x ();
1072
+ bal = balanceOf (evm2.address_0x ().c_str ());
1073
+ BOOST_REQUIRE (bal == 634'000'000'000'000'000 );
1074
+
1075
+ // EVM -> native with new fee, should work
1076
+ evm_address = proxy_address;
1077
+ fee = egressFee ();
1078
+ bridgeTransferERC20 (evm2, addr_alice, (uint64_t )100'000'000'000'000'000 , " hello world" , fee);
1079
+ produce_block ();
1080
+
1081
+ evm_address = gold_evm_acc->address_0x ();
1082
+ bal = balanceOf (evm2.address_0x ().c_str ());
1083
+ BOOST_REQUIRE (bal == 534'000'000'000'000'000 );
1084
+
1085
+ // unregtoken
1086
+ push_action (
1087
+ erc20_account, " unregtoken" _n, erc20_account, mvo ()(" eos_contract_name" , gold_token_account_name)(" token_symbol_code" , " GOLD" ));
1088
+
1089
+ // EOS->EVM not allowed after unregtoken
1090
+ BOOST_REQUIRE_EXCEPTION (
1091
+ transfer_token (gold_token_account_name, " alice" _n, erc20_account, make_asset (2000 , symbol::from_string (" 4,GOLD" )), evm2.address_0x ().c_str ()),
1092
+ eosio_assert_message_exception,
1093
+ eosio_assert_message_is (" received unregistered token" ));
1094
+
1095
+ // EVM -> native not allowed
1096
+ evm_address = proxy_address;
1097
+ fee = egressFee ();
1098
+ BOOST_REQUIRE_EXCEPTION (
1099
+ bridgeTransferERC20 (evm2, addr_alice, (uint64_t )100'000'000'000'000'000 , " hello world" , fee),
1100
+ eosio_assert_message_exception,
1101
+ eosio_assert_message_is (" ERC-20 token not registerred" ));
1102
+
1058
1103
}
1059
1104
FC_LOG_AND_RETHROW ()
1060
1105
0 commit comments