@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: 1701974340 do
Contract.set_type "transfer"
# Send back UCO to bridge pool
Contract.add_uco_transfer to: 0x000018D60115ECE0C7558A46B4693749BF6BEAB524FDDCCF9B10B910619E4EE08801, amount: 4.960075
Contract.set_code ""
end
condition triggered_by: transaction, on: refund(), as: [
timestamp: timestamp >= 1701974340
]
actions triggered_by: transaction, on: refund() do
Contract.set_type "transfer"
# Send back UCO to bridge pool
Contract.add_uco_transfer to: 0x000018D60115ECE0C7558A46B4693749BF6BEAB524FDDCCF9B10B910619E4EE08801, amount: 4.960075
Contract.set_code ""
end
condition triggered_by: transaction, on: reveal_secret(secret), as: [
content: Crypto.hash(String.to_hex(secret)) == 0x14F0C24C4130856EA4A0BA35DED4073453EEE52C363ABC6747FAD5932D910CE9,
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: 0x0000E3C9421EB5DBB5765DC3E2D9C451DAD5B43D545CBF6A3359726D321FBAE5CCEB, amount: 4.94519478
Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.01488022
Contract.set_code ""
end
"""
Contract.set_code next_code
end
Content (0 B)
State (0 B)
-
Secret shared with 1 key
Encoded secret
FC42196BB590FE8EDB139234545F832B28DF603C213E59B739F1957B5E24D1F251968B119B0A35E87DE3661B4A509D217CEE4BC8E47CA9A6934F9410
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
-
Resolved 00009265...3A15request_funds
[ 1701974340, 4.960075, "0000e3c9421eb5dbb5765dc3e2d9c451dad5b43d545cbf6a3359726d321fbae5cceb", "14f0c24c4130856ea4a0ba35ded4073453eee52c363abc6747fad5932d910ce9", "0x0dfbfc2bd71737fef3af626133af3aed1ebc58cfb37a3488358011e16202ea09", "0xbdf5cfbd3cdf5e7c40a5849d166bd48510a516ac", 80001 ]
Inputs (0)
Contract inputs (0)
Unspent outputs (1)
-
From 000028DF...732CAt 2023-12-07 16:41:05 UTCAmount 0.23974698 UCO
Previous public key
0001FFD455518972FD7F8A114C81C7B9FCBEA5E646A5BB8AB8581F5534152BB77EDD
Previous signature
C7E08BA33EDAC58FD9EA032C79DBE782067FE97907CF1D074870AF439185A3FC21C11D798794E671A3EEBB7D9F6DC5178A7EA69E934B21A937DF0CC40FC13609
Origin signature
3045022100B6E78835B52AB62ABC982C0785D3BF62BDE3D2B81525A930CADA73267BF19DC00220434EE860FBBA534C2B419DD9A748CA9637BD0972B4E7CD910D065A67723114BD
Proof of work
010104AB41291F847A601055AEDD1AF24FF76FA970D6441E2DCA3818A8319B004C96B27B8FEB1DA31A044BA0A4800B4353359735719EBB3A05F98393A9CC599C3FAFD6
Proof of integrity
00C7A4286C4E534A99EEF368648766BAF6E0B8B2761B0C4CFDC475A257794DA63E
Coordinator signature
58FEDA18991E9B8D39551B0D0ABE52D4BA40E32982AB3A14F10F239EEF03F3FA0D2826AF1B2715624EABE40CE0AF5AA6F1616D60BDD760A3F6977BBE79E6350E
Validator #1 public key
000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF
Validator #1 signature
02D421D30E36253B155E26519042917436C8DB412D5BC264131639F426C9EDA0EBEC596703C93534DBFCBACDF6169BBE68CE61C35F7EE5C0C9DF7792FC1A6E03
Validator #2 public key
0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3
Validator #2 signature
238F364083D2A2F247F30884926DB16AF8C671939FC9FF0697E8EFB07660BAF692D73E9287B6914C72BBA730DA9335CD2B7C12BFA5E9304E4152D63C876A9E02