@version 1
# Automate the refunding after the given timestamp
actions triggered_by: datetime, at: 1702144200 do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x000066062AE51C8EDDB115B895B4917CF9A25F20A0CDAEEDCFC62085AB197F6B48FC, amount: 10
Contract.set_code ""
end
condition triggered_by: transaction, on: refund(), as: [
timestamp: timestamp >= 1702144200
]
actions triggered_by: transaction, on: refund() do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x000066062AE51C8EDDB115B895B4917CF9A25F20A0CDAEEDCFC62085AB197F6B48FC, amount: 10
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 < 1702144200,
content: Crypto.hash(String.to_hex(secret)) == 0xC70F0BC82ABDC5DF0D209A5E58119883FF7FE1B412A0EC6F8E5446F9B17EFD96
]
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: 9.97
Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.03
Contract.set_code next_code
end
export fun get_htlc_data() do
[
amount: 9.97,
end_time: 1702144200,
secret_hash: 0xC70F0BC82ABDC5DF0D209A5E58119883FF7FE1B412A0EC6F8E5446F9B17EFD96,
secret_hash_signature: [
r: 0xF75573DB31DCF1F0D557AB74DAFFBCD24A2F5C180E658B7D7B93E3DFE99B443B,
s: 0x43904685C5FCB20BB95B841B9ECE32E0DD3EFFFDD0B6F3F87133404DF5152D6F,
v: 28
]
]
end
Content (0 B)
State (0 B)
-
Secret shared with 1 key
Encoded secret
DB3B10624DB7DA1B840A1356C813A891E45EE5EC60357304C11C0C81BBC698FF0659386F0756D7876D83C1527D011C1587F56C59AE3BCB0FBC393160
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
Contract recipients (0)
Inputs (0)
Contract inputs (0)
Unspent outputs (1)
-
From 00000C3E...D8BEAt 2023-12-09 15:50:50 UTCAmount 10.40834386 UCO
Previous public key
0001F4965D8B84B878B19DAECCA293FC76556668A4BDC7C1087220AE9284BA0AB678
Previous signature
2AC6F25D853C2A4C0D73518BEA3578FB11AF5AD43CD5928356A7ACEE018CD30F5188407C98CAF4491A0EC523096ACF69D598D2D076BBEFCA82DF39EB5E7E8F0B
Origin signature
3046022100E23E30F7C11A176E1FAF84FBE7DDFBECF653F7486E3C9A2D5EF7366A9F6763C2022100F578EDA23E72A071E3DC9D8572157551189EC43D9416B8D90E5620194AA60407
Proof of work
010104AB672F1E69B064D192819F1797C1926F158DBA8F3924AC732B4C4D70D0C8EA0A0D6506E5896C9C2524D2BE26CB5016287E1816A597C408008BA36FCB154A7765
Proof of integrity
003528755040698311B52392F72FDE10604CFC5A20A0ADE6CE2B06D22A47F0DF4F
Coordinator signature
E79DDBBE0E04EB0F843520410DD08F73C766FD03077ECE632F32CD45381C9EC5C36A8BE65E386831DABDA49BB2A841129D51CE494018C96D4F6514CC60923B0F
Validator #1 public key
0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3
Validator #1 signature
E3CFBEE211EBD334A3F309BC67F75BE32C85F994F86B9032097CA59E58C54017D2A42DCC0F9663660C5FDD54D880FEAA3179DFA2A7A092339E79212FFC246D0C
Validator #2 public key
000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF
Validator #2 signature
6460C594EC560CA874D546B4873002C6A653EFC58BD12C473F56F8D44A1B285A7E9DB8252DEB36E5FFD3D30EE6F26D8E03E06EAA1B3E37D22822F571ACC6CC04