Type
CONTRACT
Validation date
2023-12-06 10:25:03 UTC
Fee
0.21522365 UCO

Code (889 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) == 0x00008DD22E7496E86901E9B276A1BE6F9512EB09980CC04C7B76495EF37D5666A709
)
]

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: 0x0000E7914C512942650C9EF997F565849A1EA71B4CAE73D5555531173C33032B4C7C, amount: 0.02976045, token_address: 0x0000288BF6F0E12457B125DC54D2DFA4EB010BE3073CF02E10FB79B696180F55B827
  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: 0x0000E7914C512942650C9EF997F565849A1EA71B4CAE73D5555531173C33032B4C7C, amount: 0.02976045, token_address: 0x0000288BF6F0E12457B125DC54D2DFA4EB010BE3073CF02E10FB79B696180F55B827
  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) == 0x00008DD22E7496E86901E9B276A1BE6F9512EB09980CC04C7B76495EF37D5666A709
  ),
    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.02967117, token_address: 0x0000288BF6F0E12457B125DC54D2DFA4EB010BE3073CF02E10FB79B696180F55B827
    Contract.add_token_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 8.928e-5, token_address: 0x0000288BF6F0E12457B125DC54D2DFA4EB010BE3073CF02E10FB79B696180F55B827

    Contract.set_code next_code
  end

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

    AD9CA3DC2C8F13A7BE86822C19597C982E2D0042B05767A1D336A12BABF63C4D3362F944B94BA86AB0DF0AB8257CE1EE8144D01FC1154D46C5378EAB

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

0001D01CEDFD6DB4688D3C89368423532BAEE2B9E1367A2FFD5C09EF89806236EF4E

Previous signature

075C560B616D2284BECB45700D0E457A416FE5F7D4E259DE5FDD78E97730CFE5B59608A5C04A45A2D175F0D7C6211702BBA5BE48CC8CD3073EF5620F85BA3A0D

Origin signature

3045022100E404030D24D41EC3A6570571210F2E366BD1415F2F63241711448773F2EF790402200E280EB2DE3FD4D2F2275B579116D132041ABF229F6B2DB71B479844F727FA3C

Proof of work

010104AB41291F847A601055AEDD1AF24FF76FA970D6441E2DCA3818A8319B004C96B27B8FEB1DA31A044BA0A4800B4353359735719EBB3A05F98393A9CC599C3FAFD6

Proof of integrity

00D940E5D50C20F28A33107DEAEE5351018F7A485967C988D624EDE6E05A81A61A

Coordinator signature

ACB25365A48071ABA2E62C6743D1C34749C25093B93C5CB0EE9546D122B9A3917A8AF0E25EF9B72D2F3355A9CB8143A16D0418F30FF080876B9F21DE98FA0C06

Validator #1 public key

000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF

Validator #1 signature

F2D50A44449D3DFCD46899F1A91C992E8B1747FDD549627621B4A23418B0B1EC3C06A0EE3FDE7B52FD9420B52B05FC915DDB10D28C8658F3C2BB356A6BB5300A

Validator #2 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #2 signature

7A979FCE55AB3E16E254DE89A576AEE47CE709DDF74B084321C79858B63979A6CA3CC32A3162C7D51FEA78CBD058E90A2920934D3B6F7AE9C1C95BDA9496D60E