Type
CONTRACT
Validation date
2023-11-12 15:42:41 UTC
Fee
0 UCO

Code (867 B)

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

end

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

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: 6
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 < 1699810920,
  content: Crypto.hash(String.to_hex(secret)) == 0x98E0F2C7E069240F11555CA49908DEBCA6F80822F1DA70F4DCBC855201566EC3
]

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

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 5.982,
    end_time: 1699810920,
    secret_hash: 0x98E0F2C7E069240F11555CA49908DEBCA6F80822F1DA70F4DCBC855201566EC3,
    secret_hash_signature: [
      r: 0xEB33176EC5A7A29711D38D0DAAAC3F466AB1CE2E9544BBC1D227845AC945F517,
      s: 0x2B9E9A7C4B2F9C3CFA45CC3FDC47C6BAED2D779AE703A92B9ACB6FCF742B8600,
      v: 28
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    86CA57C097D84E1B19E33F27A74203C6E0AF54102F54C02891A0A9A515FFDBA624777974C6FBC79155D01CD9B080F0375781CB9DAD47A6F51D4A5878

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

0001BD7BACFE73AC133927AE1D5182C6543FDA1F12B68E9B96A40FB46E3C9632AEDB

Previous signature

ADA1E168975D0930B0AEE8D1E882E41E69BB077CDCEB596043DDF5F881590E04C19158438A62816F8DB9F54DC6C3AA314131105AFF8B5DB2BB57FD11696B0C00

Origin signature

3046022100EA516B2D46B95492B4CE664CDA674489D4045466A7A47F97D3CCE7F6552A5B98022100ADB0C0B1F111D1B4E1B7E7E0FC033C39A5D1473A22AA0459F3FE4DCD30A1912E

Proof of work

010204B3B2A53580086B9F36919CF40ABC55904729F78BF43673E216FAC1EB2451DD1E521879C6588F0CB09B150A103A39A73E2816B5ADF51F0721348BA3A66C33023B

Proof of integrity

00E51E5C1BCA58CF28F88A2906608FC86B5CCCCF8C69DD19902A4B07734810434F

Coordinator signature

747D78B67C18FCF0F8A9EF75067550395800BF76503509E304D6F594FFDB68BA64EE45206B164FBD312364A740A7F699EBE6262B3013CA9D94F38FB255552D05

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

7366149E045A8DB83D08D45B50EEB951F7309A2A06CC3CA504AF92D2C5220D1BFFC751229C201C6873BBED49D916F521568EA87F5D2C339224A2AA7D3675CA04

Validator #2 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #2 signature

0B8913313A1E2C5983BCBE7C3F68A182B5513090AFE90934463224F1502E8E370EA5FD7A84FD9FE77002B7727542A3A106AA7859871FF68C465545A92A813B07