@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: 1701944460 do
Contract.set_type "transfer"
# Send back UCO to bridge pool
Contract.add_uco_transfer to: 0x000018D60115ECE0C7558A46B4693749BF6BEAB524FDDCCF9B10B910619E4EE08801, amount: 0.8955
Contract.set_code ""
end
condition triggered_by: transaction, on: refund(), as: [
timestamp: timestamp >= 1701944460
]
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.8955
Contract.set_code ""
end
condition triggered_by: transaction, on: reveal_secret(secret), as: [
content: Crypto.hash(String.to_hex(secret)) == 0x1BDADC32D0AD39E93EF008A768DDB3E225402A176FF2352E162A1904DEC1EC6D,
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: 0x00004D714076A3B4FD86E80AB24789B0002CD5818D650BDFBC3159B3378C12BEED36, amount: 0.8928135
Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.0026865
Contract.set_code ""
end
"""
Contract.set_code next_code
end
Content (0 B)
State (0 B)
-
Secret shared with 1 key
Encoded secret
0DFCD05B1E1ACF01FBB5235BF8DADC0C1D53B4F32F92AE2AEB9994DAC085C89F7A267EF378C6B051B5E04A02FC07C4A028781C665985E2B9A28CA62A
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
-
Resolved 00008BF3...5CAArequest_funds
[ 1701944460, 0.8955, "00004d714076a3b4fd86e80ab24789b0002cd5818d650bdfbc3159b3378c12beed36", "1bdadc32d0ad39e93ef008a768ddb3e225402a176ff2352e162a1904dec1ec6d", "0xa9b69b5e52d2c160d10b49f7bc4163103d3f73bd1dfd2b622ced4e872339a130", "0xeaa1c95919d0c3d43e7f6fefac914c1e1c70369a", 80001 ]
Inputs (0)
Contract inputs (0)
Unspent outputs (1)
-
From 0000071E...CB1FAt 2023-12-07 08:21:51 UTCAmount 0.24714858 UCO
Previous public key
0001D5FFD27A244887D7316318E304B86D1C1DF6D799BA15F103E7DED0E1C1E74DB2
Previous signature
663CF2180C438B8EEB33886284D695CDCB0072E487A6526243C3DC5C5081172186634EF33FB1C037DB82B11FB20DAF153644A61AB0907B9E0C088FA88B1D040D
Origin signature
3045022100FEC51AA8F9C7C8F264834FC87D329616011D738B22A9196014204FD6BC7F6EF7022023827DA71C2101131471FB0782EAD13E2DC679B73E94B8B346170D04F7AA147F
Proof of work
010104AB41291F847A601055AEDD1AF24FF76FA970D6441E2DCA3818A8319B004C96B27B8FEB1DA31A044BA0A4800B4353359735719EBB3A05F98393A9CC599C3FAFD6
Proof of integrity
00E17A600D8208D6A7FCAB22BFAF88EF096C7DC6988257C72FC6F6F5E717B5EFBD
Coordinator signature
616B3AEDECED00350CBCF9A9FF267168A9239C89DA6609FA2BC195B0B8BA9BE4F718381C9D16C39B14C2F65F942EF3F244973AAA4236B63024488F083598C209
Validator #1 public key
000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF
Validator #1 signature
D33451FBB83FEC9AA96662813A5CCEFF76E613C5B80AF34DFAB8C4094AB743EBF81FB81284A61D43866F6672AA4CC084185467E7A82BFBD4A8CB33D97EDBCA0B
Validator #2 public key
00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947
Validator #2 signature
0C7F471FC76217695FB19330F9FB05B69918FF78A4FFFBB9C033369B0522A145C246092A24858966BF5180A92CBF7C31D162A59E98B8C9560654650F17961002