@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: 1702283100 do
Contract.set_type "transfer"
# Send back UCO to bridge pool
Contract.add_uco_transfer to: 0x000018D60115ECE0C7558A46B4693749BF6BEAB524FDDCCF9B10B910619E4EE08801, amount: 0.398
Contract.set_code ""
end
condition triggered_by: transaction, on: refund(), as: [
timestamp: timestamp >= 1702283100
]
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.398
Contract.set_code ""
end
condition triggered_by: transaction, on: reveal_secret(secret), as: [
content: Crypto.hash(String.to_hex(secret)) == 0x9CF5E08C485937400BF22917C5368297B0708AF2AB8BAFDE2D6A9D04B749A066,
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: 0x0000B3757ED1AFEFD40EECC9D20EA8860B2E818292618F6F5E65659EE993BF0EF1B7, amount: 0.396806
Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.001194
Contract.set_code ""
end
"""
Contract.set_code next_code
end
Content (0 B)
State (0 B)
-
Secret shared with 1 key
Encoded secret
8D03482BA078BD45E1AFDD4B3E7B30AA794F95D3B8223FA186258C78F2CB1FFAD9900D9FF29B9A67720C94CB7C9C795577909D20853910EC80BD6A46
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
-
Resolved 0000CA83...1D02request_funds
[ 1702283100, 0.398, "0000b3757ed1afefd40eecc9d20ea8860b2e818292618f6f5e65659ee993bf0ef1b7", "9cf5e08c485937400bf22917c5368297b0708af2ab8bafde2d6a9d04b749a066", "0x179de576e9b79476c0402173ffa245d746c4e51b9e7027b5be62409e5430807e", "0x1b64cf0b776396015f032624db4baf865187d7ed", 80001 ]
Inputs (0)
Contract inputs (0)
Unspent outputs (1)
-
From 0000C229...0BDCAt 2023-12-11 06:26:49 UTCAmount 0.27483069 UCO
Previous public key
000144E77A63AFE099C0E959197AECA9EE8931270E412480DAD8B5BA576608779BC4
Previous signature
ACE33E967F7421A91F0A02006E7DEAFA123257D9465FE47D1641FF8007A38FDB88C83B7D8B7C2EF38805C6BCC0DE1978034A7DD043EE8C219EE51AD6D82FB604
Origin signature
3045022100D4CD126EC9465FD304EDB82BA756A507F666A60E1110EEEDC77B2227B0261E3602206A34CE316DABAC13594C89364B373074B11B60577471BAFD9E1644363DE77FDD
Proof of work
010104AB41291F847A601055AEDD1AF24FF76FA970D6441E2DCA3818A8319B004C96B27B8FEB1DA31A044BA0A4800B4353359735719EBB3A05F98393A9CC599C3FAFD6
Proof of integrity
0084D3DFBC67A11E9AE0BFB2A5D3E45EE106399824F982209F9D7A28321D11A6AC
Coordinator signature
1AD9B1EC68FB932DFF4BAE52C8DCA2ACC846DB5A5745C6207B2EFB5CB331E7BD34561A013B795240168246B38D014C576730AF1C65F6A6BF4A6E1A242C43950A
Validator #1 public key
0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3
Validator #1 signature
66F7D4702DB231932B8569346A359B02975546EFAA7AB90F2EF819DE34DEAB5FD15A281B218774C34708E29CAB4930ECEF15F72DE80CEF2B0273C3EA47323F0E
Validator #2 public key
000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF
Validator #2 signature
F7CADDCEC78F3F473DC971AF010265B415BDBEDBD67C8567BA8E199558764A7BDAC6ABF9EB8E2D8A3DD70F510C84E76C45F81788A192DB01D48086028A3D9F02