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.

Method

Runtime.TransactionHash

Arguments

None

Description

Returns the Transaction Hash

Gas cost

-

Method

Runtime.Time

Arguments

None

Description

Returns the Time of the VM

Gas cost

-

Method

Runtime.Version

Arguments

None

Description

Returns the Version of the Chain

Gas cost

Method

Runtime.GasTarget

Arguments

None

Description

Returns the Gas Target of the execution

Gas cost

-

Method

Runtime.Validator

Arguments

None

Description

Returns the Active Validator for that transaction

Gas cost

-

Method

Runtime.Context

Arguments

None

Description

Returns the Current context

Gas cost

-

Method

Runtime.PreviousContext

Arguments

None

Description

Returns the Previous Context

Gas cost

-

Method

Runtime.GenerateUID

Arguments

None

Description

Returns the generated UID

Gas cost

-

Method

Runtime.IsWitness

Arguments

from: Address

Description

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

Gas cost

-

Method

Runtime.IsTrigger

Arguments

None

Description

Returns If it's a trigger.

Gas cost

-

Method

Runtime.IsMinter

Arguments

from: Address, symbol: String

Description

Returns If it's a trigger.

Gas cost

-

Method

Runtime.Log

Arguments

String

Description

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

Gas cost

-

Method

Runtime.Notify

Arguments

EventKind, address, Object

Description

Emit an Notification on the transaction.

Gas cost

-

Method

Runtime.DeployContract

Arguments

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

Description

Deploy's a smart contract to the chain.

Gas cost

-

Method

Runtime.UpgradeContract

Arguments

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

Description

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

Gas cost

-

Method

Runtime.KillContract

Arguments

from : Address, contractName: String

Description

Remove's a smart contract from the chain.

Gas cost

-

Method

Runtime.GetBalance

Arguments

from: Address, symbol: String

Description

Returns the balance for that Address of that symbol.

Gas cost

-

Method

Runtime.TransferTokens

Arguments

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

Description

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

Gas cost

-

Method

Runtime.TransferBalance

Arguments

source: Address, destination: Address, symbol: String

Description

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

Gas cost

-

Method

Runtime.MintTokens

Arguments

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

Description

Mints Tokens

Gas cost

-

Method

Runtime.BurnTokens

Arguments

source: Address, symbol: String, amount: Number

Description

Burn tokens

Gas cost

-

Method

Runtime.SwapTokens

Arguments

-

Description

TODO

Gas cost

-

Method

Runtime.TransferToken

Arguments

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

Description

Transfer NFT to another Address

Gas cost

-

Method

Runtime.MintToken

Arguments

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

Description

Mint's a NFT

Gas cost

-

Method

Runtime.BurnToken

Arguments

source: Address, symbol: String, tokenID: Number

Description

Burns an NFT

Gas cost

-

Method

Runtime.InfuseToken

Arguments

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

Description

Infuses an NFT it can be infused with NFT or Tokens

Gas cost

-

Method

Runtime.ReadTokenROM

Arguments

symbol: String, tokenID: Number

Description

Read's the Token ROM of an NFT

Gas cost

-

Method

Runtime.ReadTokenRAM

Arguments

symbol: String, tokenID: Number

Description

Read's the Token RAM of an NFT

Gas cost

-

Method

Runtime.ReadToken

Arguments

symbol: String, tokenID: Number

Description

Read's a Token

Gas cost

-

Method

Runtime.WriteToken

Arguments

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

Description

Write a token (Update NFT)

Gas cost

-

Method

Runtime.TokenExists

Arguments

symbol: String

Description

Returns if the Token Exists

Gas cost

-

Method

Runtime.GetTokenDecimals

Arguments

symbol: String

Description

Returns the Token Decimals

Gas cost

-

Method

Runtime.GetTokenFlags

Arguments

symbol: String

Description

Returns the tokens flags.

Gas cost

-

