@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: 1702056840 do
Contract.set_type "transfer"
# Send back UCO to bridge pool
Contract.add_uco_transfer to: 0x000018D60115ECE0C7558A46B4693749BF6BEAB524FDDCCF9B10B910619E4EE08801, amount: 84.321275
Contract.set_code ""
end
condition triggered_by: transaction, on: refund(), as: [
timestamp: timestamp >= 1702056840
]
actions triggered_by: transaction, on: refund() do
Contract.set_type "transfer"
# Send back UCO to bridge pool
Contract.add_uco_transfer to: 0x000018D60115ECE0C7558A46B4693749BF6BEAB524FDDCCF9B10B910619E4EE08801, amount: 84.321275
Contract.set_code ""
end
condition triggered_by: transaction, on: reveal_secret(secret), as: [
content: Crypto.hash(String.to_hex(secret)) == 0x6BD21AA84077AC160A10772896F0EC5493D59467803E4DC0E166825A2DDB1191,
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: 0x00007D315DBBD21D4AC008F6C9A589653C00B41D944C44F426C9F787CF03961D2F10, amount: 84.06831118
Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.25296382
Contract.set_code ""
end
"""
Contract.set_code next_code
end
Content (0 B)
State (0 B)
-
Secret shared with 1 key
Encoded secret
4B6DAE3BCD92E0E58A7AC0EC0B6893E8C9F9BBAB9EA880219D8C33526F0F463B133CC6170D4AD4A796EEF4F0A486590DFAF9CFD38D97537E3FF9DA90
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
-
Resolved 00009CE0...5DFArequest_funds
[ 1702056840, 84.321275, "00007d315dbbd21d4ac008f6c9a589653c00b41d944c44f426c9f787cf03961d2f10", "6bd21aa84077ac160a10772896f0ec5493d59467803e4dc0e166825a2ddb1191", "0xfe33b98936557a462c6b87096870d90a211a1ceb531aa50f22206dbd652441a9", "0x636a242cf5bc0e01a86dd0485b5e380d5be5510f", 80001 ]
Inputs (0)
Contract inputs (0)
Unspent outputs (1)
-
From 00004FC2...1A63At 2023-12-08 15:37:32 UTCAmount 0.24353612 UCO
Previous public key
00014B939FCFF5C5556419D360D94D961792FC82E3D81B152B82551FA7F54A4A240C
Previous signature
DD1D0B717CCEBD18B8F5EA0E947CA0367A6BFAE5D340C6B2D8BA4F3460BCC4511EC7162D8C2F6239F3822AA058FFC7545EA41AA1185EEE5F068249FE92FDB509
Origin signature
3045022100A9A744EE53333783892D6D359064DD6635BB550E8275479579D2F1FCC719EC2E022001AF0B854EAFE6EC0EC2371487A99F6FB8DA1B18C694C4691726A6D56C7201C7
Proof of work
010104AB41291F847A601055AEDD1AF24FF76FA970D6441E2DCA3818A8319B004C96B27B8FEB1DA31A044BA0A4800B4353359735719EBB3A05F98393A9CC599C3FAFD6
Proof of integrity
00F9428F77C80083C5472D0B11EB69E18ABFF11B306264219451ABED9CB2948EB5
Coordinator signature
DA6D3DB00B6989C14EECD34D8EC415A33D727C4CC6268607C7030520E3D3934BC5E2AA25F204C95DC2D68D3A037D6D9F005690FC6242C8C541F3BA8315CB6605
Validator #1 public key
000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF
Validator #1 signature
3F94ED05B4AD38257852F06EE88E8CDC029FE6832B66BDEFE291FDE7C479A9FFC729C8CEB5098E87B0320A81EB21C4EB4AEB657C7E82E0083B84A5EED841B70E
Validator #2 public key
00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947
Validator #2 signature
B9C3980FF39C20506B5E3638BACDCF08409335C07869B8B9FA7834CEFBFE51B29A3BD66EBCE0EA8BE88943E7EDFA64465A1203F1AF7AA4099A1A51622A811008