@version 1
# Automate the refunding after the given timestamp
actions triggered_by: datetime, at: 1701360180 do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x00002E23104F83E325686794C2D1BDFD23CC04566258C9EFFF6F35A34231C558CD43, amount: 100
Contract.set_code ""
end
condition triggered_by: transaction, on: refund(), as: [
timestamp: timestamp >= 1701360180
]
actions triggered_by: transaction, on: refund() do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x00002E23104F83E325686794C2D1BDFD23CC04566258C9EFFF6F35A34231C558CD43, amount: 100
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 < 1701360180,
content: Crypto.hash(String.to_hex(secret)) == 0x3C38159D3D3137131D3B448B7B8DCE5B8B5A24F2EA11D5619FBC4C85D2C172A1
]
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: 99.7
Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.3
Contract.set_code next_code
end
export fun get_htlc_data() do
[
amount: 99.7,
end_time: 1701360180,
secret_hash: 0x3C38159D3D3137131D3B448B7B8DCE5B8B5A24F2EA11D5619FBC4C85D2C172A1,
secret_hash_signature: [
r: 0xC17BA8EE041AC8AD67749E9F054AC8CFBF5CDE5A026C9EC0478C1576483C07DB,
s: 0x28C931626A6ECA79434BF8448BFFF77F76AE0DA26C887D4432E2A19A8E5A05A7,
v: 28
]
]
end
Content (0 B)
State (0 B)
-
Secret shared with 1 key
Encoded secret
C03522B4A900492F0692DFA78EA06C7086DA604412FBF79FE85AABCD11914CD442E6927068BFA1FDA97329E9EFEAE0A69F47756448188C8B38AED44B
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
Contract recipients (0)
Inputs (0)
Contract inputs (0)
Unspent outputs (1)
-
From 000051AE...CE14At 2023-11-30 14:03:48 UTCAmount 100.41777464 UCO
Previous public key
0001F7553E184D6F9D8AB562E0CDD2D4844CB31D964FCA6C916C09AF473A1E974314
Previous signature
D193006B36E605FF36D4E78BD0EEF82C3106BA2BAEF4AF80BC36C3FD061DC0FE77E738DCDEAC48DAF14DF08B7CC7C4C3AF17385A976CDC5C75435338DCD57E04
Origin signature
304402207347710C0384D7FCBFB817645E08482BF71F0BAAA0EA112771E0F1B99369782902207FCD7FC0A07FF270B97BAA60AC51C446E408BA9B7CB8BCF9A1FD59F5CB4FD82B
Proof of work
010204B3B2A53580086B9F36919CF40ABC55904729F78BF43673E216FAC1EB2451DD1E521879C6588F0CB09B150A103A39A73E2816B5ADF51F0721348BA3A66C33023B
Proof of integrity
00DB6668F260ED9E370F5857CE4DF06388DDF04D0CA20DCC4BDB02E7FFD33C7410
Coordinator signature
52E86D380BE9ADC6DAEC741D96E6727312D88B87387CDE8D46D723A2A59B1561C4E85923A6A08D1F08A889C260EFD1515360AF2CB0098B3DEC7A15A38147630E
Validator #1 public key
00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947
Validator #1 signature
B9B449DFBD0B9453DD2E8C87F36D60139C1D1CA70948C81D528B20A4DC71AE22DCB0312B2459B2FE64A458535D9DBFF6B1B4E6BBA7FD2E3CC3409642ACD7040F
Validator #2 public key
0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3
Validator #2 signature
F3BB7D40139EBC97BDC588499F5EABF898469E50D965C310012CDB60EF69FCFA76C8385FB2E5F719FB2FBD953125D8B08B071D10B76BD1A23724F6FFB35D2703