Skip to content

src/runtime/common/storage_wasm_provider.hpp

Namespaces

Name
sgns
sgns::runtime

Classes

Name
class sgns::runtime::StorageWasmProvider

Attributes

Name
const base::Buffer kRuntimeKey

Attributes Documentation

variable kRuntimeKey

const base::Buffer kRuntimeKey                                   =
base::Buffer::fromHex("3a636f6465").value();

Source code

#ifndef SUPERGENIUS_SRC_RUNTIME_STORAGE_WASM_PROVIDER_HPP
#define SUPERGENIUS_SRC_RUNTIME_STORAGE_WASM_PROVIDER_HPP

#include "runtime/wasm_provider.hpp"

#include "storage/trie/trie_storage.hpp"

namespace sgns::runtime {

  // key for accessing runtime from storage(hex representation of ":code")
  inline const base::Buffer kRuntimeKey =
      base::Buffer::fromHex("3a636f6465").value();

  class StorageWasmProvider : public WasmProvider {
   public:
    ~StorageWasmProvider() override = default;

    explicit StorageWasmProvider(
        std::shared_ptr<const storage::trie::TrieStorage> storage);

    const base::Buffer &getStateCode() const override;

   private:
    std::shared_ptr<const storage::trie::TrieStorage> storage_;
    mutable base::Buffer state_code_;
    mutable base::Buffer last_state_root_;
  };

}  // namespace sgns::runtime

#endif  // SUPERGENIUS_SRC_RUNTIME_STORAGE_WASM_PROVIDER_HPP

Updated on 2026-03-04 at 13:10:45 -0800