Type
CONTRACT
Validation date
2023-12-14 09:32:59 UTC
Fee
0 UCO

Code (866 B)

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

end

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

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

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: 1702553520,
    secret_hash: 0x0C09510926FDC41F15DE0BA4FC2FDA0AE39E9424D8487D2445AB890C80FAECDD,
    secret_hash_signature: [
      r: 0x601A7B0CB5A01F1C3BF656F81A7352D1FE47197515A4485D4ABD081953668782,
      s: 0x396D3F7180F76A7451F065C1071626CB93BBBDED0220C8E74905D0C261420085,
      v: 28
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    F0E48B3F02AB8E31B8F9E79E9B85734AA475EC7CC0A175D92996152BD36B28EA392C73FCB4AE85F441AEA1FD6CE41281AD1F04F764A6B523205B1A1C

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

000147AA9894D654870F419F29F575B7701403B271A153F40BCC8D619E3EE3ECBFA3

Previous signature

4EB3DF2351C06569B40495FE40C86FE67593869349728C5FF884BC58157EC588F13FAFC8BC22EAF3147A7741577701B3362E888D44F7AFDB0890016FF09A430B

Origin signature

3044022061462824CB11B8E423605D3C43AA21FB9A40E763139892F6E03778E7B92823040220545D50BA1B61449A5B2866C8095C375824AE975228910938B6B8C994C2F772A3

Proof of work

010104EB90F7BDD03D5A7FD9B61D9128D7CF24C11F3F7DA96825DA3680C2B6BCC48F1AFCE26E0A5F1A903EDAA4BC9390210A0A4F175847EC2A2BB325BB6D1CE8EC8F90

Proof of integrity

006B6BFFBCA6E4A5DBAE4DF1E5EDB02275C0F797F6E4E73528C2BB87029C1D9473

Coordinator signature

0D30C2C3F1DD0A0300CFF4884FC5FCA044953DD1ADC9F8809B269A52937EAAFCA2FDAA1303340A972307B25FBE8FC954345D01D9F9256A30F6A7A36DBDA96B01

Validator #1 public key

000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF

Validator #1 signature

F16164A73484292A60FB926D37344BD786D5AE4F164D3344807FCF524D6F960C99A3198BB5767DB409401EF89E3B4EBC6D5E74ABDCF5ED1548FB3DD01DB21E03

Validator #2 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #2 signature

FE09AAD6D54644CDB3A8EC6E39C9764BA44FC05AD05CC4A81138B13CFD78CCD11198B968142D25439862E535B2FFE8FFB0D11BC7A75F91F51C3EFBA2C469E603