Type
CONTRACT
Validation date
2023-11-25 14:41:03 UTC
Fee
0 UCO

Code (868 B)

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

end

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

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

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

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 49.85,
    end_time: 1700930400,
    secret_hash: 0x192F9B044BE9056D75A4BFA3BA153F599F5B82EBEE3A8A65243508227D44A1CD,
    secret_hash_signature: [
      r: 0xF7F6564EB8A9525EA6D88EE63557AF6E928D3EDEC3DE84D47DBEA3463D8A6F2F,
      s: 0x65E7B0610ACE7839F1304AF05A8A0F9ADA68859407BB7CA27FAE0D57AE04B9C5,
      v: 27
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    7B7E51EAD1B3142EB6E82277B8188C9407E4A584A30C022628CF9E3AAE3CB6C5EE3BD7A14E4EBACA8C319CC76F922EBD1F3413376D7807EAAC0B3C28

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

000111D39D0F1EF7A08B263EDB74CDF361203430C1196312EAB596F23F2D71A52949

Previous signature

DFB836E5C8DFCAD2880FF2A64654A16BB0715EA655C522B2A6D2153CCB15B5B4F6325E15427C246C438DC5E6C87C12323BCDF8A1B0CAD79A4413A02D716CCA02

Origin signature

3046022100FE4E5D4838FD546EF9C652DF0572066BBD6CE8D4CAC67739C902C1B66A27E4640221009EAFE5C058C984E73DC1535B188E37ACABDB1480BA92EF3B9CF56321ECA8A8B1

Proof of work

010204B3B2A53580086B9F36919CF40ABC55904729F78BF43673E216FAC1EB2451DD1E521879C6588F0CB09B150A103A39A73E2816B5ADF51F0721348BA3A66C33023B

Proof of integrity

0089CE8BA2F10024B20A75BC58EEF6E1F4AAA486B888D3C9ABA2AB9F283C96DA61

Coordinator signature

C1D1AE09738A1C88320F1F73F9892AC343BEF30FB711AC1619155DA40753FCBF09355219652709C456A50A06111AB56942126D188268742FA16E10ED8907E704

Validator #1 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #1 signature

5591D3B8F31B5823CD906D814702F452FAFBF06BFD349C75FBE302B891C8FB6B61E0BAC6E19CF71F4D2E05BB42634BB2B919531E5BF138E2F3162E0EC7ACEB08

Validator #2 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #2 signature

0880571C8B58DF5907398CDCC57E2D3C132AEE113ABD25D1F34B85C9753F5734D4ED37D3B76B61A34CD1E863B06F8A5300ED9E61C495C5225A9A2FE06DDE2103