Type
CONTRACT
Validation date
2024-01-25 16:52:36 UTC
Fee
0.22040225 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) == 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: 0x00004B312A76B650FA1735CA2679CD4D1F3320095F9394CB072CDE835B6C95B6BC03, amount: 0.055, 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: 0x00004B312A76B650FA1735CA2679CD4D1F3320095F9394CB072CDE835B6C95B6BC03, amount: 0.055, 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.054835, token_address: 0x00003DF600E329199BF3EE8FBE2B8223413D70BCDD97E15089E6A74D94DE3F1173B4
    Contract.add_token_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 1.65e-4, token_address: 0x00003DF600E329199BF3EE8FBE2B8223413D70BCDD97E15089E6A74D94DE3F1173B4

    Contract.set_code next_code
  end

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

    CE4F425E169E43A0B8E53668E4910F03630FE1EBE12C215EA5C0657D31D7C92F7018F952398EBC1E0FFFB5E5B94F6ACF819861C53735DA69CB6CC6BE

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

000165189F1E04C76D676024B1ACA5D20D2526BC7D7E56A8E730BB9CEA94D79012E6

Previous signature

9EB81787FD73DD12BCB5F3055A787BF95B817139552A67E24145F47272B6E7BF7A08D1FB063A9984F229C6094799D37A5ECA3374F19936B509B597C43693210A

Origin signature

3045022100CF3864EC16D9E6B7175127F444E67AB4C613838ED8080512250786C40821F40A02207F4FA26CE140222F6DE0230DFEE0D6D78978EA15A9F6725AC33BABC653E16FDC

Proof of work

010104AB41291F847A601055AEDD1AF24FF76FA970D6441E2DCA3818A8319B004C96B27B8FEB1DA31A044BA0A4800B4353359735719EBB3A05F98393A9CC599C3FAFD6

Proof of integrity

00AB3899E00CE8AB58DC678F0E1AE4D690654329ACE3AD236B9581F55BB8EC6D18

Coordinator signature

8EDC02BD0E36641392D2955919435A92064F93B75B4BEAAB1B5CBD20D13CA2B1FD92CE3B1684189DED0BE1C929AAB34687217E25890492712AB1C9DEEB9CD90A

Validator #1 public key

000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF

Validator #1 signature

565F7A222B88331B6DDD6664ACD4C2DC327C520EA0BF64D2644472F59EBBEF0E94BDF6D9432F5D637BE8B5D2AB5B9B6DD24338DCB82001A51A3A4E2C6E928B0F

Validator #2 public key

000134772A943DC0F7038B1BABA39E18841C12DD6682B1B6D1D15E08D7CAF5339AB0

Validator #2 signature

7EAFB357B7C3606D0DCF74577CA21BBFCB13692F5F8A1DE77C0E5EF073A78CE0DEF8715B88666DA6E95E8BF8C2E6834ADF3C6219E305CEC3D795270745E6500F