Type
CONTRACT
Validation date
2023-11-14 15:53:19 UTC
Fee
0 UCO

Code (867 B)

@version 1
# Automate the refunding after the given timestamp
actions triggered_by: datetime, at: 1699984380 do
  Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x0000422C61F773320F920624B9E9E7553FDCBE8E2A291554503340669CA86788CDA4, amount: 50
Contract.set_code ""

end

condition triggered_by: transaction, on: refund(), as: [
  timestamp: timestamp >= 1699984380
]

actions triggered_by: transaction, on: refund() do
  Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x0000422C61F773320F920624B9E9E7553FDCBE8E2A291554503340669CA86788CDA4, amount: 50
Contract.set_code ""

end

condition triggered_by: transaction, on: reveal_secret(secret, secret_signature), as: [
  previous_public_key: (
  # Transaction is not yet validated so we need to use previous address
  # to get the genesis address
  previous_address = Chain.get_previous_address()
 Chain.get_genesis_address(previous_address) == 0x000018D60115ECE0C7558A46B4693749BF6BEAB524FDDCCF9B10B910619E4EE08801
),
  timestamp: transaction.timestamp < 1699984380,
  content: Crypto.hash(String.to_hex(secret)) == 0xF01C479022D3F5E8612A993C230B50024134F27DBFCEEFC2CCA9BA9099A9CDF5
]

actions triggered_by: transaction, on: reveal_secret(secret, secret_signature) do
  next_code = """
  @version 1

  export fun get_secret() do
    [
      secret: 0x#{secret},
      secret_signature: [
        r: 0x#{secret_signature.r},
        s: 0x#{secret_signature.s},
        v: #{secret_signature.v}
      ]
    ]
  end

  """

  Contract.set_type "transfer"
  Contract.add_uco_transfer to: 0x000018D60115ECE0C7558A46B4693749BF6BEAB524FDDCCF9B10B910619E4EE08801, amount: 49.85
  Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.15

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 49.85,
    end_time: 1699984380,
    secret_hash: 0xF01C479022D3F5E8612A993C230B50024134F27DBFCEEFC2CCA9BA9099A9CDF5,
    secret_hash_signature: [
      r: 0xCABDEDE367FD974372559B7ACF6F3FD016DC42974CCED4BB9826741D86A56991,
      s: 0x332F3F3016CDF5A8D35E1671139FA078E022E2680C4B3D95F711195E008D1CAB,
      v: 28
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    B6307610627BB4D8832532A850EAE3D5DFFF5F348C83A9FA2C75328B3ACFB457140BB88B00883AAE29A760BA90619B152CF32AF57B84625B6090AAE7

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

0001A4B9050D2A1C5F09F7E8939A5C026F78A128C1FAB3F6F9E9446D91EA796E45CA

Previous signature

B601B6DABA68B8191168F433AE6F22A5E50C57B03A15AA8999C0936799B6559786C44F5A059EF0D3F80FDB342BF64A40F3B3660F1E615687DCD7DB343CA4470E

Origin signature

3045022100A55F826E034BC579CE20C4E9EEDA6E48F046E8F1136DF5FA9CE89A3300807B99022043D3DA714F2222FE0F41BFF19955F78528EB5FA310A610AFB76DB46AAEEE1907

Proof of work

010204B3B2A53580086B9F36919CF40ABC55904729F78BF43673E216FAC1EB2451DD1E521879C6588F0CB09B150A103A39A73E2816B5ADF51F0721348BA3A66C33023B

Proof of integrity

002C5288CBF454028B860B13DB9991A6609E496E98F3159C496FA676928213BB2F

Coordinator signature

58C995AD7878C08C81D96EBEF19F8D97BC50F69B65C880DF1C64252C9C648F4374C87356B86CFAA90724AACBC610064959214A793D6F23E3F09447EE66A0940C

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

14C6093FD5D47E0F7A7AF9B8CC7B8E3C7E9ACEEADE82B0A4C74577D814F645E26FD3C0010E978A96FDFB41310CE2DD94ACB40A1DBB6F6C73A314145FC7AB8002

Validator #2 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #2 signature

192149C13C3315EE2BE36A1E41CDAD500E735E973F38412009C5485A4B8F506C1152981B3CD5BC84206C110CA1EBD6933D41AF8F400A2A5533D6E8E53A83AD01