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

Soldity or Vyper? ABI - Or rephrase to contract method signature? #79

Open
evmKnows opened this issue Nov 8, 2024 · 5 comments
Open
Labels
question Further information is requested

Comments

@evmKnows
Copy link

evmKnows commented Nov 8, 2024

The spec mentions solidity ABI

Vyper methods look slightly different in the code:

transfer(_to: address, _amount: uint256)

vs

transfer(address _to, uint256 _amount)

However the ABI / Encoding would look and work exactly the same way.

The 7730 schema doesn't strictly enforce the Solidity syntax, so I assume it would work as is with Vyper too?

If so, maybe adjust the spec/wording to "contract method signature"?

@jnicoulaud-ledger jnicoulaud-ledger added the question Further information is requested label Nov 8, 2024
@jnicoulaud-ledger
Copy link
Collaborator

The reference implementation indeed only supports Solidity syntax. I would be more in favor of enforcing it in the spec for now and consider this a feature request, what do you think @lcastillo-ledger ?

@evmKnows
Copy link
Author

evmKnows commented Nov 8, 2024

Hmm, but would the integration still work if it's specified in Solidity syntax, with the real code being Vyper?

Vyper has come a long way and it's in production for many dApps (Curve & Yearn e.g.)

@jnicoulaud-ledger
Copy link
Collaborator

This is a good question, my understanding is that vyper and solidity use the same calldata encoding since you can call solidity functions from vyper and vice versa, but we have not tested it yet.

Regarding the syntax, it only impacts the source descriptor, you can actually use the 4-bytes selector directly like here to avoid any confusion.

@evmKnows
Copy link
Author

evmKnows commented Nov 8, 2024

Yea they do use the same encoding and can call each other.

Also wrt to the selector that's what I meant with doesn't strictly enforce the Solidity syntax. In the above example the resulting selector bytes would be exactly the same. So if the selector would work, likely the integration as well.

For clarity I'd still personally prefer to use the Solidity syntax (transformed from Vyper).

So if the integrator is just computing the selector from the format, and doesn't do string matching on the source code, it should work.

@jnicoulaud-ledger
Copy link
Collaborator

By the way, our reference implementation includes an utility to transform our descriptors to a canonical form in which selectors have been converted to 4 bytes (can be used as CLI as well). So an integrator would typically use this tooling and start directly from the resolved form.

(for reference, the current implementation of the transformation is here, using utilities from here.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants