@version 1
# Automate the refunding after the given timestamp
actions triggered_by: datetime, at: 1703261040 do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x00003EB4B1FE2A1D3C913C33FCAD6642186DD2105DE10807F0C3117E588DD6341742, amount: 50
Contract.set_code ""
end
condition triggered_by: transaction, on: refund(), as: [
timestamp: timestamp >= 1703261040
]
actions triggered_by: transaction, on: refund() do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x00003EB4B1FE2A1D3C913C33FCAD6642186DD2105DE10807F0C3117E588DD6341742, amount: 50
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 < 1703261040,
content: Crypto.hash(String.to_hex(secret)) == 0x6A4C9F002250C1EFBCB3088680AF4D4656235C26D9CDC30666C74B18E10E67F7
]
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: 49.85
Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.15
Contract.set_code next_code
end
export fun get_htlc_data() do
[
amount: 49.85,
end_time: 1703261040,
secret_hash: 0x6A4C9F002250C1EFBCB3088680AF4D4656235C26D9CDC30666C74B18E10E67F7,
secret_hash_signature: [
r: 0xFBE2A1692C37CAF704AB9A9928092BED05C6B4C2A46A47147A20296CE77CF4C8,
s: 0x474DBB4148904BA9F4E20AD117242F79C82C16052F07D2057B49EF89DEDA22AD,
v: 27
]
]
end
Content (0 B)
State (0 B)
-
Secret shared with 1 key
Encoded secret
2EC1C7E9314F7FB4CF8EE88D9927D381F800581F8293019B7A931BBE83AC994E4C3A5E750B8969F291C1DEC17CB37B8BCF790DA36B81D44867DFC919
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
Contract recipients (0)
Inputs (0)
Contract inputs (0)
Unspent outputs (1)
-
From 0000E47B...3104At 2023-12-22 14:05:02 UTCAmount 50.45006838 UCO
Previous public key
00014918C909CB5BE0D22AF6FA1ECBB15D9441C9B74E72ECD99402BA7B2E0B3AC222
Previous signature
8C80731A6610199F8F6C53A9EFF81AD0CC29A68AD7C965B61817158B92FBAD1A059CEABFB55BF1CED391932F45D2D76D78621DAA9D9433C2AD252E8A6BEFED03
Origin signature
3046022100BC6365E546DA05EE1D3D867184B95A676C99AFE10AECF6AB1C97ECDB6578ACBE022100B17272CE3C707BB5A57C69C9114CB8E46168617E79D61EF79DC4A67C527E8D6F
Proof of work
010204E9BB401A767B0C92D5DB139379AAB18E1B449B455F49E3A44F3466B2D38E59F0516B79493A528A95E5A74CF46F79CF12DEB73293458F6A4403D2B3E57D697347
Proof of integrity
000AC77D9ABED180287184EFF40C3C388D59F58EB7BDCC83C3491BFB7E5030C2A2
Coordinator signature
F553464BE540D37127C10D8FDD3554E087C3418843F3A235A74AC8D66F042105B290147B8383C80FFFE2DC66FD52099C7EE0BDA445A9664010AB4307B541E708
Validator #1 public key
00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947
Validator #1 signature
954BE24119C0AF640853FE4EDDB401472D6EAFB485949A63A1016D08609E202FB01C123249D7CD26B1CC1CC1170950A9BB6878459D41EB7F222B510F1A60E603
Validator #2 public key
0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3
Validator #2 signature
C29605611ECB9D761EA7F74C736A6B3C464F18FB8A608FA930F646256FFEB35DA8928B598C7FA6C01C1A24C9690E6EF86023018FAE2F508B13485C0B1F6D4B05