Interop

The interop calls work as a brige that allows the VM scripts to access Phantasma features written in native code.

To do an interop call, a script should push all necessary arguments into the stack, put a method name into a register then use the CTX opcode followed by the SWITCH opcode.

As interop calls do more work than normal opcodes, the gas cost is usually much larger than simpler operations.

For deeper diving, the code implementation of the interop calls is available at Github.

Runtime.TransactionHash

None

Returns the Transaction Hash

-

Runtime.Time

None

Returns the Time of the VM

-

Runtime.Version

None

Returns the Version of the Chain

Runtime.GasTarget

None

Returns the Gas Target of the execution

-

Runtime.Validator

None

Returns the Active Validator for that transaction

-

Runtime.Context

None

Returns the Current context

-

Runtime.PreviousContext

None

Returns the Previous Context

-

Runtime.GenerateUID

None

Returns the generated UID

-

Runtime.IsWitness

from: Address

Returns true of false depending if it's valid or not.

-

Runtime.IsTrigger

None

Returns If it's a trigger.

-

Runtime.IsMinter

from: Address, symbol: String

Returns If it's a trigger.

-

Runtime.Log

String

To log a message on Runtime, Mostly used for Smart Contract

-

Runtime.Notify

EventKind, address, Object

Emit an Notification on the transaction.

-

Runtime.DeployContract

from : Address, contractName: String, contractScript: Bytes, contractABI: Bytes

Deploy's a smart contract to the chain.

-

Runtime.UpgradeContract

from : Address, contractName: String, contractScript: Bytes, contractABI: Bytes

Upgrade's a Token/Smart Contract on the chain.

-

Runtime.KillContract

from : Address, contractName: String

Remove's a smart contract from the chain.

-

Runtime.GetBalance

from: Address, symbol: String

Returns the balance for that Address of that symbol.

-

Runtime.TransferTokens

source: Address, destination: Address, symbol: String, amount: Number

Transfer's a specific amount of tokens from one address to the other.

-

Runtime.TransferBalance

source: Address, destination: Address, symbol: String

Transfer all of the tokens from one address to the other.

-

Runtime.MintTokens

source: Address, destination: Address, symbol: String, amount: Number

Mints Tokens

-

Runtime.BurnTokens

source: Address, symbol: String, amount: Number

Burn tokens

-

Runtime.SwapTokens

-

TODO

-

Runtime.TransferToken

source: Address, destination: Address, symbol: String, tokenID: Number

Transfer NFT to another Address

-

Runtime.MintToken

source: Address, destination: Address, symbol: String, rom: Bytes, ram: Bytes, seriesID: Number

Mint's a NFT

-

Runtime.BurnToken

source: Address, symbol: String, tokenID: Number

Burns an NFT

-

Runtime.InfuseToken

source: Address, targetSymbol: String, tokenID: Number, infuseSymbol: String, value: Number

Infuses an NFT it can be infused with NFT or Tokens

-

Runtime.ReadTokenROM

symbol: String, tokenID: Number

Read's the Token ROM of an NFT

-

Runtime.ReadTokenRAM

symbol: String, tokenID: Number

Read's the Token RAM of an NFT

-

Runtime.ReadToken

symbol: String, tokenID: Number

Read's a Token

-

Runtime.WriteToken

from: Address, symbol: String, tokenID: Number, ram: Bytes

Write a token (Update NFT)

-

Runtime.TokenExists

symbol: String

Returns if the Token Exists

-

Runtime.GetTokenDecimals

symbol: String

Returns the Token Decimals

-

Runtime.GetTokenFlags

symbol: String

Returns the tokens flags.

-

Runtime.AESDecrypt

-

TODO

-

Runtime.AESEncrypt

-

TODO

-

Nexus.BeginInit

-

TODO

-

Nexus.EndInit

-

TODO

-

Nexus.MigrateToken

-

TODO

-

Nexus.CreateToken

owner: Address, script: Bytes, abi: Bytes

Creates a Token, not a smart contract.

-

Nexus.CreateTokenSeries

-

TODO

-

Nexus.CreateChain

-

TODO

-

Nexus.CreatePlatform

-

TODO

-

Nexus.CreateOrganization

source: Address, ID: String, name: String, script: Bytes

Create's an Organization

-

Nexus.SetPlatformTokenHash

-

TODO

-

Organization.AddMember

source: Address, name: String, target: Address

Add Member to an Organization.

-

Organization.RemoveMember

source: Address, name: String, target: Address

Remove member from an Organization.

-

Organization.Kill

-

TODO

-

Task.Start

-

TODO

-

Task.Stop

-

TODO

-

Task.Get

-

TODO

-

Task.Current

-

TODO

-

Data.Get

-

TODO

-

Data.Set

-

TODO

-

Data.Delete

-

TODO

-

Map.Has

-

TODO

-

Map.Get

-

TODO

-

Map.Set

-

TODO

-

Map.Remove

-

TODO

-

Map.Count

-

TODO

-

Map.Clear

-

TODO

-

Map.Keys

-

TODO

-

List.Get

-

TODO

-

List.Add

-

TODO

-

List.Replace

-

TODO

-

List.RemoveAt

-

TODO

-

List.Count

-

TODO

-

List.Clear

-

TODO

-

Account.Name

-

TODO

-

Account.LastActivity

-

TODO

-

Account.Transactions

-

TODO

-

Oracle.Read

-

TODO

-

Oracle.Price

-

TODO

-

Oracle.Quote

-

TODO

-

ABI()

-

TODO

-

Address()

-

TODO

-

Hash()

-

TODO

-

Timestamp()

-

TODO

-

Last updated