Closed gouravnaik closed 1 year ago
Yes, this is something we need to work on for sure!
@gouravnaik have you been able to get past this issue?
@gouravnaik have you been able to get past this issue?
I am generating data and then send the transaction. Steps I am using currently @skeevis
def self.get_transfer_data(recipient, amount)
transfer_method = "0xa9059cbb" #Encoded Abi for transfer method name
binary_data = Eth::Abi.encode(["address","uint256"],[recipient.public_key, amount])
hex_data = binary_data.unpack('H*').first
data = transfer_method+hex_data
end
def self.token_transfer(chainId, token, amount, recipient, sender)
transfer_data = MyDapp.get_transfer_data(recipient,amount)
data = Hash["chainId", chainId, "to", token, "data", transfer_data]
payload = create_payload(data, sender.public_key)
send_transaction(payload, sender)
end
Should be addressed in #191 - I'll make sure to write some tests.
Confirming this should be fixed in #191
geth = Client.create "/tmp/geth.ipc"
# => #<Eth::Client::Ipc:0x0000557f2508dc80 @gas_limit=21000, @id=0, @max_fee_per_gas=0.4269e11, @max_priority_fee_per_gas=0.101e10, @path="/tmp/geth.ipc">
erc = Contract.from_file(file: "spec/fixtures/contracts/erc20.sol")
# => #<Eth::Contract::ERC20:0x0000557f2517b160>
geth.deploy_and_wait(erc, "FooBar", "FOO")
# => "0x582738E45b3Ed823709F7A251352f55E4a6f146E"
erc.address
# => "0x582738E45b3Ed823709F7A251352f55E4a6f146E"
geth.call(erc, "name")
# => "FooBar"
geth.call(erc, "symbol")
# => "FOO"
geth.call(erc, "decimals")
# => 18
geth.transact_and_wait(erc, "mint", geth.default_account.to_s, 1 * Unit::ETHER)
# => "0x5246c13331ed7868e623e2a442879891e4b6e6170f2d7091fa7f56962cd647ec"
geth.call(erc, "balanceOf", geth.default_account.to_s)
# => 1000000000000000000
adr = Key.new.address.to_s
# => "0x49eB8f597De9B22D9141392d287BAfDc80994D51"
geth.transact_and_wait(erc, "transfer", adr, 1)
# => "0xf13020c546dffaac15b3e804b61db183a47947c860aad9418cc894822d4f1fa1"
geth.call(erc, "balanceOf", geth.default_account.to_s)
# => 999999999999999999
Hi,
I am trying to transfer some of my tokens to another address and here are the steps I followed.
But getting an error
I feel the issue is in
lib/eth/abi.rb
in line 52