Type
CONTRACT
Validation date
2023-11-23 00:12:14 UTC
Fee
0 UCO

Code (923 B)

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

end

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

actions triggered_by: transaction, on: refund() do
  Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_token_transfer to: 0x00001675BECDA24450FAD82114A15B58567979E8E7AEA1CFFC54CE8C1779513EA2AF, amount: 0.1, token_address: 0x00001A4AB7AD0CE2B494C965C66FF2962692A5FE5ECB71B345ABB53BAD88A83A01F1
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) == 0x0000072E418B60C6DABD272BC2728B17B352B8104F068D11365D50134F96A4199609
),
  timestamp: transaction.timestamp < 1700705520,
  content: Crypto.hash(String.to_hex(secret)) == 0xBE6B3768E57A246197E13490F54AA096E57E62721A7F904CA39D398FD22838A4
]

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.0997, token_address: 0x00001A4AB7AD0CE2B494C965C66FF2962692A5FE5ECB71B345ABB53BAD88A83A01F1
  Contract.add_token_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.0003, token_address: 0x00001A4AB7AD0CE2B494C965C66FF2962692A5FE5ECB71B345ABB53BAD88A83A01F1

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 0.0997,
    end_time: 1700705520,
    secret_hash: 0xBE6B3768E57A246197E13490F54AA096E57E62721A7F904CA39D398FD22838A4,
    secret_hash_signature: [
      r: 0x63E604BC3083FD8F49A1CBF972FFFA49B7B3DAD66398E47D48C5E958275766C9,
      s: 0x7AD42BBE5322E06889C7935B05C6A31B6183F86B8C61F875DE248CA05CA2FCA6,
      v: 27
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    C798AB13973D3518372E7AE38ED95FAD96D7C01112BEB74C64FCDADCAE18977C0076A019340F9DE8E612FF8E95DCDE43AA437492FCC2144407EF1AA9

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

00019BC31C2DF648DB33286EA20369B355CD75A245FB29D60B408AB0CFEFE0B68477

Previous signature

82E33EB71B8B3436E6839942AACE5E0E18364AF419069A60FCEA73158E20E82FE06BAE261DA17FCD357696EC48BDD85483F6DD4C4F632C6BD5D5B410F70CA509

Origin signature

304602210095794CA53F566C61974376030E3157F6A2E0B292E0955CC300C4C4FC299A6D6F022100F3D7D9F436F847A4D31698935DC5698294D7A5537342590EF65E08F0A11AD8E4

Proof of work

010204B3B2A53580086B9F36919CF40ABC55904729F78BF43673E216FAC1EB2451DD1E521879C6588F0CB09B150A103A39A73E2816B5ADF51F0721348BA3A66C33023B

Proof of integrity

00856C6AECF7E0AE672CEF9799C6D774ADEA2D6AA829A4FD7BA9FD7AE155710A31

Coordinator signature

34AFB4BB7DBA823FD6CAD44B25ADC92417B49BF1370FB32B1D6BDED379AC38E22374CEB5C5CA2E66B662C64640FEB50AF98954A7BB6401F66D1FEB91B895EF0F

Validator #1 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #1 signature

9580A790247D6E73BC88625BF1FAFF410BA8CEBF32F7C3D59CE14691790AECACE813ED79493F1039BD05B7FEC256024D785D3D839E6A98663BD374B266C4C103

Validator #2 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #2 signature

39E9C699B73008E05D9FDC61E00ED7FEE0FE22CC51C9CAC210E1EFD6B9D68500D749CBE4FBF4E9CF02506B5C3C04C7E4B74295CF3023B9719AF29E33A56F6003