@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: 1702106040 do
Contract.set_type "transfer"
# Send back UCO to bridge pool
Contract.add_uco_transfer to: 0x000018D60115ECE0C7558A46B4693749BF6BEAB524FDDCCF9B10B910619E4EE08801, amount: 4.960075
Contract.set_code ""
end
condition triggered_by: transaction, on: refund(), as: [
timestamp: timestamp >= 1702106040
]
actions triggered_by: transaction, on: refund() do
Contract.set_type "transfer"
# Send back UCO to bridge pool
Contract.add_uco_transfer to: 0x000018D60115ECE0C7558A46B4693749BF6BEAB524FDDCCF9B10B910619E4EE08801, amount: 4.960075
Contract.set_code ""
end
condition triggered_by: transaction, on: reveal_secret(secret), as: [
content: Crypto.hash(String.to_hex(secret)) == 0xB43C5B3C25A45E8EB3822E7FB590EDF2C078F4ED1CBD33E8B4FD87A0A9230197,
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: 0x0000A60EC381AB276FEAD46157F6E7564CBE430EBD7F24014F045B68AED539137ABA, amount: 4.94519478
Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.01488022
Contract.set_code ""
end
"""
Contract.set_code next_code
end
Content (0 B)
State (0 B)
-
Secret shared with 1 key
Encoded secret
08852D76AA87CAB56413CB999B429CF4C7813E7A69218BF5052F6F20CD2F898D4E90AC376BA18625D2842796E945B4B14079317D593C732AEE2D0DBF
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
-
Resolved 0000E6B3...A57Arequest_funds
[ 1702106040, 4.960075, "0000a60ec381ab276fead46157f6e7564cbe430ebd7f24014f045b68aed539137aba", "b43c5b3c25a45e8eb3822e7fb590edf2c078f4ed1cbd33e8b4fd87a0a9230197", "0xaf3e6797d4bf1ab08700e2ae82d9996917e91886ea88fd16739c3254b1199499", "0x866b044f75e317a1d4dc24d2f54e4fb58b9ceb0e", 80001 ]
Inputs (0)
Contract inputs (0)
Unspent outputs (1)
-
From 0000FF21...6BA5At 2023-12-09 05:15:12 UTCAmount 0.25334727 UCO
Previous public key
0001C22E629A281251A117246F2BDC7E8B0EEB0A69C580CC51BAB08A9FFAF13C9156
Previous signature
830F1F86A63E64F054788BABB03B58D766A1A9181BCF478B33A5F4B5E2D99E3B18A2FC811ADF7E2B1580FE2FB905F2AB7484B695457657F6DB475A67E548E700
Origin signature
3045022100B19BE65595EC8191ED11560128F78B88195B2D7342A6B3A8B180F25642D549CB022075BE9740CB31BF217A6B27C50498F26041D67204771342BCE121648D38383D57
Proof of work
010104AB41291F847A601055AEDD1AF24FF76FA970D6441E2DCA3818A8319B004C96B27B8FEB1DA31A044BA0A4800B4353359735719EBB3A05F98393A9CC599C3FAFD6
Proof of integrity
00A36BE68F80DFBD3FA7DDC4B80116762A734AF73FF55978E965468E2DA1CAFBEF
Coordinator signature
045893B2ED3F59087A80D6A56717E5F948DD9BA30A06B8F440BCF1E69ABCDA270D4903FC7B56230ECDEF95331F775C0B9F3FC1CE45551B735E7DC4568564E70B
Validator #1 public key
000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF
Validator #1 signature
748EDCCB180B1858175F3ED214BB04C61CB3030D253AD9D74452B9C77D0EA850DCB2DC6D3F888F4D56F41991023A0A3038EE34879522E53A79F9A1D554740E0C
Validator #2 public key
0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3
Validator #2 signature
A7C1F4DFF3421AC9FA34680CCCD47E9311EF7D2C12AB515069A7061C49419DC2BC5FE92BE22C7BBE7A6D4787980657E375B5423FC2D94E754317EA5BEF8D9001