@version 1
# Automate the refunding after the given timestamp
actions triggered_by: datetime, at: 1700155920 do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x000080D5057516F335B1FA66F82ACCC4D05BBD983ED957B5D7D67505A4CFE10277FC, amount: 10
Contract.set_code ""
end
condition triggered_by: transaction, on: refund(), as: [
timestamp: timestamp >= 1700155920
]
actions triggered_by: transaction, on: refund() do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x000080D5057516F335B1FA66F82ACCC4D05BBD983ED957B5D7D67505A4CFE10277FC, 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 < 1700155920,
content: Crypto.hash(String.to_hex(secret)) == 0xF1852F52B05AFD212026E4E3F68A9BB574970C19ED40CFF40AB7F27056B3F0F6
]
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: 1700155920,
secret_hash: 0xF1852F52B05AFD212026E4E3F68A9BB574970C19ED40CFF40AB7F27056B3F0F6,
secret_hash_signature: [
r: 0xDA50210CE6872CCD8FBCD94FE25553F302ECB8171DADFACB3959A3763AFF2D90,
s: 0x49E12DB42DBA389181A466F67E46CDA529D4763DFFAE4FAE87A4A3220FF1BDD5,
v: 28
]
]
end
Content (0 B)
State (0 B)
-
Secret shared with 1 key
Encoded secret
33694416593D63B54EE462E678F16F6024B58F35A9DE1D52E4F496354372BF7A784D54713C525B4EF37E3EF1D67EA8211E0341E24077FAFC4272613E
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
Contract recipients (0)
Inputs (0)
Contract inputs (0)
Unspent outputs (1)
-
From 000005DD...8FDCAt 2023-11-16 15:32:44 UTCAmount 10.34408374 UCO
Previous public key
0001FF9016FBA6DFE725271AEEFDFDF3DAF39E7D252E7E9991C9E10BF92446466240
Previous signature
F3915B3D298D7378CAD9668A0B9380D30EF9FABE9635FEE862A0A54F6C47D33C8EE033F06CB48580CDCFB33BB797D40A0566C137BBF2D27C712614DF54F6760A
Origin signature
3045022100F4EEF9157CAFBD0DD2CD2DF50EB15472E24FD47EA7CBD8EC5526124DC86AD09B022062476DE7C6FFA425459540C6FB3B7A36C753B95C27161DA46FB22A867E2B28DE
Proof of work
010104AB672F1E69B064D192819F1797C1926F158DBA8F3924AC732B4C4D70D0C8EA0A0D6506E5896C9C2524D2BE26CB5016287E1816A597C408008BA36FCB154A7765
Proof of integrity
00EADC5E46A7244BE5D5833E941EB43E72A1AB029DE13C6328B821159601EAC17A
Coordinator signature
E3FB273145034F42DAB48735F0D0C61DA179C6719C348654564B89EB254D4F7FE876E5A930823D5273C73B925827E69C764A1931750803F9C9CEB814FA96320B
Validator #1 public key
0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3
Validator #1 signature
64671DE7797ADBE73ECED8A0B1976310A32B8DE6C75AB5F6EABA3205A482F939DD44CC7EF24DCAAE29559CA1BD55400C181F3E1FF85F551429D31C394E5C410E
Validator #2 public key
00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947
Validator #2 signature
B345BFAE4C76F4302592DB54774F6FB4C68ED54FDA9C5E2ADB0FF1E74EE8BEE5500D190E635AA7E51A988EFCB017A229E9638B7342EDF4AF36A5B7ADDFEB9D0A