Type
CONTRACT
Validation date
2024-01-25 16:33:11 UTC
Fee
0.21970196 UCO

Code (890 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) == 0x0000072E418B60C6DABD272BC2728B17B352B8104F068D11365D50134F96A4199609
)
]

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: 0x0000562D8F6FBFDA64DF561549EF53BBF667F87F43793CDB6F0A22C311316138925B, amount: 0.101, token_address: 0x00001A4AB7AD0CE2B494C965C66FF2962692A5FE5ECB71B345ABB53BAD88A83A01F1
  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: 0x0000562D8F6FBFDA64DF561549EF53BBF667F87F43793CDB6F0A22C311316138925B, amount: 0.101, token_address: 0x00001A4AB7AD0CE2B494C965C66FF2962692A5FE5ECB71B345ABB53BAD88A83A01F1
  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) == 0x0000072E418B60C6DABD272BC2728B17B352B8104F068D11365D50134F96A4199609
  ),
    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.100697, token_address: 0x00001A4AB7AD0CE2B494C965C66FF2962692A5FE5ECB71B345ABB53BAD88A83A01F1
    Contract.add_token_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 3.03e-4, token_address: 0x00001A4AB7AD0CE2B494C965C66FF2962692A5FE5ECB71B345ABB53BAD88A83A01F1

    Contract.set_code next_code
  end

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

    44E10BB377E39E54C2EA31F880099A4AEF5C6742F6909923AACC9E54D5400C64503FC75D77F97FB64D5D3B18A3648BB804270D592269AA9D7A1871E1

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

0001DB8521CA19EBA73B85A8DB4704E9CF0A12DA49FBC87E62CA17E675C07FB2EA65

Previous signature

F661236DE95EE0464493EC6C0002F00F60EF88582067AE2080244B8A456CA1BB6DE1B0914CA5B3C5E62F8A4539C714E19B6090CF385B541206794F5E934C150D

Origin signature

3045022100F19475569C6ABC64D7D3239DF666F5209810753A974221624FEDE2246E1652A202205A3B9BC934C94125FE393220D7B9A9101EFADD6E724BE776FB3ADFCCF085E67F

Proof of work

010104AB41291F847A601055AEDD1AF24FF76FA970D6441E2DCA3818A8319B004C96B27B8FEB1DA31A044BA0A4800B4353359735719EBB3A05F98393A9CC599C3FAFD6

Proof of integrity

00052FA4EA86970655D4602D65BFDB89DE493E7E5760BC161CBB87C6107D92BAA7

Coordinator signature

6044F8946332709D82CB2C9E592CB69433995572EFD189FE783E0ECBFA0AEB947BB095E631EF3212D2FA3045377E9183DF0EDFB6BFB1BB596C71865F0E5B100B

Validator #1 public key

00011ED0B570D680BE5ECD58D2D121689DA73C46DCB38A01C6E10D06286040ADE30A

Validator #1 signature

C3F82986E87CAFB24B41EE48F067530EDE7BD2FF5F5C93A8358FC0F9E568EAA17DA598195F7904834BEFFDB898F614D08C90F2FD71C4541EF56FB53F9878CC07

Validator #2 public key

000177BA744AC778DC2D51A1B7C622E7AC4BD1E1AA8DA2D0FCE71BAAB7DAD0E020E0

Validator #2 signature

4A0B497F2E7741A4BE1C7CB879F7188CDB1D0E569F5C2D1B3846EF04A1502F329E7CA949F20975B69DCB0264327E829CF950DB88AE78BE5FCB5D56394282DC09