@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: 1702537680 do
Contract.set_type "transfer"
# Send back UCO to bridge pool
Contract.add_uco_transfer to: 0x000018D60115ECE0C7558A46B4693749BF6BEAB524FDDCCF9B10B910619E4EE08801, amount: 0.4975
Contract.set_code ""
end
condition triggered_by: transaction, on: refund(), as: [
timestamp: timestamp >= 1702537680
]
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.4975
Contract.set_code ""
end
condition triggered_by: transaction, on: reveal_secret(secret), as: [
content: Crypto.hash(String.to_hex(secret)) == 0xF72186EFCDD62AD6E634D1993E2ED4A1F2C4F0C17D42BE02307C3AB009EF27AB,
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: 0x000025CCCCEAAB3591F6896381EAF786582A45682F552E841B2AB9B4C9FC54769FB1, amount: 0.4960075
Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.0014925
Contract.set_code ""
end
"""
Contract.set_code next_code
end
Content (0 B)
State (0 B)
-
Secret shared with 1 key
Encoded secret
06FDB0B6819D504D46BB00D6D661C777ED0EBD60CF155890BF7A068B4A5FBE736FE2BA1FA646758277B74389B4B3618C6F12F90ED936A5A72E8999B1
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
-
Resolved 00003AFD...67F2request_funds
[ 1702537680, 0.4975, "000025cccceaab3591f6896381eaf786582a45682f552e841b2ab9b4c9fc54769fb1", "f72186efcdd62ad6e634d1993e2ed4a1f2c4f0c17d42be02307c3ab009ef27ab", "0x3439b32dee3cd95476c1cd549b9f31ffa28fa5a44395846156474e3be2c51bec", "0x38ead3d0115dc64d9ed5d5ac558937349eaee66f", 80001 ]
Inputs (0)
Contract inputs (0)
Unspent outputs (1)
-
From 0000E634...C68BAt 2023-12-14 05:09:17 UTCAmount 0.26922926 UCO
Previous public key
0001191AB522E9E696F836C6336A435D947B752F1D5B08C75F4130CC17C0BE3A0C93
Previous signature
795B0CFD2C45DDD81C94975572DA49D5177736100F93CBC136950715A30FEEF8A39402D017CE42C0B77C0E7A192609C4A25010904EFFA11B6584000D4CE8AC0C
Origin signature
30440220554F9BF6BAEFDB0215B4C32D401BCBE1CDA95010B6EA005C038A5B2FF07204B402201F7A05D3064BA89A5E42D109C6C06E79D445542D8D191CEA35C1AFF8824417D5
Proof of work
010104AB41291F847A601055AEDD1AF24FF76FA970D6441E2DCA3818A8319B004C96B27B8FEB1DA31A044BA0A4800B4353359735719EBB3A05F98393A9CC599C3FAFD6
Proof of integrity
00C7A7BBD8482608E9DFFAB5DFC80B4086ACAC8790535AA34FD60FD1147EF7957E
Coordinator signature
32CDDCBB74831F22E5FD8C6B920B5AE3E2D1ECAD85CCD1520163BB402444173B847478116C43B6974669216B65BFBBEA6CD59B81DBF56D3DE434436E6EDBE60E
Validator #1 public key
0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3
Validator #1 signature
44AA18E5C6CE35F783DB853039778FD75C008EFA488AEBAB542978C3D106355C190CED8AD72866AB8C294A796EAAFC96F3413FBF04D330B99BFFDF838D58A607
Validator #2 public key
000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF
Validator #2 signature
2B386E17E3015E52D82307AE8B7A2F60CF36BDABE9E4C60B564E66680E40EB1964F4B1524FF089EA7A7426E49F7E23ECD8F790FA93AEE81466ABDD527BF2F60B