Type
CONTRACT
Validation date
2023-10-30 15:29:40 UTC
Fee
0 UCO

Code (863 B)

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

end

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

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

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

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 0.997,
    end_time: 1698686940,
    secret_hash: 0x05A2A19B00D74AC970A2B995A089B8D6FE37D334184445D6BC528AC5CF98B361,
    secret_hash_signature: [
      r: 0x865F0C1C296DEC8327265C93A5A1263A4AD0C504516C6B01D4F718DD1D135CE1,
      s: 0x56F15163C2E27B3F2FCB577FCFC56FEC2AF9EC368774D49CD757A36AEE22C47B,
      v: 27
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    1EAAC22EDD567343A1091351E2F1A16CFD7FECAA7CE0EEFF8BC2B69AD86AF23077709A24FC1133E7836C4F66126EF544EB528C56B2D04C915E726580

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

00011885DFDE9724C4A296471EC44AB8F8DEF10915636E878B916C8C117E0A3C8A62

Previous signature

826224B067CEDF693879F902B92967696F91B3524E3707968B223DD0A6FA1D60514E50A7EDD34B8C81BD49063F4A24F0B101A77C2995280E0672CB6BDBEFEF06

Origin signature

304502200C37632D4428467630FE2778FAFB8310A487C70660554448002F2292CBB2270E02210085AF899D19D7079B615ABEB7338232B5B92EE1CF564B751371DCBF727A85380A

Proof of work

010204E9BB401A767B0C92D5DB139379AAB18E1B449B455F49E3A44F3466B2D38E59F0516B79493A528A95E5A74CF46F79CF12DEB73293458F6A4403D2B3E57D697347

Proof of integrity

0044A8C58CE847B740C6A7C0D8F4B65CE738E7472898968D157211D47EA298D165

Coordinator signature

2A538732FF9E480DEB78DAC93E6C71F200B7A8AAE96E1085407B8332A6E9D5212472A499ECA25866C04AF39F601A2241F78F9EB58FDE000EB14AC0C2E0410C0C

Validator #1 public key

0001500FBE298B79FFBDD5CCA1798F30FD88A53D26EC39DE5DDE1F4137B032A4BC34

Validator #1 signature

15E6649CBD71CCA9AB46310AB4B45409D13810B2A1B2FCEE5439249B728060554D14B7E6FBBBDDA5CCCEDE8FF1F2C3F0585013D4FD660F2169689DCCE2259C07

Validator #2 public key

00011ED0B570D680BE5ECD58D2D121689DA73C46DCB38A01C6E10D06286040ADE30A

Validator #2 signature

4D8D45C5419F35983973782763C74CA38EF4BEFB05B2A4BB2AFF802200A6C8F7603BC8509A09BF3EF0ACFA8B8C64D43D7E21F2E6202EEC7D7FCAC54D36A81204