Type
CONTRACT
Validation date
2023-11-12 19:49:40 UTC
Fee
0 UCO

Code (876 B)

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

end

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

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

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.00108694
  Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 3.27e-6

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 0.00108694,
    end_time: 1699825740,
    secret_hash: 0xDDBAABF3511FFB33D629FF21F29EBCAD2877DFB0510E9A4A6D32829B1D3DD3B2,
    secret_hash_signature: [
      r: 0x8E1268DF3659D481F434DECC86DAA9714B0C46BAD242D3C642AAB6A7D45EF64F,
      s: 0x30B0CF85BDB9FBBF8084873898B7A78C6106993DB73D5B39BCFEAC9B638AE664,
      v: 28
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    05F03A0EF1574BFC28AA29E665984CC2926E61A3479116D4C9AE55E76BD289A6CFADE50B6BCC57ED8AC8A8870DA4400A5CD15C570E164AAB14983C78

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

0001F61114AA754CA47CB5E2AC9A28AC03433944AEFBD6D315A98452FFAD80FB9EE5

Previous signature

26664AEF0683C35AA41DE94DFF4A784C3726F8D1E10E5778DA41E43E46D913877CBA144A5F51C004E3D1131828D0DF91DA4B656C9475EC2E5BBC9F0D35F13F0A

Origin signature

3045022100C781D2EAE759FE9E404346DFD3A616D91DC75D99BF1535AB781C4013E405156402201F3C74D7EFC4687929A9042363BA6CF63EA4E1FFB31407CB97AF25E67210DA8A

Proof of work

010104AB672F1E69B064D192819F1797C1926F158DBA8F3924AC732B4C4D70D0C8EA0A0D6506E5896C9C2524D2BE26CB5016287E1816A597C408008BA36FCB154A7765

Proof of integrity

001C9FE01C88AEFA0352E6E952D0ADD8C1F86409ACAA4FD56969D492EAACC5FEC2

Coordinator signature

280CEB7E03EE285AFB56CCFA6F535FBDE24203C7E07CB45CE2B05384DAA8843E93E741BDC83948F19E093FEBF425B2849B262DA5E4F8E2ED495FA460BB82060F

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

515F0F6CA959E1A1052F24F77478D17A38A34BDD65394AEB4D583040890D7E285A8F21D8DBF8556740377C2C83397BE86558E0F61FE5BC3D81BE757413780009

Validator #2 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #2 signature

81E6D80AD50A78F652983A785C7766A46893E6A6943DFDA296C187E43AA07CF8B1F4449E22916872AC60D82F6DCF31EA0A505CD2B47245F3A87A6C601A6C9806