Type
CONTRACT
Validation date
2023-11-21 20:43:50 UTC
Fee
0 UCO

Code (931 B)

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

end

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

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

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

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 9.97e-4,
    end_time: 1700606580,
    secret_hash: 0x8FA2EC3BC93CCFD04B94373BB3FD70D22A0585D0C821A90C27BE0BD8C86A2756,
    secret_hash_signature: [
      r: 0x6A5EB04A1F74F5F37A4540FA142C7B5DE3B182865A60FC9DF3FB1FC739018C35,
      s: 0x1A378256FC5F3A6BAF34A5BE84D74E18196F517BA26B980721861A50F31C8328,
      v: 28
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    600C9DA05FBAF18C8CA90B8E8106E7C43D3E003FF375615BEF7D5990C4299EE6350D320E7B71EFE4B92D52952A675F91A6E00575B8B431166A0E0B02

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

0001C6A6E8B8D3AF15772C796DA786ABFEE32C49D2C2E5F4D0B0F0344488EFE5FF95

Previous signature

0A8AA8554C20329D3762F3991A5B24685871BBB9B4E66CB511E299DA38F149BE2AFE85DF9EB9CFF8FAFF80AC95193EEADC1E7E872C206082FE1A454A2036DC09

Origin signature

3045022100FED32935DE5FE7EB8C87073A9BC86910B1F87E5188ABCF389CF60C79CC78BF5E02200874C766E44E4E5B36A6CACC049DE2C21FBDD71041A5A5F95298B0C07831865D

Proof of work

010204B3B2A53580086B9F36919CF40ABC55904729F78BF43673E216FAC1EB2451DD1E521879C6588F0CB09B150A103A39A73E2816B5ADF51F0721348BA3A66C33023B

Proof of integrity

0028A8D6619DCA4FB3527FF598A02D03A2D54630E2D4EDEC1B6910B95FD5FFD4D0

Coordinator signature

EECA736D17FE19E515C41A54DB53214068268FDD140F45A42047E89F84D65F8102992571430B91C2B6CC4F6DECA397E19AE878E4175187A51D71E7F977D87F09

Validator #1 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #1 signature

DD669B12D09F4E09D58ACE05674F5E6D5F10369D4804221CC42F1D846CB62E6903FE07D7A2AD21BCC0F1D217A4B7222ADAAC7A36C3F1FC1084C1D72A1769BD0B

Validator #2 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #2 signature

B825D4744CAE433F3D9BA90651D311011FB5CE5BCB950B2443D6D32705B670209889699F5CA80FE7C75A1FDD14512E057FF04CBE16E455CDD86DFAE83D2E2F08