Type
CONTRACT
Validation date
2023-11-15 16:19:46 UTC
Fee
0 UCO

Code (871 B)

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

end

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

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

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: 1700072340,
    secret_hash: 0x50E53BEAD3238C973BCFB38AFF3E70E66CA59E5EF03385D55816FDD9CA944DC2,
    secret_hash_signature: [
      r: 0x7414F8AECD17D28CF97ACA3531AB7BA49D10B13A071895725F5F35D0D90BA557,
      s: 0x1529BB80558590A8932E8F412B2F189A906FD58BDE0B4335B1EC86AA99CA8E0D,
      v: 27
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    14A6D8017EE5BCABCD58B151DAE8AD11A98F0B3A8B68E5728C3068CB0B93CF0C60B59EFDEBD31171A62390B89CEC69D3923D126A18D5D2E53EB09815

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

0001211A4BD53869FBDD9AA310EE9D2C9D0258B0C0C382FC9C78445E79AB8396E7B5

Previous signature

9F13729455C2D9469452ABB0E8AF5F44087A7492C402F45E2B9BB0E83BEC80C41DA25D8A35206D7B4142F4428D3C800278EBCF53973FA850B31D63E6AD30C60B

Origin signature

30440220762B8785E7EE800939D6FDE9097BF3F50B8F1E283994290B294D47908D230901022068AAFEA28EE8740E14AB3EF3F0B0CA9D9C5A6642E7FCA507C047C7D425A6AE30

Proof of work

0101046C39D56B717142B6EE14B0F8B2561ECA458F3D2D12C9977D613F78829419063211F9C21F7BB0D56B6523040A8156BE22B6E9D6332B88ED882574D12AE32F7A45

Proof of integrity

00FBE87B0089371E4FAE0C210957599E0BD88BEB809B092975269208A1E9D8C963

Coordinator signature

294480A71FD8285EBC86956B78B78B216ADA0317C739D4E0572C72D6B180A21CBCA3665C39D3DF27B8FB0B7D7CDDE9B855809E213854D1D5AC0AEFAE17FC4908

Validator #1 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #1 signature

7D8D923615A7013639D06745082A55FF971A1173CD79542F32255123C643B72B5D6E75654FADB874355166B3ED7B4BE151D965B79B831AE926834C5C15DA0E0D

Validator #2 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #2 signature

C9C60B403B4CC4B05E71AA7F1CF76943437DC7CE7EA0198A0EF4A64A17DAF6A3F44CF838DC937BEC2A96BF609B31A7B00105F598A69D7378055B4AFDF7848E0B