-
Notifications
You must be signed in to change notification settings - Fork 118
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
ARC-51: Method Reference Discovery #230
Draft
joe-p
wants to merge
5
commits into
algorandfoundation:main
Choose a base branch
from
joe-p:get_refs
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from 2 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
--- | ||
arc: <to be assigned> | ||
title: Method Reference Discovery | ||
description: A standardized way contracts can reveal which references will be needed to call a specific method | ||
author: Joe Polny (@joe-p) | ||
discussions-to: <URL> | ||
status: Draft | ||
type: Standards Track | ||
category: ARC | ||
created: 2023-07-28 | ||
requires (*optional): 4 | ||
--- | ||
|
||
## Abstract | ||
A contract caller needs to know which resources a contract needs to be availible before calling a method. This ARC proposes a standard way to make that information discoverable. | ||
|
||
## Motivation | ||
As of the time of this ARC, it can be hard to know which resources a caller needs to make availible when calling an application. The current solution typically involves proprietary SDKs which can make app usage and composability difficult. | ||
|
||
### Simulation Consideration | ||
|
||
It should be noted that it is currently planned for the algod simulate endpoint to allow readonly execution of a method without providing references. The response to this endpoint will return the necessary resources. Once this functionality is availible, this ARC will no longer be needed. The primary intent of this ARC is to serve as an intermediate solution. | ||
|
||
## Specification | ||
If an application has a method and the contract wants to make the required resources for calling the method discoverable, it **MUST** implement a readonly method with the same exact signature with an `arcXXXX_` prefix and a return type of `(address[],uint64[],uint64[],(uint64,byte[]))`. | ||
|
||
The return value corresponds to arrays containing the required account, application, asset, and box references respectively. | ||
|
||
The argument values provided to this method when called **SHOULD** match the arguments passed to the method for which the callers wants to know the required resources for. | ||
|
||
The ARCXXXX method **MUST** be readonly. | ||
|
||
## Rationale | ||
The provided method will provide all of the references needed to call the application, which was previously not possible in a standardized way. | ||
|
||
## Backwards Compatibility | ||
N/A | ||
|
||
## Test Cases | ||
N/A | ||
|
||
## Reference Implementation | ||
|
||
### ARC200 example | ||
|
||
In this example, let's say `arc200_totalSupply()uint256` requires two box refences `"baseSupply"` and `"supplyMultiplier"`, each encoded as `byte[]`. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: it would be nice to show an example with arguments to reenforce the restriction that the |
||
|
||
#### Method Signature | ||
|
||
The ARCXXXX method signature would be `arcXXXX_arc200_totalSupply()(address[],uint64[],uint64[],(uint64,byte[]))` | ||
|
||
#### Return Value | ||
|
||
The ARCXXXX method would return the following value: `[],[],[],[[0, "baseSupply"], [0, "supplyMultiplier"]]` | ||
|
||
## Security Considerations | ||
N/A | ||
|
||
## Copyright | ||
Copyright and related rights waived via <a href="https://creativecommons.org/publicdomain/zero/1.0/">CCO</a>. |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be nice to provide clarity in the case of a method which takes reference type arguments.
I.e. does its
arcXXXX_
function need to return the already specified reference types, or can it omit them?