@version 1
# Automate the refunding after the given timestamp
actions triggered_by: datetime, at: 1700154540 do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x000080D5057516F335B1FA66F82ACCC4D05BBD983ED957B5D7D67505A4CFE10277FC, amount: 10
Contract.set_code ""
end
condition triggered_by: transaction, on: refund(), as: [
timestamp: timestamp >= 1700154540
]
actions triggered_by: transaction, on: refund() do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x000080D5057516F335B1FA66F82ACCC4D05BBD983ED957B5D7D67505A4CFE10277FC, amount: 10
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 < 1700154540,
content: Crypto.hash(String.to_hex(secret)) == 0x49C4EF32F69258F403CBAE77DB9CB8BADD33A31B1AA48607429A0586611E6B52
]
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: 9.97
Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.03
Contract.set_code next_code
end
export fun get_htlc_data() do
[
amount: 9.97,
end_time: 1700154540,
secret_hash: 0x49C4EF32F69258F403CBAE77DB9CB8BADD33A31B1AA48607429A0586611E6B52,
secret_hash_signature: [
r: 0xCCD5E8620F49827DA683889F233E802E2DCE88CF614AB788ADF738CDFDF3B69F,
s: 0x2FBAA7D361E368DADE7BAD035A30435C9B5565A810FB1A2DA8DBA037965DCD6E,
v: 27
]
]
end
Content (0 B)
State (0 B)
-
Secret shared with 1 key
Encoded secret
A025192C6EDF1D530DA2386CAC38074F13AF0839D11231B46D1A511AA9B2949E6A68950A3903DBE0DBB12A516B2804EE64E63F72BBF0EC9F691243DA
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
Contract recipients (0)
Inputs (0)
Contract inputs (0)
Unspent outputs (1)
-
From 00001DAD...E3EBAt 2023-11-16 15:09:27 UTCAmount 10.34304942 UCO
Previous public key
000136F622606C9688E97239C5A15642A9B73CA222A9B5FC22B815902370BE6B264A
Previous signature
6C0AA8BAEBEA2B24D44D453A1E853E72C5A29EEC33FA34780EB3A7FA7EB5BAC07848E2E16083AB3DCE23AE70DB4C340FAF572C0CD7D236E854010E1226BAF200
Origin signature
3045022019151BD6CC70AEF31C4F7AE8E01D587B0ED88BDE29B9A33641F17FBCA1251DCB022100E3DB6A6E8BD14C76A6CFF58D8C19C4AC88D72E512A48303F2B86510A3612B939
Proof of work
010104AB672F1E69B064D192819F1797C1926F158DBA8F3924AC732B4C4D70D0C8EA0A0D6506E5896C9C2524D2BE26CB5016287E1816A597C408008BA36FCB154A7765
Proof of integrity
00DAE1E34B36F382EAB7629A8939AB38BC83638EDFE9B1A30A06A732FE6F4F437D
Coordinator signature
5DC99E27257947E7B7FE58E6093AAB954885CB0F0F0596533E219A9C416A5584FFE6EF47F171D723B5B938C3D804A0123F25039DE15D39A368353B1EF1410D0C
Validator #1 public key
0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3
Validator #1 signature
DD6A75DF56B299E12111D6396B5A08829103A0BCC059C6C077719F5E1A5D7906BEA934E1D67A5590A3EFFD805E132584B88D5F9FAA51D4B02056E250B988E709
Validator #2 public key
00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947
Validator #2 signature
867C1CE186EB77C02156613AFBF86AFD67BF3C9513C74E465F4A82FAC9A034BC8D733D8D312A5FAB71D998C88CBF9500F950418500550FEC554A812D13CFA102