Type
CONTRACT
Validation date
2023-12-18 15:34:02 UTC
Fee
0 UCO

Code (921 B)

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

end

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

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

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.7976, token_address: 0x00003DF600E329199BF3EE8FBE2B8223413D70BCDD97E15089E6A74D94DE3F1173B4
  Contract.add_token_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.0024, token_address: 0x00003DF600E329199BF3EE8FBE2B8223413D70BCDD97E15089E6A74D94DE3F1173B4

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 0.7976,
    end_time: 1702920780,
    secret_hash: 0xA44104B234CA054DE025EEC2BEE3C31F8260978C224A73727AA6D1AFB5E8EF41,
    secret_hash_signature: [
      r: 0x1AF0182237EC4B89E50D5EC98C0A51413E9B1B3C9C1E3CD01B9858B1D5AD1CB0,
      s: 0x1C5337B3CBF91ED21A5FE8FB6AC8521EAD42D4FBBC999F3B5C4F3405243435B6,
      v: 28
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    E1E9F8DD22A76992FBB485D253185FC9ECD4BA3C581F7F03397D84C4E255FB7835ABC53CB2A30CD225AB4CDF9FB3BACEEBEDD47F425A998F954064EE

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

0001BD905EE1ADDC8304D75835DCB763F48F89F8A22242345CE655DDBC3C1DB60C3E

Previous signature

5258DE29A401E8639252C991A58277F889FBD6695C3C98FCAFB6053C05D22924F4050C161B0031CB6DCAD4F22CB1B5A23261495C8E72AE0127996835337B6704

Origin signature

3045022077AC88E45B935DC2C8219F3F8B2CD3F65A5192AD73E026DBA83E01FE52FB66D7022100C2ACAF602C18C26BBDD6AC338420446CE36429204A6365C846291195F3918BB5

Proof of work

010204AA023E1E039788AD4B8F713C8871CA39A177414A99A0788993AD725B1FBB7AD5E4CAC86151A9E03451DCACB1EFC100B1E450FCEDAF5E5005F3A4C503D1D29712

Proof of integrity

00697CCF101A38D1DF84C22E787711E39156E793A1E47A018026D38FAFB7BBC9B7

Coordinator signature

204E4BC3964FC37533E7A9A50C318867A9500ECBA466B919922D5D355C4EE20568527C6ABC814D64746FDB76D402F44B34DFE958F5FEE7A6535EEC7F14FEFF02

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

708AD816DD01B2151346910D55348EBCE2600B3BC321B9028F71520FD55EDAF4377422E8171394B0357BDEFA468C2F29F56FCFF537AFF60ECE2356A0623E880C

Validator #2 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #2 signature

D53F7EB3ED2C35D29B6878301A61A225888BEA7E015773B735520933EE3AE6098AE47B9B28B3B5CF24A6168FD6916E2CD6AECE3A092A445EB2EB9BA8E713280A