@version 1
# Automate the refunding after the given timestamp
actions triggered_by: datetime, at: 1703874120 do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x0000AAE847768F278B0D458240DC4E5205C2CB307B81D81865338F2C6B831F6006B1, amount: 12
Contract.set_code ""
end
condition triggered_by: transaction, on: refund(), as: [
timestamp: timestamp >= 1703874120
]
actions triggered_by: transaction, on: refund() do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x0000AAE847768F278B0D458240DC4E5205C2CB307B81D81865338F2C6B831F6006B1, amount: 12
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 < 1703874120,
content: Crypto.hash(String.to_hex(secret)) == 0x76F898686F0A9FEEFC6C703E913638D52F2565764717B4FCDC6F73E226303F47
]
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: 11.964
Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.036
Contract.set_code next_code
end
export fun get_htlc_data() do
[
amount: 11.964,
end_time: 1703874120,
secret_hash: 0x76F898686F0A9FEEFC6C703E913638D52F2565764717B4FCDC6F73E226303F47,
secret_hash_signature: [
r: 0x8B0C5F6F94575F99EB8AED2871EBCBEA8251FEA933D899EFC9B5A8407DA79D3E,
s: 0x0235C67E4B74F51BEC60CC7D59F1CBE9FC81A25A63AA212B986E50E3205EC7BA,
v: 27
]
]
end
Content (0 B)
State (0 B)
-
Secret shared with 1 key
Encoded secret
FFCB51099BAED3AB5B7B59C87F85903094B6FA7ED1E73F39BB338918793915711752F75EDAA02B1077EC930E4EE3F893AC26D9470EB50E0E4D9EFC95
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
Contract recipients (0)
Inputs (0)
Contract inputs (0)
Unspent outputs (1)
-
From 00007EA5...A1FBAt 2023-12-29 16:22:45 UTCAmount 12.3986745 UCO
Previous public key
0001EF9A0D2C49A0600D8B6C595A74665ACBB5349639C4F5A69F2936C6E9A53F5AC1
Previous signature
72A00B195F2957D0FC10EA627953CA060269039DDBD9116C419BE55E2BFBB6624448458489E74631CAADFA52875F2E53A6AB08B11AB355555BE6C0E2D178E507
Origin signature
3045022053A9E6982E4C586CF768E76114CA204E1E8B9021B837B6DB70A84283F7C132560221008BE915253A3D4CB96E2950036AA0A7BD68100151BFB13D555A9877971FF55322
Proof of work
0101046C39D56B717142B6EE14B0F8B2561ECA458F3D2D12C9977D613F78829419063211F9C21F7BB0D56B6523040A8156BE22B6E9D6332B88ED882574D12AE32F7A45
Proof of integrity
0034899E36FB88E66746150977726AB3EF166B1AC58BF89ABBBD841A82725B5612
Coordinator signature
812531692610FD69F6C107DA79C2A19711D7A73BEFBDF829567ADF3E7F2BD8A2F298B7AEC0692829AA0F3974DA7CFDB36A33670D17B318AFB7F9D19E7EE8B400
Validator #1 public key
0001B01EEF96BA7E95FC844D456CE8868F18864519FC9532E1751C2035FD044DD5D0
Validator #1 signature
3E4BD65D11C5B1A4440AF263D0B7F01BAAFBCF593C8693BB52AB63B7272FFA3339CC8369FAA3A0F1B37804E410375BF11E7BC9DEF21F10696D0CAED2E6920004
Validator #2 public key
0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3
Validator #2 signature
22346705D9B7CE7C020164BD08F212FA02D6E4DF8069DBFF5980A81E7C47E211C537A18E9DE294B37B807E545BF5865E6832C95AC7E983A092B315039EC55C0C