@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: 1701941280 do
Contract.set_type "transfer"
# Send back UCO to bridge pool
Contract.add_uco_transfer to: 0x000018D60115ECE0C7558A46B4693749BF6BEAB524FDDCCF9B10B910619E4EE08801, amount: 1.4925
Contract.set_code ""
end
condition triggered_by: transaction, on: refund(), as: [
timestamp: timestamp >= 1701941280
]
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.4925
Contract.set_code ""
end
condition triggered_by: transaction, on: reveal_secret(secret), as: [
content: Crypto.hash(String.to_hex(secret)) == 0x6D4C6F559DA65516C630B2F46E7036BEF73C3CAD18C25D7C48CA8DCAB3C6A98D,
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: 0x0000854662F2FF47226AF328EFCE8A16A518F2F9F0225DE5CF5FE431071217474BB9, amount: 1.4880225
Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.0044775
Contract.set_code ""
end
"""
Contract.set_code next_code
end
Content (0 B)
State (0 B)
-
Secret shared with 1 key
Encoded secret
98E6076850B1ECD143F77896BBC010AE18255571EE966ABBE798D5828B207B38F165F747862C32DF7B946523E6865C0C82BF8BC1BF05E0E84A7B5F05
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
-
Resolved 00001586...85F1request_funds
[ 1701941280, 1.4925, "0000854662f2ff47226af328efce8a16a518f2f9f0225de5cf5fe431071217474bb9", "6d4c6f559da65516c630b2f46e7036bef73c3cad18c25d7c48ca8dcab3c6a98d", "0xda36f5b109caf33ac9cbdc730685ff9971c4ea252c0d3c97cf9ef5f41ebb3014", "0x9ee458c8514977df930b5bae20f450c6df4c676b", 80001 ]
Inputs (0)
Contract inputs (0)
Unspent outputs (1)
-
From 00003613...12DDAt 2023-12-07 07:29:22 UTCAmount 0.24983923 UCO
Previous public key
000177E8DB9C2C89E93A175A41423F7AD00EB6311899A3A3C19139B17E9B47A6D0A4
Previous signature
993124B0DAF39E9872F4C03209AB0B391D2928157BA6AAE2D7C48701F460F97BD6BC8106C5782737DDD584BF873F4AB52619637F006DEBA10E9E4428A8B9570D
Origin signature
3045022100981079CA07E9AA8514D0C1C2F438E9E2B2712FD15ADF72AAD5300647C0CACEF10220659ED1183753D12609682DF3E84E10A471B9D20B6B85A9993DCB2ECB962C7027
Proof of work
010104AB41291F847A601055AEDD1AF24FF76FA970D6441E2DCA3818A8319B004C96B27B8FEB1DA31A044BA0A4800B4353359735719EBB3A05F98393A9CC599C3FAFD6
Proof of integrity
00D96E2AEF18F87E785029307EF6150B413351DAE572F6DB7D52CFFA97E79DF9F9
Coordinator signature
712493E87DEC57BCA0731719863A80CF10157323AB4E958FF040D5B81D8EB43CFBA41CBB4C4CB85398BA9FF36621182B7D20B72AEACD06A9C08ED3314893990A
Validator #1 public key
0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3
Validator #1 signature
13A682053A5534783F8AE5DE989745D8F7125EA08786406C0EAF1C2CA7C46297CC78FB483EAB3B92072534D7FD7A5D9F4F57008EC7F988BB8448E9A16BA6EB03
Validator #2 public key
000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF
Validator #2 signature
1E63DD6A928C5E22A3F5DC58FCD3F7E772F484CCC66AEEB95A2572D293EB882E0CEF4A0D39EC5DF9AD8936C4BA1A49C521EDF47CA3726076541DE9E04C3CFD03