Type
CONTRACT
Validation date
2023-11-21 20:49:30 UTC
Fee
0 UCO

Code (864 B)

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

end

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

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

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: 1700606940,
    secret_hash: 0x1D2F951B67C1ED2EB9CC0CE47DF73B730AE30B0B089E1631508DDB678E9A1DFC,
    secret_hash_signature: [
      r: 0xE24E36F3FADBE474F4AF38098EB687EDBB7FE38E82F95E33DB3DDFF3258A00DF,
      s: 0x29E8BB6FA2DFDAB8EBCDFD05B299ACFE8610DA3CB7E16B0D1FCC76B0A653303A,
      v: 28
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    87E23FB21ABDA346D6E16290880593F0136C745FA60FD5123EA9033A05FAEA7DDB07BB4B4351FBAAE9C61D0DC778D26BD946E4FF3EB6E81C81B841F4

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

00013CE24BE7BBC4BC20FEBEF40526BE7B1E33F1AE57588AB5FF0A4830F420E53760

Previous signature

41A6B23867A2702C6261E908DD5AFFCD8951CB34C1287FBAF42FBAE44D5DEE897101F508FBACE7CE67697298536BAE8C02F47FEA71FB5545F3BCA4A4B9392B02

Origin signature

304402202381500C824F0FE3C2315BC22F7711A53A6C7B3EA13A0BE2AA9BE128245A6DE50220160B74F809747DE88B0BE0CC8EAFDD6562B55E550912517644086576849551AB

Proof of work

010204AA023E1E039788AD4B8F713C8871CA39A177414A99A0788993AD725B1FBB7AD5E4CAC86151A9E03451DCACB1EFC100B1E450FCEDAF5E5005F3A4C503D1D29712

Proof of integrity

004B3B6DEF3F6F18D91ACBE86D89C2A45060DFA9272C5D595D976B6465BD616186

Coordinator signature

3F3249ECD8246449CFD98F13EE4E8623F99D3ED06FF0C03E9C15576F6E8C6260D8FCFD6A3E466702A7B376C4F12420578327C5C77B7BA89A99D215B38756A50B

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

5039765E8A74A7DD9E257D72A828BF0EE785E259C1297193977977AC23A53DFF1701BDDEBD5502D14BB898F33B2447C0085425298BF1A0D90F2149D82F70F502

Validator #2 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #2 signature

738C06CC580143FB0D5E3A984798F24691045A3649A0E8765813FD5FC3BA78E8EE40C7648A0C9103DBA9A21D25F1D4974037E97ECC360E31BEC84D9EB0014D01