Skip to content
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

Provide icx value input in contract explorer #435

Open
nightowl121 opened this issue Mar 27, 2024 · 6 comments
Open

Provide icx value input in contract explorer #435

nightowl121 opened this issue Mar 27, 2024 · 6 comments

Comments

@nightowl121
Copy link

If the method used in the contract explorer is payable method, the contract explorer needs to provide a field to input the ICX value you want to send in the method.

Currently the explorer doesn't provide this option.

@robcxyz
Copy link
Contributor

robcxyz commented Mar 30, 2024

Hi @nightowl121 - I like this idea but to be clear, the contract explorer is based off pulling the contract's ABI and from that perspective, I don't think there is anything to distinguish an input value as being payable vs a non-payable. I could be wrong, this is not my domain as much. Someone else would know better.

But if that is the case, this is not possible to make as a default within the contract explorer but rather could be some toggle-able item that denominates in ICX (ie *1e18). This could also be left to another section that supports token transfers and other types of payment utilities.

If I am wrong though about payable not being in the ABI please let me know otherwise any feedback on the above is appreciated.

@nightowl121
Copy link
Author

Here is an example of a method in ABI showing that the function is payable.
https://tracker.icon.community/contract/cx21e94c08c03daee80c25d8ee3ea22a20786ec231#code
{ "inputs": [ { "name": "_path", "type": "[]Address" }, { "default": "0x0", "name": "_minReceive", "type": "int" }, { "default": null, "name": "_receiver", "type": "str" } ], "name": "route", "outputs": [], "payable": "0x1", "type": "function" }

@robcxyz
Copy link
Contributor

robcxyz commented Apr 1, 2024

@nightowl121 Ah got it. But then if there are multiple int fields, is it possible to differentiate between an icx denominated value vs standard int? Also does payable strictly define icx transfers or could they be token transfers as well which could have different decimals and can't be assumed?

Don't get me wrong, we should do something and not trying to figure out a reason to not incorporate this somewhere, just can't make assumptions which here and if payables / decimals etc need to be accounted for, we can build a separate tool for that

@robcxyz robcxyz mentioned this issue Apr 1, 2024
45 tasks
@nightowl121
Copy link
Author

Payable is in it's own a different field or parameter. So if there is a payable function, you should add a different input box mentioning the amount of icx to send in the transaction. You can either take the input in ICX or loop (10^-18 ICX) whichever will give better UX. Etherscan allows option to add 18 zeros at once. Other parameters remain same as it is.

Payable will always be for ICX. It won't handle any other token transfers at least in ICON.

In short, if this feature has to be integrated in the current contract explorer, the additional logic would be as:

  • Check if a method is payable. For payable method, add an additional input box mentioning the amount of icx to send. 0 if not provided by user.
  • For rest methods, continue as it is.

@robcxyz
Copy link
Contributor

robcxyz commented Apr 21, 2024

@nightowl121 - I like this idea. So basically any payable method should by default be in ICX and then perhaps have a toggle between Loop and ICX here.

image

Would be like a radio button next to Query

Agree?

@nightowl121
Copy link
Author

Yeah sounds good.

@robcxyz robcxyz closed this as completed Apr 23, 2024
@robcxyz robcxyz reopened this May 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants