Type
CONTRACT
Validation date
2023-10-24 14:40:09 UTC
Fee
0 UCO

Code (864 B)

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

end

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

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

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: 1698165540,
    secret_hash: 0x37E23DCB8191DE2BC789FFF566D67C0D258A01080F90C92AF0E9F9AFD2C803E6,
    secret_hash_signature: [
      r: 0xA8A5FBA95EBB05135E66E2345118E24056BCEC099FD8E59284E55DE74DD5A920,
      s: 0x1D30A5FA779D6D75FB158A4DF281FF5AAE179F1DBE3652D3B77574C7EB683362,
      v: 28
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    965C51A10D0B6011BE3A88185F629B35577BB43001F43E230F3141F3D5FBCAC14534FE254015FF58A0722411FEAE615244CEA62B84A47CC733BA94EE

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

00013FF2F3351808E1A8DD13C8EBEBE3FD23591CBE00541E65A537E36B93FD6BCF1B

Previous signature

7A101F6B0224B0F9AA37C3086520FE79B6D1B0B42EC977113FAAFBED43D24EEBE7BCD1C9843D1DFD2AD670F8A446C743A36DE4C4E2755A3FFD638486BAC67D03

Origin signature

3044022014114202E37F3763A24CF595AF1E57599B57505CF2B9FE67C81C2AB0017DAFE102201F89AC7D527A7D52A47BE6A41AF65C5408D4BBE51F088CB83D82EE0023C966F0

Proof of work

010104AB672F1E69B064D192819F1797C1926F158DBA8F3924AC732B4C4D70D0C8EA0A0D6506E5896C9C2524D2BE26CB5016287E1816A597C408008BA36FCB154A7765

Proof of integrity

00D5D43916CDD5F3A1B21E3CC474C9E4A0731BDCD7EA6B41E1A715A6575BB1D868

Coordinator signature

1C6EDBD0B0F782F32F4356612702DF94C0A5E2EEEBFA741513A9352BFC7B1863E1970823D3D08C4FD29F3998026B10FB7AC6A58D8314264D59368A3D922D6100

Validator #1 public key

0001500FBE298B79FFBDD5CCA1798F30FD88A53D26EC39DE5DDE1F4137B032A4BC34

Validator #1 signature

956D731754B2864E1800A3F24383400D05C5F952789E79DEE9B7C95CA1E769ABCD38FE5FAFAC595281063819DC1430BE226580424182C30BE3FBF5F2F3776F01

Validator #2 public key

00018A312AFA617E98B343D09AD2E73F0AB661DB0A59FB986D5DB8CE7664E14C25FC

Validator #2 signature

E6D0D6C1898C465CF44037607F52852B6A1A2001352043223E0FA60728883BDE9375279673DF1ACF0766964A54099C2981516638DED4377AAF55BE4778D4F001