@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: 1702538400 do
Contract.set_type "transfer"
# Send back UCO to bridge pool
Contract.add_uco_transfer to: 0x000018D60115ECE0C7558A46B4693749BF6BEAB524FDDCCF9B10B910619E4EE08801, amount: 0.64675
Contract.set_code ""
end
condition triggered_by: transaction, on: refund(), as: [
timestamp: timestamp >= 1702538400
]
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.64675
Contract.set_code ""
end
condition triggered_by: transaction, on: reveal_secret(secret), as: [
content: Crypto.hash(String.to_hex(secret)) == 0xDC2042041A2B30A732DD186737E7A70E48B480AF5BEAFEFF9693B040063ACA2D,
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: 0x0000FB892DDE25B9A9921DEADFD1148065E0DB0DF04DED5355F3F5F3354552935B45, amount: 0.64480975
Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.00194025
Contract.set_code ""
end
"""
Contract.set_code next_code
end
Content (0 B)
State (0 B)
-
Secret shared with 1 key
Encoded secret
038909F9FC658482CD213906999ED2CF6839740DCC53CBDFC56572F457B76654A59FE874845BD260C8C8BB44C42660EB280C89B40685FF6D52DD1C3D
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
-
Resolved 0000B1FB...3E41request_funds
[ 1702538400, 0.64675, "0000fb892dde25b9a9921deadfd1148065e0db0df04ded5355f3f5f3354552935b45", "dc2042041a2b30a732dd186737e7a70e48b480af5beafeff9693b040063aca2d", "0xb4fe0f449af245a9844af1e7341178b779932dccaa4a76e9a737ae2f0300db91", "0x3f5173ebdb031949c5e2d147c320a60ef2b8a178", 80001 ]
Inputs (0)
Contract inputs (0)
Unspent outputs (1)
-
From 00007824...C518At 2023-12-14 05:20:43 UTCAmount 0.26947306 UCO
Previous public key
0001018705C758911DF58421ED45541F4A53EDBA6327DDAA23BF7E830A50D745FEED
Previous signature
D9F5F9EF16CA8DE828F538847E3E159D125D8DB0B5F5647B76BE7F57F4F43048BAFCF521CC8EB10E7E272904DCA6FC25F2ED90FBAE94452FF4EB593E6B108901
Origin signature
304402200AE2A95AAFC57197D0179634655E09141EFBC503967B44B4D77A0F18CA2EBCA80220568884E5ABF939E0DCF38675A3BECAC76C8A31DC1D35C88A53239160C48D3951
Proof of work
010104AB41291F847A601055AEDD1AF24FF76FA970D6441E2DCA3818A8319B004C96B27B8FEB1DA31A044BA0A4800B4353359735719EBB3A05F98393A9CC599C3FAFD6
Proof of integrity
0018BA99F3611BDA04C9A46E02412200D05D39B8C8F2DEE9B9F6B08340CFBB5F21
Coordinator signature
EF67687B9364147D68095F65D33CD81DBB3D881F639742C0AA8D998901773762FD670A61651EDA8B312F8AC6D234E12CA7D9153F94CA2F6C4B520A73889F2902
Validator #1 public key
000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF
Validator #1 signature
820CBA3C912AD899A7428FDFDBD5C44077CE968A166623537C3C018D88776C5F48C8D51C716F90A3AD9290325CDCBC99DF939BF1AA5A1E410E0910C3D1648D0C
Validator #2 public key
0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3
Validator #2 signature
80B6A91AE652BBBFA0136EC3A5B8E4E071A1B8514B8E66C41D3B8A901BC2323D147B547B20ADB422BAA2A692C7DAD9D8565235D02830FA0099A7418366DF330E