Type
CONTRACT
Validation date
2024-01-27 16:45:39 UTC
Fee
0 UCO

Code (928 B)

@version 1
# Automate the refunding after the given timestamp
actions triggered_by: datetime, at: 1706381100 do
  Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_token_transfer to: 0x00000958DE1AC1DF79B441CCBBD0CA8E3BF6ED846175740A8D735CDA5977C5ED0093, amount: 0.004, token_address: 0x00003DF600E329199BF3EE8FBE2B8223413D70BCDD97E15089E6A74D94DE3F1173B4
Contract.set_code ""

end

condition triggered_by: transaction, on: refund(), as: [
  timestamp: timestamp >= 1706381100
]

actions triggered_by: transaction, on: refund() do
  Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_token_transfer to: 0x00000958DE1AC1DF79B441CCBBD0CA8E3BF6ED846175740A8D735CDA5977C5ED0093, amount: 0.004, 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 < 1706381100,
  content: Crypto.hash(String.to_hex(secret)) == 0x818CCB3471F30227616A840EB1BFCE5641C40B7936E800BBD906BFFD96ED06AA
]

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.003988, token_address: 0x00003DF600E329199BF3EE8FBE2B8223413D70BCDD97E15089E6A74D94DE3F1173B4
  Contract.add_token_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 1.2e-5, token_address: 0x00003DF600E329199BF3EE8FBE2B8223413D70BCDD97E15089E6A74D94DE3F1173B4

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 0.003988,
    end_time: 1706381100,
    secret_hash: 0x818CCB3471F30227616A840EB1BFCE5641C40B7936E800BBD906BFFD96ED06AA,
    secret_hash_signature: [
      r: 0x0D3356B6C2332C79F71CD78BCB65FD09427D6F941FC8357A4A6118A2A94D6741,
      s: 0x3C3A06F7846D71ABBACA88C79BE99D17F9444DE3865E4DE49EF0F0A068203367,
      v: 27
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    DA966118398080B5925E4027E99B12B074790310FB32100CCC8CFD41496371AE9D4106B042DBE56C8BFA03BA58050420ABCFA5292A0EF4AC34F894CA

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

00017D0411E56E45BE0E93D8714E1ED4A5BF9664E463858DA6B0382FCA35AE99381A

Previous signature

A47110284FADF7440AF36972AFECBE6353386BAA34D03E1278B6383A16E6DA825D7F7DF828B04EC51E458CBDE52144F26A19139C539EF37BD9886FD980635104

Origin signature

3046022100D516B4666A1DF444107906043265E00BA83C89C40E03B6466E36B4FB22C3BEC1022100B99512FA207BA1D8E5A294443D9707A29A2E4D28D410CCC6F3DF20C7F46111B1

Proof of work

010204D6052E0C6CA9244CDE5F3D664296BDFBA0090B330404C3C16B098758F27965DFEC0D3F25D1365F389C2B6C516195552F8779DEE0796C8C33F1A9C0404F4E3381

Proof of integrity

00DA6825D03832A11037CA4B2A073CBE64C4A6397DCA055F153E893C016258666D

Coordinator signature

B6F84754D81114DE881B855DC6A22C17E162AD8BBEDB1E40A4521A63A4D963B02314AD2805A7A12013FFFBCC2F3F0A78EF2CD4BEC22B9DF025F31D6251CA9104

Validator #1 public key

0001500FBE298B79FFBDD5CCA1798F30FD88A53D26EC39DE5DDE1F4137B032A4BC34

Validator #1 signature

A4B0B18DB39FE7C7BEE4BB1835FF64BE5A504DE6D4D004F611D433CF2B6B04D8DC3824C5223600816240A4CEE8597A22EEC8A7A336B2854988A31F3E63A83306

Validator #2 public key

000134772A943DC0F7038B1BABA39E18841C12DD6682B1B6D1D15E08D7CAF5339AB0

Validator #2 signature

4E301A47F4ED3B7596E5442F55AF6AD49C54099FDBB4A9D755A32CEA01B5FF159BCE697CE7C9C992F948ADFB434D255D36E308F9A0326D7CB624B745C6652B04