Skip to content

Commit

Permalink
chore: handling the evm to native usdt transfer
Browse files Browse the repository at this point in the history
  • Loading branch information
dafuga committed Nov 10, 2023
1 parent db75a35 commit 1f41dc9
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/pages/transfer/managers/eosEvmBridge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export class EosEvmBridge extends TransferManager {
transfer(amount: string, tokenSymbol: Asset.SymbolType = '4,EOS') {
const action = Transfer.from({
from: this.nativeSession.auth.actor,
to: 'eosio.evm',
to: 'eosio.evmin',
quantity: String(Asset.fromFloat(Number(amount), tokenSymbol)),
memo: this.evmSession.address,
})
Expand Down
19 changes: 19 additions & 0 deletions src/pages/transfer/managers/evmEosBridge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,25 @@ export class EvmEosBridge extends TransferManager {

const {gas} = await this.estimateGas(amountToTransfer)

// In the case of an USDT transfer, we must construct the transaction differently here
// From EVM bridge FE:
//
// USDT
// const fee = await this.erc20_contract().methods.egressFee().call()
// let tx = {
// from: this.address,
// to: this.erc20_addr(),
// value: fee,
// gasPrice: this.gasPrice,
// data: this.erc20_contract().methods.bridgeTransfer(this.addressEvm, this.transferValue, this.memo).encodeABI(),
// }

// if (gaslimit != null) {
// tx.gas = gaslimit;
// }
// return tx
//

return this.evmSession.sendTransaction({
from: this.evmSession.address,
to: targetEvmAddress,
Expand Down

0 comments on commit 1f41dc9

Please sign in to comment.