@version 1
# Automate the refunding after the given timestamp
actions triggered_by: datetime, at: 1702105680 do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x0000A60EC381AB276FEAD46157F6E7564CBE430EBD7F24014F045B68AED539137ABA, amount: 5
Contract.set_code ""
end
condition triggered_by: transaction, on: refund(), as: [
timestamp: timestamp >= 1702105680
]
actions triggered_by: transaction, on: refund() do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x0000A60EC381AB276FEAD46157F6E7564CBE430EBD7F24014F045B68AED539137ABA, amount: 5
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 < 1702105680,
content: Crypto.hash(String.to_hex(secret)) == 0xDC72C5D52DB8E96DAD723618F1D21C29F0F9084BA3C99F948C2D506646F2D37D
]
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: 4.985
Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.015
Contract.set_code next_code
end
export fun get_htlc_data() do
[
amount: 4.985,
end_time: 1702105680,
secret_hash: 0xDC72C5D52DB8E96DAD723618F1D21C29F0F9084BA3C99F948C2D506646F2D37D,
secret_hash_signature: [
r: 0xA5A8A8C49727FABA52FAEFD3E01D8A76EF982F2F668D68E1C08484A9798344E2,
s: 0x176F89D01357A8396F14BBEB0D8C973E8B615DC8406686001FFDAD2CD8A2505B,
v: 28
]
]
end
Content (0 B)
State (0 B)
-
Secret shared with 1 key
Encoded secret
9C54AE1AA3701CC39AA943F6F630364ACA59B3DEF817C8D78C8F25E5D39D4375D95CB36A37C1214EB58BCBACDEB3DB4575C154E597A5C01861DE5BC3
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
Contract recipients (0)
Inputs (0)
Contract inputs (0)
Unspent outputs (1)
-
From 00002316...B3BBAt 2023-12-09 05:09:07 UTCAmount 5.41954152 UCO
Previous public key
00014D45527F9635822E41B3026008FF47A7D56F87FA03A56726793D50A0736C13CF
Previous signature
DB5C056FE2797F47FEE62E29CBBBE3AE551C327F0EB61450E443A69B7F7559313691ABD6E24B80155AC9BE233F8FCE208AF11A8D3DED75AD4026C09C59045908
Origin signature
304402204DB2EE443745C044BCCE8A06F9E9C1EB9CBFB829AE6E611CEACDAF81F4EE085102207A51521C7644DB5CAF320C816A8656400257A79736B2701657FECCF005281E66
Proof of work
010104EB90F7BDD03D5A7FD9B61D9128D7CF24C11F3F7DA96825DA3680C2B6BCC48F1AFCE26E0A5F1A903EDAA4BC9390210A0A4F175847EC2A2BB325BB6D1CE8EC8F90
Proof of integrity
00E011F917670ED4C2F5A7B59F7484EC12F49018F22714F9D26AE44292FF1047F7
Coordinator signature
4EFA246DF625AAFFB0E6B27D5B7373DCB02BFA85D6BCD603D049EEA9324F7432B40C7A6CC4490AA9DE9071153C58C29D77DD02FB9230D8CF5DB497A9F63DB308
Validator #1 public key
0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3
Validator #1 signature
47D8B183B17210B83BA1E08EE0E651CB4B2F02676A2CF232ACF95D1A2884955837291082A89333DF6F0CA56E7472A95FF6718F297A2E9AC8CBFBC7C032E86507
Validator #2 public key
000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF
Validator #2 signature
3896EDBF86C3F27BAC266E3B821E96EE4E3DE63118A28DD96B93356CF21FBF601000DEFDCED15E9AAC7A55459BCAC52E1255760BCFC614BC1D44B8A9F919A10D