Type
CONTRACT
Validation date
2023-11-15 15:19:57 UTC
Fee
0 UCO

Code (865 B)

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

end

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

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

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

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 49.85,
    end_time: 1700068740,
    secret_hash: 0x6328454A67B27C7E07E0DFFD17F677FEDFEFEFEC2ED2456490C189FA14B6255E,
    secret_hash_signature: [
      r: 0x7418E7D5FA14898E2C23D0B545B6E98115AC23CDA8D52B8CE940B8FBA3DA6B25,
      s: 0x7CEFA4BCDF0B9F6C0A2C9E41D5B2943B5AD5BCBD205412CC93E9C98962C493E3,
      v: 27
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    AA4E424C1D3F5B188AFA8F11F0B7FA89CACCD6218B9A56C5F86E21C5D05D49C477216A2B2868F63770FD3A441644B1532392C2E712B532669232A022

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

00010758C71D5396078BFA6E2CE9BEA937A0355F20BBC6B358C158F443DDED461B2C

Previous signature

3E81FCD6FD9CD2086DEDB3EAE748BB2BDC820BD75146C83AD1865D8AE6EC4FC02986AB2B2C68447ED11B2B4D881066DE60DF12E3348698EFD539E16433AC8209

Origin signature

3046022100AC8B5984CCFBFE4BAA009C2132729F457F171F7BFDA17ED459008842127D3862022100A21F7189AB096109C5903C3F8587941D0F19CC4968C79A508283BB5A4F7CE014

Proof of work

0101046C39D56B717142B6EE14B0F8B2561ECA458F3D2D12C9977D613F78829419063211F9C21F7BB0D56B6523040A8156BE22B6E9D6332B88ED882574D12AE32F7A45

Proof of integrity

00014549AEAA2E0A1F1345D1966408750041F167E099589807F00854737E19FF22

Coordinator signature

BB7DFD80028DA135CE5E528046A1990CEDDDF513BA5332154E644700BCC94356D773FEB6C3D654EBC6EE2CCA62A1753B8C821CC6A92CCEEFDA144964EDB80906

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

5D51597329085E5118CCB1A78734588F3A8A3E2C7999975D002E8AE3EA6550DA3F828A7222558AABE2FFD2C1465E8DF48F6E49CB3A7021B27C031B13C7011C04

Validator #2 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #2 signature

170AD00D06DCA8E1A5172B8F7CC2E3B538D13E5B966CB4135EF88188FCA7CF933564BC7708CE53456BBB730E08542625F1059CA213AF2530445940114DE7C70C