@version 1
# Automate the refunding after the given timestamp
actions triggered_by: datetime, at: 1701425220 do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x000006EBF65A8D742B1176B2624E031A76BA2BC7D3284705426E8306C5A92A1FA9C4, amount: 25
Contract.set_code ""
end
condition triggered_by: transaction, on: refund(), as: [
timestamp: timestamp >= 1701425220
]
actions triggered_by: transaction, on: refund() do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x000006EBF65A8D742B1176B2624E031A76BA2BC7D3284705426E8306C5A92A1FA9C4, amount: 25
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 < 1701425220,
content: Crypto.hash(String.to_hex(secret)) == 0x03EDF6F3C21E910D1E0C7019F41BC78AA4BA38127FCD0C2FBAF4E2AEDD26E5B8
]
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: 24.925
Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.075
Contract.set_code next_code
end
export fun get_htlc_data() do
[
amount: 24.925,
end_time: 1701425220,
secret_hash: 0x03EDF6F3C21E910D1E0C7019F41BC78AA4BA38127FCD0C2FBAF4E2AEDD26E5B8,
secret_hash_signature: [
r: 0x4BAAF7BFCD03A6BBDA953D65114EE5A942D73E738E567431C00BEA7DBE8D8E22,
s: 0x7826F032487C126717C3345D0843B7D80EE56C4CEB24DCF58D48BAC8D419E89D,
v: 27
]
]
end
Content (0 B)
State (0 B)
-
Secret shared with 1 key
Encoded secret
96C00B349A0F0A3D6C20CEC9E89ADD9E9E26F1758E3421551CE9D176EB27274F2E5217161CC9CD1CCA5B0A68E875B4FD50EA008507FEB77B4D863E66
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
Contract recipients (0)
Inputs (0)
Contract inputs (0)
Unspent outputs (1)
-
From 0000F9FF...14ACAt 2023-12-01 08:07:55 UTCAmount 25.40760005 UCO
Previous public key
00013561141311A9B61440B26F332BD80AE0CD58BF7E0027272E4DC1E8FEA68A8508
Previous signature
5118FAEC668FA5D854840195026F327BED18D91C9D7A7D36BE9735745AA93F59CA6FCB68276332A4C5043A0FD3C8A6F4028C618672229145A75A913CE52D850F
Origin signature
304502206C5AEF32CB6F1AB397EBA31B370363C97E0C4EFA939632B944EE9D7CC28F7C9A0221008BD2E0296D41EBF72A9EF795659CB03599AEFA3D255AA078BED8EAAFD8E0C171
Proof of work
01020451684966573439C38DA99334546FBBDE4A6D96A50B4A4ECBB6572CDBED023F079607407E254421D1779525D11C60D55684F0B403B93B95823554E29D1E2CDB16
Proof of integrity
00B91F9D73ED50787AADD606DB8A70787BA5C397D98CB9776CD92D5D02B90C5C4B
Coordinator signature
8BBC40FEBF2515AF96EB6335780F2B2C18DD0DCA3222ECA1ABDB1CEA52CFDBFFDD92BDE9653D5B25CFF0D368E9D823F03DA742258857EDFFFEA451785F2FFE0D
Validator #1 public key
00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947
Validator #1 signature
BAC37B0795ECE333143E56648EF23CDB6358BFE98665E0FD78AAE93ADFC3C1E72F6A65C30769D3A9E9A5222FF07A6E91933E91D0C711382C89D08FAB5A6EAC04
Validator #2 public key
000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF
Validator #2 signature
CBFD6A8FDD3B726CB1DF33C9E803FC7F8517C69976775DF2F7ABC719EBB272447A9D441A4A469700AF90F6F4E476C8F51DB572875AD24BB12E28328C4158FD05