@version 1
# Automate the refunding after the given timestamp
actions triggered_by: datetime, at: 1701391260 do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x00009D9C6D9A99C302BD029B471DA2D6FE1B54B88EA9BE44F6AAABD6D0F06CB2B00D, amount: 117
Contract.set_code ""
end
condition triggered_by: transaction, on: refund(), as: [
timestamp: timestamp >= 1701391260
]
actions triggered_by: transaction, on: refund() do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x00009D9C6D9A99C302BD029B471DA2D6FE1B54B88EA9BE44F6AAABD6D0F06CB2B00D, amount: 117
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 < 1701391260,
content: Crypto.hash(String.to_hex(secret)) == 0x7B6467FA638BCF0A82FE355E5770CA68595352B145175AF62E9B79C37C303E78
]
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: 116.649
Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.351
Contract.set_code next_code
end
export fun get_htlc_data() do
[
amount: 116.649,
end_time: 1701391260,
secret_hash: 0x7B6467FA638BCF0A82FE355E5770CA68595352B145175AF62E9B79C37C303E78,
secret_hash_signature: [
r: 0xA9436407EA5E85ED36082119A1F0DBFD4D87F31041F24E102DFFA327050572E2,
s: 0x7E462D138D47391EAB21A210295B1F75BB5035CB7E47231E31786A9E2A0ECFC9,
v: 28
]
]
end
Content (0 B)
State (0 B)
-
Secret shared with 1 key
Encoded secret
F6CA903DFCB35B65D5DAE45080C88811FA01865AE648BB7958BA6503FBFE827E1DD288E70079872D26E611C3607817A4FC1362710E19D7D4B83E79B1
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
Contract recipients (0)
Inputs (0)
Contract inputs (0)
Unspent outputs (1)
-
From 00001992...C94DAt 2023-11-30 22:41:20 UTCAmount 117.41119734 UCO
Previous public key
0001A7251410485CE8268A5AF6415EDD8F93B3719A93C7E4225433901FBE6849155D
Previous signature
8DE15CF398CFE1DBA4A8CDCF259AD9DD34CFEF66A8A814B010A1C7AF2579300A432706F05035DE1EB891C9853B57B9694A072D330A3928C2571AAEC30FC49C09
Origin signature
304402207D8099625C72CC49A67AA267D31855A404C8DA46E513E297C21F0E5F85DB642C022077793F8E137495E6C760ED3E42533149D4ECE81559B8C97A6BD867E65B1A270B
Proof of work
010204B3B2A53580086B9F36919CF40ABC55904729F78BF43673E216FAC1EB2451DD1E521879C6588F0CB09B150A103A39A73E2816B5ADF51F0721348BA3A66C33023B
Proof of integrity
006007B553B0DF1277374D465B06E3756FA671F5EA2AF267526DDC3025085A5F77
Coordinator signature
B833EA24DEE83562B2AF3D29740C5E757D7E9C78F999DDFF675ABC3E7083CA9F9951FCEB2DB8B17CCEB0BBAB6CE9A0E591AE8A7E218115655CB84EDAE3564107
Validator #1 public key
0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3
Validator #1 signature
3DA1F25A7094F01AD354242570A77986832B1E726CDA874381D60D79BDDF26B3EC05F85FBDCD240CEF9DA62A6DA0E85B96419CB0138568496F9643FC7445FF04
Validator #2 public key
00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947
Validator #2 signature
1DE2A654A266216B1118E8E54EDE7D6AD131BF0BEB923D8B28184FADFEEAA29A0D8098A1CA4CA34403A2AEBEE9AB578FB4CBFCECDE2237E851B22ACDF37B4007