@version 1
# Automate the refunding after the given timestamp
actions triggered_by: datetime, at: 1699952940 do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x000043E6744CDAD8810937EC51ED7C7F9E9456B65140E16F39BC486BB3C228FF1658, amount: 20
Contract.set_code ""
end
condition triggered_by: transaction, on: refund(), as: [
timestamp: timestamp >= 1699952940
]
actions triggered_by: transaction, on: refund() do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x000043E6744CDAD8810937EC51ED7C7F9E9456B65140E16F39BC486BB3C228FF1658, amount: 20
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 < 1699952940,
content: Crypto.hash(String.to_hex(secret)) == 0xBD4791911B364149E7B24C47DD0A2CAF3FA415621D1198503E42F909D9115317
]
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: 19.94
Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.06
Contract.set_code next_code
end
export fun get_htlc_data() do
[
amount: 19.94,
end_time: 1699952940,
secret_hash: 0xBD4791911B364149E7B24C47DD0A2CAF3FA415621D1198503E42F909D9115317,
secret_hash_signature: [
r: 0x75988350C017BC68DED6C334A6917AED0599DC87601CAD9267ADDDF784E6503A,
s: 0x0448859FD8847990101B1E57F82B9F0279C47D92FEF5E14AFE3BBD93F5D6EAC5,
v: 28
]
]
end
Content (0 B)
State (0 B)
-
Secret shared with 1 key
Encoded secret
F831D92D020FAD965584CFED7F3693A463B75740401CCD0C3C33E76BA380D03EAB7AC54CE102BC82F9E79BF0745AB2F874A1AD24D2F25439306ED723
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
Contract recipients (0)
Inputs (0)
Contract inputs (0)
Unspent outputs (1)
-
From 0000AD91...5F30At 2023-11-14 07:09:52 UTCAmount 20.3504292 UCO
Previous public key
0001A4B0E76EF284316EAF768BB32DE256869F7C61C02136BE18D397D541B56B51CB
Previous signature
33A70DB59EC1CB6547778BF7F07B539B15EF5D7C195389050670D2C807E0204FB4280DFDEAF2BEDE0F15E48304A53E4DB749AD6B4B899F97505E5273E66C3901
Origin signature
3046022100D3372B7BC3E9CE6E23CA57E9200A153AE64A12AE7AA4F90AAB08CA1A28B2A088022100918223817383FBF3C27F3F07D1FE592B4982E0234E437F50DF7244E2E4DB1B9A
Proof of work
010204892A04DBE05192BCB662689E7E19700F3F7202028EF0A9F20635C4948436ED85A43BA3017281EE97781342DD8F24ED6F583B5FE542830FDB5191A11843A72A61
Proof of integrity
00C8A9EBAFB2156B94E38B5900E40B87C039EA93B00860AE478BB7639D0B059465
Coordinator signature
C2D8B15425B8DD91A2C7B5D20C32E63D0D3B45099D458521E0D9E3008A02533AB47ABE200F775B1E935E4DA9DF588CF6653C071100BF9A3D660C6C88C1C20608
Validator #1 public key
0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3
Validator #1 signature
F4A749741348A850D1BCDCC95DD0CA509D7F844F68098F93DD0BA906C7C705904F107C6F41373FB80A8A0520A56208CCBD0CBB0FD1F20617537C8CD2CBBEE502
Validator #2 public key
00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947
Validator #2 signature
F118C2369CA11700E023C87E3BCF71B6E1CEDE32E191944720EF41D750ADFC1EF838CA4FC5543620DF1C24D1B2207FE9C1F510181A714E6B289BE110490E7706