@version 1
# Automate the refunding after the given timestamp
actions triggered_by: datetime, at: 1701457740 do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x00000074711AC67E712F33FA34FCB3388738F232362F4852D06A08AC62818DF8426A, amount: 111
Contract.set_code ""
end
condition triggered_by: transaction, on: refund(), as: [
timestamp: timestamp >= 1701457740
]
actions triggered_by: transaction, on: refund() do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x00000074711AC67E712F33FA34FCB3388738F232362F4852D06A08AC62818DF8426A, amount: 111
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 < 1701457740,
content: Crypto.hash(String.to_hex(secret)) == 0x57F42502CCD6E60F6995A5E362A137E1C64F7C6B66BA11C65C6F21F91BA1A723
]
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: 110.667
Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.333
Contract.set_code next_code
end
export fun get_htlc_data() do
[
amount: 110.667,
end_time: 1701457740,
secret_hash: 0x57F42502CCD6E60F6995A5E362A137E1C64F7C6B66BA11C65C6F21F91BA1A723,
secret_hash_signature: [
r: 0x1102503587C61616CF97732739A7C47C833EDCCAD3B113AC6A15450899CC0CDB,
s: 0x062510A83F517A3CB3DCD816D0FFE169D65B938BFB28E1DA0FF5942311D0AAD9,
v: 28
]
]
end
Content (0 B)
State (0 B)
-
Secret shared with 1 key
Encoded secret
2B61CBE00ECC39FCC5CB13C1F672250C46BC0F9157EB3928B1F8AB95C54091CDF1879B5C53F0423528F028D9324713C27B7EE5D1CBCC478EF3A9B320
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
Contract recipients (0)
Inputs (0)
Contract inputs (0)
Unspent outputs (1)
-
From 0000C10F...1C20At 2023-12-01 17:09:55 UTCAmount 111.42641724 UCO
Previous public key
00011378CB2E1838981E95FC1654CBCEAA3A103636BC32176981A2606182465C32A5
Previous signature
74636CCFB8315C74E13826BA8F2ADAE15BB0A2DD685575F98355DCC0F911BFF58E60788E717EBB51B996D8B73BA29B785D5559AC6488391CC282CC095F6A1C0C
Origin signature
3044022058D17AA7179CAF7B75977D3BF85E5D28672F0BBDFDB05BD52475B6C4DB495DF90220256CBBF4C4C9CCBC2B2DD44B0C54907B1718129916B8ADF2BF57F6A4BC2C4235
Proof of work
010204892A04DBE05192BCB662689E7E19700F3F7202028EF0A9F20635C4948436ED85A43BA3017281EE97781342DD8F24ED6F583B5FE542830FDB5191A11843A72A61
Proof of integrity
00A1F6C4E7ECAF5C6FF7D95F737FCE6770A00315DD03B6476B55BDD016508EBB26
Coordinator signature
4C8D74C05394DB0E56DED1E2E43289863AD278B7BDF88625B78E95ADDDA6AF96512D1074BF19D70F6E75D78CA3143D125D476DC02BA6915B80B6B0F6D68FB70F
Validator #1 public key
0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3
Validator #1 signature
640419D30CF7F2D9CF451E6FB53C9D2EAC134B2BEDDE49A34E20B187A45F7BF49A9F26BB62B9FDE024310EC15F7DD12FA09C1B33CB019C45E5836E77724AF10C
Validator #2 public key
000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF
Validator #2 signature
C1E20C3808A906AECD50ED424F880EB185CCBA1CF2B7B62133F5EFE126D00841F86E442FB7F709E9E57AED0445EF396DBAF125E756AFF404B93754F6467EFB0E