Type
CONTRACT
Validation date
2023-11-22 23:42:54 UTC
Fee
0 UCO

Code (867 B)

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

end

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

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

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

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 99.7,
    end_time: 1700703720,
    secret_hash: 0x77B00BCB7D1484CFB91B327B3AFEC29A91B3ED918CA2CE76CD816A32C030A7D6,
    secret_hash_signature: [
      r: 0x2EE5537DA0DC588396DFDA221C531C6D2F19AE35F99DEE84C85BA32071C91E2E,
      s: 0x49B84BB651D2865764FD07DC2022973A6B49243C801AA24D7317202CE01834AB,
      v: 28
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    96BE533748FD7ED8634A0BDD6035CF4CCE61AEF98975E1CB83A34482D11453FB3689BEEC613F82C05A7362AD088ABD7C9803419F8FDFABC25F2EB555

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

0001D0C05310D3F84B534DC3F3F64A437FFE580521C7D9811630BEC2F77CC9CB0944

Previous signature

241EE92456E4E30702ADD3A69EEBF3CC562A01C9C1C8D59508E19594158541E523F138FD985BAA7D67E51DBF406BFAF0C1F7D1A0FBBE37F111924C7EE35F7705

Origin signature

3045022100F45D4ACF860E22B679F698D73D9F51AA73D1A4B4DE06ED60521464D051B83FE0022066690ED7320F46309F242EDC2E2B1D1856ABF96AB30EDA0DF1C5AB770D96A274

Proof of work

010204AA023E1E039788AD4B8F713C8871CA39A177414A99A0788993AD725B1FBB7AD5E4CAC86151A9E03451DCACB1EFC100B1E450FCEDAF5E5005F3A4C503D1D29712

Proof of integrity

00EBCA323CAA83BE1246709CFDE8506D338D895A3474E14C7B4C21597D12894458

Coordinator signature

400B4D250300567F84AA65CB210CBCFF1276949E669C647E09AB1423EBB71E0D3EDC4EFA9E62692D515488E9F4312BAA63950DE604D3B15C7EFA21C48D92A905

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

952CEC54AB3A532327C988E2D9E73B55916E3EE9CFB5A804F0EAB2F8B96D854478EAF2A2422661C323897FB13A0CD54DF4C634DD713EFF20C0FBFF9004B11D0D

Validator #2 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #2 signature

16A771662A7203BF2C3ECD2B2A215A6485FAAA1D52FE22DAC1EF510D49E7792CDAC55F580B7CD626DCC733FDE68D0CCC0721251D6E8CF6968EA2389F49476205