Type
CONTRACT
Validation date
2023-12-01 13:57:18 UTC
Fee
0 UCO

Code (867 B)

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

end

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

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

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

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 24.925,
    end_time: 1701446160,
    secret_hash: 0xA337C9865DE770F3A279E41A18167B6E3E7D6C59F49132083FEA9498DBC0FC1F,
    secret_hash_signature: [
      r: 0x35BB3F898B53AB5985436E98E5A231F79D605137529098C11BEA082C23897A62,
      s: 0x4AB07C096FB392448D2A237A5E57447ADADEEF23AC999ED627565DB13708809C,
      v: 27
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    562EEB2B13F5B6F009C53579D38557465BA1D85E8CE43F917BE790D6C818E5BAFB9336494115466D943D94C152FF00E5AAD0DFA28ABB0211DF21683F

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

00018358CFDCD6BF2DD6ED63943EE54437E89BCD32FDD35724ABE526A36C85E0D87E

Previous signature

371F9306D079B63AC4498A88ED89B4F0A8A3581ADF237963632C04A717E83F94846DDD6728ADEBA8B8CBA63D715143EA2FD7D3E40FEDEA52F9E13C1D940EBC09

Origin signature

3046022100CD61DB9E000EC799202B50337C84F2DF038C7482D2644BCB0B0AB486474D5750022100A61AE8C235DA90D796B038A72D388F20D8E06940653A97925B8377DA4A0944E2

Proof of work

01020451684966573439C38DA99334546FBBDE4A6D96A50B4A4ECBB6572CDBED023F079607407E254421D1779525D11C60D55684F0B403B93B95823554E29D1E2CDB16

Proof of integrity

0078DFA939EDF0CD733D313F5AD188773901304779D893F612D69DEC79C9CC2BB4

Coordinator signature

53B888ED18E4555D9823618FB6172E130B158CECC76D599A6FF587726D3B9755200C621AEF759677B7F1CB3AEBB2D0C2F3C93D7C0E8864187853046D08DB4E0C

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

FDCB92D9CAEE384449D08ADEDCFA5BFD5FA2BA89DAECE4896D1553D7D85B85254CFD43E68A86E798D0F42923178E4DF226D90417EC600351EB502BB69FF7D00F

Validator #2 public key

000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF

Validator #2 signature

0452894945BA3E655F5B58838A8A86AE47D06311DAB7D2C46A4B7E1E7FDEDBDC84F7C5850685284FB7976A5A289E7DEB54C1DD11DFAEA92360D7F1B14CC6FE02