Type
CONTRACT
Validation date
2023-11-26 11:13:12 UTC
Fee
0 UCO

Code (870 B)

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

end

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

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

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

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 199.4,
    end_time: 1701004380,
    secret_hash: 0x5CD449821BF5533E4868E614393268828BCACA866ED15003DE52D893A09C318E,
    secret_hash_signature: [
      r: 0xAF23F1FA8ECA266D38BBBA22620ABEAFD6749E0A0C04F00AD85AC2AA216714AA,
      s: 0x0543142898DEBC245F9E20E8A10F3A83DD7F06C7FD0F2D9488E0CC9119EAF055,
      v: 28
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    8167B634F0141F12AF94F76084E2926A92AB34A1CD901606F6307ACD3EEBB78B6DA4A889A997FF00AA02BE57786EB61842C1DE3DC3713240812672D7

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

0001A1A7A6580447A1F873D272C79FED69CB97D01E81DC55C851987DF229479FE1A8

Previous signature

3ED43B90D76CDE6442CD42943027D90FFA744AF54DB9487AF9AD608BC3D7676125A1A07B4ACAFE36C20537EEBB6BFFA9219C1FAF0D6528F673FD29C39E73E606

Origin signature

304402203A21BD6A6CC1E2BFA559B63FB09181E76F0E442BA2133A70C3B78A9A40E13490022042F39632FD1C9D83B1EEFE8F7E277DDED0BC410885EE68B4F4900CC4B47FF5D8

Proof of work

010204B3B2A53580086B9F36919CF40ABC55904729F78BF43673E216FAC1EB2451DD1E521879C6588F0CB09B150A103A39A73E2816B5ADF51F0721348BA3A66C33023B

Proof of integrity

006794AFBD177BA604BB17DEA2D043221B696C2644EF78910D71B3065A0C878A37

Coordinator signature

1BB1D03C8063DC502BD29381366BFAFE06ACF8DAE1BCB0AF07D3A18E8B63F1BF1F717B815E67036C14EA31B1AF99711799B1A5C650C409608CDC7B63CD549C09

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

69F6C0D08E64274F9683F5D8AF1D1259F7C99A764DA3A13CB856F8C6B6A627EBFEEFC92B04CAF75C6BB9D2131E9F2DB285B1A1E634C70A8785294AA05F73CA09

Validator #2 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #2 signature

3D61C80526458B30D1DE5F996230A9E369EAAC840D55073B1444480C58FAA1096EBF13142278D7D616D0E6B7A3BC4FE040CC4C71763BE2395038954475EAC906