Skip to main content
Version: v1.4

ISCSandbox

ISCSandbox

This is the main interface of the ISC Magic Contract.

getRequestID

function getRequestID() external view returns (struct ISCRequestID)

Retrieves the ID of the current ISC request.

Return Values

NameTypeDescription
[0]struct ISCRequestIDThe ISCRequestID of the current request.

getSenderAccount

function getSenderAccount() external view returns (struct ISCAgentID)

Retrieves the AgentID of the account that sent the current ISC request.

Return Values

NameTypeDescription
[0]struct ISCAgentIDThe ISCAgentID of the sender.

triggerEvent

function triggerEvent(string s) external

Triggers an event in the ISC system with the given string.

Parameters

NameTypeDescription
sstringThe string to include in the event.

getEntropy

function getEntropy() external view returns (bytes32)

Retrieves a random 32-bit value derived from the hash of the current ISC state transaction.

Return Values

NameTypeDescription
[0]bytes32A random bytes32 value.

allow

function allow(address target, struct ISCAssets allowance) external

Authorizes the specified target address to take the given assets from the caller's account.

Parameters

NameTypeDescription
targetaddressThe address of the target EVM contract.
allowancestruct ISCAssetsThe assets to be allowed.

takeAllowedFunds

function takeAllowedFunds(address addr, struct ISCAssets allowance) external

Takes the specified assets from the given address if they have authorized the caller. If the allowance is empty, all allowed funds are taken.

Parameters

NameTypeDescription
addraddressThe address to take funds from.
allowancestruct ISCAssetsThe assets to take.

getAllowanceFrom

function getAllowanceFrom(address addr) external view returns (struct ISCAssets)

Retrieves the amount of assets the specified address has allowed the caller to take.

Parameters

NameTypeDescription
addraddressThe address that has allowed funds.

Return Values

NameTypeDescription
[0]struct ISCAssetsThe allowed ISCAssets.

getAllowanceTo

function getAllowanceTo(address target) external view returns (struct ISCAssets)

Retrieves the amount of assets the caller has allowed the specified address to take.

Parameters

NameTypeDescription
targetaddressThe address allowed to take funds.

Return Values

NameTypeDescription
[0]struct ISCAssetsThe allowed ISCAssets.

getAllowance

function getAllowance(address from, address to) external view returns (struct ISCAssets)

Retrieves the amount of assets allowed between the specified addresses.

Parameters

NameTypeDescription
fromaddressThe address that has allowed funds.
toaddressThe address allowed to take funds.

Return Values

NameTypeDescription
[0]struct ISCAssetsThe allowed ISCAssets.

send

function send(struct L1Address targetAddress, struct ISCAssets assets, bool adjustMinimumStorageDeposit, struct ISCSendMetadata metadata, struct ISCSendOptions sendOptions) external payable

Sends the specified assets from the caller's L2 account to a L1 address and includes the specified metadata and options. This can also be used to create on-ledger requests to the chain itself.

Parameters

NameTypeDescription
targetAddressstruct L1AddressThe L1 address to send the assets to.
assetsstruct ISCAssetsThe assets to be sent.
adjustMinimumStorageDepositboolWhether to adjust the minimum storage deposit.
metadatastruct ISCSendMetadataThe metadata to include in the request.
sendOptionsstruct ISCSendOptionsThe options for the send operation.

call

function call(ISCHname contractHname, ISCHname entryPoint, struct ISCDict params, struct ISCAssets allowance) external returns (struct ISCDict)

Calls the specified entry point of the ISC contract with the given parameters and allowance.

Parameters

NameTypeDescription
contractHnameISCHnameThe hname of the contract.
entryPointISCHnameThe entry point to be called.
paramsstruct ISCDictThe parameters to pass to the entry point.
allowancestruct ISCAssetsThe assets to be allowed for the call.

Return Values

NameTypeDescription
[0]struct ISCDictThe return data from the ISC contract call.

callView

function callView(ISCHname contractHname, ISCHname entryPoint, struct ISCDict params) external view returns (struct ISCDict)

Calls the specified view entry point of the ISC contract with the given parameters.

Parameters

NameTypeDescription
contractHnameISCHnameThe hname of the contract.
entryPointISCHnameThe view entry point to be called.
paramsstruct ISCDictThe parameters to pass to the view entry point.

Return Values

NameTypeDescription
[0]struct ISCDictThe return data from the ISC contract view call.

getChainID

function getChainID() external view returns (ISCChainID)

Retrieves the ChainID of the current ISC chain.

Return Values

NameTypeDescription
[0]ISCChainIDThe ISCChainID of the current chain.

