Type
CONTRACT
Validation date
2023-12-05 17:02:47 UTC
Fee
0 UCO

Code (868 B)

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

end

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

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

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: 1701802920,
    secret_hash: 0xDB24E8A1B6DEA8ADE021E6AF607EBC652C3B49A8CCD3AAC6E98D1C09C2AF10E2,
    secret_hash_signature: [
      r: 0x1F4479E8C84455FEE65A420AE3FD1481A73D4FB813DF1E6D52A15C59E66E2287,
      s: 0x26A65B9010B52C07C7500F7CB1BA77C44D8F6449838969534A881FFF5FFCAFAA,
      v: 27
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    B6F120ACD9E8C5ADB53A0D11C17DAB7598A7E7CDA99D38D824B7CC430881F6C04827756277ED0336CB6122564CFD7A8C346F3DC53C5FF8A5F4203D0F

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

00010B9B22BF31C197EAF972825F4E8F17292B9B3526E3F8C270C2879CD3DB86588D

Previous signature

BD647D8870E2BFAA9B8B06D4AF4D02BAE7AB5EEFDF886EA75C450B9ADE6DD1C82B29233CFB0056FCD0EE28E9028031FFDC1E69B1C38679AE49BC7655631B6709

Origin signature

3045022058128215DFCADEA5E602A127E431B178B1CF1D864ED1A5AB5410658CDDA5363C022100E543CDA260926B608E81636C9DBC0AEA9C7DA8049E99E36D0E9802A2321C7350

Proof of work

01020451684966573439C38DA99334546FBBDE4A6D96A50B4A4ECBB6572CDBED023F079607407E254421D1779525D11C60D55684F0B403B93B95823554E29D1E2CDB16

Proof of integrity

00F4F703FBF4AF8EB054ACD87F464934D2264F0B4EA25DEA9E7CB548C0D0D132BF

Coordinator signature

84D5E7A04EC92F046CB70347A93C69740358EABE05B2D55EED98ACE9F6B7C604B94AE764F5B6086CEECB406ED82570209A383CE92692B69302B56A8F638E1506

Validator #1 public key

000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF

Validator #1 signature

349C68C1EE4AAC07467237B95E45546ED5482EB5CAEA05EA12F41DE741F1F7BBEDD06CD45EFAD757C2719617D32B717B33321AD0B14DA4586B09DCEE27B6D60A

Validator #2 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #2 signature

B69DF9C7BD06C62279B2A163FE3A2ABF07789978D8842E01502992F6B79B19A1F7774CCE50FAC0C776C57B2598404DF1175A1E263B5C317CBB391C30F348670C