Type
CONTRACT
Validation date
2023-11-15 22:28:34 UTC
Fee
0 UCO

Code (925 B)

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

end

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

actions triggered_by: transaction, on: refund() do
  Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_token_transfer to: 0x00008D5D4054C44E2D545884BD557D7E1CEA9B3669EB223C11CDADD6D99A1334F9F8, amount: 0.05, token_address: 0x0000288BF6F0E12457B125DC54D2DFA4EB010BE3073CF02E10FB79B696180F55B827
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) == 0x00008DD22E7496E86901E9B276A1BE6F9512EB09980CC04C7B76495EF37D5666A709
),
  timestamp: transaction.timestamp < 1700094480,
  content: Crypto.hash(String.to_hex(secret)) == 0x32EB9A2EEF312633916071811D38998109139ED157AA478B83FFA88585B9DEFA
]

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.04985, token_address: 0x0000288BF6F0E12457B125DC54D2DFA4EB010BE3073CF02E10FB79B696180F55B827
  Contract.add_token_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 1.5e-4, token_address: 0x0000288BF6F0E12457B125DC54D2DFA4EB010BE3073CF02E10FB79B696180F55B827

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 0.04985,
    end_time: 1700094480,
    secret_hash: 0x32EB9A2EEF312633916071811D38998109139ED157AA478B83FFA88585B9DEFA,
    secret_hash_signature: [
      r: 0xB239C9FC7E5E82510849B4B402765E7BB59C7B145BF49F670A55B67CD470F38F,
      s: 0x561F8FD7300BB1EF4F75C4F5656DF7015D131158F7F629415F6585C0BC65B8D7,
      v: 27
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    732EE307A351E5FC32C736E03B416E53AE8B1343802D6A5AD7CF3D5908401B3933726A950A67472ADD6C24C416736A5A5DC076C1D023F57D388D4388

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

00010AE3E8252A13ECB3EDC32CCA78755ED198D9C09506865A7E76AD70AF12C1725A

Previous signature

3A0494E5F29DF7A2424360084C9A07FB97D23E82B59A79C01E2A95010ECC7D3A13F761BBB3C511DC8D784B5027C35CE60ED7E3D96188DFBBB78B8856ED92510F

Origin signature

3046022100878938F7579CEDA6D1F760167C92C72A58136D1D0C55EA70F4CC13FA3ADEBE27022100D912EF08F44A13F6C108E1C1CD7329BC8275F5D61252E6B56CD74257F393EB91

Proof of work

010204B3B2A53580086B9F36919CF40ABC55904729F78BF43673E216FAC1EB2451DD1E521879C6588F0CB09B150A103A39A73E2816B5ADF51F0721348BA3A66C33023B

Proof of integrity

00392EC1A24E79A48CE617FB351D1AC3C0AA584B44936F7F05FD1FE7056D4FCD14

Coordinator signature

F509A88416B492A878CB0E13DCF2BF97851B611CFA22E9B0DD453005379B0B805E2CDCB4EF6D35D8F7E4CBC929CC21458D6D9F2FADB683E78D1374EBB818C00F

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

A4886916745FC87A57DA20827B7A887163080EAD00184A2BCA20BE2A6AE325D600FFD0D85F99F2E3E7244E7FA774EB28ECA33EFBDD6A01E8F1077264705F0A06

Validator #2 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #2 signature

FF8A325DD0D66D6B47FBB07BA0C39326747A6CBBF4B9747A3246F03CD797BC26F252E9FA230BFF0C16BBE51649457BD79CA819A5162D2F44E0AD6E4A2712F90D