Type
CONTRACT
Validation date
2023-12-16 18:53:09 UTC
Fee
0 UCO

Code (865 B)

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

end

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

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

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: 199.4
  Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.6

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 199.4,
    end_time: 1702759920,
    secret_hash: 0x6BAEB3667D343DBF326C76402E25D3C81918705DB26C6F2747E29B4872D487E1,
    secret_hash_signature: [
      r: 0x6BEF89666E171FE81C834C2A14381796C68FADFA1AE52E654A9ECD74F1A23F4D,
      s: 0x3C2D30DB254954E54B7D25068687E233D068170A61AEFE33B1CF91479EC17F23,
      v: 28
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    299A1FEE67ACBD83AC8043FBA4F3A037F9C017A022604E7B2F85BCB24307271E20D646F2BD9AE7029F6BF882E53052DF8EB349DFF89EE1EBC8CF6E2F

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

0001692D61488B6A46D59025CFC11CEC54A06EBE24E8D0DF64CA3351DDE9DC6F9414

Previous signature

113CC8E90EF0881241F4C58FEF00CBAD38A8A2D1E9AB51FAB8DF1A87E1D7C464F4F5F31C46BA8BF4019CD451E810AE1245445361F42022EA9EE57B0B93393F0C

Origin signature

304402202E0C921C5A96E49EF3665EC656432222DA8663A5E277D6211AF996006CA66A380220281D3D4787278ADE77C4F456380FE534B628E5D38B3AE23FA928E0961614CF8A

Proof of work

010104BB7216545F28C83467606EDA88968E19C436410AB446D1BC88FEBDE3506275F9B0B931CAAE420B96B2A158B7112F13795C878CCC346C76E04A96C59CCFC6FC39

Proof of integrity

0077E7ED133CAE3E41D098EF7319B89E2CF7DF700743D8D5CD8F152F0B3A46F0DD

Coordinator signature

7B095DB25B5350912873F35FA322C04E003D8B7EB72E23A6FA3A0673242F1C5270182DD389679B718026E20EEDFFEF1DE88E85BA9E5D1B5D40530EA211FE6B02

Validator #1 public key

000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF

Validator #1 signature

935AB3003A1F7F7F02C5F1BD5E49A5269253FAF8B085290DA9F30970B49DCF546DCB26E3C0AD550916209F90E15CDB11E272147259633C293ED973DB405E5404

Validator #2 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #2 signature

84FE369DB210CF5E16AAEEE3979D27C0958BC03EED4D7F15C214CB373B5BA3B9293651D7E97EF7393A52E7401C66C309B4AF1F3F885B96561E4824126D32C806