@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: 1702026540 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 >= 1702026540
]
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)) == 0x4659F59A6C20BBD610AD40C3CAC7C90596D97035555A6B736E59F8A47B7657D3,
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: 0x00005C09BDA141CE65900201C4B2F2E3F3F1CDDCFD6AD046842D9E917C5D0997E32F, 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
82CC1139A5324F2FF18C10D2FD688A47805CE2E9B31A9AF0C6E73F3B65CDE6AF1D8B89AE963CCD94DFF20A0A482156FC7AC15BB543909B5DFBB3C5AF
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
-
Resolved 00004F42...917Crequest_funds
[ 1702026540, 1.194, "00005c09bda141ce65900201c4b2f2e3f3f1cddcfd6ad046842d9e917c5d0997e32f", "4659f59a6c20bbd610ad40c3cac7c90596d97035555a6b736e59f8a47b7657d3", "0x28089bb7e10b5246c6b4b133d362798841be18b364f08d45314eb730c4490d24", "0x0d6012b8f1983a38faa1769af8dd68786139defc", 80001 ]
Inputs (0)
Contract inputs (0)
Unspent outputs (1)
-
From 0000BDE6...E83AAt 2023-12-08 07:10:24 UTCAmount 0.24236446 UCO
Previous public key
00010ECF30844744A4BFAE3B2469237F95E2A284B165EE1069423BB47A4C0A5298CC
Previous signature
E49B24504E85B6D84817E9A2C4B39F6570D5466CD7ED5E0E0C87F3519DEB4B9BB284B49B805D278648111CA32CECFC71465FF7268F7FF459B7EE480F7FB6A50F
Origin signature
30440220056BA93A6B09FDE8CE2638918F259DA51FE29C3CE4DAF1BACCF0C677AD0AA0B202205BD028C34B822C9E287A34E94ACDF2917190AFAFE3CEE2BE1987FEA1B7432CF7
Proof of work
010104AB41291F847A601055AEDD1AF24FF76FA970D6441E2DCA3818A8319B004C96B27B8FEB1DA31A044BA0A4800B4353359735719EBB3A05F98393A9CC599C3FAFD6
Proof of integrity
008C7C06A15FBD111C4B31B72A3CB2BB2D402B5C0AF55D2A85C7A0B99FFCED3002
Coordinator signature
595C49A0859AB6260437C379867AA94D94F07A1F7C186061264205A29F4738A1DA78291AF17038077410B8EA40640297CD0EC1D62A18E7DCC423796D9A207C0E
Validator #1 public key
000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF
Validator #1 signature
E1D6F846CE5748CCC28D19B85E1498ABC15A79853C2AC443D13E78373E53CCBB17871E6F6C4CEA9E7AA8405E0E44BA25F1E9C916E385490EABA95C6E70BD4501
Validator #2 public key
0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3
Validator #2 signature
3934165562EF05CDF0507E8B4CE7427A9981989BA340C75D554BE712249AE2EE04FFC2C777CE203DF191B8FFEEA14C3A2A1C4C5393EC1D2EDE72FE6803736C07