Skip to content
This repository was archived by the owner on Jul 16, 2025. It is now read-only.
This repository was archived by the owner on Jul 16, 2025. It is now read-only.

Implement NTCALL opcodes for NTs #74

Description

@PaulRBerg

Tasks

  • Implement the NTCALL, NTCALLVALUE, and NTDELEGATECALL opcodes to take a variable number of token IDs and token amounts instead of a single ETH amount.
  • Refactor the existing CALL, CALLCODE, CALLVALUE, and DELEGATECALL opcodes to act as "stand-ins" to the new opcodes. Each existing opcode would fall back to its newer counterpart by passing a pair of (BASE_TOKEN_ID,value).

Spec

The proposed spec for NTCALL (analogous logic applies to the other opcodes) expects the token IDs and values to be put on the stack:

  • Delete the value input at position 3 (alternatively, turn this value into a no-op; more research required)
  • Add a new value called tokensLength, which signifies the number of token transfers
  • If tokensLength == 0, do nothing; this call does not transfer any tokens
  • Add tokensLength pairs of (token_id,value) pairs

Notes

  • Since the stack can support only up to 1024 elements, a limited number of tokens can be transferred (but this should be high enough for all practical use cases)
  • In practice, we should set the upper limit for tokensLength to something like 512 to make it difficult for the callee to run afoul of the stack limit
  • See this StackExchange post

References

Activity

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

Metadata

Metadata

Assignees

Labels

effort: epicMulti-stage task that may require multiple PRs.priority: 0Do this first before everything else. This is critical and nothing works without this.type: featureNew feature or request.work: chaoticAct-sense-respond. No clear relationship between cause and effect.work: complexProbe-sense-respond. The relationship between cause and effect can only be perceived in retrospect.

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions