Type
CONTRACT
Validation date
2023-12-06 09:15:00 UTC
Fee
0 UCO

Code (929 B)

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

end

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

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

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.014955, token_address: 0x0000288BF6F0E12457B125DC54D2DFA4EB010BE3073CF02E10FB79B696180F55B827
  Contract.add_token_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 4.5e-5, token_address: 0x0000288BF6F0E12457B125DC54D2DFA4EB010BE3073CF02E10FB79B696180F55B827

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 0.014955,
    end_time: 1701861240,
    secret_hash: 0xDF914A866F5E5CF16B1273CFAB37DADF52378C0998E310B654FEC66B54CBAEC0,
    secret_hash_signature: [
      r: 0x675D9D246F901E560A504364884BB1E20A76AE63BA0D01E9A833E97324F3619C,
      s: 0x78CBE7178DE3E62382364AA8E96C26965B7B9E910A6F8E79555446B73DA3CCB6,
      v: 27
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    9BF48B94D44B732BC6E218ED998BB186FBF29D39C21F872E47836B9A2F96B57C3C6403F4424B289BEA0BDD62E50DD494E464A9CEAC598E977F2627E5

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

0001EDBE151A813FBADF27EE0BF6A9412174597E38D897BA8D1413E2B4C6E4883020

Previous signature

1A86FD56D7DAEE98518D5A101241A18EC66C186343E969D73AC201B14F2C13E0F166E4621AAF2C6575508298CF5530765D098317098D7463C02FF0C03DF6A301

Origin signature

30440220440850C48992802D84A34D5134FB28ACFFE7D4AC601EABA9CCA778BD31F15E8A0220688D56BE391F35ED7CE1B708502ED1CCB19B1515175B1886E615B1F1C50A9FD3

Proof of work

010104BB7216545F28C83467606EDA88968E19C436410AB446D1BC88FEBDE3506275F9B0B931CAAE420B96B2A158B7112F13795C878CCC346C76E04A96C59CCFC6FC39

Proof of integrity

0025BB992696DC1CC6FD5E86C02818724E8F8E99F2010988B8E4FD5B2B80B00C2D

Coordinator signature

1D7DB29530A80BE63B4DAF91F7E536B96EC0A25B4300704FF82F1924A43928F5DC0F700077F030C3AABDA252CEE522B1030FE6E1958B1FFF3E4111A660320103

Validator #1 public key

000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF

Validator #1 signature

F434747018AAE91022AC36B497EE3D8A9C8DDECF0F3530DC9BB0B525517F8B11D9957BE3013D87F0FE80988EB45F5330BAB134560AC9D8ED2DFFA53560679C00

Validator #2 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #2 signature

177FC068B558907D94EB39B0FAFB2545D3F2D2F7D762E5C14B712C06F2273D150A90BB6FC2660F791A29F535FBAA989A86998E3D62509B5FB285CE33C9FFC803