@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: 1702539000 do
Contract.set_type "transfer"
# Send back UCO to bridge pool
Contract.add_uco_transfer to: 0x000018D60115ECE0C7558A46B4693749BF6BEAB524FDDCCF9B10B910619E4EE08801, amount: 1.194
Contract.set_code ""
end
condition triggered_by: transaction, on: refund(), as: [
timestamp: timestamp >= 1702539000
]
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.194
Contract.set_code ""
end
condition triggered_by: transaction, on: reveal_secret(secret), as: [
content: Crypto.hash(String.to_hex(secret)) == 0x0CC129661C86832B8F8BB6E78A81C97A479DABEDF754446C0FF1A65AF22199DD,
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: 0x00000415C63E8DB898974380DF06B9E013FCE0C2D3D8CD97D63901351BA96079B47C, amount: 1.190418
Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.003582
Contract.set_code ""
end
"""
Contract.set_code next_code
end
Content (0 B)
State (0 B)
-
Secret shared with 1 key
Encoded secret
F025C292D75B67814A68122747F843638F759734FC4F66BE3CDAF29A294CA6A8DAB18E3D3D9744917CD5C9BC3FA90CC6CFA60E275E9852CB62F8DED3
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
-
Resolved 0000301C...41E0request_funds
[ 1702539000, 1.194, "00000415c63e8db898974380df06b9e013fce0c2d3d8cd97d63901351ba96079b47c", "0cc129661c86832b8f8bb6e78a81c97a479dabedf754446c0ff1a65af22199dd", "0xe950e32d1b777b846659f00951cde486d6c20d911a112d55b9ea7edbc3adef1c", "0x9fc2f7edee294b9da6b92e32bde65aca5c307fb4", 80001 ]
Inputs (0)
Contract inputs (0)
Unspent outputs (1)
-
From 000007C4...6628At 2023-12-14 05:30:46 UTCAmount 0.26918657 UCO
Previous public key
0001EA5C3B59C02FE324CA8A50F6765F629CEBFB2480B4D5AEEFE849B1B74417354E
Previous signature
8F61FB63C1F4CE3AA6617E2808F5873489361E56CB8D78C4BD378A1E1F060081DD5486B94A1756C06269BAFE2D3DD9B988DA3B1EC952859E8C9B6A0C96BE1501
Origin signature
3045022100B475C5541098C54CA24700F6D31A820ECE018EF2929B22D854789473B574DD1B02202B93D113D4994F274CA75CFDA17FE8A6FD0395EFA1AC140A03AB77661AA11AA9
Proof of work
010104AB41291F847A601055AEDD1AF24FF76FA970D6441E2DCA3818A8319B004C96B27B8FEB1DA31A044BA0A4800B4353359735719EBB3A05F98393A9CC599C3FAFD6
Proof of integrity
00F034B914A1D6929207BB8192A52985D4CEA9795BB7292EC882285B77BFF35590
Coordinator signature
FBF7E6603D05002FB473D7B9CDFA4495EA9FB52675E80DF8F1190AD1286487100717B739C1C757EB5C186C2079C3BDC8B600DACE5A7CB66562DC9CBC7CAC620D
Validator #1 public key
0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3
Validator #1 signature
67CE8F3F556708AE73EF1DBB79E60D88A8CA924E30F651041CE6ED8A48E6650ECCAA5676EB5DFD428F18B4FE62746C8E63AC31A487D1D2A64E21835FE4687B0D
Validator #2 public key
000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF
Validator #2 signature
D984E0F4CEB2BC00FB68CC20A8070B90D0FF01D2AC518791B7B770FB7296466C53F903C49885F071D83B39B2CAC965A3603A6B354DD4F769CE0C36C5C9AA8F00