Type
CONTRACT
Validation date
2024-01-27 17:44:49 UTC
Fee
0.21161104 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: 0x0000FEA155AEF688306C66CCDF1B83DB3429E948EB5F57C006128669401B9B906720, amount: 0.027, 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: 0x0000FEA155AEF688306C66CCDF1B83DB3429E948EB5F57C006128669401B9B906720, amount: 0.027, 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.026919, token_address: 0x00003DF600E329199BF3EE8FBE2B8223413D70BCDD97E15089E6A74D94DE3F1173B4
    Contract.add_token_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 8.1e-5, token_address: 0x00003DF600E329199BF3EE8FBE2B8223413D70BCDD97E15089E6A74D94DE3F1173B4

    Contract.set_code next_code
  end

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

    1AAF7541CC429A7FADBFE368176EE667EEFBFD455E4F0D84E32DDFED1239FFE3A417F0A0D1F5C77CB542BD8B377A0CF9866B882D3C0AEDFC67E40063

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

0001874F651AFF546AAA0A10F5CE4BC111113DEC3F626061FA48DC15DE2AC5447C6F

Previous signature

BC1A6C7AD264818796306115F5D77901F6FB35D12AC6CDA04AFBE573BA7E25330BEB972F1832C02D0E874E978A549A170154D994291C30A54D4E620005F29902

Origin signature

304402200C16C422498AF989A60E4F8E5F7B163E4ED19051E5F102EB17BE89D0260AF22D022016C1513EDC3EAD5485295C81EEC3B701627EDB547A01417DDCB3ACFE387C3178

Proof of work

010104AB41291F847A601055AEDD1AF24FF76FA970D6441E2DCA3818A8319B004C96B27B8FEB1DA31A044BA0A4800B4353359735719EBB3A05F98393A9CC599C3FAFD6

Proof of integrity

007C9165EB9C7649A796B92683CF0DCA561DA7A895E93B252E309EB8466F22AF47

Coordinator signature

B6C57731715261C2A39E1A0674086F6FBE56AE22987E0A56B605546D3D0F6FDEC128FDC8E736C96E68432F8903B20561707CA3EF5F5D264D1FEEA2F98B2B1802

Validator #1 public key

000177BA744AC778DC2D51A1B7C622E7AC4BD1E1AA8DA2D0FCE71BAAB7DAD0E020E0

Validator #1 signature

390C5579C64A72E7C562C14B03417609A931B4F698934662837E67404AB87A645D7D2547D33FF55F16DA8FDB2B3C2C100F9995BE5F8BE24036165E33C3755C00

Validator #2 public key

00018A312AFA617E98B343D09AD2E73F0AB661DB0A59FB986D5DB8CE7664E14C25FC

Validator #2 signature

F170726A2CFA28ECA2589BC5A19F77D7438D315D214F7F2A7820BAB92131DBAC7147F340A92538B8A6FB614930511BE84F16EA46212A3CA644887965A8AC2F0B