Type
CONTRACT
Validation date
2023-11-21 16:42:14 UTC
Fee
0 UCO

Code (874 B)

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

end

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

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: 0.0001
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 < 1700592120,
  content: Crypto.hash(String.to_hex(secret)) == 0x31CD7A1BF222EB7C5D8535A667F5CD45A93187C3A8FF73CC59C00CAA83F2EB2A
]

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.97e-5
  Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 3.0e-7

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 9.97e-5,
    end_time: 1700592120,
    secret_hash: 0x31CD7A1BF222EB7C5D8535A667F5CD45A93187C3A8FF73CC59C00CAA83F2EB2A,
    secret_hash_signature: [
      r: 0xFF655FB12984EAB6303A373ED3D9C2577692B3DCE86BF9993EBF2716F6A5DB47,
      s: 0x59D5F2D5048DF9AA3988848CB98EC865514380D8183EE2FC4610489E2450E840,
      v: 27
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    E735167B4CE99323F76338D5C7797052CF780FE2942E1D3B9637840B514FAEBBF66975FD6FA9268063CE6F07E4FA1C7451A018D8A4EB44E612FCC5EC

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

000186F37C4B3873101C9FAAC6775C5F5C58BAA82FA92D1D50F4F7B1D8DB77813087

Previous signature

6A0175CB662AB1284354D5ADDB06EB54499006E94D0C22F0AA09226785312BDD6FCA41D1469CC70797554132A04AC14B99509981C91D35887063D5CFF8120007

Origin signature

304402202507B0CFBB5DD7100D4675FF143E23BE664CE5A193604B4AAAEAC22BF738FD4C02203356391391CB0574437E7998E1DAF832E9F108984991A28403008D318AFDE608

Proof of work

010204E9BB401A767B0C92D5DB139379AAB18E1B449B455F49E3A44F3466B2D38E59F0516B79493A528A95E5A74CF46F79CF12DEB73293458F6A4403D2B3E57D697347

Proof of integrity

00EF1E59B519F24762CD453156EF59AAD21711CEEF73C7DD66E0CB32D165F06B8B

Coordinator signature

3F8F8434256219220C575F8AFF1B6D2845747BC41AA770A92E8AB00A2C3DAD1C31C80B8AAC628C7462DAF27692802543D595946FAE6DFB6C3650314B90E05E09

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

5CD094A10F79AD6010D5A10FB5EB5804732B91E944B32B3222965ECB95F3B79D4FFAEC922A3A8F2FB63FCAD79DE5BAE93753DC7D553449F765D6E244FF22DF07

Validator #2 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #2 signature

4051D7553DE5E42D6B1AE3B933FACBA53B98339D5DFF1423A4CB327F23A767E0A1014FC63D012034A55679FB6919D42F8461FA7A71A7BB8D6C5F0DF04DC5580F