setcode

SystemService::SetCode

struct SystemService::SetCode {
    const psibase::AccountNumber service;      // "setcode"
    const uint64_t               serviceFlags; // Flags this service must run with

    setCode(...);  // This action is called in order to upload compiled service code to the chain
    setFlags(...); // Sets the flags that a particular service must be run with
};

All compiled code is uploaded to the chain through this service.

SystemService::SetCode::setCode

void SystemService::SetCode::setCode(
    psibase::AccountNumber service,
    uint8_t                vmType,
    uint8_t                vmVersion,
    std::vector<char>      code
);

This action is called in order to upload compiled service code to the chain.

Uploaded code is automatically uploaded to the account that calls the action.

  • service - Must match the sender account
  • vmType - Specifies the type of the WebAssembly VM. Currently must be equal to 0.
  • vmVersion - Specifies the version of the WebAssembly VM. Currently must be equal to 0.
  • code - A byte array containing the compiled code to upload

SystemService::SetCode::setFlags

void SystemService::SetCode::setFlags(
    psibase::AccountNumber service,
    uint64_t               flags
);

Sets the flags that a particular service must be run with.