Type
CONTRACT
Validation date
2023-11-14 10:22:07 UTC
Fee
0 UCO

Code (868 B)

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

end

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

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

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

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 19.94,
    end_time: 1699964460,
    secret_hash: 0x4B0EA30ABB026D65BDB2D69008D9B02B369EF81B5E999D3AC1849309872417B2,
    secret_hash_signature: [
      r: 0x0727D713ADA98DEAF5F1C51B64EF6565B1AE9D80827E43216240396B8C25F10C,
      s: 0x0E3F463C388B7B7D541D1120899383AB0D0AEA499C29C0B9D379D53C7F3EF162,
      v: 28
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    464D7035C35EB9B11ED56139BD81D911DC51296A3F6D00514450DA91B4F17E9D9A489BC4A7CD3E19459C47268DB1BFF963A64C8ADB40A4DB8745370C

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

000137DFB55C56CD91A3E9E05FD90604829A8E3569320471470C30639CAC8E9BC548

Previous signature

8127E3B10334096475A0C0203A80FC0B8456A13221BA6BAFF30D7DF6B2449797BE417756885A83F9FF2E40A798359D8C13ACA00AEEA78548907B844A84D8ED01

Origin signature

3045022100B313E14D57316FFA02CACC6A335EB6926BD6A45CD86ABFBE9E980E0F3D76EF8602202312A973548F808FEEF1AF9A68D242AA6DCB981DFBF581CDDDB27AE94F95F9B4

Proof of work

010204B3B2A53580086B9F36919CF40ABC55904729F78BF43673E216FAC1EB2451DD1E521879C6588F0CB09B150A103A39A73E2816B5ADF51F0721348BA3A66C33023B

Proof of integrity

0078D85E33E1AC16334CEFB406E3F832E530F4F660DCEBCB0E5A7B64A57106E107

Coordinator signature

9E0C2C725641CAEF256882318E4BA60EDFA197982ADDD561F9239E249AEDF436A39F0F5F46BF030A0AF149FF8D603DEB845B0065A3D33AA7061F169711527D09

Validator #1 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #1 signature

69C4EB1D68A624FBBA2DA58EA4C9EB61EF9B133A90A70CB7421C4AAF5FB366E6187AFCA8F168607CD53F80CDF51D4C04AE1F785B3B50AD9E7ECD83FE44B33C06

Validator #2 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #2 signature

4CBF4EA61AF09741C57E21A65A29BCE356FFBC06069640DBEC44C2BC96312EF8EE279C86419AA91CC608A2DA7CE28C0B13FDA2759EEA71FBB639EDDD49826509