@version 1
# Automate the refunding after the given timestamp
actions triggered_by: datetime, at: 1701318960 do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x000052DBB0394202F5E1A0290DC1595870AC160515BE80781452FCB0A205644F801B, amount: 30
Contract.set_code ""
end
condition triggered_by: transaction, on: refund(), as: [
timestamp: timestamp >= 1701318960
]
actions triggered_by: transaction, on: refund() do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x000052DBB0394202F5E1A0290DC1595870AC160515BE80781452FCB0A205644F801B, amount: 30
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 < 1701318960,
content: Crypto.hash(String.to_hex(secret)) == 0x9DAF1E9AE66B5E1483B76BF132D5255976B2E5B3AF1B848F85591611481AE37D
]
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: 29.91
Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.09
Contract.set_code next_code
end
export fun get_htlc_data() do
[
amount: 29.91,
end_time: 1701318960,
secret_hash: 0x9DAF1E9AE66B5E1483B76BF132D5255976B2E5B3AF1B848F85591611481AE37D,
secret_hash_signature: [
r: 0x5C1D7F69DDF848B289EE90EE90AAAC7445BE72F1DDD1E4C68413BF0D599DF512,
s: 0x1F79EDA5E2112823DE39B8D7877AFA367F95F0F63074C23BEF68208B93D86DF8,
v: 27
]
]
end
Content (0 B)
State (0 B)
-
Secret shared with 1 key
Encoded secret
EBEDF4AC3B05202223CB8FACD19EB6EB6F414BDC128E9F89042016C5595E50386C9B9B9B5109A3031DF6B9EBFC52B06604DA539D2136F2FA60619ABA
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
Contract recipients (0)
Inputs (0)
Contract inputs (0)
Unspent outputs (1)
-
From 000071B5...7816At 2023-11-30 02:36:51 UTCAmount 30.42137329 UCO
Previous public key
00012FC9A0A054C841F3249F1CA7D72DBBDA6837B0B0F47003AEE6D20CB10E57040D
Previous signature
FBC9A41137826E34E30A4952C87C79F7C6A7228E88B8ECC64735694211F093FC0E77793EA69E181A04C35A00509C18C45D9CC4CA4F076336E852D7D53D5C6C0E
Origin signature
3045022100C61C0278CAF455871D4F797AB85F9A47EAFFF12A2CFA4E8A3209333ACBF229D10220272883CB80667C4565F91D2FA0E33E07E778DF1F66B2D1FEE22587942F21D157
Proof of work
010204D6052E0C6CA9244CDE5F3D664296BDFBA0090B330404C3C16B098758F27965DFEC0D3F25D1365F389C2B6C516195552F8779DEE0796C8C33F1A9C0404F4E3381
Proof of integrity
00B9D5DC73C9096EC01F66A7FDE8263586617E4AB934C8CB892C3987E7A457C82C
Coordinator signature
A8643E591DF872CFCE35F14AAB3D71B961B505244FDD509C63B3D23B61842F326AD69E31A1A4324316C2DBC829523359D25CF9C6BBDD0EFB3BF2BB70BDEFA505
Validator #1 public key
00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947
Validator #1 signature
DF6B1A9753AEED29CC0ABF496D6EC12D22B5679DF356A3D5B2070A7159E3618781C7F4B76467965BB0DEDE7A6C9297EC9186D16F14AF9E9E0C8EE3630AD7A206
Validator #2 public key
0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3
Validator #2 signature
597EE4DDB9FAE44C6C3C67B2D473491F48313B66C3936743B816597F90B814D10BBC55E3FB1EDC379C9F13392F5E35E7EE58A51112632506622B59984533800C