Type
CONTRACT
Validation date
2023-12-28 22:13:53 UTC
Fee
0 UCO

Code (864 B)

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

end

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

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

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

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 6.979,
    end_time: 1703808780,
    secret_hash: 0x743165056BEDC7AB37A59C562413CF7EFE2A1AFE4EEB0203189C503D151B7005,
    secret_hash_signature: [
      r: 0x708302BEFAD64420D1BDA4098314D55F3590278C93685A8C582C6CDBF23B1DC9,
      s: 0x442D24FAEB67AC54EDF798F7565D6730B8E9A4457720FC53EF68118FCA042378,
      v: 28
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    B85E13406D4B60338F87318A85AB422BDB3099589FDD3366045772D265DAA8D7EA8084F4D563B7B04164415BE94F39F3BC78D28C28AF313DC05C2A89

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

00015F627F656A912126D24DACDF8F4C94032D97365290C04DA32279DBBA0A1DD834

Previous signature

80BCA11C19AA424C72DC0D68BA7CD220314E6DBB798A13900410F997BC1503DAC33CF81884453F61DEAB8772E08C68F8DA770602637E79DFD902B1F7D3461100

Origin signature

304402201C3ED131AFF9DC9E98A960E3F277A4CA3DC20535EEBB5C69597D888767ABA4C10220601FD1C7A4EE4E992BE685CA0120CAF578311BAB7059E65FF9528F78FABDFC22

Proof of work

010204AA023E1E039788AD4B8F713C8871CA39A177414A99A0788993AD725B1FBB7AD5E4CAC86151A9E03451DCACB1EFC100B1E450FCEDAF5E5005F3A4C503D1D29712

Proof of integrity

00759C31103F33E9960A190CBCCF3CC5F1225D8068C2E67D27086C12C2000A633C

Coordinator signature

13BF4CE1156CC0914F6C686ABD1E15A38163A5A254E4471936F4507FA78F81351D52D2244F875AA8B400294B11FA1501F30B7BD735DC0B33691769E4E8AA8E0B

Validator #1 public key

00011ED0B570D680BE5ECD58D2D121689DA73C46DCB38A01C6E10D06286040ADE30A

Validator #1 signature

8E30D3B89D24DD0456A0DA2F248FA825FA1CBC94BCB278553CD633A8A5BB1624A2688192B06DAB274E841F4DD89825ABD7E1C64D3ACC7FB1188C10CDEC011F0E

Validator #2 public key

000134772A943DC0F7038B1BABA39E18841C12DD6682B1B6D1D15E08D7CAF5339AB0

Validator #2 signature

6CE99AADF99902B18DECC435E17ED6BB73CB8A883D85637CA75877393BF3F34F7670BC895D0003BCD6C3D0693C89985F1C0EF68A93D607078C6024753910C00A