@version 1
# Automate the refunding after the given timestamp
actions triggered_by: datetime, at: 1701363600 do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x0000FFBFCC2711C600ED72B89F32DF580EDBFBABC0B774B67A4A52ABA4B2837062BD, amount: 250
Contract.set_code ""
end
condition triggered_by: transaction, on: refund(), as: [
timestamp: timestamp >= 1701363600
]
actions triggered_by: transaction, on: refund() do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x0000FFBFCC2711C600ED72B89F32DF580EDBFBABC0B774B67A4A52ABA4B2837062BD, amount: 250
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 < 1701363600,
content: Crypto.hash(String.to_hex(secret)) == 0x38A3CFFEF03B936EE01594DD47B91951CEBA970B6377A8EC75CE6E1E7188ADE6
]
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: 249.25
Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.75
Contract.set_code next_code
end
export fun get_htlc_data() do
[
amount: 249.25,
end_time: 1701363600,
secret_hash: 0x38A3CFFEF03B936EE01594DD47B91951CEBA970B6377A8EC75CE6E1E7188ADE6,
secret_hash_signature: [
r: 0xFF74F2722DF45923D7880776F0873546198F6DC8888D4EC84881D33D8139C076,
s: 0x31C813D2C32DCF920E3C8F1FD73784178AD3033032EBD00E2675FEECF0895E81,
v: 28
]
]
end
Content (0 B)
State (0 B)
-
Secret shared with 1 key
Encoded secret
B95C280EA7538BFCDA934F65D8189F1C3654FE9B773E6FA85ED2BA674B0B9726E19B0B85804C5FD8F073B2931C7D5B4CF1748F9FF33244FCF51FF399
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
Contract recipients (0)
Inputs (0)
Contract inputs (0)
Unspent outputs (1)
-
From 00009732...D8BEAt 2023-11-30 15:00:40 UTCAmount 250.41821824 UCO
Previous public key
0001628ED2CF7352860B05B68BFEE6F580FBC5C99A3BE4CE4875316709DD5D207E1D
Previous signature
556B0DA00BC1C87F8996AC1D111F0C835DD79733A22E42BAF7331F288C25DFA40EBA2E772458DA4ED4B5BA492A6A35612B4FD93C48B2F7763DEE2B26BEE49605
Origin signature
3045022100FDA9649F400C3B990138E8132289A1F41C828EF79D96C6D12C3A582CA038D55002204B6DDC804DAC53C9282B92817BB0F71AFEA9E886BB43EC67C9201582434EA5BF
Proof of work
010104EB90F7BDD03D5A7FD9B61D9128D7CF24C11F3F7DA96825DA3680C2B6BCC48F1AFCE26E0A5F1A903EDAA4BC9390210A0A4F175847EC2A2BB325BB6D1CE8EC8F90
Proof of integrity
00067B9BAA33D5D1DA61A9DB61C72E39C848613082372FDACD1871F4A237AC6414
Coordinator signature
C2C1F26AFD109134DEDFDDCF91E8D626BE568BC51157F72C0133A8EC22F031418049E7D90030D71E62D1BB4D2AEACE23A553C988B1C6485CBF6AC5FA63FE8D0B
Validator #1 public key
0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3
Validator #1 signature
AC2B573C89C13075F5C9CA901475AA409E006E5646BD0A04B2088615DE21EE2A0E95109D79A98E56C8615ADD7E77C66A24D9024DF37B49B66D31CF0A17E5900A
Validator #2 public key
00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947
Validator #2 signature
FF1AEEDA971EB9DB5AC47ACAF10C801D5EFA288A918FBF3D1CD73C8391D37B0B8B101FD275ABA27E3B0302FD42EDF81DD40BAFF97788470B6494EBC8E15A580F