@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: 1702024740 do
Contract.set_type "transfer"
# Send back UCO to bridge pool
Contract.add_uco_transfer to: 0x000018D60115ECE0C7558A46B4693749BF6BEAB524FDDCCF9B10B910619E4EE08801, amount: 2.189
Contract.set_code ""
end
condition triggered_by: transaction, on: refund(), as: [
timestamp: timestamp >= 1702024740
]
actions triggered_by: transaction, on: refund() do
Contract.set_type "transfer"
# Send back UCO to bridge pool
Contract.add_uco_transfer to: 0x000018D60115ECE0C7558A46B4693749BF6BEAB524FDDCCF9B10B910619E4EE08801, amount: 2.189
Contract.set_code ""
end
condition triggered_by: transaction, on: reveal_secret(secret), as: [
content: Crypto.hash(String.to_hex(secret)) == 0xD78685D92DE373DA5610637A867AB9D121739485A0B521DDBD36338F672F965F,
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: 0x000079AAE5FD689797A5D03DEBBA98F6174259FE4CF81F2C51F0DDD937C13963B2A0, amount: 2.182433
Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.006567
Contract.set_code ""
end
"""
Contract.set_code next_code
end
Content (0 B)
State (0 B)
-
Secret shared with 1 key
Encoded secret
BF7F3F41B426B1F71BB91CF3C33BA21E6C02C53756EDA24A7A4C985C618E12FA9FF6617D3CC5FB83DCFD54235735C2BC8424CD22182EF0D7644BD6BF
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
-
Resolved 000087A0...7E0Crequest_funds
[ 1702024740, 2.189, "000079aae5fd689797a5d03debba98f6174259fe4cf81f2c51f0ddd937c13963b2a0", "d78685d92de373da5610637a867ab9d121739485a0b521ddbd36338f672f965f", "0x119d8d9b02df4990aa426745528475f6bc04b9a7b843fb15a24e0fdd6dbf34c8", "0x70c8e5bdd68270b50d340cb2e8235f6135e79ce9", 80001 ]
Inputs (0)
Contract inputs (0)
Unspent outputs (1)
-
From 0000306A...4DA5At 2023-12-08 06:39:52 UTCAmount 0.24202722 UCO
Previous public key
0001FF95E04E867EE4A6D3155D136F13CCB6B0AAF0CB5D2DCE0E85D40FCF73F4A5F2
Previous signature
F4859A003224BDFDC6194BB0B3DE9A3ADE1ABC3EAF7A22C029546F7D9D98DE11157E9A592D46B544C1A0B308B5E8148C11A6BCA4B411E26D120EE762B7875401
Origin signature
3045022100DB601FFAE97EF3005B32DD95D16C86C0AA96167448296F4EAED800931042B850022033A8D11075918C5AFEE3B0208B6177CAE30703BB59369AA6619D3BA46980B988
Proof of work
010104AB41291F847A601055AEDD1AF24FF76FA970D6441E2DCA3818A8319B004C96B27B8FEB1DA31A044BA0A4800B4353359735719EBB3A05F98393A9CC599C3FAFD6
Proof of integrity
00E3626828B8CAB13220D10A81D5CA607868B6701810ABBB50FD3F55D511AF5994
Coordinator signature
4DAC7D38BACA2B041AF231C68970A91086F946AB6616D94945890D6D4E7BAC579667182836114D7E7DF691BEF2DF439CF2E34737F2160E0AD1E88DFE74524106
Validator #1 public key
0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3
Validator #1 signature
84C1CFCA6BC77CEE770B8300D38EC30B08D8B54E994C4756F88570D0615103DF4C3FF67ACB2801353340D2F4BDBF6BCE28C04FB4C4AD7FA4A996862AF885C00A
Validator #2 public key
000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF
Validator #2 signature
91713F25CA5164565E3FE13B10EB05BCF31E5372C9F40BB75C5B37C8365EF81EB79116FB37559AB6DE2EAD70D76E66CC9B0C51AFE9007A1FA1B30D509C8BA60F