@version 1
# Automate the refunding after the given timestamp
actions triggered_by: datetime, at: 1701444420 do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x000083B000A5BACC553C131B64C034EEC5A6444A69B397ACC929549161B820CB99B4, amount: 10
Contract.set_code ""
end
condition triggered_by: transaction, on: refund(), as: [
timestamp: timestamp >= 1701444420
]
actions triggered_by: transaction, on: refund() do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x000083B000A5BACC553C131B64C034EEC5A6444A69B397ACC929549161B820CB99B4, 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 < 1701444420,
content: Crypto.hash(String.to_hex(secret)) == 0xA241080A43279CC5566D37D60C70E7C44DB249B6A38E5C4AF0E2B61539944FC0
]
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: 1701444420,
secret_hash: 0xA241080A43279CC5566D37D60C70E7C44DB249B6A38E5C4AF0E2B61539944FC0,
secret_hash_signature: [
r: 0xE98BD8EB3CE37EBCB3B61405E79714E82C827693528287B09DA216352460560C,
s: 0x4FBAFAC005FF6DDC7DE08EF32ABC85AA6BC0C4CE82A111A2D667A0C233011431,
v: 27
]
]
end
Content (0 B)
State (0 B)
-
Secret shared with 1 key
Encoded secret
2CD18B60AEAEA3E0DC4AB9344E06C2EA8FB589B605103AD7979969CD64F70E96DC5E6746D5EEFC8A134CBF4FF983EEAB5C251EE9403957D5AA3F46FE
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
Contract recipients (0)
Inputs (0)
Contract inputs (0)
Unspent outputs (1)
-
From 000099A0...CB4AAt 2023-12-01 13:27:24 UTCAmount 10.42497326 UCO
Previous public key
0001E89D5353AB5241B12A71C6C8D85E8A4641DD23E63D68D539AAC4C72A24189A3E
Previous signature
D02477930CD511FF453491FFFE89C3166A87C54D177624EBAEFACE983A810DD6516E2394CCB43CB6B10C0E67D258119A8067DD226F9B956131B28BD3CE9F970E
Origin signature
3046022100E83585A47F9C0A8B53C2766B14464CE38DBF6522478994D307F7EA6400436503022100D0191D2B33803ED7E87D21349043A78849E8FE7C84210BDD5D2A93F604124C6A
Proof of work
010104BB7216545F28C83467606EDA88968E19C436410AB446D1BC88FEBDE3506275F9B0B931CAAE420B96B2A158B7112F13795C878CCC346C76E04A96C59CCFC6FC39
Proof of integrity
00F2672ECA1F3D985E8ED59BB9E3589F9D2A1293BB8DA97221C09AD26D208EF79B
Coordinator signature
7867486DBB2E2930A0DD6FA2AA4C150DC424FE5F862129AD4AFA8B68C65D2EB7F6604704F63A49441ED97597D7EB82620812FCF880162213CDA489D0CF795503
Validator #1 public key
0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3
Validator #1 signature
D20A2C966365FCBF3A3AD86927470CBC2332C73324D3C006EABD9055B176C4A2D69EE46F510E0850ED62FD4D7C2BABE1B8209CF37E4CBCDF6D9643E5AABF2901
Validator #2 public key
000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF
Validator #2 signature
141894E2180DC1E79D8D981600E932A6B43AB1B8BC865352C627233BF44F55DEE8A078F819AA89157F897664BE8934F0A97F6EB8711EC2E8BAABE7C025B55C06