Type
CONTRACT
Validation date
2023-11-23 00:13:46 UTC
Fee
0.18954488 UCO

Code (883 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) == 0x000066706D704329CA8C2A4153991E2DDACC968622CA10217CA14952EB7ABB966C30
)
]

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_token_transfer to: 0x00001675BECDA24450FAD82114A15B58567979E8E7AEA1CFFC54CE8C1779513EA2AF, amount: 0.1, token_address: 0x00003DF600E329199BF3EE8FBE2B8223413D70BCDD97E15089E6A74D94DE3F1173B4
  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_token_transfer to: 0x00001675BECDA24450FAD82114A15B58567979E8E7AEA1CFFC54CE8C1779513EA2AF, amount: 0.1, token_address: 0x00003DF600E329199BF3EE8FBE2B8223413D70BCDD97E15089E6A74D94DE3F1173B4
  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) == 0x000066706D704329CA8C2A4153991E2DDACC968622CA10217CA14952EB7ABB966C30
  ),
    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_token_transfer to: 0x00000000000000000000000000000000000000000000000000000000000000000000, amount: 0.0997, token_address: 0x00003DF600E329199BF3EE8FBE2B8223413D70BCDD97E15089E6A74D94DE3F1173B4
    Contract.add_token_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.0003, token_address: 0x00003DF600E329199BF3EE8FBE2B8223413D70BCDD97E15089E6A74D94DE3F1173B4

    Contract.set_code next_code
  end

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

    865DF9C08C43B51FFEA30E819449570D1D0A303B7D4EAF58C20260779D550EBE634F8ABB3E1ADA8F7CEC2DAC15528ADCECE59A501623FABDFF254A5A

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

00017429F8134D397FFEAB1C6ECA120D794A63A6B1A3E54144A7A3FE2D974F3D29E5

Previous signature

ABB9AC80977637D8BA3AC817ABEB0269358E54AD0345D9AE460FCC2AB745562F6D4FBC6BE64D16F663E5EE79D17D7EEEF556F976240BA5D908D8E059CD9CC103

Origin signature

304402205FFD3E727E07935587AC0CCF4962551C3BDB294E7CB279D886F88A1F9C5C1CCE02201AF31CC27012C09F5F3D6FC4243F347B0D6B78DBD8AC7B7582B96A5F3016FB67

Proof of work

010104AB41291F847A601055AEDD1AF24FF76FA970D6441E2DCA3818A8319B004C96B27B8FEB1DA31A044BA0A4800B4353359735719EBB3A05F98393A9CC599C3FAFD6

Proof of integrity

00D84899F154A6E3844694889B472E2337D340157C5501397C1498F099C3D62E11

Coordinator signature

849AC70704FAA75AAE9B3A4A158A0AB76DFD2D8A306942F307F0765EC2108D99F9D2C1834EB6BAA44A7AEAAC4896DF61322CC04349B7604033108220FFDFF000

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

153A172400E449BFC9609320156187AEC79C73DF31683DB0E528D5DA90B9FC74DC7A3BB3B208E3D3A327D41967BD6C228F3B01E2EB9C7F8C4EA5251224CB2D06

Validator #2 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #2 signature

DC1D2605A093BF2BE49DB4C371A2EB1C9424DC9E58AD5F1D465BDE5073C151605C35DB41FF532D3B8E16DAA0380B1907E9E74C92A38D492F03C9BE59B623420B