@version 1
# Automate the refunding after the given timestamp
actions triggered_by: datetime, at: 1699997040 do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x00000BC0EBA2DBCE4455B46F5E51AFAABA6EB4C7FBA1D4E2E6DABD55DC70F9A04D6F, amount: 0.2
Contract.set_code ""
end
condition triggered_by: transaction, on: refund(), as: [
timestamp: timestamp >= 1699997040
]
actions triggered_by: transaction, on: refund() do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x00000BC0EBA2DBCE4455B46F5E51AFAABA6EB4C7FBA1D4E2E6DABD55DC70F9A04D6F, amount: 0.2
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 < 1699997040,
content: Crypto.hash(String.to_hex(secret)) == 0xC875A0AACC45A5D6955154D192F111BE860ECFAA29D99B399DE2DFEBCC66B9EF
]
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: 0.1994
Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.0006
Contract.set_code next_code
end
export fun get_htlc_data() do
[
amount: 0.1994,
end_time: 1699997040,
secret_hash: 0xC875A0AACC45A5D6955154D192F111BE860ECFAA29D99B399DE2DFEBCC66B9EF,
secret_hash_signature: [
r: 0x93A4679D8EBA4A4213E38833923FE8C7360CB0D16158F4FF3CF084DD1B9BB60C,
s: 0x317DA4CC61CCF2AB4B1EC475C4614AA9E4121FDA0B712CE176B7490C3FBA0574,
v: 27
]
]
end
Content (0 B)
State (0 B)
-
Secret shared with 1 key
Encoded secret
80E371F5C321E432EA36897F7AD27CF900FAFAC79E91C05A772AF71B76DD89E7F79701526F6E93962DD0304ADE9D5C50B9B2540E5C013E9C9B84A21C
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
Contract recipients (0)
Inputs (0)
Contract inputs (0)
Unspent outputs (1)
-
From 00009E17...EA68At 2023-11-14 19:24:40 UTCAmount 0.55297662 UCO
Previous public key
0001ADF06731CACB6F35350D034A2F9FA02EB821AFF0726E514097CF9402933A3F4E
Previous signature
261668653869D5388880C9875357250363F046AA0D1E3A389BA9312D252DCFDD71C6810853A8591EEB0F1556B5F8128CFB79BC0A0841ABB333E77294D3A8CF0B
Origin signature
304402205A98E6E6E2E9E3518DD6A81C0E1061A7B7C068EF331B3CBECDF0A1E268C753690220382D86F6B1FB14C259535F922FD5B106EAEC7AC4B4D4F19BCBA5BF4EB3BD07B1
Proof of work
010204D6052E0C6CA9244CDE5F3D664296BDFBA0090B330404C3C16B098758F27965DFEC0D3F25D1365F389C2B6C516195552F8779DEE0796C8C33F1A9C0404F4E3381
Proof of integrity
00DDB8DC1EF1F1D0AA6AA433B4E19CC080F4554C91A6B3982E85AD32F8C265BF1F
Coordinator signature
976BC92A487F2DE55FD07627BED979465A37B2175531A329EC6488A1470DE012D5AC511D3BA8581086AFF6E3AD28250918C7E287F40E2CE337AEA52F3C88EC0A
Validator #1 public key
00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947
Validator #1 signature
92D3AFBBE1B8F88B6393D8B030AA671151D223F97403258A1400EF2FA2C106378C681B22C3CB3FC96753F180C97EBBE9A5635D102613A37CAD883D663AA4A603
Validator #2 public key
0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3
Validator #2 signature
60AFDFA1BB7610B6EB951E5A4A8FCA3E3AFC4A05312F0AE6EAE772F8B04AB02940550FAABD9A21D73108E92FFC4BA8F901C4490611F7CBFDA19AD56DE83AD30C