@version 1
# Automate the refunding after the given timestamp
actions triggered_by: datetime, at: 1701944280 do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x00004D714076A3B4FD86E80AB24789B0002CD5818D650BDFBC3159B3378C12BEED36, amount: 6
Contract.set_code ""
end
condition triggered_by: transaction, on: refund(), as: [
timestamp: timestamp >= 1701944280
]
actions triggered_by: transaction, on: refund() do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x00004D714076A3B4FD86E80AB24789B0002CD5818D650BDFBC3159B3378C12BEED36, amount: 6
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 < 1701944280,
content: Crypto.hash(String.to_hex(secret)) == 0x37AC8CCEC0A79D4514E49B12C953B29348E0D51B1619DB8172562633EC1E5011
]
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: 5.982
Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.018
Contract.set_code next_code
end
export fun get_htlc_data() do
[
amount: 5.982,
end_time: 1701944280,
secret_hash: 0x37AC8CCEC0A79D4514E49B12C953B29348E0D51B1619DB8172562633EC1E5011,
secret_hash_signature: [
r: 0x05803D956CAE35A036E5EB70C9A4A6B327AC26E2C04991B7A8071BFD1ABD389B,
s: 0x6A54C5FFBF8D98351940813CBA1570DFC48637FC5661AA4487C430F79C6193A6,
v: 28
]
]
end
Content (0 B)
State (0 B)
-
Secret shared with 1 key
Encoded secret
5D0D4BC1AA3797243B1AB5C3CC71F58F4C9707E11DBFABB0CD796C2876F43DC8596AD6689B04DEEED80DB364D215CD05B206F09F80A22F3676B2E09E
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
Contract recipients (0)
Inputs (0)
Contract inputs (0)
Unspent outputs (1)
-
From 0000D294...C63DAt 2023-12-07 08:18:59 UTCAmount 6.40238402 UCO
Previous public key
0001A4966996548D5C60148E807BDB2149B78A1A82C38E147B956F0A8CAC706A10D2
Previous signature
846C0DA1BECF84587C134EF53ED7A3D531BF5759A8DE780B87EC9958CA2AC422C78826130BC79B624331CB520614E4CAE4B0C51B73DC19EF5A25EC17BCBE270E
Origin signature
3045022100B9B252DFB64646179F73306CAAEC445179B9219341AC109A9315FFC7156D4D3502203F3FB25C4CA268DF0806ACC5CCCE7519BEBBFE82EB9BE10B79B0C9216C9E8F59
Proof of work
01020451684966573439C38DA99334546FBBDE4A6D96A50B4A4ECBB6572CDBED023F079607407E254421D1779525D11C60D55684F0B403B93B95823554E29D1E2CDB16
Proof of integrity
00C067DB005E3D76A73C4076BA692DBD2D534B548AB6B1C5E80BAA58546C4B9BD2
Coordinator signature
BA63C02EA405BB86AFB5AF598C144E3F7E576973F2B8F630A7E230D78B4881FA263CD9CB6DDB9FB4262639BDB2E7155D9F04DB69A1D15F354CFC42FDCD7BB200
Validator #1 public key
000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF
Validator #1 signature
0073BC11D0CBD38A7009E73C04DE5B62DA633F5CF2769C1C86D4A767CA30C930D6CC819CC0B1222D839B48532891E9D7879C6745F5D786AFDBE9622C7556A400
Validator #2 public key
0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3
Validator #2 signature
618916808B1B08826B6D92722E7AD37DBADE47CA0B65D384DD1D05FEDC07F168EF6A20A3B990BC701E7488AC70718A596EF1CC80B5FE7568F56FD577AA52B500