@version 1
condition triggered_by: transaction, on: provision(_evm_contract, _url), 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: provision(evm_contract, url) do
next_code = """
@version 1
# Automate the refunding after the given timestamp
actions triggered_by: datetime, at: 1702092480 do
Contract.set_type "transfer"
# Send back UCO to bridge pool
Contract.add_uco_transfer to: 0x000018D60115ECE0C7558A46B4693749BF6BEAB524FDDCCF9B10B910619E4EE08801, amount: 55.72
Contract.set_code ""
end
condition triggered_by: transaction, on: refund(), as: [
timestamp: timestamp >= 1702092480
]
actions triggered_by: transaction, on: refund() do
Contract.set_type "transfer"
# Send back UCO to bridge pool
Contract.add_uco_transfer to: 0x000018D60115ECE0C7558A46B4693749BF6BEAB524FDDCCF9B10B910619E4EE08801, amount: 55.72
Contract.set_code ""
end
condition triggered_by: transaction, on: reveal_secret(secret), as: [
content: Crypto.hash(String.to_hex(secret)) == 0x15368BEF40B000A0B9E36F8E2BD6C741910784253E6F917666457B4E39E9848A,
address: (
valid? = false
abi_data = Evm.abi_encode("status()")
tx = [to: "#{evm_contract}", data: "0x\#{abi_data}"]
request = [jsonrpc: "2.0", id: "1", method: "eth_call", params: [tx, "latest"]]
headers = ["Content-Type": "application/json"]
body = Json.to_string(request)
res = Http.request("#{url}", "POST", headers, body)
if res.status == 200 && Json.is_valid?(res.body) do
response = Json.parse(res.body)
result = Map.get(response, "result")
if result != nil do
decoded_abi = Evm.abi_decode("(uint)", result)
# Withdrawn status is 1
valid? = List.at(decoded_abi, 0) == 1
end
end
valid?
)
]
actions triggered_by: transaction, on: reveal_secret(secret) do
Contract.set_type "transfer"
Contract.add_uco_transfer to: 0x00002F226DD3C62155E95202F0935C8A8726996010D2CCCE7311F39824253AA65E70, amount: 55.55284
Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.16716
Contract.set_code ""
end
"""
Contract.set_code next_code
end
Content (0 B)
State (0 B)
-
Secret shared with 1 key
Encoded secret
822A628439AAE9C927636EF23BC4AA239DBF4A6D6ABE985F54F95DAF9CDBC87FF5669333A42740C59CC236B4B230EB7A2B59F4BBEA755562162C7C97
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
-
Resolved 0000DC2F...00F3request_funds
[ 1702092480, 55.72, "00002f226dd3c62155e95202f0935c8a8726996010d2ccce7311f39824253aa65e70", "15368bef40b000a0b9e36f8e2bd6c741910784253e6f917666457b4e39e9848a", "0xc17db62ef1663e3ee9a33477dffa8c995da35fdb13cd067436a4e59c0d0310e6", "0x3cd701cdb87a011d5458b88e2708a9206d21dbf7", 80001 ]
Inputs (0)
Contract inputs (0)
Unspent outputs (1)
-
From 0000D87B...FEE3At 2023-12-09 01:28:49 UTCAmount 0.25964723 UCO
Previous public key
0001095CA6149B949D3A8CFC977553455C945A541B48C6CF7BB8A8BFD9FD47D7766D
Previous signature
BED9D23966B9DF0501185A325842080087B96D03315D1DF726AD5DD3CC4F9BE35C09E07E3FA0E4C1E8ED732C09250497E88133D11C02D6DE6F49C79ADADC7800
Origin signature
304402207F3A189E9ABB3FD3802350017692E79E2A724EDEBC32210BBEE3275F6640A5DC02205CE085F94DB08EFE9F0444678E9ABA529DC68DF5D3921DC4C1869690AA1830E0
Proof of work
010104AB41291F847A601055AEDD1AF24FF76FA970D6441E2DCA3818A8319B004C96B27B8FEB1DA31A044BA0A4800B4353359735719EBB3A05F98393A9CC599C3FAFD6
Proof of integrity
00F181C4B9DBC4C2DE7AEB9D7D4E21D94ABD45DD2947C0BD2316FCB22D03446AAB
Coordinator signature
BC5FDD3C9A487AA07B58F7B27EA0A7853A5FC722C1C0793FCFB10AA6B7D1005A61613FB487C2BC5F4E8122806E9E6DB2B54E0AEAD0F918DE9C68FCF8BE4D9602
Validator #1 public key
0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3
Validator #1 signature
F26EDD4E9F3EB2DC1ED01E972FB43605C724344AEA07FDF3B403A3552AE968B068F648E7151C27BEBF1A8C6F776B9F9D3F997AA4CB01CE24D996D98840B0050D
Validator #2 public key
000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF
Validator #2 signature
673D586495C02BE3B44988D287C6B15FA5D7164963DD2999F845F29BEC08971B957C3D57B364BAEED0758949539FDB29599E691AF79A7AFB5BDDAD0413462005