@version 1
# Automate the refunding after the given timestamp
actions triggered_by: datetime, at: 1701430440 do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x000079B40CB20AB1624178169798B0C9D9245BE746399864BE620B3099689DB824B9, amount: 10
Contract.set_code ""
end
condition triggered_by: transaction, on: refund(), as: [
timestamp: timestamp >= 1701430440
]
actions triggered_by: transaction, on: refund() do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x000079B40CB20AB1624178169798B0C9D9245BE746399864BE620B3099689DB824B9, 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 < 1701430440,
content: Crypto.hash(String.to_hex(secret)) == 0x20C5DE7ECEB779CB4A961980C4328F00F71B718CB002856CDD13210D502AC68D
]
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: 1701430440,
secret_hash: 0x20C5DE7ECEB779CB4A961980C4328F00F71B718CB002856CDD13210D502AC68D,
secret_hash_signature: [
r: 0xED7A13AA4628B3618213ACA4DEFBFD8C988A8AEFF28557BDB45566A87DABC126,
s: 0x2A16B1D39EDCA3414B6BA66455877F7A94344FE7C9BE835EEEA303CBB8667A5B,
v: 28
]
]
end
Content (0 B)
State (0 B)
-
Secret shared with 1 key
Encoded secret
9CE18D60AE7CE79CDD10D22E28241694C1D21FAD6454BE14CF49D785315AD3710C7239A805AC7E00E8CC69142CBD829C0F007A9ACF753694598CB298
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
Contract recipients (0)
Inputs (0)
Contract inputs (0)
Unspent outputs (1)
-
From 0000F710...0022At 2023-12-01 09:34:21 UTCAmount 10.4148203 UCO
Previous public key
0001A5DE7246C872745E65FC980C0E64C7DF9F1CF2F8F5ACA7CEE3709B20B8AD451A
Previous signature
CF1AD81FFFE12B86B6CD136D1905217E795FDB36BEDA2B0085DCA6E4A97C82B035D4BD523EF767E580E57C06C55F4F4022DF619C98593EC826C3BC8F7469A70C
Origin signature
30450220363668CCCE1EF59141A1EA534F7F75B9C56294A92897927B74A7C7F98B4AF94D022100927D43D3FB6CEE59AF3D6BBB09BBD86B623462FCB23BBF5F28B9CF995EAAE0D9
Proof of work
010204E9BB401A767B0C92D5DB139379AAB18E1B449B455F49E3A44F3466B2D38E59F0516B79493A528A95E5A74CF46F79CF12DEB73293458F6A4403D2B3E57D697347
Proof of integrity
006F84D388D0776A046119EAC71069AB0F569E1D862A60C94C81D4A735337B698F
Coordinator signature
30A405090DD4E13AB56FA8C56A268F142E5BE91D1069019B6BBB6781D46EC9AE35DBEEC68E62521F86BBEC389A6E2D114D7D280D6D7A22A0E73FAC85E9565809
Validator #1 public key
000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF
Validator #1 signature
AEE01D745B3388466CFAD5349D2B87D3F233C00C16906E0F732D45F0EDFA2ACC385157867B673BE5B2823105C9B991D668060319FBBE1C966554CEB7D8CB2704
Validator #2 public key
0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3
Validator #2 signature
3E1C6B757AB9A740AABF208B7ABB6DBADC7776CFABC60BCB863040BE735697456D816598824F6EC6C14CEB92D48816AB52DB4B558241A8A5249085A02D881506