Type
CONTRACT
Validation date
2023-11-13 09:31:08 UTC
Fee
0 UCO

Code (870 B)

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

end

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

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

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

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 9.97,
    end_time: 1699875060,
    secret_hash: 0xE1E0BD548C521F50ABF2FBC100783784A19C86E8855DDBE070E7D03C58E79385,
    secret_hash_signature: [
      r: 0x9A25BFBB327966797E615A2F7E2FAF3BE2D307702F33B9F59AE86D00889F9874,
      s: 0x74544D479D4C3893DE409E0010DA2BD043FA88A1B852D591E48E6016B3BD1E7E,
      v: 28
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    237F593EED17C57F172CE781D930B92A68C4F670957CF2DBFBF82B7540D470BEF77C0B0CCA0F4D95F382096399AE4CAD9CD29ACF3FF3583EE7B0BCEE

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

0001D41AB3F7B0BB41C124755C4F577D12802CEA67693826A8D2B3779D081C4FACE2

Previous signature

8FCF5A305D32963CD7129EB7DB42229BD016909D98462D4DE6BCFBC7FFEA9A2172D7492CD240F5B9665404A97D62212C53A1262C3420EE2B1221FE398853D802

Origin signature

304502204EF0BED0AEB2B1082DAA206B2C60C124F96455C2C380FF827E4287D89AEEB82B022100EAE96D47EC97777F51F724E4BE3C0CC16EEAA15B0E9684705BE2B1EEA4744DA9

Proof of work

01020451684966573439C38DA99334546FBBDE4A6D96A50B4A4ECBB6572CDBED023F079607407E254421D1779525D11C60D55684F0B403B93B95823554E29D1E2CDB16

Proof of integrity

00EA1A4F48A961D5F0343A4C896F54DC93F4546CF825EF3808126DDF7D8CE06D48

Coordinator signature

C61EC0C50B166AA168C813F69A2C9B8D5247E4D33C01FE1A6197D8EB0BEAE5FA7476790B58782E2C08D6B410FAF079EA349C11B450056F67E90388C4A6EE2606

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

9087DBA77491EF3CB0788FAC69A7529B7A14FA379ADF5850C772EEF86AA0DEF2456C56818D381959F03D0E4AF655E85E81845380F07670C29921D60B944F2E0D

Validator #2 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #2 signature

053B2F81CC1A3E6D273A21DC42EE5A16D495B954DE50AD76E97C3BB27EFE4C73C91C3C6D604099F31FCF671CB44EB429BA6BBF81C41030E41AD05804EE920A0A