New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
If Contract has been Verified, Developer sees “Read Smart Contract” tab #70
Comments
Hey, @acravenho! We have just added more details to this card, but we still have some questions we are investigating... If you could help us with some of them, we'd appreciate it!
|
The last 3 we will need to do more research on. |
About the last point, I came up with a way to do it. The function name, its arguments' types and the arguments themselves must be encoded. In order to get a value from a contract function, we use the
For instance, suppose we want to get the result for the function
The data parameter is the concatenation of 1, 2 and 3: After doing some research, the most feasible way I found to accomplish 2 in Elixir is using this keccak lib. It is important to use << first_four_bytes :: binary-size(4) >> <> _remaining_bytes = :keccakf1600.sha3_256("double(int256)")
Base.encode16(first_four_bytes, case: :lower)
# "c6888fa1" The best way I could come up to accomplish 3 in Elixir was using the Hexate lib. So, if we want to get 2 in a 64 bytes hexadecimal value, we can run: I found no way of accomplishing that with just the code that is currently available in this project. In fact, the Ethereumex lib does not implement it as well. I actually found an issue on its repository that actually helped me reach this solution. What do you guys think about it? Can you think of any better apporach/solution? I personally feel that might be a native Elixir way to do what Hexate does, but I was unable to find it. |
@josevalim pointed out that Hexate's implementation is actually pretty simple and there is no need to include it in the project. Reference implementation: https://github.com/rjsamson/hexate/blob/master/lib/hexate.ex#L33. |
Regarding the functions sorting, I've been searching a little bit about that and found out the following:
This issue in Solidity is discussing this topic and a possible less arbitrary sorting method: ethereum/solidity#2731 Think we can follow with the same solution used by Etherscan for now... wdyt, @acravenho? |
Yes, let's follow the same format as Etherscan. |
@lucasnar regarding the last question we've listed above, the Solidity documentation on contracts says the following:
So, probably we should look at ABI entries with both Also, I've tested this on Kovan and Etherscan has listed the pure function in the read tab along with the view ones. |
The |
@KronicDeth I'm not sure we can cache them. I understood they don't depend on the state, but they might depend on input arguments. For instance, the documentation example is the following one:
|
It is possible to memoize a function based on its arguments. It is one of the nice things about pure functions. Whether we should do it would be if a pure call is costly, but popular with users, so it can wait until an actual performance issue is spotted. |
@amandasposito @lucasnar I found the following issues:
|
…inspec Get Genesis info from generic chainfile
feat: update tx detail
Hey there I am recieving an error for Read-only function which mutability is View an it is not tacking any args . https://sahara.ftnscan.com/address/0x385C32d00cD8FF896eCd7Ca3335bb30f391a3057/read-contract#address-tabs |
Description
As a developer or contributor visiting the address page for a contract that has already been verified, I want to see the "Read Smart Contract" tab so I can click on it and interact with the blockchain through read-only functions.
Acceptance Criteria
stateMutability: view
) without required arguments is shown with the following fields:query
, a section with the query response is shown with the following format:[ <name> method Response ]
<type> : <response>
Example
Example
Tasks
abi
saved inSmartContract
table to list functions and constants;ethereum_jsonrpc
for theeth_call
method so that we can get the values of the blockchain;eth_call
call, according to documentation;eth_call
call;eth_call
for the respective contract function inabi
;The text was updated successfully, but these errors were encountered: