Type
CONTRACT
Validation date
2023-11-14 16:45:19 UTC
Fee
0 UCO

Code (869 B)

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

end

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

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

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

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 14.955,
    end_time: 1699987500,
    secret_hash: 0x1121D1C985452AF3C37972FD28EDC5E2F1A2612B6DF089A8F1C1814934F21D37,
    secret_hash_signature: [
      r: 0x853E86D26221990317E495806E3C1426CBFF3F2C9F8AC3B8A8DAD17FFC13CC3A,
      s: 0x238EAD270C5628D7C89F30A8F5C49EFEB375C250D6524817272F9FC000D3AF58,
      v: 27
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    27F675DACA7CF756A69DD9ABA8D1846467417BE772AC0F7EC3F814FE5EE275908FA823A96A13579D4A41059146E0B7CFBDB62A0F58812A3EEC84D7D1

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

00015FC7ACE7CD343FFBEC30AFA62E63B51F2B83783152CBAD822655FCCF8B0620DF

Previous signature

5B93DCFC439494139E667B57D775ABC9B796768E1CE4EDA29CD416B1BFF5A5F2F66ABF5AAEB6AF84EE4403B5D6D68A089028FDDF7DEF532628BF83537A17E20F

Origin signature

304502210095CE2C200260BAAC25F54146AC39FB21D13A86A70B3BA5D2799849319453CA2202201510A4C03A239CB33687F59356351336AA4BCE5B4E68D7E9E06CFF54CB0C2D23

Proof of work

01020451684966573439C38DA99334546FBBDE4A6D96A50B4A4ECBB6572CDBED023F079607407E254421D1779525D11C60D55684F0B403B93B95823554E29D1E2CDB16

Proof of integrity

00D328A7894B811446615494DEB167CBC7D2056C6D6D2656088F7B30567D6D535D

Coordinator signature

0D754F98E15B2DE5A718A0B9AC224C9FAFDEFF22015FC8029517DA52837B36A5AA8B3B1D7CDE5EC1DD361B16B7C9776E0DE9496EA8342274EDCD3320A3D09A0F

Validator #1 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #1 signature

EC07FCA69BA5EC212E4A6DD34156646D455EB7495FEF67927033D97C4F75371B9535A4DB88B69693E98AEA3B76D1ECBD0F6A57B35B97683CEAF11475A1C28B03

Validator #2 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #2 signature

4066E46762E1D3D2BD2415975F61A568F23671526860EAB94A242AB0B9267B5AB16D306B968F6B5F9C58C196E6906CF75588B7299E3E1D591437F053FEF0DA0B