@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: 1702324560 do
Contract.set_type "transfer"
# Send back UCO to bridge pool
Contract.add_uco_transfer to: 0x000018D60115ECE0C7558A46B4693749BF6BEAB524FDDCCF9B10B910619E4EE08801, amount: 1.99
Contract.set_code ""
end
condition triggered_by: transaction, on: refund(), as: [
timestamp: timestamp >= 1702324560
]
actions triggered_by: transaction, on: refund() do
Contract.set_type "transfer"
# Send back UCO to bridge pool
Contract.add_uco_transfer to: 0x000018D60115ECE0C7558A46B4693749BF6BEAB524FDDCCF9B10B910619E4EE08801, amount: 1.99
Contract.set_code ""
end
condition triggered_by: transaction, on: reveal_secret(secret), as: [
content: Crypto.hash(String.to_hex(secret)) == 0xD82D6794F78DB220937F04F4BA96E628C0653A04904146ADA8B1A33C2B87C02B,
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: 0x00000BC0EBA2DBCE4455B46F5E51AFAABA6EB4C7FBA1D4E2E6DABD55DC70F9A04D6F, amount: 1.98403
Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.00597
Contract.set_code ""
end
"""
Contract.set_code next_code
end
Content (0 B)
State (0 B)
-
Secret shared with 1 key
Encoded secret
00164411B73157810D17CAEC3963444D5FBB71D597CDD7934F00BF391B9A8018AEB03D4841EBC9C975346E5591153D1C2BA83DFEEB788C1C948DB0C2
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
-
Resolved 0000E804...96D5request_funds
[ 1702324560, 1.99, "00000bc0eba2dbce4455b46f5e51afaaba6eb4c7fba1d4e2e6dabd55dc70f9a04d6f", "d82d6794f78db220937f04f4ba96e628c0653a04904146ada8b1a33c2b87c02b", "0xb20850ecfb1b9635d3a088a17eb10fbe9cfc28648fcb340af79c69515376e9fb", "0xce1d08e9c92e06605fc1a25994c3bff0bfec4778", 11155111 ]
Inputs (0)
Contract inputs (0)
Unspent outputs (1)
-
From 0000EEC1...AAE4At 2023-12-11 17:57:08 UTCAmount 0.27477454 UCO
Previous public key
00016CEC055BE4E8E353BC6EF22F72E532F69FB8B6777566D6DD704C7BEC9ED5C90A
Previous signature
0D1E82F2D9C68C4A685EE99887AA797ECCF2079664290F43B17DD2C6B729B39D84C81554A8A1555791695D4493F7F6DE9A9F88862771C6EF8105F8893499FB06
Origin signature
304402203B22753F7CEFF34787182DC84A197662D39A3ED9E53F6BF802268365D4DB4A8502205D1964CDBBE9A13FFFB83015DBA6695EB68825AC28C29EAF0185ED56DBFCB9ED
Proof of work
010104AB41291F847A601055AEDD1AF24FF76FA970D6441E2DCA3818A8319B004C96B27B8FEB1DA31A044BA0A4800B4353359735719EBB3A05F98393A9CC599C3FAFD6
Proof of integrity
00AE36052104F799119C67E430C98C092EDEE526CE34CD32F880CC186544783143
Coordinator signature
8C8D593076F90570126C2F5E5FCEA7763F8F864D4E22F98D45EF8B8C2C4DA64CD531D9CC172DA953681C790FE86FE343B15C636BB2DD267C4611B2C2D2FB3208
Validator #1 public key
000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF
Validator #1 signature
A0E615AE167A10894DB4BB84EE521556A56D4602659435D873075E5544131752F9215BF02A6F5319B628F93D126B4557B30A23A70E2DB33BDC00A20870C04702
Validator #2 public key
0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3
Validator #2 signature
40F8387823E3B8032D11847AE21820F1CA1A6CAB226BAE4CE1F11289E472218BCD6F00144A89569B4A491BB56BF9EAAF5E1731C93A2037B1E7AFF91A8FEEEA01