@version 1
# Automate the refunding after the given timestamp
actions triggered_by: datetime, at: 1701429540 do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x000079B40CB20AB1624178169798B0C9D9245BE746399864BE620B3099689DB824B9, amount: 5
Contract.set_code ""
end
condition triggered_by: transaction, on: refund(), as: [
timestamp: timestamp >= 1701429540
]
actions triggered_by: transaction, on: refund() do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x000079B40CB20AB1624178169798B0C9D9245BE746399864BE620B3099689DB824B9, amount: 5
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 < 1701429540,
content: Crypto.hash(String.to_hex(secret)) == 0x3186D45FDD044C55C663C9E4EC9700A092BEC9EBCB41E40133016CE2AB4650E7
]
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: 4.985
Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.015
Contract.set_code next_code
end
export fun get_htlc_data() do
[
amount: 4.985,
end_time: 1701429540,
secret_hash: 0x3186D45FDD044C55C663C9E4EC9700A092BEC9EBCB41E40133016CE2AB4650E7,
secret_hash_signature: [
r: 0x1B02195DC25E80432FD8CE3B68C2FA114E50C236ADDDA08A3944C99051B36B53,
s: 0x44F9E622D37A93D01D3E809CA6DF3AF5A4FA7FEF7067682C43B047F0CACC26AD,
v: 27
]
]
end
Content (0 B)
State (0 B)
-
Secret shared with 1 key
Encoded secret
7A223B51F403CF398D0A0B0A2E461117A8985E1B43E8D34363926B2E16A990A48591E40AE17B7334E2AC0E5F771DF9254505E2354075C3366374CB15
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
Contract recipients (0)
Inputs (0)
Contract inputs (0)
Unspent outputs (1)
-
From 000091F4...F336At 2023-12-01 09:19:17 UTCAmount 5.40538393 UCO
Previous public key
000183D3767403B4553560806CAE801FE19FD8B6E450AAE8942E11F0F34F1D4DB979
Previous signature
E42E4F0BDAE72E56B7037ED27923C3CF26551D5DB0A74A6C598869F836AC78F2E5D6E63AD6F1D647C7104E67C91E339814F25A3CE258BB74FC18CBABB726620A
Origin signature
3046022100CE65BEB32416DB5D37E42CE97C87FDE37CD818A4B4862DD130ABBF23BBE1900102210094C56C7C3E4929FFBADDD0579587C5F5B9CE862857234657C3DB61378BD29863
Proof of work
010204892A04DBE05192BCB662689E7E19700F3F7202028EF0A9F20635C4948436ED85A43BA3017281EE97781342DD8F24ED6F583B5FE542830FDB5191A11843A72A61
Proof of integrity
007100F69748785507A2EAEDACE3CE661AA1F8ABCA2AEEE6A8E57128B3161ED988
Coordinator signature
DAA555034FEA33B03194B4D75FE90E8FA0204AE491FBC2125DBCB5D3C2BFAA3E121DE243C523A843AC2580F5E78309B046003B9509524671877F5E7C32CE6F0A
Validator #1 public key
0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3
Validator #1 signature
1D5F9711202206542A09543B68BABFAB07B9AD911CEB3A83075A859FE82FF294AD26763E1E615B35C08366028C99134A2F465F514270A4A62948BEB8A51DCA08
Validator #2 public key
000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF
Validator #2 signature
3BAA7D6EE5B5DA5F42AE9C92D6F5C0AA4DE2F74632FC19AA30080BC2A543970CB4905F42CABFCBAB01C8A74285F7DA840CD690B44D89B962CD61D339FCC30908