Type
CONTRACT
Validation date
2023-11-21 11:04:29 UTC
Fee
0 UCO

Code (866 B)

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

end

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

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: 100
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 < 1700571840,
  content: Crypto.hash(String.to_hex(secret)) == 0xBED9A2210069DFA1609BEC3600C1BC133C527522869C25EB73ED218A82B6BAA5
]

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

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 99.7,
    end_time: 1700571840,
    secret_hash: 0xBED9A2210069DFA1609BEC3600C1BC133C527522869C25EB73ED218A82B6BAA5,
    secret_hash_signature: [
      r: 0xBD9F8074C33629C738021D41EAFC73F037963204CD11494F696D5A8E68129567,
      s: 0x7BA8A08C8A87833E0E7F1C6B4BFE6D0958F815FBBF48F7803EEB3CF286EA9E34,
      v: 27
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    B42F92F4362D9DEEE9C92D7A2690B7EE98D5CCC15EE68E3475DF2447E6F7F30AF3863333407A0E47071FFCBEF965E6CD8A7BEEE983FFC9FE8AA18BEA

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

0001CCFE3F7DBBB6E8DEA59B31110A648B8901ECB1CC7BF275008358789D7655A23B

Previous signature

088725CB5B1992D18F118F3EE5393D93B1CF6EE4C18BF788212CB99F156716173664A7BA483181F4C4CEDE2E499597E5B53CFF3436A4A6B1C5FB3BA2DD11A50D

Origin signature

3046022100D344F17C1F46806D9D5AEF20E14078A06A66D5777BEEEF11C5C07DB1C2E5089B022100F169E7257FD4C717E480E5A477A62EB69CF002C89FA5E155FEC4ABA4D34827D7

Proof of work

010204AA023E1E039788AD4B8F713C8871CA39A177414A99A0788993AD725B1FBB7AD5E4CAC86151A9E03451DCACB1EFC100B1E450FCEDAF5E5005F3A4C503D1D29712

Proof of integrity

005B1E57765DE1DC0A90CF13AC7815C8FCFC843BFD4389C1FD1935BFB59D40BA8B

Coordinator signature

018415E334E7E79DF5A27CD041DFE455F7B65325894602C92F3D9E37B5D21FA32A25798B9B2DEA8C78881B73F1BFF21EF6C08074F3CBDBB2C18C4BC7DBADA90D

Validator #1 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #1 signature

7579AE65B2656C0272390308E231A72A655D2B8D0785ABB8A7C0684B1A79CCB2EBA7F663C141CCC553B2AEA7494C241DBA03480C87E0CBA7DB26A95E5CDE3408

Validator #2 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #2 signature

6FC8FAC93495C9191E2011F4C678474C0C65CD79A98E3E93C577965A71EEDEF4C6DDDDF7D80B4BC08D7B7A0B7DF3D4DFDB5CB3E05FE325E13625EFA5030A6203