Type
CONTRACT
Validation date
2023-11-16 16:53:35 UTC
Fee
0 UCO

Code (864 B)

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

end

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

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

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: 1700160780,
    secret_hash: 0x59B7801BF3EFF61B38FABB8D3DAE849E192A89360188A6D186FC977354812F5D,
    secret_hash_signature: [
      r: 0x4FD8AC5A94E79F06716BE8BE157049F5601E05DC77653C290B81ABBE5D830E2A,
      s: 0x4390728901F86BA189E35E2BC8E667E4B6B98FBAE1BDCB7752623F568AECADFF,
      v: 28
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    956218BD7DED3E8AB38EDF6F551B18828CFF7182F4D53812ADD7631D6FD3589535BA9EF48F7B5C13A1777B46F3C765F4C1CFED62152C1995557AD8F1

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

0001D20F9EDC1ADD9EAE17EA07F9B77B3AEFC0622477AD4473C14FEBF01778F0A262

Previous signature

C7210473ED678AAA0EF2B574A0A2FCDC6E511D48A39CFD957D4A8C3734B124EC63CDA48EF7170EA7C5B0019E8C5978954B501630E4F194A48E7F209FDA678B06

Origin signature

304502206E2E9EFDBBD18063E940F066FE1285823EF54577BF6ADF210A5088CF859B3231022100977F09F9E455EFABBC6613C2EE51C7CF887DB8D79C3646A885F8757B0A3D004E

Proof of work

010204B3B2A53580086B9F36919CF40ABC55904729F78BF43673E216FAC1EB2451DD1E521879C6588F0CB09B150A103A39A73E2816B5ADF51F0721348BA3A66C33023B

Proof of integrity

002FBD3FEB998620A370F473EC2B37082C16554FBA0F12F4E40BFF17C3F054F417

Coordinator signature

60BB5869ECA56EE215C7CA74D672C1BAD4A381958D4D7BD45A1877C1F6A297A0FD69E9EC34ED3237C10D9CAE31ED0131129D2AC2795047810CA83404B2934403

Validator #1 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #1 signature

8CA7F7B919DA13FB01C41C94B79126A12AFB98FCC9961DF5CE5EC9F2ECF670F7290E0CE5A5D30D7B4C2A70286AEE059035BC6FDD168FC263967C2BE7427C5406

Validator #2 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #2 signature

BD6EDC3AFB97D830422CCC77F0873B1CA2622CEC752B7FEE1ED1EDC0E915356361008EF1D4635F1D1FA28B4075B438A7B62849BC88EB31DDDABD6BE50B3D4807