Type
CONTRACT
Validation date
2023-12-07 09:07:35 UTC
Fee
0 UCO

Code (870 B)

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

end

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

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

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

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 3.7886,
    end_time: 1701947220,
    secret_hash: 0xD33A29B8AE1E71CC46B180971ABF7408EF579A754B63CE9B1F879DD921154BA4,
    secret_hash_signature: [
      r: 0x126902239234F91CFDFAF3901E4B1A02532ABA2A5B692ADB72F39D23339AA061,
      s: 0x08D7E3CD1ACD04977ECDF8AC4BB15437C95DFF10170A9009D04C3C8B9C6C354A,
      v: 28
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    125B112EAD5D28EC16B9C01BF2FDDC51E3ABB082F91D76DD494C6C6DE6E122E825D364EC0EA9FA793EA0EC347DA50208D6F563F4F9E7E704C8BBCF04

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

00010F9CB230104955E5E4A4E241564CB7FB1FF749EB582FAE55A3FB4D2AC7B713A0

Previous signature

39A8EA5A68AACB55DFAC7655561B8282495F8F9CAA84C7D283D1B463FEB2CE9E98AC045AD3D1CC7703F3C16158800724638AA6430001D8021487C1E9D843C605

Origin signature

304402206C43403E0ACD09C2ECB48D2A74F3B626F1FC2B98F575A4BB590C7B60E0215CC90220287830D68191C50988D56A9900807C234F836FA7D33DF829C9F19B2B2E88AB3D

Proof of work

010204892A04DBE05192BCB662689E7E19700F3F7202028EF0A9F20635C4948436ED85A43BA3017281EE97781342DD8F24ED6F583B5FE542830FDB5191A11843A72A61

Proof of integrity

005B7F63AF5F15F2371282C38AD7681C32CBAF56E8C4FD8BEF9168543B80ABFDB4

Coordinator signature

BF5366B81B7FD91C19F5DE18642B14EDD4FDFFA67A90ACBB326BB743B09E90B7E082B9E1981028402C0598F1F5BC4EBFAF19A7A811C5CED42802926AC0C6EB01

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

6A824E1CA09E6D3D789021708FBD1FABCA6A4E839A16C7BB1E81097A301FCE13CEABA5B5B80FD6A1733DB73908DEA14B2688FD69E75E6A031593CA7A83F0600D

Validator #2 public key

000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF

Validator #2 signature

4AF4AA49E327D417BE33038FD3E8792A54E4895393653278C668F8FE23B52AC8EAE2FE5ADFCB2B95D752EB6093A4366D8099742DECE9B77B3A2B359CF17C2C09