Skip to content

Core Contracts

Back to Devpack Overview

Syscalls.sol

Low-level Solidity wrappers for the supported Neo N3 syscall surface. This is the lowest-level devpack surface — every other contract and library ultimately delegates to Syscalls.

CategorySyscallsExamples
StorageGetContext, Get, Put, Delete, Find, AsReadOnly, Local.*storageGet(), storagePut(), storageFind()
RuntimeCheckWitness, GetTime, GasLeft, Notify, Log, BurnGascheckWitness(), gasLeft(), notify()
ContractCall, GetCallFlags, CreateStandardAccount, CreateMultisigAccountcontractCall(), getCallFlags()
CryptoCheckSig, CheckMultisig (via System.Crypto.*)checkSig(), checkMultisig()
CryptoLibSHA256, RIPEMD160, Keccak256, VerifyWithECDsa, Ed25519, BLS12-381, Murmur32sha256(), verifyWithECDsa(), bls12381Pairing()
StdLibserialize, deserialize, JSON, base64/58, hex, string ops, itoa/atoijsonSerialize(), base64Encode(), stringSplit()
IteratorNext, ValueiteratorNext(), iteratorValue()
AdvancedGetRandom, GetNetwork, GetAddressVersion, GetInvocationCountergetCurrentRandom(), getNetwork()

Syscalls.sol also defines the core data structures used throughout the devpack:

StructDescription
BlockTrimmed block: hash, version, previousHash, merkleRoot, timestamp, nonce, index, primaryIndex, nextConsensus, txCount
TransactionBase transaction: hash, version, nonce, sender, systemFee, networkFee, validUntilBlock, script
WitnessinvocationScript + verificationScript
Signeraccount, scopes, allowedContracts, allowedGroups, rules
WitnessRuleaction (deny/allow) + condition bytes
StorageContextContract storage context (id + isReadOnly)
IteratorNeoVM iterator handle (id, hasNext, currentKey, currentValue)
NotificationscriptHash, eventName, state array
ContractStateNativeid, updateCounter, hash, nef, manifest

TIP

Prefer NativeCalls wrappers over raw Syscalls.contractCall() — they generate specific manifest permissions instead of wildcards.

NativeCalls.sol

Direct wrappers for all Neo N3 native contracts. Each function calls through Syscalls.contractCall() with a deterministic contract hash constant, enabling the compiler to infer exact manifest permissions.

Native ContractHash ConstantKey Functions
NEO TokenNEO_CONTRACTneoBalanceOf(), neoTransfer(), vote(), getCandidates(), getAccountState(), unclaimedGas()
GAS TokenGAS_CONTRACTgasBalanceOf(), gasTransfer(), gasTotalSupply()
ContractManagementCONTRACT_MANAGEMENTdeployContract(), updateContract(), destroyContract(), getContract(), hasMethod()
PolicyPOLICY_CONTRACTgetFeePerByte(), getExecFeeFactor(), getStoragePrice(), blockAccount(), isBlocked()
OracleORACLE_CONTRACTrequestOracleData(), getOraclePrice(), setOraclePrice()
RoleManagementROLE_MANAGEMENTdesignateAsRole(), getDesignatedByRole()
NotaryNOTARY_CONTRACTnotaryVerify(), notaryBalanceOf(), notaryLockDepositUntil(), notaryWithdraw()
TreasuryTREASURY_CONTRACTtreasuryVerify(), treasuryOnNEP17Payment(), treasuryOnNEP11Payment()
LedgerLEDGER_CONTRACTcurrentIndex(), currentHash(), getBlock(), getTransaction()

Reference constants for CryptoLib (CRYPTO_LIB) and StdLib (STD_LIB) are also defined, but their methods are exposed through Syscalls.sol directly (e.g., Syscalls.sha256(), Syscalls.base64Encode()).

solidity
// Transfer GAS — generates permission: {"contract":"0xd2a4...","methods":["transfer"]}
bool ok = NativeCalls.gasTransfer(from, to, amount, "");

// Query NEO governance
NativeCalls.NeoCandidate[] memory candidates = NativeCalls.getCandidates();
uint256 unclaimed = NativeCalls.unclaimedGas(account, NativeCalls.currentIndex());

FrameworkBase.sol

Base contract providing common infrastructure for Neo N3 Solidity contracts:

  • OwnershiptransferOwnership(), renounceOwnership(), onlyOwner modifier
  • InitializationwhenInitialized modifier, version tracking
  • Witness-based access controlwithWitness modifier (calls Runtime.checkWitness)
  • Gas limit guardswithGasLimit(minGas) modifier (calls Runtime.gasLeft)
  • Contract lifecycleupgradeContract() with NEF + manifest update
  • EventsFrameworkInitialized, OwnershipTransferred, ContractUpgraded, EmergencyStop
solidity
contract MyToken is FrameworkBase {
    function adminAction() public onlyOwner withWitness withGasLimit(20000000) {
        // Only owner, witness-verified, with at least 0.2 GAS remaining
    }
}

Framework.sol

Extended framework that inherits FrameworkBase. Previously exposed a fully dynamic callContract(address, string, bytes) surface, but this forced wildcard permissions in the manifest ({"contract":"*","methods":"*"}).

Strict-Manifest Mode

Framework.callContract() is intentionally disabled — it reverts at runtime. Use explicit NativeCalls.* or Syscalls.contractCall(KNOWN_HASH, ...) wrappers instead. If truly dynamic dispatch is unavoidable, compile with --manifest-permissions to supply explicit overrides.

OracleService.sol

Convenience wrapper around the Neo N3 Oracle native contract:

  • request(url, filter, userData, gasForResponse) — issue an oracle data request, returns a requestId
  • oracleCallback(url, userData, code, result) — receives the native Oracle callback (restricted to onlyOracleNative)
  • Forwards responses to the original requester via IOracleServiceReceiver.onOracleResponse()
  • Uses a fixed callback method name to avoid wildcard manifest permissions
  • Tracks request metadata (requester, URL, filter, timestamps, completion status)
solidity
contract MyOracle is IOracleServiceReceiver {
    OracleService private _oracle;

    function fetchPrice(string calldata url) external {
        _oracle.request(url, "$.price", "", 100000000);
    }

    function onOracleResponse(
        uint256 requestId, uint256 code, bytes calldata result, bytes calldata userData
    ) external override {
        // Handle oracle response
    }
}

NEP17Rescue.sol

Optional extension for NEP-17 tokens that enables emergency recovery of accidentally sent native tokens (NEO and GAS only). In strict-manifest mode, rescuing arbitrary NEP-17 tokens is not supported because it would require wildcard contract permissions.

solidity
contract MyToken is NEP17Rescue {
    // Inherits emergencyTokenRecovery(token, to, amount, data)
    // Restricted to NEO_CONTRACT and GAS_CONTRACT targets
}

MIT Licensed