@version 1
# Automate the refunding after the given timestamp
actions triggered_by: datetime, at: 1701941100 do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x0000854662F2FF47226AF328EFCE8A16A518F2F9F0225DE5CF5FE431071217474BB9, amount: 4
Contract.set_code ""
end
condition triggered_by: transaction, on: refund(), as: [
timestamp: timestamp >= 1701941100
]
actions triggered_by: transaction, on: refund() do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x0000854662F2FF47226AF328EFCE8A16A518F2F9F0225DE5CF5FE431071217474BB9, amount: 4
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 < 1701941100,
content: Crypto.hash(String.to_hex(secret)) == 0xDF101ED551362363564B2AF4D7A7F500C31B1DD4890E01F880B270DC8BB5A6A8
]
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: 3.988
Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.012
Contract.set_code next_code
end
export fun get_htlc_data() do
[
amount: 3.988,
end_time: 1701941100,
secret_hash: 0xDF101ED551362363564B2AF4D7A7F500C31B1DD4890E01F880B270DC8BB5A6A8,
secret_hash_signature: [
r: 0x88C20F134E10A5C432AA54D1781FC38B954B78B8729F972EC928E7961D323906,
s: 0x77E80D4C623505A5CB5C572E9BFF2AECDF3CB07BA9B211B0649DB0BCD2474D4F,
v: 28
]
]
end
Content (0 B)
State (0 B)
-
Secret shared with 1 key
Encoded secret
601A8DCA6E84CD8C840D32573B3168BA38F5FBB2B844A067F709927A2588BCA02466085544089E6FAEDAE3417BD7F88DE0A8CF8492938C685CB567EC
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
Contract recipients (0)
Inputs (0)
Contract inputs (0)
Unspent outputs (1)
-
From 0000AE72...5BD7At 2023-12-07 07:25:22 UTCAmount 4.41037576 UCO
Previous public key
0001B037B3F7D20464806449E1AF45906FADBA195C64A78A4ED3E8950210F50B19E1
Previous signature
F0B7989407D25B1FF168FADE89F68117876D35C497EF5EA8A0188C48EBC976779FBB9463B0127C9A078F70C16AE523E1FD87E2455D70896645FF767B96D20606
Origin signature
304502210088E4E97FAC4C2FD12501F1253E993421627E7FCEEAF382AF1DBC0BF5A2420F480220084367DB84F61C54FFD1BD49CEBD22AF86A915A5E8B3F67BF0586D14AD165B7F
Proof of work
010104EB90F7BDD03D5A7FD9B61D9128D7CF24C11F3F7DA96825DA3680C2B6BCC48F1AFCE26E0A5F1A903EDAA4BC9390210A0A4F175847EC2A2BB325BB6D1CE8EC8F90
Proof of integrity
00A95195BC4B702930F76F9A7B6A52BA55F41BCF469A30FC263B51E7689F83061A
Coordinator signature
83CE1B1B7C911203A7EB98DBA2E3241B0B50759D3C6E1A69B58767CD387B228818FA06B140ADE7D3E40B57D6EB5232BCB6954A59BBECDCB9B0C2C3215DE46A07
Validator #1 public key
0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3
Validator #1 signature
874AF94A3869AC3C6EDB790B7E92D949977F131F6A6FCEFBC8C336D941A8BA8D41A61435A7259EBA55E757C6E83A08EEB74F1F704A3C70A157C5A03B285D5402
Validator #2 public key
000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF
Validator #2 signature
F9AE7CA71C54036E878C88E0FDFE9479ABC56CCB05636E18C8B0E3B8C741354F376D6A8490DDE23D8EF0112F92D56EB5D2B7D71B46715124775F99AD24E68008