Class: Runar::StatefulSmartContract
- Inherits:
-
SmartContract
- Object
- SmartContract
- Runar::StatefulSmartContract
- Defined in:
- lib/runar/base.rb
Overview
Base class for stateful Runar smart contracts.
Mutable properties are carried in the UTXO state. The compiler auto-injects checkPreimage at method entry and state continuation at exit.
Constant Summary
Constants included from Builtins
Builtins::SHA256_K, Builtins::TEST_MESSAGE_DIGEST
Instance Attribute Summary collapse
-
#tx_preimage ⇒ Object
Returns the value of attribute tx_preimage.
Instance Method Summary collapse
- #add_output(satoshis, *state_values) ⇒ Object
- #get_state_script ⇒ Object
-
#initialize(*args) ⇒ StatefulSmartContract
constructor
A new instance of StatefulSmartContract.
- #outputs ⇒ Object
- #reset_outputs ⇒ Object
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
Constructor Details
#initialize(*args) ⇒ StatefulSmartContract
Returns a new instance of StatefulSmartContract.
31 32 33 34 35 |
# File 'lib/runar/base.rb', line 31 def initialize(*args) super @_outputs = [] @tx_preimage = '' end |
Instance Attribute Details
#tx_preimage ⇒ Object
Returns the value of attribute tx_preimage.
29 30 31 |
# File 'lib/runar/base.rb', line 29 def tx_preimage @tx_preimage end |
Instance Method Details
#add_output(satoshis, *state_values) ⇒ Object
37 38 39 |
# File 'lib/runar/base.rb', line 37 def add_output(satoshis, *state_values) @_outputs << { satoshis: satoshis, values: state_values } end |
#get_state_script ⇒ Object
41 42 43 |
# File 'lib/runar/base.rb', line 41 def get_state_script '' end |
#outputs ⇒ Object
49 50 51 |
# File 'lib/runar/base.rb', line 49 def outputs @_outputs end |
#reset_outputs ⇒ Object
45 46 47 |
# File 'lib/runar/base.rb', line 45 def reset_outputs @_outputs = [] end |