@version 1
# Automate the refunding after the given timestamp
actions triggered_by: datetime, at: 1702024620 do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x000079AAE5FD689797A5D03DEBBA98F6174259FE4CF81F2C51F0DDD937C13963B2A0, amount: 4.8
Contract.set_code ""
end
condition triggered_by: transaction, on: refund(), as: [
timestamp: timestamp >= 1702024620
]
actions triggered_by: transaction, on: refund() do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x000079AAE5FD689797A5D03DEBBA98F6174259FE4CF81F2C51F0DDD937C13963B2A0, amount: 4.8
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 < 1702024620,
content: Crypto.hash(String.to_hex(secret)) == 0xB223E052E6F40ED47E64302B4EE104A0CC328C3AE164190DCBE3FF2D8D9BBD34
]
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: 4.7856
Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.0144
Contract.set_code next_code
end
export fun get_htlc_data() do
[
amount: 4.7856,
end_time: 1702024620,
secret_hash: 0xB223E052E6F40ED47E64302B4EE104A0CC328C3AE164190DCBE3FF2D8D9BBD34,
secret_hash_signature: [
r: 0xE36FA9ED3D055A3AC57C387312965ED7B3971C0CF2F6049BB10C47015DEB3AE9,
s: 0x37A93C6B58FE3B5F3C915121AAC0A234EE6DE6AD1B362821E2792E9674F2F798,
v: 27
]
]
end
Content (0 B)
State (0 B)
-
Secret shared with 1 key
Encoded secret
90A3BFB510575F889A54F812A9CE8635B4A8A37A99B08BACAEA8AFE18EBD110B4C1BFA4CF466C4FA3A164E3D37C8F4B5199863B471884574B018D1CD
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
Contract recipients (0)
Inputs (0)
Contract inputs (0)
Unspent outputs (1)
-
From 00000B81...C23FAt 2023-12-08 06:37:46 UTCAmount 5.19480244 UCO
Previous public key
0001A8604F5DBEF150E576FC48F224D14CE68C6D681EC4497EBE8CF9F90D766F44A7
Previous signature
3EF82417593EEAE666C0D27053124096200082E17F1322512E9C0A728FFA099E2B96602C9BC9CD99A63BE16B03692C5B36474213C4D9B1B018DFF4536E588A0B
Origin signature
3045022100B5FBF1805BFE55B90B33B6CB6DB3C4ADD32D3BFCA562A0140DEABC2B217A5460022053D9B5FB5FFE8875A698ED26D3040AA37F8BEF7A28CA5D806CD31D8F118E0930
Proof of work
010104BB7216545F28C83467606EDA88968E19C436410AB446D1BC88FEBDE3506275F9B0B931CAAE420B96B2A158B7112F13795C878CCC346C76E04A96C59CCFC6FC39
Proof of integrity
005B501B2F33A5F952A846D071C06DC8156841343193CB0D9434CFC3ACCDD663E8
Coordinator signature
73C5FCF9DDDA6A4E6BA2AB9FAAE86B9F25BDA14723CCE4501CDB94B169478BBB759DCAF027C711859CCA233470D1036AE8D70302006BA8A30188D3DA11443C07
Validator #1 public key
0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3
Validator #1 signature
D64B7BACB4162036F2E77133689DD46C1209E520D5636D3FCC47BAD09AD8A8078C6A9180885BE14BDB0822F3B8BD210609612646DD233EFCF8B8558AB1E2EB07
Validator #2 public key
000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF
Validator #2 signature
C5A8FF677FFE3A9DF38F582C6253B855CA1408CB7C51140E1D025DBBA24284022CB1459873336E82AEB1B18A4742104C23E4740DC231DB85D3C9596D46434B00