@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: 1702110720 do
Contract.set_type "transfer"
# Send back UCO to bridge pool
Contract.add_uco_transfer to: 0x000018D60115ECE0C7558A46B4693749BF6BEAB524FDDCCF9B10B910619E4EE08801, amount: 0.4975
Contract.set_code ""
end
condition triggered_by: transaction, on: refund(), as: [
timestamp: timestamp >= 1702110720
]
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.4975
Contract.set_code ""
end
condition triggered_by: transaction, on: reveal_secret(secret), as: [
content: Crypto.hash(String.to_hex(secret)) == 0x3CCB35E7F25F42C300D6E928B4B2AED4CC5023EBA346F680E41C357FCE3CFD34,
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: 0x00003684E37F30AFF213A83B7F912C3DC8965D03FA1BA2A716C39736EDC292C29F07, amount: 0.4960075
Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.0014925
Contract.set_code ""
end
"""
Contract.set_code next_code
end
Content (0 B)
State (0 B)
-
Secret shared with 1 key
Encoded secret
B9BE55A85163FA730E319C1DD81673DCDD2963C294230750875B50B39881FA7AAF71B195CC01A553C4BA8052724B24942ED8A09E2F046BA71D43A9D6
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
-
Resolved 0000B739...595Crequest_funds
[ 1702110720, 0.4975, "00003684e37f30aff213a83b7f912c3dc8965d03fa1ba2a716c39736edc292c29f07", "3ccb35e7f25f42c300d6e928b4b2aed4cc5023eba346f680e41c357fce3cfd34", "0x965aa005dbf9135a91ef5cb487ce653da4aa06d74485747f519206c573c65e4b", "0xb4d7fe767aec0131fe471fee3b452e4e3aaf4ce1", 80001 ]
Inputs (0)
Contract inputs (0)
Unspent outputs (1)
-
From 0000413F...F1B2At 2023-12-09 06:33:35 UTCAmount 0.25945896 UCO
Previous public key
0001B535CF6E7F29B56289E93CD711F0C9A9E7E5671E73118975C666FA9856C5DDC7
Previous signature
240FCBD091D980E220720940438C7DD48DD680B41620ED78BB53130D52530C235B4641ADE74BD8D178BFA7A623D4D66FF03FBF4BCA3C0BA0E69E2216BBB5C30E
Origin signature
3045022100931C903245EBBBAC296D384F12BE380744E4C16EA7591FEA5D2C23A9CBE5E8F002207CCA17BB8FB71522638200C3D8BFCA8D95184950778C7F21921059BF56CC4DE2
Proof of work
010104AB41291F847A601055AEDD1AF24FF76FA970D6441E2DCA3818A8319B004C96B27B8FEB1DA31A044BA0A4800B4353359735719EBB3A05F98393A9CC599C3FAFD6
Proof of integrity
00571CE04E5BDB4DDC9DCFA8EC2CC1C458D5AEDA97C5776A7EEF8BA717E381B620
Coordinator signature
9FABAFA43227BB782C4DBC3651DA495B9ECDE9D50B8FB69288BCF5D5AA6FE8F23D35AAA23CEF5395F3732863F1E68B25C3495DA408476DCDE9EC1B5C48FEA60C
Validator #1 public key
000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF
Validator #1 signature
EDC7839BF8B1228EFA5715C6ACF5157C10F4A2BC07118CDCC27A047B55E845352912D8252CD9FAB9F5D321FC3AE8296CC100C6527F3A8CC0D4E20A094C428407
Validator #2 public key
0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3
Validator #2 signature
D06F2FF7A6DA6E2899AD4A9ABCE532A7D39657DE14FF6C589DDE5EEC8C2FD76276E3F00E2657F1508C7ABE3121092C945D1530CE260829991FCD9CEA59886704