0

I'm trying to use eth_call to send USDT (TetherToken) from one account to another (Although I know that eth_call just simiulate such transaction). Everything is clear in this regard, just the data parametere is a bit ambiguous. As far as I read, it must be an encoded value of the contract and some other parameteres. After checking many web pages, I found this value as ABI-Encoded and is the last bytes of the Contract mentioned in this link:

000000000000000000000000000000000000000000000000000000174876e800000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a546574686572205553440000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000045553445400000000000000000000000000000000000000000000000000000000

Now, my questions are:

  1. Is using this code as data value enough for running eth_call?
  2. The value above is a HEX one. But the givven example inside documentation uses a shorter value of data like 0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675 which is HEX too, but in a shorter format. What kind of encoding is applied to prepare such final data value?
  3. What are other parameteres beside contract signature which have to be included in data value creation?
  4. I've found a website to convert contract JSON to ABI encoded format. After pasting the TetherToken contract JSON in this website and pressing parse, some new field appeared. One of them was _initialSupply. Other field are clear, and their values are available. But I could not understand what is _initialSupply exactly here and where can I find it?

I hope you can help me to find the answer of my questons. Sorry for too many questions...

0

I think you are confusing different things:

The string you have pasted 000000000000000000000000000000000000000000000000000000174876e80000... are the parameters that were used to invoke the constructor of the contract.

  1. The data parameter is passed to the contract. The contract can interpret it in any way he wants. But usually solidity contracts follow the ABI specification.

  2. Where did you get this value? I'm unable to locate it in the USDT.

  3. You usually pass the function selector and all the parameters.

  4. The first select under the "parse" button allows to select the function you want to call, and it shows the parameters below. By default it select the constructor, and the _initialSupply is one of the parameters.

For example if you call with a9059cbb00000000000000000000000012345678123456781234567812345678123456780000000000000000000000000000000000000000000000000000000000000017 it is interpreted as:

  • a9059cbb: selector of transfer(address,uint256)
  • 0000000000000000000000001234567812345678123456781234567812345678: recipient
  • 0000000000000000000000000000000000000000000000000000000000000017: amount of tokens

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.