@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) == 0x000018D60115ECE0C7558A46B4693749BF6BEAB524FDDCCF9B10B910619E4EE08801
)
]
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_uco_transfer to: 0x00001675BECDA24450FAD82114A15B58567979E8E7AEA1CFFC54CE8C1779513EA2AF, amount: 0.0008
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_uco_transfer to: 0x00001675BECDA24450FAD82114A15B58567979E8E7AEA1CFFC54CE8C1779513EA2AF, amount: 0.0008
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 < #{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_uco_transfer to: 0x000018D60115ECE0C7558A46B4693749BF6BEAB524FDDCCF9B10B910619E4EE08801, amount: 7.976e-4
Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 2.4e-6
Contract.set_code next_code
end
export fun get_htlc_data() do
[
amount: 7.976e-4,
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
5AFCA38FBF1D6A2E2554143A0A393856C04F108086FFE3ADD7C273B7DCE38E7C51D2EA1656B557AA05C39D006BD6009A5A6582BC0C8F8D7CFF68527D
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
Contract recipients (0)
Inputs (0)
Contract inputs (0)
Unspent outputs (1)
-
From 0000D238...BA43At 2023-11-22 02:24:37 UTCAmount 0.38459452 UCO
Previous public key
0001AFF93DB0CF00E2C4F001983FED7FADA55E7AD3E3F65AB887C983FC6C4668E7BB
Previous signature
73626D1A977FB9C1373EBB47AC6820E64FACD4F90B9221E2A5E13C5279CBC3D4048010783C91AA87BFF0080C2081CDCB235F8BA873024D11D0C2611632BAAB03
Origin signature
3045022100BB3D1CB8A2016B2DDF8985F9B177A7D4A7DE559DE5985C287F22372F650926AA02202783D58567B8BA819609830234D3AAFE636E10BAC386CF02D5BE121C49A8B256
Proof of work
010104AB41291F847A601055AEDD1AF24FF76FA970D6441E2DCA3818A8319B004C96B27B8FEB1DA31A044BA0A4800B4353359735719EBB3A05F98393A9CC599C3FAFD6
Proof of integrity
000F41176622592709A92E279C5547BE1914D3ADC8D3606FB0B52251661B2AFCE3
Coordinator signature
AFD46F58657BBC792BC2C77BDD01CDF65C477A1360D646325A0C1C48F008180407E49B25D24BE37C74212D040E052464C12E19552BE878560987567D8D5CC607
Validator #1 public key
0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3
Validator #1 signature
FF22DCFC78E613D8DD7165CE4ED80AD40FABC3D9B4326DF9A4C3A5B9BD30418700FECA1905EA1E5FF35598D660CD3FD7CA13018E8EDAD3B19BCAAA7C60A67C0D
Validator #2 public key
00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947
Validator #2 signature
C1AFC3584B668EA3A9586FDA3458E44F102176EB7CFA7C58D2EC98EF399D05821772D7075D0006D7B320749D18C5F098A0CF3690F921AFC97BD24249236F7806