@version 1
# Automate the refunding after the given timestamp
actions triggered_by: datetime, at: 1701537120 do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x0000FBBB22C44885F42E897B4CE0D3DD921C4ECAC303EEEE9EDD806DACEA55B70D25, amount: 250
Contract.set_code ""
end
condition triggered_by: transaction, on: refund(), as: [
timestamp: timestamp >= 1701537120
]
actions triggered_by: transaction, on: refund() do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x0000FBBB22C44885F42E897B4CE0D3DD921C4ECAC303EEEE9EDD806DACEA55B70D25, amount: 250
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 < 1701537120,
content: Crypto.hash(String.to_hex(secret)) == 0xC5966C6E4A2A74BD5EA17FF5944EF7188F56FE7082D3E2FB300D0D3DA0C93FFB
]
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: 249.25
Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.75
Contract.set_code next_code
end
export fun get_htlc_data() do
[
amount: 249.25,
end_time: 1701537120,
secret_hash: 0xC5966C6E4A2A74BD5EA17FF5944EF7188F56FE7082D3E2FB300D0D3DA0C93FFB,
secret_hash_signature: [
r: 0x7B6B012E02354A77A5A5A12B108A17AEB7650E8C4B3276EED8ED7F7594C19C4D,
s: 0x29613D7FDDBC5E3747DD87946FC6017C8DCB7A05E9A4EFA2CC8F6BD22FB00192,
v: 28
]
]
end
Content (0 B)
State (0 B)
-
Secret shared with 1 key
Encoded secret
5B94F7D1EA17A08B2ED11014574BE26AD3B3F68D47B014CBBC94E54F2DF3813B8FA9C2651503979E83B3A9D57C9EE25369F1709658612FB0F587C250
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
Contract recipients (0)
Inputs (0)
Contract inputs (0)
Unspent outputs (1)
-
From 00000EC3...4E7AAt 2023-12-02 15:12:20 UTCAmount 250.42552552 UCO
Previous public key
000131FE7E705106B1DD7F33A94985CB7D1BF331219B384ACF973F78494905281682
Previous signature
21B48F2EB7F153D56EB7CE40BD0D932AA7E3D43D947DEE05F013CF75416C8CB0F16FEAFA7D4A5845E7CC301365477A929EF68303689F50846B00D7E2D0BFCE0F
Origin signature
30440220028AFD2570BE65A7C7EB135BD99DEB7F5A2BF244E86944DBDC0B1EC8304BF5AF022018FA8A2C5E6299E93631EB55EF49E0B27072FE38242275E64CA4ECE0D19207F2
Proof of work
010204B3B2A53580086B9F36919CF40ABC55904729F78BF43673E216FAC1EB2451DD1E521879C6588F0CB09B150A103A39A73E2816B5ADF51F0721348BA3A66C33023B
Proof of integrity
0079621E9F5B86C65DAE125006C2F345865B562BC1344F75ECD69574D5CE917A68
Coordinator signature
38376F0AC07B943ACBE2E4A47E44E05325D6156F8466C7C006981368A61DEABEA0DED54E64871E621BEBC6EC73962FBF2F394B9DFA14753A6A4BBA38EBCF3102
Validator #1 public key
0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3
Validator #1 signature
B36B5E8C9632D47E4E69E8D297098C81E34DCE7DAC30F7601AE9270BE6673715BF050B8811FCF2E60CCEEC3B52305FFA154899602D3BBE09E5FD69CBA8895D07
Validator #2 public key
000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF
Validator #2 signature
7394097FFF6F14F68C471E9CD7B80BAADA4526DEFCE103DF329A8711D8054FE83F83B66662F730EDD60DBBA7C2D9098412D172468E0FCAB8CEA45BBCB9DE2F04