@version 1
# Automate the refunding after the given timestamp
actions triggered_by: datetime, at: 1701341340 do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x0000083A1B345FA78DABC772F1FDADB9DDCEEF7AB2F28208EBB6593B976A7E631882, amount: 10
Contract.set_code ""
end
condition triggered_by: transaction, on: refund(), as: [
timestamp: timestamp >= 1701341340
]
actions triggered_by: transaction, on: refund() do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x0000083A1B345FA78DABC772F1FDADB9DDCEEF7AB2F28208EBB6593B976A7E631882, 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 < 1701341340,
content: Crypto.hash(String.to_hex(secret)) == 0x3AC4C35BFD00C94BFD944DD06C79CC24C7EA237D8160CE745BB4B82B6F5B4644
]
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: 1701341340,
secret_hash: 0x3AC4C35BFD00C94BFD944DD06C79CC24C7EA237D8160CE745BB4B82B6F5B4644,
secret_hash_signature: [
r: 0xC2091237B797F9CC26CAE31DB9B9DC6F1B437D4885381DFFFA0A98E434CB564B,
s: 0x7ACAD5195660FDCE25E4BEE29ED5EDCD1F5737724A1988F8748F31728A0A7769,
v: 28
]
]
end
Content (0 B)
State (0 B)
-
Secret shared with 1 key
Encoded secret
28262FA9C08A83A201113990B0A033A8184443B62B302C6F8B26EC6981BEB09EA38C1CC0E09E8FD57F9EBED790FEEB0F361F245E56CA6E72679DD640
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
Contract recipients (0)
Inputs (0)
Contract inputs (0)
Unspent outputs (1)
-
From 00002CCD...CF94At 2023-11-30 08:49:43 UTCAmount 10.4211111 UCO
Previous public key
000148775A823DD731C5FD18CF61F71F9C839AEECA3121B8A6779328924DED091FDD
Previous signature
FFA9DD79C0D5F4865179F015EACF53FD356B4ACFCB48591F6D41476110BABC280EDD1F5B6140E3C1C47C504973DEA2A33F33E07CB124AC6A64D4A88F0E665B0A
Origin signature
3045022100AC716025307F2E2632ED25B3C4EC6398715D59669C654E65ADEC6CB77A54BB78022042F95F85A3097B6E77C450DB296FEBD0F194236F581F3F4292FECEFFA5E922DA
Proof of work
010204892A04DBE05192BCB662689E7E19700F3F7202028EF0A9F20635C4948436ED85A43BA3017281EE97781342DD8F24ED6F583B5FE542830FDB5191A11843A72A61
Proof of integrity
004E0AF3A5244283B3BB7EB9A29BF4E73D25A055287653FF596944816F464558C0
Coordinator signature
1653A214432C79EB8A452EEE954915871C27F4CF3765B69A7F6F40BA9B743FF9375005B16FE1B3CBFBD9AC11F87AC38C15D254167DC0BFCC893A416AE865B600
Validator #1 public key
00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947
Validator #1 signature
43F2CEA9FFA3BFE76A20DD492722C7E7EB9014E9E6D4A47E81C795F5715E1636451C0E196591479E096A0701EF17E4F93FCA4F39761EBE8BB45DFB7807A41109
Validator #2 public key
0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3
Validator #2 signature
707381578C954361C656C3F2C46B6CF8B6976CE9B1311884929E3BAA249F7AA2B972D9002FCA562FC828F0D1FA22D48DB55F5E8E67F937A2F55522521A3FCA0B