@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: 1701824820 do
Contract.set_type "transfer"
# Send back UCO to bridge pool
Contract.add_uco_transfer to: 0x000018D60115ECE0C7558A46B4693749BF6BEAB524FDDCCF9B10B910619E4EE08801, amount: 1.99
Contract.set_code ""
end
condition triggered_by: transaction, on: refund(), as: [
timestamp: timestamp >= 1701824820
]
actions triggered_by: transaction, on: refund() do
Contract.set_type "transfer"
# Send back UCO to bridge pool
Contract.add_uco_transfer to: 0x000018D60115ECE0C7558A46B4693749BF6BEAB524FDDCCF9B10B910619E4EE08801, amount: 1.99
Contract.set_code ""
end
condition triggered_by: transaction, on: reveal_secret(secret), as: [
content: Crypto.hash(String.to_hex(secret)) == 0xC5E7641F659F218EF05D72B0CD999946D7714654601422998AAFD8BBC9DE6FB7,
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: 0x0000BD22CD5903A6579840451F0BCD98CCD93F4366F5A8E6893717D913FC6F9772CC, amount: 1.98403
Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.00597
Contract.set_code ""
end
"""
Contract.set_code next_code
end
Content (0 B)
State (0 B)
-
Secret shared with 1 key
Encoded secret
39A466FBE2A1686DCA586C7E85C326F442A73A3E24EF464A0076EE542EB1108D1D6CCC2EE6BDBD4676516FDAE8DFFC2C8C5ACAC479AFC19FAED0DA2F
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
-
Resolved 0000C89D...A0FCrequest_funds
[ 1701824820, 1.99, "0000bd22cd5903a6579840451f0bcd98ccd93f4366f5a8e6893717d913fc6f9772cc", "c5e7641f659f218ef05d72b0cd999946d7714654601422998aafd8bbc9de6fb7", "0xbab8b44c0b3f4ad454ab85e94881a6480eef7b9ddf7edf9f18d5e9e43ec2646c", "0x191e35168e5c3866f20199f5cd892d21a73b3b00", 11155111 ]
Inputs (0)
Contract inputs (0)
Unspent outputs (1)
-
From 00001ED7...4D49At 2023-12-05 23:08:16 UTCAmount 0.26080948 UCO
Previous public key
00015599923C1E03FA48BEE8CD8D6DECDB3A597434FF5440856FB9BD95915BAA9167
Previous signature
AADE769A22436DB71C3061F98114A16C2416702EFF5C2CA7DCD462CC1AE60406A77AE20EC5955385228B6901BA3077E2D1C994716ABD8F396B337F8F47812D06
Origin signature
3045022100D3C7FF0C837CAF938AC8DE8BC19BF7EE4BD0AF35956AB042BD6A74BB39C3E04802205003BD0D67C32BEEE2DD226F3884C6F442246E5D7FE246BD3E106E4E10961153
Proof of work
010104AB41291F847A601055AEDD1AF24FF76FA970D6441E2DCA3818A8319B004C96B27B8FEB1DA31A044BA0A4800B4353359735719EBB3A05F98393A9CC599C3FAFD6
Proof of integrity
003C8933DE5F4940130747AEDF36BA7AF70A8E0117C84605A14AA475F4BEB0B2CB
Coordinator signature
686D8E3CBD16D7F54D1D34E2A324AE3D780FE702D67F48ADE89B94DD6FB6E96081987F9726B04A403B763E8DAB9C423C061CA7060AF19B2C8004349253791D0C
Validator #1 public key
0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3
Validator #1 signature
E933AACF7F8982EF17DFECAE2953D138F6F8EC4A0A77CFC2D7DE17514AB97ECED95C591CEB93FDDEA1F9813A32AFB5D5049A4BD6639210D56C32A058DB87170B
Validator #2 public key
000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF
Validator #2 signature
B0983210F78FA69980BE7259BE5B83C89A15D5DE673761AEF374CEA95A7A47D27F4B9F037F804CB0001FEB3FD8C95E9B7269ECC7F07C1CB5BF01601295F2FA02