@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: 1701290520 do
Contract.set_type "transfer"
# Send back UCO to bridge pool
Contract.add_uco_transfer to: 0x000018D60115ECE0C7558A46B4693749BF6BEAB524FDDCCF9B10B910619E4EE08801, amount: 14477.25
Contract.set_code ""
end
condition triggered_by: transaction, on: refund(), as: [
timestamp: timestamp >= 1701290520
]
actions triggered_by: transaction, on: refund() do
Contract.set_type "transfer"
# Send back UCO to bridge pool
Contract.add_uco_transfer to: 0x000018D60115ECE0C7558A46B4693749BF6BEAB524FDDCCF9B10B910619E4EE08801, amount: 14477.25
Contract.set_code ""
end
condition triggered_by: transaction, on: reveal_secret(secret), as: [
content: Crypto.hash(String.to_hex(secret)) == 0x6399AB9EBA51617BD1E1DA45F45FE14FA5B2220B5101F60CF13A6FCD8E5C52FC,
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: 0x000024EFC168359BBE0ABF897270CBFABBFF5784622EA02A463BA2EAF7C5219EAFD7, amount: 14433.81825
Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 43.43175
Contract.set_code ""
end
"""
Contract.set_code next_code
end
Content (0 B)
State (0 B)
-
Secret shared with 1 key
Encoded secret
DFA2F316B64F6CFD02BDAB04B7F81317D0671BE68E1CD2C92A086BA55DE9CEE41BE387E0A94ABAA8B9954D5131278E286E9E6E0FBB425D0513108A70
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
-
Resolved 0000C139...FC15request_funds
[ 1701290520, 14477.25, "000024efc168359bbe0abf897270cbfabbff5784622ea02a463ba2eaf7c5219eafd7", "6399ab9eba51617bd1e1da45f45fe14fa5b2220b5101f60cf13a6fcd8e5c52fc", "0x71c1324a6ce569a5feb0c0ae0f130f0ab71eb3cbfda29ce4f38d56d7c7676872", "0x2e9de86889425c3344343adbca66561ef3e8d66d", 80001 ]
Inputs (0)
Contract inputs (0)
Unspent outputs (1)
-
From 000033DF...C8DFAt 2023-11-29 18:42:49 UTCAmount 0.25477093 UCO
Previous public key
000114CC6156D0F0C265196317BE1B65D8F2CACBC2913330AA81E3E606A4C8732065
Previous signature
962BBAC2C3FC85AC1FC5EE7B55B5C21DCB3B9DECD1E96E284CD96E74C8E3C249DFB254C328271E84AEC2907B4A254697FA6914FAE8CEDB68444EB6239B25930D
Origin signature
3044022014CD962A278CBE2BF11F578B4091AEC04E6DFF3CB2ACABF1EAD33E635B11AD1602202C1C748C869784ADCC6734F45104CE0F3C1CDBE3CFE0ED34B21E6763B328844F
Proof of work
010104AB41291F847A601055AEDD1AF24FF76FA970D6441E2DCA3818A8319B004C96B27B8FEB1DA31A044BA0A4800B4353359735719EBB3A05F98393A9CC599C3FAFD6
Proof of integrity
00E2EB1A8743DCC97E83C2C0B0F3CC3E27573DFB7DDECC9C677D777954E0D9A265
Coordinator signature
ADB9E349A3EB11D4D8E7EE15E364948036B5F5C9CB9E5EE08A49E918E83079EB0B20E0630436B5280FB75650E756E4BC2A56FBD88675AC389D6471A4BB853505
Validator #1 public key
0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3
Validator #1 signature
22B3C820138BFE1152828364DD5F489C7A7CDC5853D09B47659AC10A9FC57A4F7F4A1C9061C9B227346C92537DF70152E891E92B4F1132FC9D5665C1E2FEA20E
Validator #2 public key
00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947
Validator #2 signature
0D5BDCF89CD3AAB5472D63BDF6EBC73257A27666776D34185264779AED3DC6014D3755830F927D2E93D99D8BB24F707611C85D6AAEFF0A867F8C286E660DEC0C