@version 1
# Automate the refunding after the given timestamp
actions triggered_by: datetime, at: 1702579140 do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x0000BBA672E26D797C80A9C4A49F81E63BF1A5E4A0BD3C093DC64857A55C5F882863, amount: 50
Contract.set_code ""
end
condition triggered_by: transaction, on: refund(), as: [
timestamp: timestamp >= 1702579140
]
actions triggered_by: transaction, on: refund() do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x0000BBA672E26D797C80A9C4A49F81E63BF1A5E4A0BD3C093DC64857A55C5F882863, amount: 50
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 < 1702579140,
content: Crypto.hash(String.to_hex(secret)) == 0x900218D0BB72B1A79896B7FB2E12FD4E8FD8185F384B46941571F4FE6844A05D
]
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: 49.85
Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.15
Contract.set_code next_code
end
export fun get_htlc_data() do
[
amount: 49.85,
end_time: 1702579140,
secret_hash: 0x900218D0BB72B1A79896B7FB2E12FD4E8FD8185F384B46941571F4FE6844A05D,
secret_hash_signature: [
r: 0xE63E2CE5897C6C6A615DAF7415026AB03276D2654388DE8820F4F1273589970A,
s: 0x5766EBC3CBC15B108654AA7B95FDB5376C416258D6ECCA857965CB04DDE6F761,
v: 28
]
]
end
Content (0 B)
State (0 B)
-
Secret shared with 1 key
Encoded secret
099FF79E3182ACAAEA62C4EC0F0268732C78035F1F133D2BD133AB27426895BDD7A89B38DBF59AC2EE5073CB86F67309A957FDFA9164D4753F5D16C4
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
Contract recipients (0)
Inputs (0)
Contract inputs (0)
Unspent outputs (1)
-
From 00002A15...31ABAt 2023-12-14 16:39:36 UTCAmount 50.4447787 UCO
Previous public key
00014A258E465134D26A064694D8F7D8A77D34CE25CDDE4D753ECADE0136D2869B45
Previous signature
BBA2C2E0090BA8F103F8468A2DA1FD59C44A489AEA69848A4B81E98F929C31808C1540122A7A6C9895B09E33942F01B87C4E017F0C4456B66FDB4E0A66D7550F
Origin signature
304402200D280E670E49F89706CCA29DBA145C33D851A8F1A56CCCAB305EBEC302249D2602200E5C36012BD930AFB254876402484A917E3D1E42DB9AF5DA0B339001F7A06D8A
Proof of work
010204892A04DBE05192BCB662689E7E19700F3F7202028EF0A9F20635C4948436ED85A43BA3017281EE97781342DD8F24ED6F583B5FE542830FDB5191A11843A72A61
Proof of integrity
00B0E0E4521AE2E1BDC98C67051CE662CB28DE3F3D637508FE22F2C2E75EE23281
Coordinator signature
F08A8B54193291D8B3ACBEFC7359B30819DAC7EA0BCC9D7FA28FD0C0D6D2B5E06CA2DF280FC02C430B08C900C9038C79F8DEC0A9097ED5C454B46375DCB9F907
Validator #1 public key
0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3
Validator #1 signature
3F09E9582168A0DDDDFCCC26F37B981C8E838A7418516C4A77EF1FCD69E3E36334829475FF80EE7238261EA0615F9BD70EBBCB59942F9C87A6C93ABBDD93B801
Validator #2 public key
000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF
Validator #2 signature
16492A8F871841276E483819DAB0ECB369A0DD41BC0126C38637E7192696009BB400D62B4FDEC7FA58254B39D3711ADA7D9D844A786EAE65D5ABC3F017CE7A00