Type
CONTRACT
Validation date
2023-10-20 08:14:52 UTC
Fee
0 UCO

Code (867 B)

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

end

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

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

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

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 0.4985,
    end_time: 1697796840,
    secret_hash: 0xFE6632F914CCE0CB524669BE92408B3EF9E131F19BF8341BE2979CE8C210C74F,
    secret_hash_signature: [
      r: 0x649DE2CBD8258E8776A607F27EFAC0D8EACBF7942C7B76FD1282AAFC6FA32D3B,
      s: 0x737EA598EC145B4BC23C5C29448E2A4CBE6C35AD5B9BF01B6714BC3E1EDAD1F0,
      v: 28
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    DF9FB9692B56391DD12672C62FD2CD9445F5E6E56477B8DE562F048CD22589DADAF5ACB55D245E5608CA982616F1065A40837B7DB56A9AA804385E10

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

0001A7EF11136425A0D00ACB7FCFE24E4A70FBBFE58E685C4388666CABB59DB5111F

Previous signature

903552D93743AAFBA71DD2EB5CD9AFAFCF5A2E9FF301D0697E57157E50AB10E4CAD9509467044D322BA517C450FEB584EEF85A3B4DBC6F33983A5894FA7E0C03

Origin signature

3045022100C40D56DFA6EA6D9E0F841C249402119F14D15EA571537CDB250D8793A3651632022056963FDF5FC415D6C1CC6EA28977F7EB72E65942382DD1176F6C7167A1128029

Proof of work

010104AB672F1E69B064D192819F1797C1926F158DBA8F3924AC732B4C4D70D0C8EA0A0D6506E5896C9C2524D2BE26CB5016287E1816A597C408008BA36FCB154A7765

Proof of integrity

0083845D64B905CFCC4A059646D82A29D720D1A3BA815818C0C4655A18A16978F9

Coordinator signature

5D7D0955EECF522F5B3B2FBE7107089AE1600101212BCEA6B9BB95652ADEF50BD76641E712E0AFEDCCB1DC5C34CEA45C32678D9116A64C4D34F5C4DC5CA84508

Validator #1 public key

0001500FBE298B79FFBDD5CCA1798F30FD88A53D26EC39DE5DDE1F4137B032A4BC34

Validator #1 signature

6A3BA117C86AD46E196BA5BDCB595D4D985A4508A29A0F7A7C19F0C5C3B83913E55A2AF730F012C94E8CD4E85D5F98AF983D49FC4208BD2333410A2389B47A08

Validator #2 public key

00018A312AFA617E98B343D09AD2E73F0AB661DB0A59FB986D5DB8CE7664E14C25FC

Validator #2 signature

7D9A00D88F456EC914057C6728649A6272539F380D38B2487B488DB26B4D4955D7E74BCD8CDF1A8AEADB7BDA942DF20A83D26DE8A3BF1FEFADC8514590432000