@version 1
# Automate the refunding after the given timestamp
actions triggered_by: datetime, at: 1702109760 do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x00006205EC2CC3B763AE9890AAF29B505C7FB96395DF7E129924D72D0548A8E57436, amount: 5.8
Contract.set_code ""
end
condition triggered_by: transaction, on: refund(), as: [
timestamp: timestamp >= 1702109760
]
actions triggered_by: transaction, on: refund() do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x00006205EC2CC3B763AE9890AAF29B505C7FB96395DF7E129924D72D0548A8E57436, amount: 5.8
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 < 1702109760,
content: Crypto.hash(String.to_hex(secret)) == 0xF6CAC6996F6F6010678515F8D42C2AE67AA08C74F01B297CC51E5FB15D24C125
]
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: 5.7826
Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.0174
Contract.set_code next_code
end
export fun get_htlc_data() do
[
amount: 5.7826,
end_time: 1702109760,
secret_hash: 0xF6CAC6996F6F6010678515F8D42C2AE67AA08C74F01B297CC51E5FB15D24C125,
secret_hash_signature: [
r: 0x54228606CAA0ED331B7B65DF83FDF0294819B89D415D1C4A019F116A78134738,
s: 0x36A4D753C63CEE214AC7E71C3D2F641789660B3423EB8ACC6993C01B2AF20E20,
v: 28
]
]
end
Content (0 B)
State (0 B)
-
Secret shared with 1 key
Encoded secret
B20AAA3CFB1BFAE8E418E5B5D8F24816AEC1D49833A3A2F241301B3CABAD0C720F8DFE26216FB60DE18845D4C4DD4497ABDAB508BD31CF4C3E922F5E
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
Contract recipients (0)
Inputs (0)
Contract inputs (0)
Unspent outputs (1)
-
From 0000FCF0...1A88At 2023-12-09 06:16:46 UTCAmount 6.223095 UCO
Previous public key
0001458DDAB96449C5F784EC4CA22C5102085102189F346FE06EE8EA81E54BFAA25F
Previous signature
7B29EC3DE39F3B7935337E6E61A1AFBA8DF7DC48E0A9844C4A16B006AD14CE8CCFA6E7662B3D230B615E9AA386B69A25456AB6261BE6484C028A090F88FD4005
Origin signature
304502205766D97B5CDF09F285BE58E7264D71D061C51FBCF164723884EBFC618C81F98A022100FEB10E3F12B4EC9E8AA2842CD245350F77F959D7B7AAD84A41D79838AB422DA1
Proof of work
010104228ED9FE757FA46CEDCAE4E3FDDEC1EF6511A71B15E5611AA36EA41DFB969EF2FB83D72D13AD1E89873CD4EFF1364880B3557D72AE5188EF5E1BD09253CE235A
Proof of integrity
00DF20C0A7AC17302D1C929D27DD566E341479C34521CA661A1D11554210E6B437
Coordinator signature
AB4372EC9FBAFC2DBED0365BBD0E0ED5FA8B029A9CFB055DC966545A3092A7922144B7D8ABE9735F1272A49818285DE42B203E5182CD3956E80F594C14668303
Validator #1 public key
0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3
Validator #1 signature
9E864ECF2C230EFA9AA57AF1A57240D38A9162F37F635B3C6C41F47FFBFB676847F8F60C53EF2E54DE8B74631ECF466050A366E1CA67863AA8BF4F578FD06005
Validator #2 public key
000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF
Validator #2 signature
45E6312767C963940C7290E9A50D49E0D05684A64386AF5D9ABEB0E42295D9DA4F959828E9BA7F8676C8384AAC0E7DC641A33AC418DD30B01D4E1FDAE8D3A902