@version 1
# Automate the refunding after the given timestamp
actions triggered_by: datetime, at: 1702218900 do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x00005F4C53E037645214F5C85A044BC2604168E36EB4493FB422E60E187E5CAC66C0, amount: 75
Contract.set_code ""
end
condition triggered_by: transaction, on: refund(), as: [
timestamp: timestamp >= 1702218900
]
actions triggered_by: transaction, on: refund() do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x00005F4C53E037645214F5C85A044BC2604168E36EB4493FB422E60E187E5CAC66C0, amount: 75
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 < 1702218900,
content: Crypto.hash(String.to_hex(secret)) == 0x23B9B63D2B26AC67EF2012F79DDF214EA4F2E2EB620496D0A244F9B97F08AFDF
]
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: 74.775
Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.225
Contract.set_code next_code
end
export fun get_htlc_data() do
[
amount: 74.775,
end_time: 1702218900,
secret_hash: 0x23B9B63D2B26AC67EF2012F79DDF214EA4F2E2EB620496D0A244F9B97F08AFDF,
secret_hash_signature: [
r: 0x6FBF143CA114E737059A8F376A40F009782BBC9112F34D9109D021C18BCAED03,
s: 0x679D372537AA6B91FC4848C34D1389ABD2FC85664E8564AAADACB42DB9EE52F1,
v: 27
]
]
end
Content (0 B)
State (0 B)
-
Secret shared with 1 key
Encoded secret
66F7932F90D312ECB835981262E5B67ACFD3C785652C51DE60501FDEE3506D7E54534A822BDFA67946173C6D971AA62B6377BD2CB35095B05F0054E9
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
Contract recipients (0)
Inputs (0)
Contract inputs (0)
Unspent outputs (1)
-
From 000044DE...26CFAt 2023-12-10 12:35:48 UTCAmount 75.42950114 UCO
Previous public key
0001061F0590544DB81EBA9FF0C3FAD73E92BE7BBB3554A3F3F56BBFB81027E4B034
Previous signature
0ADF1049CE39263BA196BF99C5BAC32B51A07C7514AA982357B7B7825C068C989CDEAE0AA4FE0CF535AD3D1FAEC69369462E4FE42E525D850ACF18AFCF20A101
Origin signature
304602210081E264CB47E39E9BDE8A8A276D85EDB08B2A73859D4B89FBFFE7E2157E7A093702210092F5B329A070AF785BD8DD65A06B3799CD4E8B95A90DA670B38AA0BA226F3264
Proof of work
010204B3B2A53580086B9F36919CF40ABC55904729F78BF43673E216FAC1EB2451DD1E521879C6588F0CB09B150A103A39A73E2816B5ADF51F0721348BA3A66C33023B
Proof of integrity
00FF9399E3BE7DA05076700ABBB1FF799C51D2C721FFD1AB2A18DC2E4F5A6E1EDB
Coordinator signature
DC9488B7DA7134D8043855053141F9627DEE92417F02B7A490FE869F98CE51E3BC5EF8A1618EFEE315E908202F5A3E024CA11BCD5AC700C1D2E9E673EB9B7000
Validator #1 public key
0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3
Validator #1 signature
524BD57B2AF86E404D7467767D7E0F67D5ABC98D56BF256595EB0D1097405F0CE1513A9C62549BE620E0C1AA1C698AAEC044345CDBF80298FC8DCB5D149FCD03
Validator #2 public key
000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF
Validator #2 signature
870849DD6CBD81054322E48FA4DA014E799286152486BB8B5894DAFA65E23BF24D1DA7EEAFE8624452793CC48601733B1B5069E862CD042E324711453E819203