@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: 1701296580 do
Contract.set_type "transfer"
# Send back UCO to bridge pool
Contract.add_uco_transfer to: 0x000018D60115ECE0C7558A46B4693749BF6BEAB524FDDCCF9B10B910619E4EE08801, amount: 24.875
Contract.set_code ""
end
condition triggered_by: transaction, on: refund(), as: [
timestamp: timestamp >= 1701296580
]
actions triggered_by: transaction, on: refund() do
Contract.set_type "transfer"
# Send back UCO to bridge pool
Contract.add_uco_transfer to: 0x000018D60115ECE0C7558A46B4693749BF6BEAB524FDDCCF9B10B910619E4EE08801, amount: 24.875
Contract.set_code ""
end
condition triggered_by: transaction, on: reveal_secret(secret), as: [
content: Crypto.hash(String.to_hex(secret)) == 0xFC1C592F24C32ED9E71924E57A43E8E66C3794E779558F4BDA994B511DC0C13F,
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: 0x0000B2EB08BF3D472A2E4141D37FD3DA8B61D0E58246B4F37436A5404C6151BE7FFD, amount: 24.800375
Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.074625
Contract.set_code ""
end
"""
Contract.set_code next_code
end
Content (0 B)
State (0 B)
-
Secret shared with 1 key
Encoded secret
E69038D866837B29874648B741844C6F4409BACAEE19271CC3D448359FC416AB2AB273C07A0B8CA53C8C643A4EEA6F3EC3136FF0F38F9968AE645E64
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
-
Resolved 00009669...2DD8request_funds
[ 1701296580, 24.875, "0000b2eb08bf3d472a2e4141d37fd3da8b61d0e58246b4f37436a5404c6151be7ffd", "fc1c592f24c32ed9e71924e57a43e8e66c3794e779558f4bda994b511dc0c13f", "0x0c0545ce6af1c4fb839c7a9268ff298db7293583fcda9d92e2f93f63a7ca3351", "0xa694d4056a8ffac35e99e643fce68dfe1c68ae33", 80001 ]
Inputs (0)
Contract inputs (0)
Unspent outputs (1)
-
From 000063AB...90EEAt 2023-11-29 20:24:30 UTCAmount 0.25672453 UCO
Previous public key
00019072E0920C2E92568F076D8C3CE1F71E4AD38D88934B7A40913135934E0DA960
Previous signature
4D694EB0873058162D526663A377DED07E42C590200AB5425F9B5026ED7A1E5BF89B51E073DD75FD8C4F019C74793313B12E682A951604E09CF5FB55FC600A00
Origin signature
3044022068EAC7716E8A4D66A9B1B2B46AACEF86067AED90590C3331DC2E60C6C6BC9DFB02205DFD93BEECD8CBDF411BBE19C2A3FC7F5CDCA0196CD58C79670E52F99B87CC98
Proof of work
010104AB41291F847A601055AEDD1AF24FF76FA970D6441E2DCA3818A8319B004C96B27B8FEB1DA31A044BA0A4800B4353359735719EBB3A05F98393A9CC599C3FAFD6
Proof of integrity
004C6CA315AB1B6ABD9ACB2823300EE8E2D2D3EA1A0D068EE5629767655CC910B7
Coordinator signature
1CABD1E87A98C535C8AA6C2085415742A283D7C48F9324A02B802274A28DAF64353F4405E8F995E3463812F60C22360EB8837D1B51EB1BAFF8A58FB66E980406
Validator #1 public key
0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3
Validator #1 signature
69034E07F1D8544B3C2EA1D30B379D5C50B6C21D1CF29D3962B9B795C6852EBE5852BA7DD28979E035D722FB2AFCBC89F26F21E51575D9F83A435BB4110F2200
Validator #2 public key
00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947
Validator #2 signature
29C36B6246C29FEC900E833E5BE61159700EC168059BFCCDECEA95FF534B824362E96A9D5597FF55FA5B8828619E0B881DD8310F88447AEC4DAABFA1BFD8B902