Type
CONTRACT
Validation date
2023-10-24 14:51:00 UTC
Fee
0 UCO

Code (866 B)

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

end

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

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

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

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 0.0997,
    end_time: 1698166200,
    secret_hash: 0xEAF2FDBB3549D8D9791AC0D76CE09AF38C0DBB00CC82048A0F1654905B701465,
    secret_hash_signature: [
      r: 0x8CCDD1C63C88C220960E27C0BA1EB356934A0C22F669289B98F740F7309E40ED,
      s: 0x10BB20197B1D38B89611188C5CC25F2B141678D437EEC46EADB7679A05638856,
      v: 28
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    0A73839862C7C85758FE2532E1592D01DBE18AD7A43F56B9823B3586CBFF16423D418CDB9ED701030F64DEBE85F316327BE9F241F4518C51C5CDBAA1

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

00013D29502046C9D28D830A4691560E77302C05EB92D1FAB197372DA69C0F1F6D42

Previous signature

FED9A65D36CE0AE611EE0F215687A90A3CF1534CFF9B6C2D5CFAE248E8F9A23B9BC255C3D0C7BCE2ED87B297A0589C859769FD5851D4D3BBB490049E47229F0C

Origin signature

3044022021E3FDD4AA7DBB7C46F0E6B0AD51762E9141136BCFF10C94784B1EB89419AF9B02201448D13BD54904E2E6A0DA743251DF365D73526A56B7B39784560ED8E96BE0AE

Proof of work

010104EB90F7BDD03D5A7FD9B61D9128D7CF24C11F3F7DA96825DA3680C2B6BCC48F1AFCE26E0A5F1A903EDAA4BC9390210A0A4F175847EC2A2BB325BB6D1CE8EC8F90

Proof of integrity

00ECAD3E80235C2FEE296063D008C3E1468ED2E2B2937B4006DD9B49C8928D1099

Coordinator signature

DD954FF885265BCF5B9A00682D72B19E83667443C2F31BE0879E3770EE0E372B82D5C2656586A175DE4907DD268092F43C50296B9CD908B3A4AA3C21E8279E0C

Validator #1 public key

0001500FBE298B79FFBDD5CCA1798F30FD88A53D26EC39DE5DDE1F4137B032A4BC34

Validator #1 signature

2C25248DFEE156420104274FBD6C291E11286C550F0DA26FD39BD084895674DC356D2B0B63F819092A9F79EBD82791A3CD09A17FE6A4213774873DA8D7EABC03

Validator #2 public key

00018A312AFA617E98B343D09AD2E73F0AB661DB0A59FB986D5DB8CE7664E14C25FC

Validator #2 signature

E615C6DB3F5D2772651E42FCBA63498BEDC432C67ED08B27FAEA86696F7F5E5A09DB4CE0C8A3845DB4DFDA3B2581B540A83C523230EE701C7D72B6A8731ECD0A