Type
CONTRACT
Validation date
2023-11-21 15:41:07 UTC
Fee
0 UCO

Code (864 B)

@version 1
# Automate the refunding after the given timestamp
actions triggered_by: datetime, at: 1700588400 do
  Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x0000647409F94DE9798EA91E049B9AABA07B8CF3570A22056513B3437091C04B6807, amount: 4
Contract.set_code ""

end

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

actions triggered_by: transaction, on: refund() do
  Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x0000647409F94DE9798EA91E049B9AABA07B8CF3570A22056513B3437091C04B6807, amount: 4
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) == 0x000018D60115ECE0C7558A46B4693749BF6BEAB524FDDCCF9B10B910619E4EE08801
),
  timestamp: transaction.timestamp < 1700588400,
  content: Crypto.hash(String.to_hex(secret)) == 0x39B1AB25C6D9CCF8F174E40E191C3800697FC883DA888799457BEA1C080223A0
]

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_uco_transfer to: 0x000018D60115ECE0C7558A46B4693749BF6BEAB524FDDCCF9B10B910619E4EE08801, amount: 3.988
  Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.012

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 3.988,
    end_time: 1700588400,
    secret_hash: 0x39B1AB25C6D9CCF8F174E40E191C3800697FC883DA888799457BEA1C080223A0,
    secret_hash_signature: [
      r: 0xDADE38930E9BAACCF671F2736F48D877C7F9D06E9BE76BC2DE38547F9A60A5CA,
      s: 0x13A723940980BD0C1BC331869AEA8F548DB9D74AFE1E6864DAF70D967EFCDC84,
      v: 27
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    D6F7B30F4BF90A760DA7041237A00FBE2835D9E4CBD415561E707C3DC41CCF6E843ECF3F09F3D823B3A46A993392BD8C94810BA76E50BD6ADD2EDFED

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

0001D653CC6667D88BBE1225237AC37DCEC3F4D1B73EA465A86D8F5192FAB5CD3F7F

Previous signature

D364CA8DD52847C9AEB030BD262132CBA59D3490D5A5579F652ECE8888AFE88C8F81737FE946BAD569E8F1541E522BFF70A13EEA23ADD41F22564578A3316F0F

Origin signature

3045022100D3A83193D35931CCB0B4D21AFB9A39AC7A77EAD5AF974FB38B56AE51A2C2BD1C0220547F54980562A6973A2B479C0E520E688174B594552553F6AAE1C1015BC51AC2

Proof of work

010204D6052E0C6CA9244CDE5F3D664296BDFBA0090B330404C3C16B098758F27965DFEC0D3F25D1365F389C2B6C516195552F8779DEE0796C8C33F1A9C0404F4E3381

Proof of integrity

00ED383868DA0B4AF9A53EABB4BEA23C7EA71D1D9F19EA67073121B258D39E8862

Coordinator signature

76F1356EF0D5D1360A55E40E47D142B655354C97B6C63DFEE28A402F3C7A50F0AEB8FA694923BE0F971CE5104E64E972001BB4227AD32BA08D2EF5A33E84300F

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

7558253C2641D80D3EC6584F79F21F48937333B301AB307F5E6CC2D1D307CD37BE5E7E0714FAE1490AB68A753A5F3063AB419ACA9DD13BDEAFC767C92678420B

Validator #2 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #2 signature

A2DECFC6DE537DB90BB5D4650345F3DC573EDFB0449CCFECAD0F1BE522041EA133E89460CB7E1B5D664D4759B0BCFC4CDA8273FA4B945CB0EAED1971F791F601