Type
CONTRACT
Validation date
2023-12-14 04:57:40 UTC
Fee
0 UCO

Code (866 B)

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

end

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

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

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

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 5.982,
    end_time: 1702537020,
    secret_hash: 0xDB1F6D9E6F8ECEEE73BBA8EA83F070304F61AACA5EF08EAED8CD173E7C2CB982,
    secret_hash_signature: [
      r: 0x84BCFEEF704D12CE1FDA9E7B3243153BDC60A038C82BB80C404054BB142A8E3E,
      s: 0x1E668D707920F5B2A1265C782D7344A2B93F6164552C5BCB216BEBFAEE45DD0C,
      v: 27
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    33591F2AAECB62EC280ED98FB8EABD98901F46BBD738450899791B06B0F63A57B2D321E26DE2832FD3B81CE0F4067C6B941187CD23359C3B899CFCA8

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

0001800283FB66E7391469DBEFC0FBDF9703320CFB99A1CCF06F0D0BD690CBCCF0D8

Previous signature

C0358F9687EC43C1E2A25985A1E7AF9DDBBD94BA6FFBACF14F557A1E41509D1FB18EEAB29E02C551288C9E53D5196D81EF9CD08E1B33D353E1343E25EC190700

Origin signature

3046022100BB5D7E4D19E466E9837B398A6CF1F5DF199EA5FF7EF1CC6920F0B679C7BF96F5022100CADE44BDF342CCFE0C9381244947DB76E2D319795808A584ED9B0289D14F1D1F

Proof of work

0101046C39D56B717142B6EE14B0F8B2561ECA458F3D2D12C9977D613F78829419063211F9C21F7BB0D56B6523040A8156BE22B6E9D6332B88ED882574D12AE32F7A45

Proof of integrity

00CF2AE34E54753495764AE0B234D99A8FE81AD333D19973941358ECFF7A8681E7

Coordinator signature

54072CB84F59745EBF0640BB5C8E93FD32FC1517BA0302D82DB57A92EF4B8DB62DB90DC7A0973B1215A81973566CBC5A562E63F5E13A504E41B7E4870FE18B0F

Validator #1 public key

000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF

Validator #1 signature

17D666BED8F7D6A618690AEB737F302581D9DFAF9BA058B33BA69AFF0B30D644CDFFD93AD7D99BC1A592B05F243A438109D7DF969F737008CE4F5E2A45C3A207

Validator #2 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #2 signature

C6B57D6CEC9A1A2A88AEB0A2BBB64133F7DEBC7B4D4028894FA47D5848B27073846AC035D94343F6EB10E13ABDDA5D90F2E29B8B5CCB2320FCB580AB74A0490D