Type
CONTRACT
Validation date
2023-12-01 08:20:52 UTC
Fee
0.20290828 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: 0x000006EBF65A8D742B1176B2624E031A76BA2BC7D3284705426E8306C5A92A1FA9C4, amount: 125
  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: 0x000006EBF65A8D742B1176B2624E031A76BA2BC7D3284705426E8306C5A92A1FA9C4, amount: 125
  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: 124.625
    Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.375

    Contract.set_code next_code
  end

  export fun get_htlc_data() do
    [
      amount: 124.625,
      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

    3E67318DA925BF2DCE792E6E338CB1C64AE1CA698FC57E4CF9A79178AF986A091CE1252D5E62B084EAC13D0E24897F8516E54936E54BBE8B16B1D1EE

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

00011555E875F803B90A8162AC89F6FF83316E404C70A70393B660395537329D09A6

Previous signature

A27D40BC502B120A58E72D471AB24B5B9663F22B246F6BECD208D119E564DF02A6A2B3E9F99448AB257A1254B1714172A3997F4261FCEBC1952B4478F82B6907

Origin signature

3045022100CABEACED159201D4F5F8DC743B14B423D706A0E1724053951BB778CA9FE4FA380220682BA332984CF167A977B2B32FFED2DE06F091605D2689DDC62C64F1D7D93335

Proof of work

010104AB41291F847A601055AEDD1AF24FF76FA970D6441E2DCA3818A8319B004C96B27B8FEB1DA31A044BA0A4800B4353359735719EBB3A05F98393A9CC599C3FAFD6

Proof of integrity

00E669270DCE6AF1FF8622416FB5C7A3AD5BD1117FF14990FA5FAFF027B134900C

Coordinator signature

B93987B1C835CD703F080D088A647D9306B5D4AC9BB74EABDAFBE2D1CEC5FF17047A02FD85C77B5DBF99474507E01CC97EAFCE6CF68168B200A51CD78CA08D0E

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

8BAFE12FFDF68249310FA4B044D40C359F792254DCB03DEE786AC5552BEF0C3EC2E56EBACDC94D13D91D82AF8773852E8A6BB0A1DE32FCAEA21CE49E943C1304

Validator #2 public key

000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF

Validator #2 signature

35EC121E8166BD05CE5926A01BE258CD86D57E6E5E7248217C4863B780F51A7BD75655B91BF3EC928DC584EDFDE298246488CEF52E3386557557A3260DAEFE0C