Type
CONTRACT
Validation date
2024-02-01 01:29:28 UTC
Fee
0 UCO

Code (867 B)

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

end

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

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

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

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 49.85,
    end_time: 1706758140,
    secret_hash: 0x280AA2D3FB7BD442CF7B18BD224A69D069E86CD5D50A36AAE6038C48CB00BB00,
    secret_hash_signature: [
      r: 0x0203AB98D97128726550478E92E8DA922703744AAF0C1BC48BBC7E45A78922C1,
      s: 0x75AECC0313439E487AC6661FD208F8187F6498DC15E8FE22676DD8B9A632B7F9,
      v: 28
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    A686A79F445F009D7B3B8465C3AE0D3E3DCC98D9BC5D9714859ED484423444182182802918E7EC55C3898094562F5755887014DFAF3B7FEE9835A617

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

00012D9B087675EDE45500FC71E70B07E2C36A302BBB1E8FD31D582779057514D68E

Previous signature

129C746DE024D15C3B376C7B9D9E58C7E8542AE854C792DB0A3A0034EFD6DA8253F8F71395C370A0E7E392DE9F9AAE7BF469687AC3F17268DD1DBFE7ED40400D

Origin signature

3046022100C144B7A044D39C194D68FF636B8D261C6C05AE1206AB82C454CC94E7BE857CE70221008A7FA31540A679ED856677BC1F82DD09B494546C3C3D1E0B6F82C18D689F0AF1

Proof of work

0101046C39D56B717142B6EE14B0F8B2561ECA458F3D2D12C9977D613F78829419063211F9C21F7BB0D56B6523040A8156BE22B6E9D6332B88ED882574D12AE32F7A45

Proof of integrity

00FBE02B6FDD30A8D499EDD50F14BC38585A06BA99ACC1539D9BE863E3FBF3356A

Coordinator signature

E9548BCCCB3C26F94E62EEE95A13A1BFBE80FD605B87C4AB52F7A7DC4152A4D940D18FF6133F4C9EB336638022196688234F634D69834E75A0FBDAB6AA5A8B05

Validator #1 public key

0001500FBE298B79FFBDD5CCA1798F30FD88A53D26EC39DE5DDE1F4137B032A4BC34

Validator #1 signature

3C24176EC4AE7CC70E6D304C24D822494892AA95843DCE03859DE9843352A4181AF5C445912D7CECD425CF126E453EEDFA42702960851D8D9A93E76C6B652F0A

Validator #2 public key

000103E30584AD8DE66F9E29419D5D0ABEE5A76722C9FD0D012BDDE3A6E2B149C48D

Validator #2 signature

BC5215FF2182298773069935656ED892CE6F07D16528E7A318325C2286B889841F20D407A6F1D048AF52ACB6B72104ACF5B32A829DC475585A99011EEB79F70E