@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: 1701814680 do
Contract.set_type "transfer"
# Send back UCO to bridge pool
Contract.add_uco_transfer to: 0x000018D60115ECE0C7558A46B4693749BF6BEAB524FDDCCF9B10B910619E4EE08801, amount: 2.985
Contract.set_code ""
end
condition triggered_by: transaction, on: refund(), as: [
timestamp: timestamp >= 1701814680
]
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.985
Contract.set_code ""
end
condition triggered_by: transaction, on: reveal_secret(secret), as: [
content: Crypto.hash(String.to_hex(secret)) == 0xCD4B26E837D29E29A012545BF3CED2F8D44DD90711449766A80B454E978C25E9,
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: 0x000069DE327AB026CB14829D47EFC5C765183C23A6488DBFBF5B19FCF7E40175F2E9, amount: 2.976045
Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.008955
Contract.set_code ""
end
"""
Contract.set_code next_code
end
Content (0 B)
State (0 B)
-
Secret shared with 1 key
Encoded secret
6E116E668D029835916EA56C45AE5B86B6C3DB97A4754B6CF535126459F893E8B5CED32CBF32E58D6C7701FF52131641549E837FC51396455F76D06C
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
-
Resolved 00001437...BA95request_funds
[ 1701814680, 2.985, "000069de327ab026cb14829d47efc5c765183c23a6488dbfbf5b19fcf7e40175f2e9", "cd4b26e837d29e29a012545bf3ced2f8d44dd90711449766a80b454e978c25e9", "0xc564db71dcad29026c2c068c7135cdcf7f08c0bfde88835e1b1bf1354151716c", "0xef23cbe6c8806de4a337674f401dc07365d308a3", 11155111 ]
Inputs (0)
Contract inputs (0)
Unspent outputs (1)
-
From 0000C051...35A3At 2023-12-05 20:19:17 UTCAmount 0.2613009 UCO
Previous public key
00014EF895B7AD16119F615F229D0F13A9A38E62A9E9E759DC59CBFA2EA2681522D2
Previous signature
C82670F724586C6CDBE013733F9188C7D8359C4C9D758FBEF50A4F0E769898F7D08F04A671CC94575A2603828C1B9F74FE3A44091F785927C46C9A80CFC2870A
Origin signature
304402205860730343F71176EC7195A7425AB043F4A7065B38B263F6B6B8C0009520CCD002200F676A5A9A178B08E55E9551D506DC11A4C0F0907438719B3DBBE791EF3193F9
Proof of work
010104AB41291F847A601055AEDD1AF24FF76FA970D6441E2DCA3818A8319B004C96B27B8FEB1DA31A044BA0A4800B4353359735719EBB3A05F98393A9CC599C3FAFD6
Proof of integrity
00A56F3827707C828F2D0E5FE9203D5C47DB641C8DB376EDC4811F576D90E20AA4
Coordinator signature
677F8FB69F58E8D31BE94E3024336C43510D532C400059417AED12A45A846BDFC3B1153EA8B9E4F46D08FBDF33AD34F0A05322D4EB341EEE2D0506AC23FAC202
Validator #1 public key
000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF
Validator #1 signature
9A39F78BDA0173038E816582AAA22F144164ACF0EEB565ABD007292C899B0CE2985B20DB75ACA85F88B5C33B868F0EB51EDB8BF86B97BB11180A60B6DCA82C05
Validator #2 public key
0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3
Validator #2 signature
54B4BFE92CCC8ACE4F5455D0751F09FE3E3153DFFB41C531D7CAF761C5153592E856B2A5E04E9715828A6A4589730F39CD1F183D6E07E691285ADF1AB6CFC300