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

Update arc-0200.md #253

Merged
merged 8 commits into from
Oct 27, 2023
Merged

Update arc-0200.md #253

merged 8 commits into from
Oct 27, 2023

Conversation

temptemp3
Copy link
Contributor

@temptemp3 temptemp3 commented Oct 21, 2023

Lines 42, 45:
Fixed typo: bytes -> byte

Line 56:
Propose changing arc200_decimals return type to uint64 for improved compatibility with compiled smart contracts that do not have uint8 available

Change return type of transfer, transferFrom, approve from bool to byte

Describe what non-readonly methods return values should be.

Describe decimals return value

Fixed typo: bytes -> byte 
Propose changing arc200_decimals return type to uint64 for improved compatibility with reachc that may not have uint8 type exposed to smart contract developer.
* Update return type for transfer, transferFrom, approve
Describe what byte return value for non-readonly methods should be
Describe decimals method return value
@SudoWeezy
Copy link
Collaborator

SudoWeezy commented Oct 24, 2023

Can you give more explanation on why you want to Change return type of transfer, transferFrom, approve from bool to void?

@jannotti
Copy link
Contributor

What does this mean?

compiled smart contracts that do not have uint8 available

uint8 is the ABI type. If you have a number between 0 and 255, you can use itob; extract 7 0 to produce a single byte as an ABI uint8.

@temptemp3
Copy link
Contributor Author

temptemp3 commented Oct 24, 2023 via email

@temptemp3
Copy link
Contributor Author

temptemp3 commented Oct 24, 2023 via email

@temptemp3
Copy link
Contributor Author

temptemp3 commented Oct 24, 2023 via email

@temptemp3
Copy link
Contributor Author

Can you give more explanation on why you want to Change return type of transfer, transferFrom, approve from bool to void?

Sry this is outdated. I considered void but changed it to byte afterwords. My mistake for not noticing.

ARCs/arc-0200.md Outdated Show resolved Hide resolved
@temptemp3
Copy link
Contributor Author

temptemp3 commented Oct 26, 2023 via email

Fix description of decimals
@SudoWeezy
Copy link
Collaborator

For interoperability, I would keep bool & uint8. Changing the standard based on Reach implementation of things is not right.

How do you handle https://github.com/ethereum/ercs/blob/master/ERCS/erc-20.md tokens? Do you also return bytes & uint64?

@temptemp3
Copy link
Contributor Author

What does this mean?

compiled smart contracts that do not have uint8 available

uint8 is the ABI type. If you have a number between 0 and 255, you can use itob; extract 7 0 to produce a single byte as an ABI uint8.

Thank you for the advice. I may be able to use this.

@temptemp3
Copy link
Contributor Author

For interoperability, I would keep bool & uint8. Changing the standard based on Reach implementation of things is not right.

How do you handle https://github.com/ethereum/ercs/blob/master/ERCS/erc-20.md tokens? Do you also return bytes & uint64?

For sure. I'll figure something out.

@temptemp3
Copy link
Contributor Author

@SudoWeezy @jannotti I have retract proposed abi changes that will not move forward. Kindly accept changes in this PR as they address known issues, there is a type in the abi. Thx!

@SudoWeezy SudoWeezy merged commit c43f726 into algorandfoundation:main Oct 27, 2023
5 checks passed
@temptemp3
Copy link
Contributor Author

extract 7 0

Work great. Thanks for the tip! @jannotti

@temptemp3
Copy link
Contributor Author

temptemp3 commented Oct 30, 2023

@jannotti any tip on how I might return a bool instead of byte in transfer, approve, transferFrom method?
Currently the txnResult.logs looks like this

  Uint8Array(5) [ 21, 31, 124, 117, 1 ]
]
ABIMethod {
  name: 'arc200_transfer',
  ...

Last byte is 1 indicating success.
I am wondering if it will just work if I were to update the methods selectors to match the abi spec? For example,
Instead of

    {
      "name": "arc200_transfer",
      "desc": "Transfers tokens",
      "readonly": false,
      "args": [
        {
          "type": "address",
          "name": "to",
          "desc": "The destination of the transfer"
        },
        {
          "type": "uint256",
          "name": "value",
          "desc": "Amount of tokens to transfer"
        }
      ],
      "returns": { "type": "byte", "desc": "Success" }
    },

Use

    {
      "name": "arc200_transfer",
      "desc": "Transfers tokens",
      "readonly": false,
      "args": [
        {
          "type": "address",
          "name": "to",
          "desc": "The destination of the transfer"
        },
        {
          "type": "uint256",
          "name": "value",
          "desc": "Amount of tokens to transfer"
        }
      ],
      "returns": { "type": "bool", "desc": "Success" }
    },
    ```

    Any thoughts?

@jannotti
Copy link
Contributor

I believe that will work. I think a single bool would be encoded exactly the same way a byte would be.

@temptemp3
Copy link
Contributor Author

temptemp3 commented Oct 30, 2023 via email

@temptemp3
Copy link
Contributor Author

I believe that will work. I think a single bool would be encoded exactly the same way a byte would be.

Thanks @jannotti it just works

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants