@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: 1701319320 do
Contract.set_type "transfer"
# Send back UCO to bridge pool
Contract.add_uco_transfer to: 0x000018D60115ECE0C7558A46B4693749BF6BEAB524FDDCCF9B10B910619E4EE08801, amount: 29.76045
Contract.set_code ""
end
condition triggered_by: transaction, on: refund(), as: [
timestamp: timestamp >= 1701319320
]
actions triggered_by: transaction, on: refund() do
Contract.set_type "transfer"
# Send back UCO to bridge pool
Contract.add_uco_transfer to: 0x000018D60115ECE0C7558A46B4693749BF6BEAB524FDDCCF9B10B910619E4EE08801, amount: 29.76045
Contract.set_code ""
end
condition triggered_by: transaction, on: reveal_secret(secret), as: [
content: Crypto.hash(String.to_hex(secret)) == 0x0C698A946FBEB931238BC58BC7A2C1BFE8CCC0062D8D7E56C0182A426DA585DC,
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: 0x000052DBB0394202F5E1A0290DC1595870AC160515BE80781452FCB0A205644F801B, amount: 29.67116865
Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.08928135
Contract.set_code ""
end
"""
Contract.set_code next_code
end
Content (0 B)
State (0 B)
-
Secret shared with 1 key
Encoded secret
75459718FD891951F08C589C905E423E8DD7577498673DD3685BF00E09D2AAD2F8030FF114B70BA96D150353187800B54A816C7F8ED6EB692997AE56
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
-
Resolved 00004033...8397request_funds
[ 1701319320, 29.76045, "000052dbb0394202f5e1a0290dc1595870ac160515be80781452fcb0a205644f801b", "0c698a946fbeb931238bc58bc7a2c1bfe8ccc0062d8d7e56c0182a426da585dc", "0x4ee390fd38367a5e37971499d14c3c7a15b98dce192188a7b42fbe3e05355827", "0x295f548d118b051a094f50a5cd1741da2790b445", 11155111 ]
Inputs (0)
Contract inputs (0)
Unspent outputs (1)
-
From 0000442A...DEC2At 2023-11-30 02:43:22 UTCAmount 0.25427498 UCO
Previous public key
0001ED5D8F6D6B9896223859CF7D43B27CC9344F775184F92E156D3F99B2CB2B5150
Previous signature
E538FDE65BA2274F0CB5FB16EAD21B866DD3B0FD2BDD6A2EC1DC9DF08B2C89E705029E0FAA395092CADFB4807BB17B6FF21879839EBE4B060FCC680BDB9EBE0A
Origin signature
3045022100874B7D17A430A65E061EE46C317D350525E7EC3BA05FF15A6EF03D9F3B9E6C3A0220189AC65C97285CE143A2A3CD1AB146A80D2C5FB8AD16B6B7FFFDE8AD17DB9CEB
Proof of work
010104AB41291F847A601055AEDD1AF24FF76FA970D6441E2DCA3818A8319B004C96B27B8FEB1DA31A044BA0A4800B4353359735719EBB3A05F98393A9CC599C3FAFD6
Proof of integrity
00E8599BC7992DF815E57ABF75E915AF3D0D3D629ED626C4579C676F828839388A
Coordinator signature
4CCD33534C099C450EC1C7A3FDEE1E4C02EB3D8E196088DBB9D9A2198A7F92831A2003C1FB4D2C9C9FBC8FC319D1567BBB6939715C08E6BD292FF36139EC4309
Validator #1 public key
0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3
Validator #1 signature
3CCEB4CCCF84903EC40B7961D7CF076A37113C2E96C4A45B9E4D001048E048A85E4AED1CD9103D1A2B73E36D28C52F6C97DCCF5512DEBA2464B722F04094A006
Validator #2 public key
00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947
Validator #2 signature
03FF0F83CDABEADA067E0668F358F440007CE9BE437C9828863992FF88AEE4C92D6BFE8F919513F3A637724B07D802A6823E29D38F10C6C04A0038FD3B02C60C