Class: Runar::SmartContract

Inherits:
Object
  • Object
show all
Includes:
Builtins, DSL, ECMixin
Defined in:
lib/runar/base.rb

Overview

Base class for stateless Runar smart contracts.

All properties are readonly. The contract logic is pure — no state is carried between spending transactions.

Direct Known Subclasses

StatefulSmartContract

Constant Summary

Constants included from Builtins

Builtins::SHA256_K, Builtins::TEST_MESSAGE_DIGEST

Instance Method Summary collapse

Methods included from Builtins

#assert, #bin2num, #blake3_compress, #blake3_hash, #bool, #cat, #check_multi_sig, #check_preimage, #check_sig, #clamp, #divmod, #extract_amount, #extract_hash_prevouts, #extract_locktime, #extract_outpoint, #extract_output_hash, #extract_sequence, #extract_version, #gcd, #hash160, #hash256, #left, #len, #log2, #mock_preimage, #mock_pub_key, #mock_sig, #mul_div, #num2bin, #percent_of, #pow, #reverse_bytes, #right, #ripemd160, #safediv, #safemod, #sha256, #sha256_compress, #sha256_finalize, #sign, #sqrt, #substr, #verify_rabin_sig, #verify_slh_dsa_sha2_128f, #verify_slh_dsa_sha2_128s, #verify_slh_dsa_sha2_192f, #verify_slh_dsa_sha2_192s, #verify_slh_dsa_sha2_256f, #verify_slh_dsa_sha2_256s, #verify_wots, #within

Methods included from DSL

included

Constructor Details

#initialize(*args) ⇒ SmartContract

Returns a new instance of SmartContract.



13
14
15
16
17
18
19
20
# File 'lib/runar/base.rb', line 13

def initialize(*args)
  # Apply property defaults declared with `default:`. Subclasses should
  # call `super(...)` at the beginning of their `initialize` method so
  # that defaults are set before any custom initialization logic runs.
  self.class.runar_defaults.each do |prop_name, default_value|
    instance_variable_set(:"@#{prop_name}", default_value)
  end
end