@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: 1701544260 do
Contract.set_type "transfer"
# Send back UCO to bridge pool
Contract.add_uco_transfer to: 0x000018D60115ECE0C7558A46B4693749BF6BEAB524FDDCCF9B10B910619E4EE08801, amount: 0.995
Contract.set_code ""
end
condition triggered_by: transaction, on: refund(), as: [
timestamp: timestamp >= 1701544260
]
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.995
Contract.set_code ""
end
condition triggered_by: transaction, on: reveal_secret(secret), as: [
content: Crypto.hash(String.to_hex(secret)) == 0xDFFFF954F3C099286D0D2DDE81DDBBC87DF5C4617B3971F7C5555019971C7E59,
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: 0x000024BF9D5BCBD7F48E4EA13B91004B20B71CC76611A12A74FFC29809EB3C1FF2F3, amount: 0.992015
Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.002985
Contract.set_code ""
end
"""
Contract.set_code next_code
end
Content (0 B)
State (0 B)
-
Secret shared with 1 key
Encoded secret
A5E893BA0AF896A01854FE1ABBF164FA61D26883D491143609475BF18A94AC00447CCDCB0AF4644B69E2984018D9C92F32A248ABEB8613B7E412BBBC
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
-
Resolved 000057F3...C4D8request_funds
[ 1701544260, 0.995, "000024bf9d5bcbd7f48e4ea13b91004b20b71cc76611a12a74ffc29809eb3c1ff2f3", "dffff954f3c099286d0d2dde81ddbbc87df5c4617b3971f7c5555019971c7e59", "0xb7e2a76b584b3550a71eb7c460f6c85175f91674da9cb365779f9374973dd5d5", "0x2beb322861767a077b6e29e9a9d1ac4ee719f4b5", 80001 ]
Inputs (0)
Contract inputs (0)
Unspent outputs (1)
-
From 0000FAC1...96FAAt 2023-12-02 17:12:32 UTCAmount 0.26138192 UCO
Previous public key
0001F45D64B3687A3E9306B32FF00B9D98FD4428CC81EA37AB258420B187A2A765CA
Previous signature
3C23451D8F0A194889BAF121ACA83FF12529CB50F0E03DAC6BDE1EF3172391F10B6A83D527AFEB5E3FB6D00EEAB7AFAA28DDF5733566505E838A3EA04E2DB704
Origin signature
30440220058F0F0D6954C16245864C7D93B584F1CC805CCC158D33E1E6D85E0A98E7199002203850BDCDAE8A0CFCD24158D9CD32E5D7D9218400C17056C13793148BC51351CB
Proof of work
010104AB41291F847A601055AEDD1AF24FF76FA970D6441E2DCA3818A8319B004C96B27B8FEB1DA31A044BA0A4800B4353359735719EBB3A05F98393A9CC599C3FAFD6
Proof of integrity
004B111E9AFB8299141BEEE17BBD5E69B1A9C2EDAA907C36AF2BC3355541E58CC8
Coordinator signature
5368F0B066E6F97B1546F824C6A8F675AE9D0948366CA12BD0125389971A3C253EE252E6348E6661856287EC6980A898659A9B72B8FC708C576027A2D84A270D
Validator #1 public key
0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3
Validator #1 signature
CB68530C330EFBEA9878A4B7780791AAF68577B5499114CB54DF5096A51BB67ED09A3D653DBCEB8796822AE38474817C559CF054F9F3EE94FBEB931A0B76EF0B
Validator #2 public key
000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF
Validator #2 signature
AF26D42AC960597ABFCE125E4124E3D13DC980000213DE1A445BB31C5C785BF6F095814C7E6C76F27D1E27FEAB0C38260E16BC2EE02E4EF5FD7C4B680EC01F00