@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: 1701458640 do
Contract.set_type "transfer"
# Send back UCO to bridge pool
Contract.add_uco_transfer to: 0x000018D60115ECE0C7558A46B4693749BF6BEAB524FDDCCF9B10B910619E4EE08801, amount: 1.0e-8
Contract.set_code ""
end
condition triggered_by: transaction, on: refund(), as: [
timestamp: timestamp >= 1701458640
]
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.0e-8
Contract.set_code ""
end
condition triggered_by: transaction, on: reveal_secret(secret), as: [
content: Crypto.hash(String.to_hex(secret)) == 0x124EA7C3C202BE5F6F18FBB9A9E0ED946F96A30102952DE72AE8436BAF617696,
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: 0x0000F25C3DF408399FD5CC26D5A53C4081F6D6600B04B5EF4E41836D384F8B84C772, amount: 1.0e-8
# Transfer fee is less than the minimum decimals
Contract.set_code ""
end
"""
Contract.set_code next_code
end
Content (0 B)
State (0 B)
-
Secret shared with 1 key
Encoded secret
9D0E9BE9838643BFD692F575FE3103BE23D1CDD9B1A22372D2167703CE8F758C991EC6C816C86807A597EAD92808105864D8474EEA23F571CEF50130
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
-
Resolved 0000CB28...6E77request_funds
[ 1701458640, 1.0e-8, "0000f25c3df408399fd5cc26d5a53c4081f6d6600b04b5ef4e41836d384f8b84c772", "124ea7c3c202be5f6f18fbb9a9e0ed946f96a30102952de72ae8436baf617696", "0xfbad77559fc362856f522b52af2118d1b7638cda3b6a1634d3bcd165cea9fe9d", "0xe614cac79da2dc6bfef9fa22d6bc6d14b55ed09d", 97 ]
Inputs (0)
Contract inputs (0)
Unspent outputs (1)
-
From 0000B276...2F4BAt 2023-12-01 17:24:51 UTCAmount 0.2623144 UCO
Previous public key
000167DB844BB92D633F38250022BF1C834285BB8FF11B4D91BE9523ADEC37C8EF71
Previous signature
A909D6AA711054A5C79B9E87CF337EB45DB0AF6ADBDB6033901481B1224830709C1AF2E27962951D2116A3F7F0EDB797F76486FEFD49A7EF7379CD856D757C0A
Origin signature
3045022100998B53323D0F283C187EEA2B742882F46BC5A114B6CD34F643CD3109E27D480F022009D231975AC11476AE4058B5D2375EE55C23D280972EE13EC29B4D09902FE08B
Proof of work
010104AB41291F847A601055AEDD1AF24FF76FA970D6441E2DCA3818A8319B004C96B27B8FEB1DA31A044BA0A4800B4353359735719EBB3A05F98393A9CC599C3FAFD6
Proof of integrity
00240C3E860CEA9F531DA839FCC3B53422327A6E6EAC04F1CE7AEB8F9EA6673957
Coordinator signature
838AFF9620271A85CC2596A1A3E109734415CCE1743E9EC87A2AAC1077505A85F5C803907B9575C2417ABDEF772708BD8A507325B05767B057E793428C200E0D
Validator #1 public key
00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947
Validator #1 signature
10C878F14B30D4417735C102D4395A5DDA9F6389F7FFFBEA70F7053163AF728D03EF041D984EE885C7A542009B77CDD244E3450842785F683135239D5FA26709
Validator #2 public key
000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF
Validator #2 signature
A829BA8EF52063919BF1FA940C472FBEDA38D4B02781FAC79FD9E4CBA9DB4D98634A1F0CB657C34D34785A33578C52F18848B748F30F18DE6B1D71D4EF366304