Type
CONTRACT
Validation date
2024-01-30 18:04:45 UTC
Fee
0.23198624 UCO

Code (888 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: 0x00000BC0EBA2DBCE4455B46F5E51AFAABA6EB4C7FBA1D4E2E6DABD55DC70F9A04D6F, amount: 0.01, 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: 0x00000BC0EBA2DBCE4455B46F5E51AFAABA6EB4C7FBA1D4E2E6DABD55DC70F9A04D6F, amount: 0.01, 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.00997, token_address: 0x00003DF600E329199BF3EE8FBE2B8223413D70BCDD97E15089E6A74D94DE3F1173B4
    Contract.add_token_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 3.0e-5, token_address: 0x00003DF600E329199BF3EE8FBE2B8223413D70BCDD97E15089E6A74D94DE3F1173B4

    Contract.set_code next_code
  end

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

    89BBB74CAEC664B5E00CEE4DD9F969277A1EEA75666BB1EB4B0CCDD936D54057DADA9C356DB268A1EC8809B8D67EA32338D0D2599ADD0BE6314A890C

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

0001F0F7625665F360C7FF6A279F5778141F994D6EB874FC22038E1D4C221C1EC7D7

Previous signature

87B58BD208168D6361151317E36475C3C0A42E49F86DFDDEE779F13151236F7B1A53C341796E3A1509826EE59979C01FFABFB4E2E69B069C79B2EEE906836507

Origin signature

3045022100ADE61D71DB6BBB88F7B1F89D38FFEEF8DBC3310F01EEB8773D904A8524C2297F02204C9E0731A13BB15ABCB40ACAB7F5D01E3075C4DCDA22000203C2C156FAA23389

Proof of work

010104AB41291F847A601055AEDD1AF24FF76FA970D6441E2DCA3818A8319B004C96B27B8FEB1DA31A044BA0A4800B4353359735719EBB3A05F98393A9CC599C3FAFD6

Proof of integrity

00869BE734360528A09ACF26F205CF7B20966C0F9186750518F3B57AD098B17E0A

Coordinator signature

9F753C90B503B119553E0FBC5CE7306F3BA925E4DE81C5A8B4FC8062CF4CF1B42F47BF5D472EF589175CD02ADBA5CCAFB4C41ADC46D1894716C7A29340298203

Validator #1 public key

00018A312AFA617E98B343D09AD2E73F0AB661DB0A59FB986D5DB8CE7664E14C25FC

Validator #1 signature

9A6EBC8FBD7AB4129D3C26C899DDBA0BC0327B290346A588B61C8EF8624EC745E2AB90BD9FBDA90646870C3945F48CD1E7E1F902A20953D3707FAF88E2F85C0C

Validator #2 public key

0001B01EEF96BA7E95FC844D456CE8868F18864519FC9532E1751C2035FD044DD5D0

Validator #2 signature

D9521F30198C54DCFB30DBE4FBD6B7F222F80A3AE4418F5E1AB5F55746EE58DC2C2C8F9F6E8881C489E86A910C09B9433168D36010D9E7B9877503A435BFFF09