Type
CONTRACT
Validation date
2023-10-26 17:15:19 UTC
Fee
0 UCO

Code (869 B)

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

end

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

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

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: 0.00997
  Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 3.0e-5

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 0.00997,
    end_time: 1698347700,
    secret_hash: 0x3D95CE1335E9E4C33691006D300E58E25CDA54061CD27C3127719504CD2D2B39,
    secret_hash_signature: [
      r: 0x501BD7E4CF8978A0BCF1474629B31436114698BAD68CB34E1642D158111F0E56,
      s: 0x1C9FE3A9128193DCB7A706F571BF9096E3021C4E392DA4118AAF2BCC6B4BA8B8,
      v: 28
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    0AF3B30C706043DF4B6EB5968938C31824F345D8B8C05CD4F16ACCF536FA9EEE3954C24A107F328693E4419FE197FC962E1A51E76B6C3C2F4A1C2391

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

00018DCC2ED0ED6F1917AFF5ADB6053DD36D94EA569B22E5FF187E4131AF87BDEDCE

Previous signature

9264C5454676949BFBBFDA82412E72A9A4D0CAD3917892947C0ECF928DAE79E699B7CE7FB09413AF69C12108B705C446382D0363B153109A900F276B6B01C90F

Origin signature

304502210081238EC38BE1F30576D001355B975339A079F08CCC1BB3F70C4FA8A3F3472A4202201661E3EF08674C8370F2EA1389FAE64D72AD0C1EB9B760956E9165AEA0CB1389

Proof of work

010104AB672F1E69B064D192819F1797C1926F158DBA8F3924AC732B4C4D70D0C8EA0A0D6506E5896C9C2524D2BE26CB5016287E1816A597C408008BA36FCB154A7765

Proof of integrity

0029E003038B2A1D9BADDB42116DBF658B0D8E5FAF8682BE41F8A156699B9E6372

Coordinator signature

C2009C13290E07C524E62A02060DE629BB9196F3E48E2CE6D80B9589D487AC2FE118FC3C7FD991CAF380880B5B6F8903A5372396A8F7CA00386361CB182E9B07

Validator #1 public key

0001500FBE298B79FFBDD5CCA1798F30FD88A53D26EC39DE5DDE1F4137B032A4BC34

Validator #1 signature

3ED047FC0A2FBF055497D968670A16A84DC0BF08D6B0934F8455C25C477AAC81922C0B378B16F9EB0E57CC9B922108C6675233BAB04B8550B1D414C06E646E08

Validator #2 public key

00018A312AFA617E98B343D09AD2E73F0AB661DB0A59FB986D5DB8CE7664E14C25FC

Validator #2 signature

5208F86A626FF4976F948B3524EAF3B9285107F2A86C61AD51C2826AC612A3F55291A3A9401E5668671669C86B6036DD69603DD03669A155A62E38DA115D7B0B