@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: 1701947340 do
Contract.set_type "transfer"
# Send back UCO to bridge pool
Contract.add_uco_transfer to: 0x000018D60115ECE0C7558A46B4693749BF6BEAB524FDDCCF9B10B910619E4EE08801, amount: 1.64175
Contract.set_code ""
end
condition triggered_by: transaction, on: refund(), as: [
timestamp: timestamp >= 1701947340
]
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.64175
Contract.set_code ""
end
condition triggered_by: transaction, on: reveal_secret(secret), as: [
content: Crypto.hash(String.to_hex(secret)) == 0xDF6F9BF1E9AF1F43ED9460AE0BD5160A70CDD6F21557A9ED76C4E15B2B6C00B3,
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: 0x0000290636588E1AA2A069C0094185633D1A04CDE098D3A4E93AD53191B29C223F8E, amount: 1.63682475
Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.00492525
Contract.set_code ""
end
"""
Contract.set_code next_code
end
Content (0 B)
State (0 B)
-
Secret shared with 1 key
Encoded secret
220167259C2F9436B38C2D6D0CAAE96FA176624F9D67005680D978060A69AC1F072BE8F6ADEB40968A23246FE2F329F8A6655C6610D3D0BC735916A0
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
-
Resolved 0000B96A...8FA9request_funds
[ 1701947340, 1.64175, "0000290636588e1aa2a069c0094185633d1a04cde098d3a4e93ad53191b29c223f8e", "df6f9bf1e9af1f43ed9460ae0bd5160a70cdd6f21557a9ed76c4e15b2b6c00b3", "0xa44687b4e0a61bf60cad2bfae098651c5698b5df37012d40b1b7fe376290fb51", "0x5e89755c3b7c35340befd8b036efc10a880b4112", 80001 ]
Inputs (0)
Contract inputs (0)
Unspent outputs (1)
-
From 00001B78...3E25At 2023-12-07 09:09:52 UTCAmount 0.24841064 UCO
Previous public key
00015BBBA29D2350F122CBDD185A2419B66281A21E328042875022D95BC9884D00AF
Previous signature
2D523E362023022CA1C45DD82EF322147A0B04079839A67427EABB53BA0A0A261446582B9364791C6488B3F6D765F61B409B6F67B2A4000535BE8DDCB5759709
Origin signature
3045022100A29027F239CF15790AAA88617F1409E1FBEF6A11CE0A95E983B73D4861226DA2022058DA811600C555C1B152CA0FF44EDA7D022A27F09DDB2582C735733569F08AF5
Proof of work
010104AB41291F847A601055AEDD1AF24FF76FA970D6441E2DCA3818A8319B004C96B27B8FEB1DA31A044BA0A4800B4353359735719EBB3A05F98393A9CC599C3FAFD6
Proof of integrity
0012DB9A9B4AC78DADC8E0968EE71395E97159DDF7E240DA88CA831DED196A1E59
Coordinator signature
24DF7E0E41C1C3962012D48879CEE7840384F0836F370F7C3DC858D2F2F0EFD95E2AD8273F138E798C4F24D9AA73976C0E120CC5D6937D0A37FAF3C581EDAC08
Validator #1 public key
0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3
Validator #1 signature
6824B8479E45557C80EF1CD4180BC68E39E9B5890AE5F67ACE99F6800154699C93CD1EAA1C5258AA0E9D0E220D1FE5B3F1D6FA9833428E5429DFC14485EECC02
Validator #2 public key
000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF
Validator #2 signature
51E5B906907D0081AE9BAB5501ADB522ADE1D0E68D7015290AD5B9790001371E11DF927811DA57CED07C4FE4A5C167F6B6A6777E80C4F2B077573397E9C7B101