question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Tokens: be able to represent as numbers

See original GitHub issue

We are able to represent tokens as strings (token.toString()) and as string arrays (token.toList()), but in certain cases, there’s a need to represent them as numbers. Introduce token.toNumber().

We need to somehow encode the fact that this is a token into a number. It’s not going to be elegant (e.g. -66737346654.<random> can be the key to the token map).

Related to #744 Related to #1453

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:12 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
eladbcommented, Jan 8, 2019

This does bring up a more general concern around input validation which exists not only for numbers and I suspect we are violating already in a few places.

0reactions
rix0rrrcommented, Apr 24, 2019

By the way, I just realized something. We should make the number VERY LARGE as opposed to VERY SMALL, so that if users manipulate it by accident it’ll reduce the opportunity for it to break the token:

tiny_token + 1 === 1
huge_token + 1 === huge_token
Read more comments on GitHub >

github_iconTop Results From Across the Web

22.1.2. Parsing of Numbers and Symbols
A token is a potential number if it satisfies the following requirements: It consists entirely of digits, signs (+ or -), ratio markers...
Read more >
Numbers on role tokens? - BoardGameGeek
As the Announcer, place any tokens with numbers on them near you, and open your eyes in between roles if you need to...
Read more >
Tokens - IBM
Also, be aware that in Assembler language, hexadecimal numbers are represented with the X in front of the number. REXX only accepts hexadecimal...
Read more >
Tokens: their Significance for the Origin of Counting and Writing
The plain tokens stood for farm products: small and large cones, spheres and flat disks stood for different measures of barley; ovoids for...
Read more >
Understanding ERC-20 token contracts | by Jim McDonald
An ERC-20 token contract is defined by the contract's address and the total supply of tokens available to it, but has a number...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found