@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: 1701361740 do
Contract.set_type "transfer"
# Send back UCO to bridge pool
Contract.add_uco_transfer to: 0x000018D60115ECE0C7558A46B4693749BF6BEAB524FDDCCF9B10B910619E4EE08801, amount: 154.225
Contract.set_code ""
end
condition triggered_by: transaction, on: refund(), as: [
timestamp: timestamp >= 1701361740
]
actions triggered_by: transaction, on: refund() do
Contract.set_type "transfer"
# Send back UCO to bridge pool
Contract.add_uco_transfer to: 0x000018D60115ECE0C7558A46B4693749BF6BEAB524FDDCCF9B10B910619E4EE08801, amount: 154.225
Contract.set_code ""
end
condition triggered_by: transaction, on: reveal_secret(secret), as: [
content: Crypto.hash(String.to_hex(secret)) == 0xF633D831401B0D11EABA1290C647F0DA9C1DA0020C3D6EB557C83DDBE642820F,
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: 0x00002E23104F83E325686794C2D1BDFD23CC04566258C9EFFF6F35A34231C558CD43, amount: 153.762325
Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.462675
Contract.set_code ""
end
"""
Contract.set_code next_code
end
Content (0 B)
State (0 B)
-
Secret shared with 1 key
Encoded secret
26ED3DD58B65F4BBB83EC98237A842113AB13DBA0046E06918371917A1C306D1AF6EC42C25ABFB8F7D075C7BBD5F8FCDD03504C8D1FB0340BF6D5655
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
-
Resolved 0000A644...0E0Arequest_funds
[ 1701361740, 154.225, "00002e23104f83e325686794c2d1bdfd23cc04566258c9efff6f35a34231c558cd43", "f633d831401b0d11eaba1290c647f0da9c1da0020c3d6eb557c83ddbe642820f", "0x317d0aad22153b175e1759bdf8dd1191b5c103ed8ae2fb273c07e40e1b17cae2", "0xfdcbc28c1179f0e1913dc8324e16c32761636509", 80001 ]
Inputs (0)
Contract inputs (0)
Unspent outputs (1)
-
From 000015DE...9949At 2023-11-30 14:30:49 UTCAmount 0.25780045 UCO
Previous public key
00014E5C011641BCBC74C269945B353AE9D79ED4AE623F6B00A209B6432CD030336D
Previous signature
4C0BD61A6DF866AF222C8F62B7D6B8B1482CE04C11E2E7E751FBED782515E879871B63F88818207289AC008B4F10433388F57E9C97909168839F0A7F95FB6508
Origin signature
304402204E31F114B92549FC93E52DCB10BA6E9A9585FF21D1725F0A709A297EEFEE45E502205B1CD465A39E22A0889E041641BB8B281CAA6F193F2530C49B0EC089C12CDECC
Proof of work
010104AB41291F847A601055AEDD1AF24FF76FA970D6441E2DCA3818A8319B004C96B27B8FEB1DA31A044BA0A4800B4353359735719EBB3A05F98393A9CC599C3FAFD6
Proof of integrity
009D44AEF4A6A0FB05B80FE6417944728C5EF0ED777AFBBE42AEFFD0112005DFD8
Coordinator signature
69235A7691E79FA8CB88095A8085C9331F53FEBCC278BD44D56CE17D2D29FFE50B0CF845CB4CC4EE6413B2A4E6C131CB4224245AC1061BD678C47545BE33ED09
Validator #1 public key
00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947
Validator #1 signature
0458FD3A073BBED58856302B4E5A1FDA2886130D280F4393CA8FC0F2CD5F5A56AFDB6F8AE50D809D751EB9BCED3759F11D82E47509AC1F95BAD871EC9F913D00
Validator #2 public key
0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3
Validator #2 signature
82B4EF7D5E36711F0A4ACEFF99DFF6A78F904378346501C957C7129BD5FF90C25992960A899D06CF33D6CD5880FF2B0ED94F08FC453F8A94FCA29A18E1117D00