Type
CONTRACT
Validation date
2023-11-14 10:42:37 UTC
Fee
0 UCO

Code (874 B)

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

end

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

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: 1.337
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 < 1699965720,
  content: Crypto.hash(String.to_hex(secret)) == 0x4CC7D7E6CF781658385DABD9729E3E1D0044A1516764E04A6EEC473513B12E9F
]

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

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 1.332989,
    end_time: 1699965720,
    secret_hash: 0x4CC7D7E6CF781658385DABD9729E3E1D0044A1516764E04A6EEC473513B12E9F,
    secret_hash_signature: [
      r: 0x991644D21208B3153AE14A9CF50B6DDE6F5B6E1CA47DD80FF2A8D27D863B8E39,
      s: 0x7BCC199C2B3C69E70068A0AC921C714C758F66641E90D3B6F11DC81BEAA72D15,
      v: 27
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    138A76A9440C7D88176E7A5F91B2ED7DD40F89AC3A13FE4312FB07CE9412BA02BBB262A5B8DDB1A098041229CE7DC6421CABA0B1C00D1DCD6A8AEBAD

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

000191DD2D50841F85496A450A6E9287D60839134D55DE4414736EF33B7B8A8B9F84

Previous signature

F59F737D71ACEFEEFBFA4E504C1459E92C668535CFD5438FEDDBAEF71BB60DBC1785FA884913363064226034113D2601A087F73620656B3E6909548B253C8100

Origin signature

304602210091E2EB546105B0C339E953A8E50ADC3F59EA0A0D52DE62EF5C4825A985BF6CD8022100D4DEE765AE2FDF20E32E78FC8761C5D1748C8563AE007D774763EB6B3A43666C

Proof of work

01020451684966573439C38DA99334546FBBDE4A6D96A50B4A4ECBB6572CDBED023F079607407E254421D1779525D11C60D55684F0B403B93B95823554E29D1E2CDB16

Proof of integrity

0061910AEA25C356AAB1B7F6F67022E0FD43B22CC47C1A8AD786EB7B9499CC23A7

Coordinator signature

EEB9246DAB2647D8E7845B9E07C13B8CC3BD3E655B959B2A81E15CF788991041B0AD246D1057A1B8D7D645F4410209CD1B16217F44C48EBC82405E5514A39A0E

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

B5FD97D14BD7232A5D0F2082BBD2A2CEA450C2E358FF7FAA5814565A2AB2B35726AF5A4B3E86B808EBA40916940EE7CFCC70B14F8997224C2F02B8CD9A31870A

Validator #2 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #2 signature

06C81209AD8E7E2ED1A773D002ADBB2709B79EB14C7F92F58F46DC6FAB75DB8E2C8FAB44E51D9F500D23A292833DE29966544830F152C9549E5F3B4EF2B22B0A