Method

Runtime.AESDecrypt

Arguments

-

Description

TODO

Gas cost

-

Method

Runtime.AESEncrypt

Arguments

-

Description

TODO

Gas cost

-

Method

Nexus.BeginInit

Arguments

-

Description

TODO

Gas cost

-

Method

Nexus.EndInit

Arguments

-

Description

TODO

Gas cost

-

Method

Nexus.MigrateToken

Arguments

-

Description

TODO

Gas cost

-

Method

Nexus.CreateToken

Arguments

owner: Address, script: Bytes, abi: Bytes

Description

Creates a Token, not a smart contract.

Gas cost

-

Method

Nexus.CreateTokenSeries

Arguments

-

Description

TODO

Gas cost

-

Method

Nexus.CreateChain

Arguments

-

Description

TODO

Gas cost

-

Method

Nexus.CreatePlatform

Arguments

-

Description

TODO

Gas cost

-

Method

Nexus.CreateOrganization

Arguments

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

Description

Create's an Organization

Gas cost

-

Method

Nexus.SetPlatformTokenHash

Arguments

-

Description

TODO

Gas cost

-

Method

Organization.AddMember

Arguments

source: Address, name: String, target: Address

Description

Add Member to an Organization.

Gas cost

-

Method

Organization.RemoveMember

Arguments

source: Address, name: String, target: Address

Description

Remove member from an Organization.

Gas cost

-

Method

Organization.Kill

Arguments

-

Description

TODO

Gas cost

-

Method

Task.Start

Arguments

-

Description

TODO

Gas cost

-

Method

Task.Stop

Arguments

-

Description

TODO

Gas cost

-

Method

Task.Get

Arguments

-

Description

TODO

Gas cost

-

Method

Task.Current

Arguments

-

Description

TODO

Gas cost

-

Method

Data.Get

Arguments

-

Description

TODO

Gas cost

-

Method

Data.Set

Arguments

-

Description

TODO

Gas cost

-

Method

Data.Delete

Arguments

-

Description

TODO

Gas cost

-

Method

Map.Has

Arguments

-

Description

TODO

Gas cost

-

Method

Map.Get

Arguments

-

Description

TODO

Gas cost

-

Method

Map.Set

Arguments

-

Description

TODO

Gas cost

-

Method

Map.Remove

Arguments

-

Description

TODO

Gas cost

-

Method

Map.Count

Arguments

-

Description

TODO

Gas cost

-

Method

Map.Clear

Arguments

-

Description

TODO

Gas cost

-

Method

Map.Keys

Arguments

-

Description

TODO

Gas cost

-

Method

List.Get

Arguments

-

Description

TODO

Gas cost

-

Method

List.Add

Arguments

-

Description

TODO

Gas cost

-

Method

List.Replace

Arguments

-

Description

TODO

Gas cost

-

Method

List.RemoveAt

Arguments

-

Description

TODO

Gas cost

-

Method

List.Count

Arguments

-

Description

TODO

Gas cost

-

Method

List.Clear

Arguments

-

Description

TODO

Gas cost

-

Method

Account.Name

Arguments

-

Description

TODO

Gas cost

-

Method

Account.LastActivity

Arguments

-

Description

TODO

Gas cost

-

Method

Account.Transactions

Arguments

-

Description

TODO

Gas cost

-

Method

Oracle.Read

Arguments

-

Description

TODO

Gas cost

-

Method

Oracle.Price

Arguments

-

Description

TODO

Gas cost

-

Method

Oracle.Quote

Arguments

-

Description

TODO

Gas cost

-

Method

ABI()

Arguments

-

Description

TODO

Gas cost

-

Method

Address()

Arguments

-

Description

TODO

Gas cost

-

Method

Hash()

Arguments

-

Description

TODO

Gas cost

-

Method

Timestamp()

Arguments

-

Description

TODO

Gas cost

-

Last updated