@version 1
# Automate the refunding after the given timestamp
actions triggered_by: datetime, at: 1699460580 do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x00008DD40CD42287A3C8282065F5BCA7259AC7014CD73109B570E946A977687C7BD0, amount: 10
Contract.set_code ""
end
condition triggered_by: transaction, on: refund(), as: [
timestamp: timestamp >= 1699460580
]
actions triggered_by: transaction, on: refund() do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x00008DD40CD42287A3C8282065F5BCA7259AC7014CD73109B570E946A977687C7BD0, 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 < 1699460580,
content: Crypto.hash(String.to_hex(secret)) == 0xA48E68E8D3275D0A1BF3D93AA91F3D816D01E8A5FE623F570F820660160C7C69
]
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: 1699460580,
secret_hash: 0xA48E68E8D3275D0A1BF3D93AA91F3D816D01E8A5FE623F570F820660160C7C69,
secret_hash_signature: [
r: 0x79DF36B8EF28D0C2A7FDC446A9E336832B129F7C610680F18123FD98BD9519E2,
s: 0x0DF2A7C81BB7137A35029BA1410D50F42E21494BC451E881923908D26095BC7C,
v: 27
]
]
end
Content (0 B)
State (0 B)
-
Secret shared with 1 key
Encoded secret
D0790BBA07C35E62FA2D3047848E71308307D43498F5F083219BA88BE1D54BAA5581868CC02A70730F5B7B26AA25DA443E92A8754271C3ECA7A7E403
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
Contract recipients (0)
Inputs (0)
Contract inputs (0)
Unspent outputs (1)
-
From 00000D7C...16FCAt 2023-11-08 14:23:57 UTCAmount 10.3607622 UCO
Previous public key
00019B7F3CB24F4C1DF61EF4EE47D7D260601348A32BF896D58BB13CB57CFFF94466
Previous signature
559383D4DC79562A2674404B8979BFC52869FF03EC6CF7C02C9CDDDD0195BF0E6FD924F434681D7847FFDC4BD099015B9A47FE2078F8C957C886D69DDD2F3803
Origin signature
304402204FCF085AA396B5D27CD53968090E75C363857FA437D5C247B72D7AECBAA96DC402203B2C56C094CCAEF4AEE4547355FD9C3F0F81A3043F650C5E3EF58FA4597D70A9
Proof of work
0101046C39D56B717142B6EE14B0F8B2561ECA458F3D2D12C9977D613F78829419063211F9C21F7BB0D56B6523040A8156BE22B6E9D6332B88ED882574D12AE32F7A45
Proof of integrity
00C9482ABF660BA0767969B8B83DEDB003C7DCC95DC9708FFA18C3371FA1C9AE60
Coordinator signature
8B7822F665D84A3C8BCABD2B9034A9CFB8F95BC15B9041AF083CBC7B61BA63F222B97EAB47E139173057BCFD807CBB4C7CAD013E8065640ECACCE7023DD9BB0F
Validator #1 public key
00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947
Validator #1 signature
558DCCEF2DDD48EF0C66D0B73909BC196D2B0F209D0B08404CDC138D267708B86F9D50BCB84030B9E4B3EED009C4C1D7AA482E7453C05CC9AFDA204B5BA26F0E
Validator #2 public key
0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3
Validator #2 signature
FA6DDCF33D1E40707260D64BE708B78D73496B6B5FC383733AA5BB8994BB85E83224B5BCB58B723E0808181A937DF2D91293BDAD07671B6C5BCC5EE93D45CC0E