Type
CONTRACT
Validation date
2023-12-09 14:37:23 UTC
Fee
0 UCO

Code (868 B)

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

end

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

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

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

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 5.5832,
    end_time: 1702139820,
    secret_hash: 0xCA7B3348BE971237045AF08F9C550504C480A32DDE8459F30DD61DC1D6ED54E3,
    secret_hash_signature: [
      r: 0x255B82CE0608A900B321239A6EF319B584EE63ED916D85F56AA117C0EC409013,
      s: 0x5EF5A6207205899FD93D891B4965181B5679DA10318137034EC098ACCE1AECAE,
      v: 27
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    1282817942FFC3A5D7C3675E360F884E47A8A74E243FB9D471DBCD2F1BEFF1BA190901446DD4BDF81DE2E546281766FAA9D985FAF763676ED3A55A5F

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

0001097E6BA90281A03F56C3DED346790C752894DAAC9BA5928781CBDF9FD5F2A3DB

Previous signature

F95C5D17F31F16092C6919DF8F9A1BB646FCE40D159B9AE33D1474B2AF5D068E210C41B3D9EEE6AE9E2467E224DB74AFB3E3F58EC37B07ED29F6FD0C89A88C0A

Origin signature

3045022071A5E918F346CDBF7F7B37E5684A81B247EFE925E851A353816831DDF1A8D659022100BE3DF4EF35E38B4088DE77ACF667DED66DB13C6376C57BCA94166B5D370F8283

Proof of work

01020451684966573439C38DA99334546FBBDE4A6D96A50B4A4ECBB6572CDBED023F079607407E254421D1779525D11C60D55684F0B403B93B95823554E29D1E2CDB16

Proof of integrity

00A137AE772C404E5FD8E68C6F13B5EF656B44F8BE214ED898214176E4E254826C

Coordinator signature

DDFF02EC5CE529F6935F6962C1421601D13995E807140FCE20C96F0D3AAB91DB3D826F4DD3C13E0C32C8B7FC0593A16B7D06643ADBC69CAACA56DB236C055805

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

1BABC8F18650F088F483798837B042F6D66C24D2D2777F482FBB10FA08735BC7D99D05B4EE076F18FBD0719E445AF66AC71C3431AD287E2CA11002EC72544202

Validator #2 public key

000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF

Validator #2 signature

69C9D4BFA4B8DCD5A073E763FDEC55B892054558282CA95BADF38D59CEA205248318DC52E3F23F2526A4D178BE801C4E394AE41D34EA0E7F02F3A8C3BA51D50C