Type
CONTRACT
Validation date
2023-12-07 23:33:16 UTC
Fee
0 UCO

Code (868 B)

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

end

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

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

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

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 199.4,
    end_time: 1701999180,
    secret_hash: 0x569E5F0930CB710038F0C56524C94C90F60DFCC5FEEF5AE9E9999CBBF424652A,
    secret_hash_signature: [
      r: 0x7AAE0D1BFDAC1AFE2E31BC92418E41CD8CC554EB68DB17C8632DEFB6FF3E0BBB,
      s: 0x4C612F0D2FBE14D8712C017BCB4A32390D28583C02D709E934D53380317CA595,
      v: 27
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    B280A1AC925088FD3E9864CB75E26B9B6A9DE98A06E5B2A0D636AA964C4D98F2CC6502F0C07D585964DE1F793B646EB6268E2949F92E85A4DC297F51

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

00019F9D2350DB53A874B625CC25A9E7F63831B2525D7BDB7FB1D98E8FB377B30AEB

Previous signature

131AF0A3D02F0E963ACF3C858C6EE948330B956D913649FB083DA58D03C097094B5D6E0DE74BB5048BBC3852E469859153EA314E75F90C6F60D864C1BDB31407

Origin signature

3045022063D26ED53913FA8F9824628E112116FCB5254215E547EBE6E55AEDF053B70F4502210097CD6FB03D5D00276086343847DC60CDD0DEF9791601B136918ED4148485B718

Proof of work

010104BB7216545F28C83467606EDA88968E19C436410AB446D1BC88FEBDE3506275F9B0B931CAAE420B96B2A158B7112F13795C878CCC346C76E04A96C59CCFC6FC39

Proof of integrity

00928E41CC048140E65688FC1643A70566F646716D863A4DB9E2FB74A930FD52EA

Coordinator signature

14EAEBE5B0CCB4255A3FA96037DAC5A870932F2B82630497054ABBBDC2E3619CBC958844F1E12B113050F4FC624D712654F4520D63ACC689F14E62961EAA9E08

Validator #1 public key

000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF

Validator #1 signature

3656BBB2C081D1D0EC89C56B12B0C4D082541645545BAD94C3AF79E022366174A8A3005D49E733B193ED51CCE25BC17ED5C14F0B21A315C3E6BE70F1A4DA9101

Validator #2 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #2 signature

F0278420B019FAC31517A28B584AC4F7376AFCDC0C319F60A1E9927FF5A65A38933C9AB6C9D3B17D9DEE9E0C3576C5CAA27BA4458DECFA8C941CEBB7FB603306