@version 1
# Automate the refunding after the given timestamp
actions triggered_by: datetime, at: 1702117020 do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x0000A13340CA5E06989B6600C5B84FE8CDFEF4CBBA34041203EB1FD0DB386A469337, amount: 5
Contract.set_code ""
end
condition triggered_by: transaction, on: refund(), as: [
timestamp: timestamp >= 1702117020
]
actions triggered_by: transaction, on: refund() do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x0000A13340CA5E06989B6600C5B84FE8CDFEF4CBBA34041203EB1FD0DB386A469337, amount: 5
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 < 1702117020,
content: Crypto.hash(String.to_hex(secret)) == 0xBC57865DFC9387E3BF70F8A7666D7FFBA5BE18005ECD260B7D5A8969D2A87827
]
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: 4.985
Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.015
Contract.set_code next_code
end
export fun get_htlc_data() do
[
amount: 4.985,
end_time: 1702117020,
secret_hash: 0xBC57865DFC9387E3BF70F8A7666D7FFBA5BE18005ECD260B7D5A8969D2A87827,
secret_hash_signature: [
r: 0x472396DF43ADA9EC9BF5A6620B5BE9E1A4B94243583ED2844B67F0D9EAE143B8,
s: 0x0D1234E935A8B31B00D1B4BA8B4FADE5D47EAD83965C8727D754C3C62C76DE0B,
v: 28
]
]
end
Content (0 B)
State (0 B)
-
Secret shared with 1 key
Encoded secret
91C2C68E2B2EDA051CB75A2B01F91B3A386B3FAA3DF8EA45390FE62067ED9536032154833DBB153B0B436C639BE57DFB20C683E8A380C0F6E5042E05
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
Contract recipients (0)
Inputs (0)
Contract inputs (0)
Unspent outputs (1)
-
From 00008D40...6EB6At 2023-12-09 08:17:43 UTCAmount 5.42194036 UCO
Previous public key
00013B0B0330986E4918A11226241360EFA2F65308BD915AC1B48618FECC3353D46C
Previous signature
1817E1E6946E5FA05300E3867C3D57335EA9CFDDF39357466DA5C5318AA875FA601D0F0A187A380A0C8AAE07A774672D44E00BD5E2A90CAE1378A920F4150000
Origin signature
304402202CAEBF8F0F6707E0D71EF22C5DCE7CE87122F61958BF9F631E6CBE3F23C6CFF302201F0DB9E673FC7D708456E2CCB54C99A89449964D045143FBF2914CBFD73FFBFB
Proof of work
01010484B78F4110D8E9D6FBEC72759895CC9D4532177314FBAA8B07BC525FC1AF48F150EFBF104B1819106B8E3563CD0E1FAAE5325F8FCFE58FF744C35F47669D2704
Proof of integrity
0029864AEE06A801910E8C464647DA313D6A8E3BBAB73CB2828751E57E37998572
Coordinator signature
B4F9613438F0EA26F1D8EA1423630F0CD3CAE3896BD6F83D1ABD111F776953FCD04FC969E387C1468B73E4EDD7DE09FCE448ADD629076C5E9B963962D3CD4308
Validator #1 public key
000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF
Validator #1 signature
32CE4F886DC8A5BF25CEAF0A845832AA01F0DE8706BD452B165B033FEB11501F6F29D4DD8FE4C5C2D4A71450B04C0AA47F5BC40C5D5F92E27E9D0D6E0B809300
Validator #2 public key
0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3
Validator #2 signature
E3EB302A0FA3461FD593BF843C1F283E974AEA64FB1EDBF1B882ECDA87249AB49248201BFE8AF7849E62EF32470F530B927D8AA82B5FF5DC957E4BE247A0CD05