Skip to content

Commit

Permalink
Change transferFrom to transfer on send ETH (#35)
Browse files Browse the repository at this point in the history
* change transferFrom to transfer on send ETH

* fix evm20 abi

* fix transferFrom abi
  • Loading branch information
jxnata authored Feb 7, 2024
1 parent 743eea1 commit 5800202
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
5 changes: 2 additions & 3 deletions packages/kos-sdk/src/chains/ethereum/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -254,13 +254,12 @@ impl ETH {
if !is_eth_token {
// update contract data for token transfer
let contract = evm20::get_contract_evm20();
let func = contract.function("transferFrom").map_err(|e| {
Error::InvalidMessage(format!("failed to get transferFrom function: {}", e))
let func = contract.function("transfer").map_err(|e| {
Error::InvalidMessage(format!("failed to get transfer function: {}", e))
})?;

let encoded = func
.encode_input(&[
ethabi::Token::Address(addr_sender.into()),
ethabi::Token::Address(addr_receiver.into()),
ethabi::Token::Uint(
U256::from_dec_str(&amount.to_string())
Expand Down
2 changes: 1 addition & 1 deletion packages/kos-sdk/src/chains/evm20.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ const EVM20_CONTRACT_ABI: &str = r#"
}
],
"payable": false,
"stateMutability": "nonpayable",
"stateMutability": "nonpayable",
"type": "function"
},
{
Expand Down

0 comments on commit 5800202

Please sign in to comment.