Type
CONTRACT
Validation date
2023-10-20 14:41:55 UTC
Fee
0 UCO

Code (932 B)

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

end

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

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

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: 9.97e-5, token_address: 0x00001A4AB7AD0CE2B494C965C66FF2962692A5FE5ECB71B345ABB53BAD88A83A01F1
  Contract.add_token_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 3.0e-7, token_address: 0x00001A4AB7AD0CE2B494C965C66FF2962692A5FE5ECB71B345ABB53BAD88A83A01F1

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 9.97e-5,
    end_time: 1697820060,
    secret_hash: 0xFB274E866ABBB60A9BD97C27E1835900B65E757D9AE2CCB7D77C871F1B34533B,
    secret_hash_signature: [
      r: 0x30FA8B9B575E3A570C04E4917F51EF935CB4F99558FD5A8079D5563411CD657A,
      s: 0x5C6526FA49AB842890E1C67A5CC625666E3E0CD388CFF9F0FE497B4D572889BB,
      v: 27
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    023C324C0EF6CC77CCAA52FE413FDFC99A445933B417F67B6444B66D95F2A76B484362344C4DA11DC95FE45FE574FA5875F92193987504B5168B465E

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

0001E0F25CEB54176A568362927D91020859154815286086C58FCAEAFED474FA157E

Previous signature

FFE34DFC04A79FB5E64207190AFFF2993D024EA181041489C6AC6EBAE3D7D2AE8C38E87CC82469E7422BF62E25907878FECDD4CA89FFC7862034C0F8E46D4700

Origin signature

304402206BF7D511CB4DF6EF72985E0F2D1A62DA7D46E8997B8F1B86EDC3C1C3F8FC3F48022074768E3E479999CDC4BD4258D601652464BC798AE852F20D3769B5376E3AC3F9

Proof of work

010104EB90F7BDD03D5A7FD9B61D9128D7CF24C11F3F7DA96825DA3680C2B6BCC48F1AFCE26E0A5F1A903EDAA4BC9390210A0A4F175847EC2A2BB325BB6D1CE8EC8F90

Proof of integrity

00CA5216648D46BE0AD47C4240DE6916A9345438DBF9CAEEF99252C8A8B2E56524

Coordinator signature

1271C0A33CD04F961139309D5DD014CA4E7C3A15E7F178E839142E30213908F265188B69A46433CD585862F1EB9042C750EA17A6963DDEAA2054CA5B786E6101

Validator #1 public key

0001500FBE298B79FFBDD5CCA1798F30FD88A53D26EC39DE5DDE1F4137B032A4BC34

Validator #1 signature

ADC0E6416B8607D5DE9109DCC9F09F2AF32AC01133ACFDFF963DA07F1E288C121D54CE02C8CBB250632ABE18252CFC6F1F54251A76CDA42D281AF7ACB981DD02

Validator #2 public key

00018A312AFA617E98B343D09AD2E73F0AB661DB0A59FB986D5DB8CE7664E14C25FC

Validator #2 signature

1182A2B585C6D33E0926D97B2FEB7AE73508CF7B3713C00E0F5E2631E64AC4067A0671D368F4722D2E84AE83E41179C35A21291D278734A3926C22A3DAB9D106