Type
CONTRACT
Validation date
2023-11-16 15:36:37 UTC
Fee
0 UCO

Code (864 B)

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

end

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

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

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

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 9.97,
    end_time: 1700156160,
    secret_hash: 0xE98D50118DCEDB037873B16ED87B54A6C101B71A29F1CE7EA962DFB1E963C896,
    secret_hash_signature: [
      r: 0x75A8F9DCCC0F3B334F7FDE4D7F3F2418509584E06B20EC0CA872C54A3030FCC5,
      s: 0x46A71A1988D1A1BF90BEBE7727195BFE86AB62CED05975EEEF799B56AB8E0296,
      v: 28
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    E84D5ECDC382F5DE2B99BAEA2074247AACEEE8D2DD247561596FB8F7AE78ECF4CBCED2F7EFAF105FDB732A53CF13E161704A0252EAD98B1080C9A3D3

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

0001A37CC2D639D562F8CA6C19F273D93F6109601ABB067C4D10AA72E4080EDE9098

Previous signature

B50FC2EF47A15B70E14948AE16864D20DBAA6B6D023C803887B5224F2629D367158FAAC294CBF52E3143A09C2E1945D1D7AEDDE4929C17488B5A31130AE88F01

Origin signature

304602210092DDD07D0F718ECBE1C7B082560C9FC4D0C3B3B10E21BF9ED9612305DF780758022100B535E2DABF3448816C949105282A4D3B4D9AC5159F7507D741E3823AE9C6967C

Proof of work

010204B3B2A53580086B9F36919CF40ABC55904729F78BF43673E216FAC1EB2451DD1E521879C6588F0CB09B150A103A39A73E2816B5ADF51F0721348BA3A66C33023B

Proof of integrity

0013DA845A54181958E3F074ED5FB78D8F5E5896CE86E93E288667FB449ACC9195

Coordinator signature

BF9BA0DF1AEB1DCF71127EB588B744AD42EA0EBF4D0A25634E4DD02A7D4CC193D6462A5EFA4394A88D24CFA36AFD10CCDBD5B5533FF0A877DB65E8E745F6B50F

Validator #1 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #1 signature

93D578B10204EF54B91523CB89B219919F5B96AFEF34BAFF0A6A89514146D90AD9CAFD5D43354AD60C707BC8CD5702F1A5EF8EA57E597587100526B931297908

Validator #2 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #2 signature

BAF569079DAB39C91BFD4BAAD581C038EF63928CCD0E3269B374337CDD9493EEE5911BEDD1B80278859F2091F34788221BE30DC78DE60995BD48744633C9A509