Type
CONTRACT
Validation date
2023-10-25 17:37:45 UTC
Fee
0 UCO

Code (875 B)

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

end

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

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: 0.001
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 < 1698262620,
  content: Crypto.hash(String.to_hex(secret)) == 0x950E89DB0E6F22527F0B8D5B685AA4794FE543F6A4A6592134A3B1277FE4BF4F
]

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: 9.97e-4
  Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 3.0e-6

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 9.97e-4,
    end_time: 1698262620,
    secret_hash: 0x950E89DB0E6F22527F0B8D5B685AA4794FE543F6A4A6592134A3B1277FE4BF4F,
    secret_hash_signature: [
      r: 0xA107BADD795666DE69F12BCBC7AD623E5112A49DA060F9434EE5F12661C05097,
      s: 0x653EFCBAD8B961B1EDB64376EE3E7F70E1D5E1E861ED89547C61FE118B491AF6,
      v: 27
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    9976BA07E0335AB1DB41DDA3AFF2FEE041A09940DDD832D37A3A318CCB9E3F9DE3111548ABB1491588B65F687BABEBEA745FB88C06A3AF306BF1A21D

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

00012BE0AA02FA519A5D7CE3E04740EA0C2F71433E05B34BF384F6213E71F8F68D24

Previous signature

CF05FC2C4EEADF57D39CDEEB575D18A04FA2AD2344E2205754829EFF47062D2A4D17138A379324C33B9EAE883C7D03085E40F08B402BACA93FFBFC9CDD1BE604

Origin signature

3046022100FD59F3B00E1D1B0EE1C0105D733868FD022AE6728172987F84C571539C2533AF022100D5B71F9F31B0F440D30DDF1ED081D618675040456DBBA7B23547978559C683E9

Proof of work

010104AB672F1E69B064D192819F1797C1926F158DBA8F3924AC732B4C4D70D0C8EA0A0D6506E5896C9C2524D2BE26CB5016287E1816A597C408008BA36FCB154A7765

Proof of integrity

0081C8C3FFA5A294FE222135907B456F5512C0495439947F6D0A13FDC4EECD8BCA

Coordinator signature

F53D77A79683A3327A5F908CD511E8AF645C5D5AA536EF24AD4461BC9C76662804659EF6BF9A89C8AD48CF81444C9B295465714E2EA5B1E62E61CF26881B5C02

Validator #1 public key

0001500FBE298B79FFBDD5CCA1798F30FD88A53D26EC39DE5DDE1F4137B032A4BC34

Validator #1 signature

71887B3F38E57F24A1DBB57F07C41DCC083E1DD4CA84BDA91F102307B2CC78F9FCCD9B38E335E032B11ABD7BF574D7C91B938767ED5CD9B85298BF6DFD4E3202

Validator #2 public key

00018A312AFA617E98B343D09AD2E73F0AB661DB0A59FB986D5DB8CE7664E14C25FC

Validator #2 signature

D67FFA0E92B140BFC0388FF0F347E88FDAB713B26BC770CF6410460D899528FA05F4B508786AC1EC164A4001EA8FB081183BD6FE08A2733954B25373E195C400