Type
CONTRACT
Validation date
2023-12-06 09:52:13 UTC
Fee
0.2160754 UCO

Code (891 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: 0x000070C7056DC223A1CBCD752558A92B7E2020176540FD854381D88B3F1421537663, amount: 0.00992015, 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: 0x000070C7056DC223A1CBCD752558A92B7E2020176540FD854381D88B3F1421537663, amount: 0.00992015, 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.00989039, token_address: 0x0000288BF6F0E12457B125DC54D2DFA4EB010BE3073CF02E10FB79B696180F55B827
    Contract.add_token_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 2.976e-5, token_address: 0x0000288BF6F0E12457B125DC54D2DFA4EB010BE3073CF02E10FB79B696180F55B827

    Contract.set_code next_code
  end

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

    B7F2F174EBEB1527BE138DD9DB1EF3E9C8592BA307D3223F0AB12CFB813DCE2308C770BD2434C63FE2A9159C7B0DEC7CAACD8D7B054067542CCE5AF7

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

0001210FA74C9E235EF4610A70AF5A4B17759248B516584882E4DF2E198CB9EFCB2C

Previous signature

EB5654BED998D2965A542E03A1D6B04BFB254529B82CAEE2CE1A3E9F37861100A08828F0221E42786083563E5EF0A8357525E1945B27546C578691DD2AB47206

Origin signature

30450221008086D01C3A1D03569FEBBC35AA76BF744D71AD591C60F761580DE005B1ACA768022021A8D2CEDF7DE696E3C309CB380577F4400D73EC6927949DF5364DDC9D835612

Proof of work

010104AB41291F847A601055AEDD1AF24FF76FA970D6441E2DCA3818A8319B004C96B27B8FEB1DA31A044BA0A4800B4353359735719EBB3A05F98393A9CC599C3FAFD6

Proof of integrity

00D2B5820EB55193074E7872673041E50D8D583A79C2E5EC541AF9B5A0A2824009

Coordinator signature

378827ED8CB08FA3CABA319BEF7808ACA7ECCC340381AA021A8CE6CA424A4527CB2A7DE75A7ACF99B3A5FD5A5955FBF038F49762642AC7D00FEA51422F66730A

Validator #1 public key

000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF

Validator #1 signature

B2D0B8772610FCF90F863702D9509DC893D86ED1907F39BB5FC3DBCB0E1F0C506DCFE5E85BB3DCE90AC13F67B08EA3AD1241D2A00C4BB981378E1FCBE8DFEB09

Validator #2 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #2 signature

AF2E9DC0DE6C3D0ABC254733E1ADE29DC81748DC0E00272DE9D45C5999B65E2E9BD2255E44341E850FCEAB92254378E1B005D0BB13AA8C579343B3B91710000F