@version 1
# Automate the refunding after the given timestamp
actions triggered_by: datetime, at: 1702133160 do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x0000D9E7B4300CC29670CA80010FE23292BEE4AE28057328732A0FF4CF11C319D81A, amount: 200
Contract.set_code ""
end
condition triggered_by: transaction, on: refund(), as: [
timestamp: timestamp >= 1702133160
]
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: 200
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 < 1702133160,
content: Crypto.hash(String.to_hex(secret)) == 0x5A005307E6BD227F9680ED73A08DED6AF7A47AE2DF53682F858310023EC770BB
]
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: 199.4
Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.6
Contract.set_code next_code
end
export fun get_htlc_data() do
[
amount: 199.4,
end_time: 1702133160,
secret_hash: 0x5A005307E6BD227F9680ED73A08DED6AF7A47AE2DF53682F858310023EC770BB,
secret_hash_signature: [
r: 0x1391970DACB1B9FE61857DD88CDC4D459E464B544C8469EAE9A0B0A4C44B43FA,
s: 0x3BC9EF516648CF97CADEB295FCA070057EF59916428E1A53D60791D33BBD8632,
v: 28
]
]
end
Content (0 B)
State (0 B)
-
Secret shared with 1 key
Encoded secret
8A11ACA80F37B330A863629099D0791A6808BF032950BF709C399A5348DE33AE86F3D50E8AEA4810B7C6686B157F9DECDAED9049458603B71D9BC91D
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
Contract recipients (0)
Inputs (0)
Contract inputs (0)
Unspent outputs (1)
-
From 0000A2BC...10E6At 2023-12-09 12:47:05 UTCAmount 200.41541736 UCO
Previous public key
00012F83C8537CE11438B78D1F3118F62CF44EC10B6526B6B975634ECF10B2D0133F
Previous signature
2FE4F7ED4072DFCB3E07E0EF12A6A59815BD8682A615A605DE3C480E18ECB94C634F0BD1C8109F2D8E4692ACF20EAFBA0795F8C93ACA3E13CC29B1D1479E9204
Origin signature
3045022100A5D286EE47911F6D8021405AFF246B866476B5D7CF90F286CBF61C90F3C067D9022065ED1B6346BFB8CE732896B33C77BC5DE22C8E07125313B05702A811832EFC1A
Proof of work
01010484B78F4110D8E9D6FBEC72759895CC9D4532177314FBAA8B07BC525FC1AF48F150EFBF104B1819106B8E3563CD0E1FAAE5325F8FCFE58FF744C35F47669D2704
Proof of integrity
00E9BA6163F8B5893DAE7E304EDCD756E33F859F5EBD4C908D8130F62040E3B79D
Coordinator signature
B9AEC9BBC90F22B290C9D8D179F670E3552E3EE91AFFEB3897BE1EED789761EE181EDF2FE474AB8584D40C967A2A4B28D7533B2404C777327D032FA63D183205
Validator #1 public key
000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF
Validator #1 signature
E65D81B64616F405496698B111D1AFFAD330137E9314EDCAA7BE5CA7F34009A4B6351A25293F2FDD1AED130D3521FCFA0F1457EB282B207645A44C6C760A0209
Validator #2 public key
0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3
Validator #2 signature
87AB3B2B2D1BE68843C649858CB7966371DBC38ECC4A764BBD09FD1C007A467D5EB1E46E2FEFE63FD7450689BE09A67806E71427B233C46A0F96CA0A5CCF7D0C