@version 1
# Automate the refunding after the given timestamp
actions triggered_by: datetime, at: 1701454200 do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x000027DBFA6C5BE7B6BA69D237DB95C4F481DBA5B608A82B7D98BCB70B2A3A712F86, amount: 123
Contract.set_code ""
end
condition triggered_by: transaction, on: refund(), as: [
timestamp: timestamp >= 1701454200
]
actions triggered_by: transaction, on: refund() do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x000027DBFA6C5BE7B6BA69D237DB95C4F481DBA5B608A82B7D98BCB70B2A3A712F86, amount: 123
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 < 1701454200,
content: Crypto.hash(String.to_hex(secret)) == 0xB675DF4ED718547A1BB1AB52044F98D08F8B6C158BF28A1C621709F3DBD9D03F
]
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: 122.631
Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.369
Contract.set_code next_code
end
export fun get_htlc_data() do
[
amount: 122.631,
end_time: 1701454200,
secret_hash: 0xB675DF4ED718547A1BB1AB52044F98D08F8B6C158BF28A1C621709F3DBD9D03F,
secret_hash_signature: [
r: 0x48F5D4E4D760413205F6A20F2FA8FABC011C931104657098A770F52C1874BBDF,
s: 0x3FC634EE17E6D074C4BF8176210FFE1620AB5B7A54B9345E0269EFBF1431BCE8,
v: 28
]
]
end
Content (0 B)
State (0 B)
-
Secret shared with 1 key
Encoded secret
C1C575A2AA15602C4F403AEE0728009F78CB76315FC04AEA3F06FBDCB531571C13AD93DDD262DB10E107C384BCC08FA8B9DA79E9A9F4CEE58ECB811D
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
Contract recipients (0)
Inputs (0)
Contract inputs (0)
Unspent outputs (1)
-
From 0000D82C...31B2At 2023-12-01 16:10:53 UTCAmount 123.43315965 UCO
Previous public key
0001C5663EDAE27AAD5E02B040F17C0F1200D81A341E1421C32572ACFDA9EFD0F4D2
Previous signature
3419C5DF4414C8D43090DFEEAB6B351FC95F9885EF40AE26DF6D6B196AEE61A6231211D6C3B29BBDF4DB94DA2559439316F26FF85EF4A7B6EEE3ABC791DF7303
Origin signature
3045022100E69A6AC60F8FF0B83F164C08C859937765440650EAB6190612B8F2315B22E9C302200A8C07E436CB03C1B835A3210AA2B5D28753443C3F326EBA96CFDD9DDF8B09E7
Proof of work
010204AA023E1E039788AD4B8F713C8871CA39A177414A99A0788993AD725B1FBB7AD5E4CAC86151A9E03451DCACB1EFC100B1E450FCEDAF5E5005F3A4C503D1D29712
Proof of integrity
003ABD808991976E82A373DB4900530F90C6B6DD08082883C65984EF919C7A76C7
Coordinator signature
166D0DC05980DDEDBBBF731F1D2C69476B50A56CEB4DFE78AF9E22C8CB0EC5938322C56B5264160A6DD2ED1BB8BEE3017F7E904DF8E0A21FD287C2B72511E107
Validator #1 public key
0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3
Validator #1 signature
53CC00E24FF7124D42CF410BF72E3BADCD7AA3522EC8548DEBFE4EAD07364318ACA66B403258EC14EF65C5AD68AE16BF21A796F3C78FA4A33300AB1725269C03
Validator #2 public key
000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF
Validator #2 signature
AFE03B8559FE5597EE0078CB2137724B8CC0876E44FA1BA3F0620596BBE7FE01371537E791880A0FB4BC1706A7265CA8CC100B6F2ACCF3FE03B22778B3F9730B