@version 1
# Automate the refunding after the given timestamp
actions triggered_by: datetime, at: 1700065200 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 >= 1700065200
]
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 < 1700065200,
content: Crypto.hash(String.to_hex(secret)) == 0x082AE851F1BBB6B5AF89A9AB95E13951E7B48A299816B388B80CF3648691F220
]
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: 1700065200,
secret_hash: 0x082AE851F1BBB6B5AF89A9AB95E13951E7B48A299816B388B80CF3648691F220,
secret_hash_signature: [
r: 0xF48294206FCB282472CDEB4FAFF0F11586B7BC1213B4FEEA968C76E914F9BA8F,
s: 0x05D1924CFFC69AC2DFD5D440514AE3E37D0DAA0839B58FAC38E8039DE04A48B4,
v: 28
]
]
end
Content (0 B)
State (0 B)
-
Secret shared with 1 key
Encoded secret
A5D8EDD64632E8F54E0F932DD6A2CBD27557DF7501B3E8AFEEC216458659B4022B86E86E5ABD56438B09419DE4A98BCF018617881FC4735B3ACEFE79
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
Contract recipients (0)
Inputs (0)
Contract inputs (0)
Unspent outputs (1)
-
From 00003E28...3092At 2023-11-15 14:20:46 UTCAmount 100.35108494 UCO
Previous public key
0001EF692101AD77A677C7277624C7F0DFBAF6DE0D11EE888E0092EE5DF0B3A06683
Previous signature
1E6DAB7F4946BC1C1BDB14428C8FFB540CDCD641D39A203BD39643B301100A1932C6325A278E7DB37C682413C004C3352963EEBE46992EB4640610AB77A29307
Origin signature
3044022047B71EC198A7586602F7350424D3EAECA72ECE4F489B584944099A06F0C71C9102203ABF3D25996BCCA36E3B3FAD4310A51895A08107CCCB107D073E9F69FB06D0E9
Proof of work
010204D6052E0C6CA9244CDE5F3D664296BDFBA0090B330404C3C16B098758F27965DFEC0D3F25D1365F389C2B6C516195552F8779DEE0796C8C33F1A9C0404F4E3381
Proof of integrity
001B77A7D851B6B1F83586C0F4292F167632AE9205C85372FB558ED49C00C2185E
Coordinator signature
4B219E6AF556FD301B0AF93B855D767E6F98139B7330BA74A8A7000883210BCD4F558A92CBE06BB8A2C4F394DA70F71709E11C9DD0F3A154938435C538E4F20F
Validator #1 public key
00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947
Validator #1 signature
EAC4CC50987A867054EC8E2CECEE06126B21F3880E240E289553006451C3B9A163E2D3E2CB699229EF52B9A7C321F471D1889EDE5D86DDC1764CF2462593490B
Validator #2 public key
0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3
Validator #2 signature
62B05B4BA07435ACDB2AA51C58A2D890DF58B814F45C09A8E8900BE5056F4CDB3E9750BF816722E77832602F1602C0786ED8AD91258B7161444D85F99440E902