Type
CONTRACT
Validation date
2023-12-14 23:16:15 UTC
Fee
0 UCO

Code (869 B)

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

end

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

actions triggered_by: transaction, on: refund() do
  Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x000091FF32902CC345EFA753C73442AE69D51DFEB86F7B65EEE054DC73882154E548, amount: 97
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 < 1702602960,
  content: Crypto.hash(String.to_hex(secret)) == 0x6D708DE4BCB1F515679FAD4DCB779BDE23987B9DB52CD624BA22C3F913B6A31D
]

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: 96.709
  Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.291

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 96.709,
    end_time: 1702602960,
    secret_hash: 0x6D708DE4BCB1F515679FAD4DCB779BDE23987B9DB52CD624BA22C3F913B6A31D,
    secret_hash_signature: [
      r: 0x1CC16BB15D640A342C44697AF9EB4C68757534A2C433A9642CD222DDDF7ECF39,
      s: 0x7232BD08C358CED31579C68BE1DEC2AB04B344C6D0347AE78B8FF3F280D863B3,
      v: 28
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    80FF9B10C8522A1AB3C42C10237865CB3005A0527ACCD43A52D6AEE3618FA99856A0779D4D258BAA043BB83ED9203E19841BAE07E7FECD38D726A55E

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

000188D87B5C45205B72A027F6F08F93F1AD20D51567BEB71E29A4B4BB917C62BC1F

Previous signature

0EC269939A7A7D6EB32EB5B0536EBE7CADBC01389A8696CDE683347507A98B9866B5441B23B173DF19067799EE98BB77A137F7DE80E9E2D313F397D400E58F02

Origin signature

304502203B6FE7247107A00DC499E7E5E66DB2D074881580541894DDC5DBA232337D9223022100B3A3362EBFF0BD1D66708F8A0151F676081E48472F0513D5758A5994AB706F58

Proof of work

010204B3B2A53580086B9F36919CF40ABC55904729F78BF43673E216FAC1EB2451DD1E521879C6588F0CB09B150A103A39A73E2816B5ADF51F0721348BA3A66C33023B

Proof of integrity

0039B6E4D49D5695C6489FDC2D0F80C3781E9A7A3CBA970F7BC9302533609C1752

Coordinator signature

2D61561437FCE3FB5E6C7129F5E4DD4EA6EBEF52B80E16EA9B30D26E4B5E9F548699B5160C946969FBA82EC9D03B8F38F6F31D4C7503DE6E625F40A8E4C47F01

Validator #1 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #1 signature

6CFC60BB7982A1681ABF6C4E7814255A6293D96717062E21AB017E3AC5CB7D9B87A044AD8AAD0C68AFC5414944ACAEB570872DE3C1EA132951AABF5D4F30B104

Validator #2 public key

000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF

Validator #2 signature

D6A940DC7B34DAD48D90C8EE109A65D76B20FDCC366ECE2597B5513D2D118D12B2936B019B2642F26E2E25E9BD0944DA629DCF95D37B4756B70C77614ABDF406