getChainOwnerID

function getChainOwnerID() external view returns (struct ISCAgentID)

Retrieves the AgentID of the owner of the current ISC chain.

Return Values

NameTypeDescription
[0]struct ISCAgentIDThe ISCAgentID of the chain owner.

getTimestampUnixSeconds

function getTimestampUnixSeconds() external view returns (int64)

Retrieves the timestamp of the current ISC block in seconds since the UNIX epoch.

Return Values

NameTypeDescription
[0]int64The timestamp of the current block.

getBaseTokenProperties

function getBaseTokenProperties() external view returns (struct ISCTokenProperties)

Retrieves the properties of the base token used in the ISC system.

Return Values

NameTypeDescription
[0]struct ISCTokenPropertiesThe ISCTokenProperties of the base token.

getNativeTokenID

function getNativeTokenID(uint32 foundrySN) external view returns (struct NativeTokenID)

Retrieves the NativeTokenID of a native token based on its foundry serial number.

Parameters

NameTypeDescription
foundrySNuint32The serial number of the foundry.

Return Values

NameTypeDescription
[0]struct NativeTokenIDThe NativeTokenID of the specified native token.

getNativeTokenScheme

function getNativeTokenScheme(uint32 foundrySN) external view returns (struct NativeTokenScheme)

Retrieves the NativeTokenScheme of a native token based on its foundry serial number.

Parameters

NameTypeDescription
foundrySNuint32The serial number of the foundry.

Return Values

NameTypeDescription
[0]struct NativeTokenSchemeThe NativeTokenScheme of the specified native token.

getNFTData

function getNFTData(NFTID id) external view returns (struct ISCNFT)

Retrieves the details of an NFT based on its ID.

Parameters

NameTypeDescription
idNFTIDThe ID of the NFT.

Return Values

NameTypeDescription
[0]struct ISCNFTThe ISCNFT data of the specified NFT.

getIRC27NFTData

function getIRC27NFTData(NFTID id) external view returns (struct IRC27NFT)

Retrieves the details of an IRC27 NFT based on its ID.

Parameters

NameTypeDescription
idNFTIDThe ID of the IRC27 NFT.

Return Values

NameTypeDescription
[0]struct IRC27NFTThe IRC27NFT data of the specified NFT. Note: the metadata.uri field is encoded as a data URL with: base64(jsonEncode({ "name": NFT.name, "description": NFT.description, "image": NFT.URI })) Note: metadata does not include attributes, use getIRC27TokenURI to get those attributes off-chain in JSON form.

getIRC27TokenURI

function getIRC27TokenURI(NFTID id) external view returns (string)

Retrieves the URI of an IRC27 NFT based on its ID.

Parameters

NameTypeDescription
idNFTIDThe ID of the IRC27 NFT.

Return Values

NameTypeDescription
[0]stringThe URI of the specified IRC27 NFT.

erc20NativeTokensAddress

function erc20NativeTokensAddress(uint32 foundrySN) external view returns (address)

Retrieves the address of an ERC20NativeTokens contract based on the foundry serial number.

Parameters

NameTypeDescription
foundrySNuint32The serial number of the foundry.

Return Values

NameTypeDescription
[0]addressThe address of the specified ERC20NativeTokens contract.

erc721NFTCollectionAddress

function erc721NFTCollectionAddress(NFTID collectionID) external view returns (address)

Retrieves the address of an ERC721NFTCollection contract based on the collection ID.

Parameters

NameTypeDescription
collectionIDNFTIDThe ID of the NFT collection.

Return Values

NameTypeDescription
[0]addressThe address of the specified ERC721NFTCollection contract.

erc20NativeTokensFoundrySerialNumber

function erc20NativeTokensFoundrySerialNumber(address addr) external view returns (uint32)

Retrieves the foundry serial number from the address of an ERC20NativeTokens contract.

Parameters

NameTypeDescription
addraddressThe address of the ERC20NativeTokens contract.

Return Values

NameTypeDescription
[0]uint32The foundry serial number.

registerERC20NativeToken

function registerERC20NativeToken(uint32 foundrySN, string name, string symbol, uint8 decimals, struct ISCAssets allowance) external

Registers a new ERC20NativeTokens contract with the specified foundry and token details. Only callable by the foundry owner.

Parameters

NameTypeDescription
foundrySNuint32The serial number of the foundry.
namestringThe name of the new token.
symbolstringThe symbol of the new token.
decimalsuint8The decimals of the new token.
allowancestruct ISCAssetsThe assets to be allowed for the registration.

__iscSandbox

contract ISCSandbox __iscSandbox