@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: 1702113540 do
Contract.set_type "transfer"
# Send back UCO to bridge pool
Contract.add_uco_transfer to: 0x000018D60115ECE0C7558A46B4693749BF6BEAB524FDDCCF9B10B910619E4EE08801, amount: 0.796
Contract.set_code ""
end
condition triggered_by: transaction, on: refund(), as: [
timestamp: timestamp >= 1702113540
]
actions triggered_by: transaction, on: refund() do
Contract.set_type "transfer"
# Send back UCO to bridge pool
Contract.add_uco_transfer to: 0x000018D60115ECE0C7558A46B4693749BF6BEAB524FDDCCF9B10B910619E4EE08801, amount: 0.796
Contract.set_code ""
end
condition triggered_by: transaction, on: reveal_secret(secret), as: [
content: Crypto.hash(String.to_hex(secret)) == 0x912D188A55B16A51CA4369C4CDEB3EB9A2791FFC4F52783958602ADB443910BE,
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: 0x00003605944D6720BEDF147D7E63F48EC006FB059C2EA7A60E5A027E28CC53E7A200, amount: 0.793612
Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.002388
Contract.set_code ""
end
"""
Contract.set_code next_code
end
Content (0 B)
State (0 B)
-
Secret shared with 1 key
Encoded secret
4F3241E8EBE97C51A47D2C295EC30F857509E02D32FE2CBD79CD2A0A94A7A03704ECFD05030600927A002412D1BE1F56251A2988D1102EA038488019
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
-
Resolved 0000D066...F0C2request_funds
[ 1702113540, 0.796, "00003605944d6720bedf147d7e63f48ec006fb059c2ea7a60e5a027e28cc53e7a200", "912d188a55b16a51ca4369c4cdeb3eb9a2791ffc4f52783958602adb443910be", "0xf922b2d32cb1396f08f809309e3531bf609b94057478868a50fce40f153791c2", "0x5924ca0522938b3ac20c6a38c55ece8d67a207e0", 80001 ]
Inputs (0)
Contract inputs (0)
Unspent outputs (1)
-
From 0000F9BA...F133At 2023-12-09 07:20:19 UTCAmount 0.25716027 UCO
Previous public key
00014302C629C425299BAAC057A85A20D091BBA96F157DE34CB2FD678D9D6D92BBE7
Previous signature
D2B1CAB573632C7D01C2AE0EC27C00E3CEE6D3BF039FDA5E58116078892A18F8691BFCD9F025B73BD52BD6344C74B99A482C22CFF9B95CA6F9C4778F10E0130E
Origin signature
3045022100D46FC7E929EA74E6A12BD8B5B5EC23D288BD1D4B382401007C9A5DE38D11A52802203BEB86CC7971080AEE7B959862F3FB88A8E35DF0CA91FA44D78E3F225AC9EB43
Proof of work
010104AB41291F847A601055AEDD1AF24FF76FA970D6441E2DCA3818A8319B004C96B27B8FEB1DA31A044BA0A4800B4353359735719EBB3A05F98393A9CC599C3FAFD6
Proof of integrity
00F1D03527C3B881BB2F744ED4A42888316863358B8DC21EC383D4935CF862C3BF
Coordinator signature
0E6B6E05C229CC7A37710D4D52C3818970485F63D3E9A02FB25AD3F93EF088247C0CB166A80580DC1560F7E9B31AF6333C331D744DF2E037329019333AF5D903
Validator #1 public key
0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3
Validator #1 signature
A958F9054E6BB50D7E6828E281C6A930CA5A2D4C1167799491C92D83D96B99CA423FF11B4934F7D0E3AEF30BB9D4E741660579338635A5075499517AE0ED2004
Validator #2 public key
000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF
Validator #2 signature
EED17037B845A896D6F6C92BA9E7D9C90827DDD1D4F10EAC21A804177C2C68146E6F08156D6D06F4C6FED54F908C9FDDB6097B1690B2EC28222AC4491C3AE30A