Type
CONTRACT
Validation date
2023-12-11 07:11:55 UTC
Fee
0.22392674 UCO

Code (822 B)

@version 1

condition triggered_by: transaction, on: set_secret_hash(_secret_hash, _secret_hash_signature, _end_time), 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
)
]

actions triggered_by: transaction, on: set_secret_hash(secret_hash, secret_hash_signature, end_time) do
  next_code = """
  @version 1
  # Automate the refunding after the given timestamp
  actions triggered_by: datetime, at: #{end_time} do
    Contract.set_type "transfer"
  # Send back the token to the user address
  Contract.add_uco_transfer to: 0x0000C350C6CD84AD1FCD2D58E51AD56A1E468A7C38DFE8D88A3E433AF20E85C68A51, amount: 4.5
  Contract.set_code ""

  end

  condition triggered_by: transaction, on: refund(), as: [
    timestamp: timestamp >= #{end_time}
  ]

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

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

    Contract.set_code next_code
  end

  export fun get_htlc_data() do
    [
      amount: 4.4865,
      end_time: #{end_time},
      secret_hash: 0x#{secret_hash},
      secret_hash_signature: [
        r: 0x#{secret_hash_signature.r},
        s: 0x#{secret_hash_signature.s},
        v: #{secret_hash_signature.v}
      ]
    ]
  end

  """

  Contract.set_code next_code
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    9121E31B660E0934FC6D1F41A046FD0406969D790F3B29F65ADF527A1BB89A35F7B9EEC89E57EC517579F3559B06AEFEF3CAD326A85742BB3A8553CB

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

000120C1354AC787C6BA48154BB2EC0C81722354644BCCF63E716C53B98F30F46E6D

Previous signature

AFC6C7C1FB5F23C8BF9A2758CFD1BDE8E21DF3790BB0DE37D94BBC62FB7FC65EE11FB73E0275707D7C7E1439D60448120CC7C1951B5B174576D6160AF729D501

Origin signature

30440220314F54818F8E353C052F8B4066438922ED204655ABA70A197E7DE809E021C1E20220541C7EF1DB6C343EA6E54A7A4D4AFE08E9E3F20C61D7CEAE93A416610ED24F0C

Proof of work

010104AB41291F847A601055AEDD1AF24FF76FA970D6441E2DCA3818A8319B004C96B27B8FEB1DA31A044BA0A4800B4353359735719EBB3A05F98393A9CC599C3FAFD6

Proof of integrity

004148FAE44D72F2301FFCFF676B5050527736992C2AFDD33C0B7111672DC3DA89

Coordinator signature

707171EAC884B9C9B57C8BD1FBA05271E3C4CAB3369E22B18A44E7EBB8F4B332A2D27A4CB01CE36C5943378F835B8EF4599E86C26952204E3F3E9BF04265160B

Validator #1 public key

000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF

Validator #1 signature

B519E020E6182EBA2500187C1BF6C34A3DD6486EB358D00BDBBADE7B46AC1CFF9C2E9EA9B7BFE3C17E82C0F75F5B276ABCFD8DBC437EB751698E70028DB56201

Validator #2 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #2 signature

34552F33882DF158845BD6C38BD5BCA63A9C7C963B2458F76F6B25AFD670A78229EE6A8AC4614D689B37A88DDB3F4C836BD225C3B98B3D63374ECEDF8770A90E