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

fix: variable clash with the process' global variable: 'Name' in the token blueprint #280

Closed
wants to merge 1 commit into from

Conversation

hitwill
Copy link

@hitwill hitwill commented Jun 28, 2024

Each process has a global var called Name, and this clashes with the token blueprint's Name variable.

The line: Name = Name or 'Points Coin' is never assigned, since Name already has the value of the process name. (Default or whatever the dev names it)

For example, the dev might name the process Currency Contract when instantiating it. In this case, the token never gets the name Points Coin.

This can be fixed by updating the line to: TokenName = TokenName or 'Points Coin'

Each process has a global var called Name, and this clashes with the token blueprint
@hitwill hitwill changed the title fix: variable clash with 'Name' process global fix: variable clash with the process' global variable: 'Name' in the token blueprint Jun 28, 2024
@twilson63
Copy link
Collaborator

I think it has to be Name possibly add better instructions for setting it when creating a token process

@hitwill
Copy link
Author

hitwill commented Jul 8, 2024

I think it has to be Name possibly add better instructions for setting it when creating a token process

Perhaps one option is:

  1. Remove: Name = Name or 'Points Coin'
  2. Then in the Info handler, add this comment
--[[
     Info
     
     Note: token Name is inherited from the process name
   ]]
--

Handlers.add('info', Handlers.utils.hasMatchingTag('Action', 'Info'), function(msg)
  ao.send({
    Target = msg.From,
    Name = Name, 
    Ticker = Ticker,
    Logo = Logo,
    Denomination = tostring(Denomination)
  })
end)

@hitwill
Copy link
Author

hitwill commented Jul 10, 2024

Closed as superseded by: #287

@hitwill hitwill closed this Jul 10, 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.

2 participants