@version 1
condition triggered_by: transaction, on: set_secret_hash(_secret_hash, _secret_hash_signature, _end_time), 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) == 0x00008DD22E7496E86901E9B276A1BE6F9512EB09980CC04C7B76495EF37D5666A709
)
]
actions triggered_by: transaction, on: set_secret_hash(secret_hash, secret_hash_signature, end_time) do
next_code = """
@version 1
# Automate the refunding after the given timestamp
actions triggered_by: datetime, at: #{end_time} do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_token_transfer to: 0x0000A6A865901EF67DF81F22FFB026F5DA4F039AE0E9481B896FF2CF8CA5CAC32364, amount: 0.03472053, token_address: 0x0000288BF6F0E12457B125DC54D2DFA4EB010BE3073CF02E10FB79B696180F55B827
Contract.set_code ""
end
condition triggered_by: transaction, on: refund(), as: [
timestamp: timestamp >= #{end_time}
]
actions triggered_by: transaction, on: refund() do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_token_transfer to: 0x0000A6A865901EF67DF81F22FFB026F5DA4F039AE0E9481B896FF2CF8CA5CAC32364, amount: 0.03472053, token_address: 0x0000288BF6F0E12457B125DC54D2DFA4EB010BE3073CF02E10FB79B696180F55B827
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) == 0x00008DD22E7496E86901E9B276A1BE6F9512EB09980CC04C7B76495EF37D5666A709
),
timestamp: transaction.timestamp < #{end_time},
content: Crypto.hash(String.to_hex(secret)) == 0x#{secret_hash}
]
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_token_transfer to: 0x00000000000000000000000000000000000000000000000000000000000000000000, amount: 0.03461637, token_address: 0x0000288BF6F0E12457B125DC54D2DFA4EB010BE3073CF02E10FB79B696180F55B827
Contract.add_token_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 1.0416e-4, token_address: 0x0000288BF6F0E12457B125DC54D2DFA4EB010BE3073CF02E10FB79B696180F55B827
Contract.set_code next_code
end
export fun get_htlc_data() do
[
amount: 0.03461637,
end_time: #{end_time},
secret_hash: 0x#{secret_hash},
secret_hash_signature: [
r: 0x#{secret_hash_signature.r},
s: 0x#{secret_hash_signature.s},
v: #{secret_hash_signature.v}
]
]
end
"""
Contract.set_code next_code
end
Content (0 B)
State (0 B)
-
Secret shared with 1 key
Encoded secret
AB728DFF882BBD00F538F150CF8F51373578EC741C760A405366DC8CA1DE44E4E976DEDD61A35E3714471AFF2E5AF9155A1DCD2C5850160D2C63F031
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
Contract recipients (0)
Inputs (0)
Contract inputs (0)
Unspent outputs (1)
-
From 00004312...9897At 2023-12-07 12:39:00 UTCAmount 0.4074536 UCO
Previous public key
00016B86A48403EBB19A2240679FA5330A2CF5652743D67740D78E609DEFFF0D011C
Previous signature
64F4080B12D44C02CBE5B753BB360116BC2A8D560EAB3390410B979CACA39DC9042BE0F1E4958DC90722CCBE3A8BC39E16FFBF977D780B3AD714EE6B8B5ECB07
Origin signature
3043021F3926A4456FCCC5639EC6D1AAE912E8AD2F1A2E718D7C3655A344241A7DD6C0022005A61EA5328F6D98BE0386ECA91AD4AC190ABB4C266D344FCF7986C8A62C12E7
Proof of work
010104AB41291F847A601055AEDD1AF24FF76FA970D6441E2DCA3818A8319B004C96B27B8FEB1DA31A044BA0A4800B4353359735719EBB3A05F98393A9CC599C3FAFD6
Proof of integrity
00ADE6D04055ECEB91E529D743BB5662AEA040D770560F48CA6C010125774325B7
Coordinator signature
3E405DB84150B27F563035099E95F041A63E20F4C43C0D9B8BB99085202AC1E7E8B4AA3AF55F5764C0BCFFF280AEC2306B75FBCA0EDD3FA1D38782B67152270C
Validator #1 public key
000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF
Validator #1 signature
782836C3D96AA9A17D611CFEE51B839AC94040AD563FBA4E81FFF7AA79B76ED305E2BD53F1B6A4AA68389EC3A38AB2BAAD49DBE3B7715A53449866C7EC7CAE08
Validator #2 public key
0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3
Validator #2 signature
3879F28C8480C0477FDF2FE5C0B445B623AB1C56739C1F2E11A5AEE5F1E28BED8B1F40DC712859B8733CC268B58C3DD995C5C22214386497747AAE3E84DB4304