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

token standard: 0x address and fix token.lua code #941

Open
wants to merge 14 commits into
base: main
Choose a base branch
from

Conversation

zyjblockchain
Copy link

The 0x address format implemented on ao is EIP55, which means that the recipient address for token transfers on ao must be in EIP55 format, or else the asset will be lost.

ao 0x address code:
https://github.com/permaweb/ao/blob/main/servers/cu/src/domain/utils.js#L487

return true
end

function isEthereumAddress(address)
Copy link

@kunstmusik kunstmusik Aug 7, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've been using this:

function isEthereumAddress(address)
	return #address == 42 and string.match(address, "^0x[%x]+$") ~= nil
end

But I should perhaps add the type(address) == "string" to have:

function isEthereumAddress(address)
	return type(address) == "string" and #address == 42 and string.match(address, "^0x[%x]+$") ~= nil
end

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This regular expression is more concise and my implementation is a bit more readable, I'm not very familiar with regulars, so the implementation is a bit more readable I guess

@TillaTheHun0
Copy link
Member

Cool @zyjblockchain. This would be cool to publish as an APM Module!

@zyjblockchain
Copy link
Author

Cool @zyjblockchain. This would be cool to publish as an APM Module!

I haven't tried APM, I'll check it out, oh it looks like you need a NEO token to use it.

@zyjblockchain
Copy link
Author

Cool @zyjblockchain. This would be cool to publish as an APM Module!

https://apm.betteridea.dev/pkg?id=6CodALD5aCaSByXrEqw2RcmkFWUQ8B9ZuN6VU-4IJtI
successed

@TillaTheHun0
Copy link
Member

Cool @zyjblockchain . I think developers can be directed to install your module from APM if this functionality is needed. I don't think it needs to be part of the standard-token example in this repo.

Perhaps instead, a note in the README on how to install your module and when it would be useful?

@zyjblockchain
Copy link
Author

Cool @zyjblockchain . I think developers can be directed to install your module from APM if this functionality is needed. I don't think it needs to be part of the standard-token example in this repo.

Perhaps instead, a note in the README on how to install your module and when it would be useful?

yes, I submitted it.

@zyjblockchain
Copy link
Author

Cool @zyjblockchain . I think developers can be directed to install your module from APM if this functionality is needed. I don't think it needs to be part of the standard-token example in this repo.

Perhaps instead, a note in the README on how to install your module and when it would be useful?

Hello The token.lua in the standard library wasn't working, so I fixed it and submitted it to this pr

@zyjblockchain zyjblockchain changed the title token standard: 0x address transfer security token standard: 0x address and fix token.lua code Aug 14, 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

Successfully merging this pull request may close these issues.

3 participants