@version 1
# Automate the refunding after the given timestamp
actions triggered_by: datetime, at: 1701802740 do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x00009D53CB349AEDEFD4D737A5413CDA50355FC7DA89611AA4EF94C282E3B84C0BFA, amount: 40
Contract.set_code ""
end
condition triggered_by: transaction, on: refund(), as: [
timestamp: timestamp >= 1701802740
]
actions triggered_by: transaction, on: refund() do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x00009D53CB349AEDEFD4D737A5413CDA50355FC7DA89611AA4EF94C282E3B84C0BFA, amount: 40
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 < 1701802740,
content: Crypto.hash(String.to_hex(secret)) == 0xA21C9000D09D9AF3E9FD6B58AB2ADE12504415B0DB2AE3EF56BDDC12D4D596CE
]
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: 39.88
Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.12
Contract.set_code next_code
end
export fun get_htlc_data() do
[
amount: 39.88,
end_time: 1701802740,
secret_hash: 0xA21C9000D09D9AF3E9FD6B58AB2ADE12504415B0DB2AE3EF56BDDC12D4D596CE,
secret_hash_signature: [
r: 0xEF2AC5AF3EC914A5947172D58DF8F5BEEA24ECA6561A213BCCCC7E063E68DBCF,
s: 0x05EB2AC0F77D526D2EECC779B8BD28CF6FEBF56F32C99FC58D72125554063AC4,
v: 28
]
]
end
Content (0 B)
State (0 B)
-
Secret shared with 1 key
Encoded secret
C7EB797D1F3A0C67E74AB74FAA63AB35B13A1EEBDA7793CB197D252669978DB36CDBDFE3A2F656DCFB7E291A10B1477DF3C7BAD02A1B63FCA78F8BE7
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
Contract recipients (0)
Inputs (0)
Contract inputs (0)
Unspent outputs (1)
-
From 00003168...CBDBAt 2023-12-05 16:59:38 UTCAmount 40.42229497 UCO
Previous public key
0001BA154018E1584B1DAE61C0D04BDA8429D084BDEEA4BC1E7CBEEFFBA712EF1C9E
Previous signature
880CA2DF58670C0D7C1D1D5EA2A2FB1BAF8B60650904805FBB3A4CE728D3253507ECBBAAF140BB41DBDD4C8EF9EFC54D70B1D2EAA9E357FF7D87D99B4D624B00
Origin signature
3046022100A9AAB4BD5584E5DCF0C4D6E241355C92F69CAB6860539C2AC3E06240250A9B2D022100CAC33F62755E2578253538339C8C339874DEA367FAEEA95EA07C780237D05652
Proof of work
010204D6052E0C6CA9244CDE5F3D664296BDFBA0090B330404C3C16B098758F27965DFEC0D3F25D1365F389C2B6C516195552F8779DEE0796C8C33F1A9C0404F4E3381
Proof of integrity
00C82B25027552CEAA9E0DDE4C83D169614E9BFF1BA8BD2ADEFCB31462DE81BB70
Coordinator signature
7824F02EF4F5339D70211AA0511D545D27EFAA6CA5A686A5D07B08A26F800916FBDD21D13864CCE93F99C4DE399E8EE4805928EE647D134215CAFAED63F92F0B
Validator #1 public key
000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF
Validator #1 signature
C9B93D23849C4A67F793AC97B728E67BE91A5B8B8668A1E76E1A5509766FDBF37ECB6805AD6BCEE8A33C569B95A308B1F6253415DF93E2172340DD262DD21607
Validator #2 public key
0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3
Validator #2 signature
20B85B99B98CE73FA7AE79C5D6163BD7788A71D80DDBED68E9EED83B5EE989559F5A6DCC43FA562DB5165CE4C4857963B45DFEF3A1DE52764DF8E39F18F38600