@version 1
# Automate the refunding after the given timestamp
actions triggered_by: datetime, at: 1702085400 do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x00001DCF526FF46682AFCA9984CA510CE777EAE927C82DCAD6986E77FB867AEFA48A, amount: 54
Contract.set_code ""
end
condition triggered_by: transaction, on: refund(), as: [
timestamp: timestamp >= 1702085400
]
actions triggered_by: transaction, on: refund() do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x00001DCF526FF46682AFCA9984CA510CE777EAE927C82DCAD6986E77FB867AEFA48A, amount: 54
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 < 1702085400,
content: Crypto.hash(String.to_hex(secret)) == 0xC364E36804808D4CB41384E57970611C89635CF439FB6BAD6BCDE6649B83E1AB
]
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: 53.838
Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.162
Contract.set_code next_code
end
export fun get_htlc_data() do
[
amount: 53.838,
end_time: 1702085400,
secret_hash: 0xC364E36804808D4CB41384E57970611C89635CF439FB6BAD6BCDE6649B83E1AB,
secret_hash_signature: [
r: 0x8EAA6B0E169FD6E507A47B1A7D31B7BAC2B3BCEB4573977412FF8A4F35543A3B,
s: 0x7F6073DB1112917A3A7A61F007D99E8EF4B325629008DB1A023123695C4318E1,
v: 28
]
]
end
Content (0 B)
State (0 B)
-
Secret shared with 1 key
Encoded secret
A51D928C7E8046790B2694F5F02EE5CAF5569777BB9194D4E559D27079812731A488BDFBD035F4C9DD83CA62245A1EEFB367E4930AFE40083CDB87D8
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
Contract recipients (0)
Inputs (0)
Contract inputs (0)
Unspent outputs (1)
-
From 000076CC...D5B1At 2023-12-08 23:31:07 UTCAmount 54.42499588 UCO
Previous public key
00015AD47B455504990E8BBEBB18D0B33EA0E5A462695EFBD44531D4C2DC2D3064E8
Previous signature
78ECF13A12D33457841CA1568F4FFE84A79F968B66766A2FC01E995812DE9508C4552F68B3492E17A6685AB9BF8D3988A7BF09A5D12D3C7B19F52335B031AD09
Origin signature
3046022100F8EAE15234D02F5577D64503CF616F37F804D6344F583D0DDF315E60DE63BFD6022100B8CC21545F2900746DA8BD0E95454ED6A65C9AFA020955913DEF5A2C8E803580
Proof of work
010104AB672F1E69B064D192819F1797C1926F158DBA8F3924AC732B4C4D70D0C8EA0A0D6506E5896C9C2524D2BE26CB5016287E1816A597C408008BA36FCB154A7765
Proof of integrity
00BAFC8001A59E4B15BA39D4E0B72C5EA393C3F21A4592E809914B5CE5F481DFCC
Coordinator signature
CF39D49712BC317D8F676A67002797FA46A8F26C062F523789C96AD84D51B9A26FC596A660CFC5850BF967C847F8F1C678F00E195C4FB87BD67C3C481CCBD904
Validator #1 public key
0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3
Validator #1 signature
937E0FAD0C2C89B9856F51D0337981DA5A606DDEFC2EA830ACFB77C59E60455A353B61CA3FCE0A0D78014E51884BBC78905F4B3D1F30306C8179B1BA30DFA008
Validator #2 public key
000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF
Validator #2 signature
5B003C8BA4F32AB16206BF60E00424F71AAA3A11AD1D059D5599C0EA2A9C41B0E0B85C3DC14179A40BF7A73B3344739CDFF9D4004B15DF5587412380D88CCE07