Type
CONTRACT
Validation date
2023-11-30 08:02:32 UTC
Fee
0 UCO

Code (864 B)

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

end

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

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

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

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 99.7,
    end_time: 1701338520,
    secret_hash: 0x81F6BC46C1826CEC878AC96BBB03FF5A2C0400A05018CD7A45F7C04D182B0EE4,
    secret_hash_signature: [
      r: 0xCD67CF91E256E20F9CDBBBD8448012C6C0CBEF6F6000BBDA32F4B160BAD473B5,
      s: 0x25D32E3943BACA12923DEC963B977D914BF3A8EAC1C58907A8B1A7F306CEC294,
      v: 27
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    C3C8809BCC5C01A8F6890CCB75EB36324C5AA784D18CD5DB7D12813B742FFC05A954D2B878129786A32BBF97D1CF2DFD34B33FEE0F45DB5A9FBE21B9

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

00014348C6BB185AA5FCE887C2C8EBDCBAF85BABA822EE8490A54F92E846FA435572

Previous signature

9CEB354C5180F71FFDCDA546F64D44891F08DD7576829AAB04538529050F0ABF502B4A7852F7D7C614D4B10796A3CEFC445A13519C32A96E10F8C6B0542AE604

Origin signature

3046022100E65FDF68B7E3205060DE8A684FFE10B499D38E1FA769091829F0D2F84819FC05022100EA9D6A4BB81E11427F27615E9C4B0FE2A66F0945368A926E56529EAAA3C4E022

Proof of work

010204892A04DBE05192BCB662689E7E19700F3F7202028EF0A9F20635C4948436ED85A43BA3017281EE97781342DD8F24ED6F583B5FE542830FDB5191A11843A72A61

Proof of integrity

00EAE56E527A387B8B02EA803C231BB3AB0874604F50AAAFE3FA4CE329370C43A5

Coordinator signature

025C3DC0906061B3155F3BD17DEA4CF0FD210B089A75DF9F79E3425A42EA233D74DC545318F338DFF27F1D3A137C86E61E5A7D88FFD960CB7829713A67D19E0C

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

3E2A4C93B104D6125E3CDE1F2F624F079A673515B0A321BF71D4391CAAC890892E32E5E3F002DEC343D4E8B63137E4979F5B5C44C3517207A8BEB35E8AD16804

Validator #2 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #2 signature

6D31AC7D5C918FDC624EC61E9E5DC08AF6E60B9DA938F4D9A8BF1C7471ED5DFB0DB2064744B60FED243369F3542CE678B330E356BB3C5536F9A3196A68C2AA0F