Type
CONTRACT
Validation date
2023-12-07 13:46:11 UTC
Fee
0.2034096 UCO

Code (893 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: 0x0000494E90EC94BFF45915EB024AE23A3DD729A46AC117582AE430BB911B317D6CA7, amount: 0.04067262, 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: 0x0000494E90EC94BFF45915EB024AE23A3DD729A46AC117582AE430BB911B317D6CA7, amount: 0.04067262, 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.04055061, token_address: 0x0000288BF6F0E12457B125DC54D2DFA4EB010BE3073CF02E10FB79B696180F55B827
    Contract.add_token_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 1.2201e-4, token_address: 0x0000288BF6F0E12457B125DC54D2DFA4EB010BE3073CF02E10FB79B696180F55B827

    Contract.set_code next_code
  end

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

    D41473FFA9DBD47349D9659312B051AE59DE437ACE2FC79DEBF1F17D6BED87A577A2177FCEFB6ADA9AC8A1FAC2D4D4BADEA3AB4C3286208BEE996825

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

0001D0CA7F16282A2F2D88CA64FD20340ADE6457CA3B85A2209626E78EFAA0C464FB

Previous signature

1B20C9DA8F52216F3A02FD5603FE11AFA1AEE63C3F00DD196DEA52FB92A05730A1C6359794575753486E13005A11BB8012BFBAE3634400C08147D82F0FED5C00

Origin signature

3045022100BD6336A46A1329B8C836DA331A7D5742F1E7B526EB81C1CF5001EA4913C7C1B7022023F6A62C5D7E9B25FFFFE0D85E084169760D7E5DEA06B8422C5A8913960E7F84

Proof of work

010104AB41291F847A601055AEDD1AF24FF76FA970D6441E2DCA3818A8319B004C96B27B8FEB1DA31A044BA0A4800B4353359735719EBB3A05F98393A9CC599C3FAFD6

Proof of integrity

00548289BFD397C42A70A08FDCD31BFA5A11CBD1DCA1767292A9AFFDB44DDADA58

Coordinator signature

7BA4E1FB27BF9A873E805CA222F9E2A0B69ADFC96CF8412EEF7094B7EA096BE42F33730E054AE22923A4281D7D7D36E387394B91CD4D4BA54B1036A836CAF006

Validator #1 public key

000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF

Validator #1 signature

E8C0CB429F3BF511B781320B13B508B794472AAE0B7CEF61120BD468D0952EB1A085BD38E50DBD5E324F8E00CB7D439691AB1B2EED43D2D08031C5249BC0870B

Validator #2 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #2 signature

777D2C2318A876E737F3C2053E13DD1F0CF5A467B501F14B1A0E79B924141F18986075DD70BEBA68AC78AB3C4914D6218EAC1D4821D1315050D5694848FF3500