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

Code (867 B)

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

end

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

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

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

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 4.985,
    end_time: 1702113420,
    secret_hash: 0x152DA44A878B5785337D3A7FF462AB49DB97E3E5B5E2B74EED1BE5A654CD9166,
    secret_hash_signature: [
      r: 0x0D83B654601762B541AEFCB3FFD3F6FCA0065A5972B6C1A3B3E326F16CB27DFE,
      s: 0x1BAEC104B761CAE2092C685E54D8005DDDEDE2591FBE5CD279F3A346A5F82035,
      v: 28
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    A783A16DCAC04126507908C3CD769E40BA78318C6A433A1909F126CD3CFAB13CE0103102FC3A6D20E162040532708CED9894685721E1C61283242346

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

000113EADFB8848A0869355A366A8DB4FE31F061412C768B7D9D2FA9CA1145B1F0F8

Previous signature

3996AE6569C751433771704CD1E5CA4E173585DA0EB4E1E9C81EAF8E38CBF9E4F76EA194FAEBEFF68A13937D1E5DAD8C77B0330FD8DD479A55B1E500C912C101

Origin signature

3045022100FC1852298767C18920C31797AA19B99B4192E06E41042BBD17628936E8C14D030220163ECCF5685F7B94131295CB1AF771C443A7DDC979706842CA752CE6E5EA27D5

Proof of work

010204E9BB401A767B0C92D5DB139379AAB18E1B449B455F49E3A44F3466B2D38E59F0516B79493A528A95E5A74CF46F79CF12DEB73293458F6A4403D2B3E57D697347

Proof of integrity

00FDCECA7083AF6731B78BF48FB6044180A6D076D819EDD125273FB4155992531D

Coordinator signature

85CE9A62789C12F2E7C09DD4E9C19CD4D4C01D9C846BC30F16260B41A0B2E9B65D3CB213087296267575F16A15ECC36C38346AD51FB8AC1BE99B9E6D59E36D01

Validator #1 public key

000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF

Validator #1 signature

69E5911D15D1E4043FECE377F1C1AD5CEBCDE943141A6179E947C79C91DED687D7833355DEFEF38FD7DA9D509F0A9ACBDF917244676AF8DB8EC46D76EDD2DE0D

Validator #2 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #2 signature

5D2A5D461A61CC97E77D1F5E84257D3FB41AA6A50EC0D853AF4B1096EF5D0A30CCCB64A2D5B783BD38A8470AD9DC106B51909117ED951EE3D6CE2A7B41000104