Type
CONTRACT
Validation date
2023-10-27 09:53:53 UTC
Fee
0 UCO

Code (866 B)

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

end

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

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

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

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 1.994,
    end_time: 1698407580,
    secret_hash: 0x5963EBBAAD275FDFDFE5E05725F7A8AA1351CDDF0A97CE31AED110EAC88E6A84,
    secret_hash_signature: [
      r: 0x649105518CF258456454592ABA5503D0C53DE0FA7A634B0FA9F1FDB6B72FF8A5,
      s: 0x3216860C5C733BAD218FBE5624A8C188F77D503BABCF650B3C8753E66745AAE0,
      v: 28
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    7F6CB0FF87A86B680A6B2AA3D101D90168901BD4424521B06485FA7008E689EBD2E285141F54F5CE55E9913AFCCDD3E28AB4234CF3BE177412F8282D

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

00017D6DB5FDCB5E869F11C456A3306715AB6FCF0145673EBEEDC9376AF68A7ED351

Previous signature

CA7E78D9DFF9DD7C30DE77A0E11831A2461F223379BDC0E0C7C956911B6C28F1479E6C9C05D0140C6FBA39FCB48243FF516ECD42BE05DE171BEDFC9C46DB5E0D

Origin signature

304402202952B65D6F138F76988D6AD6DB5FBA8194951B45D526E016FCD28D23EE8C6F1502201D9CD2EAC45D959C870033FB973763B017D6D13B85E96A58898108797CE68BD5

Proof of work

0101046C39D56B717142B6EE14B0F8B2561ECA458F3D2D12C9977D613F78829419063211F9C21F7BB0D56B6523040A8156BE22B6E9D6332B88ED882574D12AE32F7A45

Proof of integrity

00424FD1E34FB0D76283E6F1281AB9C0510A0DCA969C393347B03981EE255689BA

Coordinator signature

111362BC6235EA769F0FDA0D825BA0D22A1BC168FF5528E75B70C8C334B949E5496F7C52C8C782140974C4075C421EB3CD1ACBA31DA9A12477F8BAEBD7860D04

Validator #1 public key

0001500FBE298B79FFBDD5CCA1798F30FD88A53D26EC39DE5DDE1F4137B032A4BC34

Validator #1 signature

33AD10CDF6C665D6395541D4CE2757B0D41B08FF02CAF299AB37F6BCFE2D99ED8016C154BA3CB872E09F9EBAEA62DBD8D4C8C7D181232946233FEC8A77DC7703

Validator #2 public key

00011ED0B570D680BE5ECD58D2D121689DA73C46DCB38A01C6E10D06286040ADE30A

Validator #2 signature

8742EE3778532857126D71D25A566A04A1E6E5C41780A43FD8B3B911CD6AFB93A3B89FBDFD2B72B21B5827C102A429CF2DDDDE1126E7EBCAA9FABFF7AAA9DB06