Type
CONTRACT
Validation date
2023-11-12 15:52:41 UTC
Fee
0 UCO

Code (864 B)

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

end

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

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

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

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 0.997,
    end_time: 1699811520,
    secret_hash: 0x720F8ADE9324C8863A37D4EEEEE4633285E5902815FF8EC24B8262192F3F564C,
    secret_hash_signature: [
      r: 0xA0E339C9F4AD5CE757208D31D6AEA5195AD7B3E801672E2BF8498E720A96EA06,
      s: 0x1FACCCB5D53E45F09FE302949D86C3072C29424CA88BA266A06C14956A3E214E,
      v: 28
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    C0AE3A5C9B6CEF5061545726B149B0C02E7251345566232D3EDAFA53D1193681F94465E5BF93B44D9865D926D51A240146B3BEBDAA31CD845645006D

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

0001D7384D08C634A6A60F7F01AF157B73D05AAB82A8257A3A8F55914B1B9B356AE0

Previous signature

73F9069789BD5627A5C78B8B12E9EF5D3147C97807FD00CC6D46221AC6691BC7AF35247FA75AAD4CDCC4521CAB88A6794211962B6C295E8E200884447839810F

Origin signature

3045022100F35747EA62B995FED6FC03E6FAA83D0C9BF8743B28F5494C63EBA7FB36B79053022061DA45F428EF97298EFFB21895B60440D61FF295BC786DC667B17F7E5D7F339B

Proof of work

01020451684966573439C38DA99334546FBBDE4A6D96A50B4A4ECBB6572CDBED023F079607407E254421D1779525D11C60D55684F0B403B93B95823554E29D1E2CDB16

Proof of integrity

00EA974AFE577D482BE354A24BF76D95286F2F7810A3208349D57268215744312B

Coordinator signature

3CE6B6AFD68E87C4F7A2A16F5EFDDAFFDFE489683C00A2DC5882A427DB19CE06E37C371826E7F9C7E7F11B717A72227BECC441D7659012814B97D74A0181CC05

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

54BD523C9EB031A104F8EA7D8AE37EED59A4BBABA339DFFE8A63A86ECA9C532FBB8C99AEBD2B0C147843A2F2EC82255C2877066CEF3C373AFF67E635FE4B7307

Validator #2 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #2 signature

C4A660030DA496D86171F88ADFFB797B0986736187C0A3D68C51F9C67BA3A37969ACDEBC23B02D6A7BB54420139B9D51938CF8706BA383EC715566861B552008