Type
CONTRACT
Validation date
2023-10-25 17:52:35 UTC
Fee
0 UCO

Code (874 B)

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

end

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

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.001
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 < 1698263520,
  content: Crypto.hash(String.to_hex(secret)) == 0x0A712BD25FFD373BCD86FF5FBE07D180CBE42E869163CFA5ADBE2F3D96DF755B
]

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: 9.97e-4
  Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 3.0e-6

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 9.97e-4,
    end_time: 1698263520,
    secret_hash: 0x0A712BD25FFD373BCD86FF5FBE07D180CBE42E869163CFA5ADBE2F3D96DF755B,
    secret_hash_signature: [
      r: 0x39B69BDA77A39E7081F1DA342DD6D96901C47EF47140032C8F1B07A213984965,
      s: 0x20475B077F9207625DF79BA33A8B007305D6F636E8BB2AF4FDBD8020A0FCEE5E,
      v: 28
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    117DD34A481369D68A7FB14A5258C1DE5F1A131DC62A1783E2CCEDFB25562587B5C34A97D059B130CFC61CF5CFB93307E3F22E2A22951E57A1EF7BBB

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

00010051011B304E78A48A719F7A5F7B4D50379F7195B8C888E271233D651823467E

Previous signature

D1B9244E920A676497F2D74BB26BD318A9550618FD99723AF97E7D7EF90127EB271D49072AB0B64109A740E1841C786EDC36AA1CA0EDD5D6B60E7F417F09E40B

Origin signature

3046022100FD332F404C7C810EE49F8588F50D02734BE1D855843A8366269EF8E607041A22022100D8BF8F25A0A04771DCABAA9501EE39D6CEB0845CA31DAA086EC0B428B6019238

Proof of work

010104AB672F1E69B064D192819F1797C1926F158DBA8F3924AC732B4C4D70D0C8EA0A0D6506E5896C9C2524D2BE26CB5016287E1816A597C408008BA36FCB154A7765

Proof of integrity

008E58A994B13CE026A826AC39CC422756BB549D3478D484DE6F04C67D951D53ED

Coordinator signature

18CD22132C2E5F4B9168B94A8530B913766F9AA8509921F07B37F00F73B2428B8E98E5D41BB25CA105193F3F75B7437FF2FB3B52570A03C3D896B3E34A249305

Validator #1 public key

0001500FBE298B79FFBDD5CCA1798F30FD88A53D26EC39DE5DDE1F4137B032A4BC34

Validator #1 signature

F4D0676D0E12E261D3A769AB7EAF4C7BD84DD3E150BDA9452B489CE783A6BA5DE68F8C311999307AAC0100AA6A3B44267DC929BD47A9FC77F18036B6902BBB01

Validator #2 public key

00018A312AFA617E98B343D09AD2E73F0AB661DB0A59FB986D5DB8CE7664E14C25FC

Validator #2 signature

34C26381C0E7922C3BC59AFC9B1105BDA69758A5D4015702B41BCC5347DD78C40AF338BA7813388D682A40DF3D25F7E569832867892901489F9D5D5DD05BC006