@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: 1701540780 do
Contract.set_type "transfer"
# Send back UCO to bridge pool
Contract.add_uco_transfer to: 0x000018D60115ECE0C7558A46B4693749BF6BEAB524FDDCCF9B10B910619E4EE08801, amount: 0.995
Contract.set_code ""
end
condition triggered_by: transaction, on: refund(), as: [
timestamp: timestamp >= 1701540780
]
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.995
Contract.set_code ""
end
condition triggered_by: transaction, on: reveal_secret(secret), as: [
content: Crypto.hash(String.to_hex(secret)) == 0x9540D2FA568F8063299D824F03FA6BEEF51D5118CE080DDC4861ED62AFC43C09,
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: 0x000079B40CB20AB1624178169798B0C9D9245BE746399864BE620B3099689DB824B9, amount: 0.992015
Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.002985
Contract.set_code ""
end
"""
Contract.set_code next_code
end
Content (0 B)
State (0 B)
-
Secret shared with 1 key
Encoded secret
770E1DC96571E444EF25BE3D2C4D1FE95F219FDD384AFEF25FCB7B206620972213981F05CFB43327F88CBE8A7B7565767329A0A155C460D93919F95E
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
-
Resolved 0000272B...7577request_funds
[ 1701540780, 0.995, "000079b40cb20ab1624178169798b0c9d9245be746399864be620b3099689db824b9", "9540d2fa568f8063299d824f03fa6beef51d5118ce080ddc4861ed62afc43c09", "0xa73947ed2ee9849fd224a071c55d6665ff58e25aa9d28a83e0e394e37a49534a", "0xc1fe1f90e69df3c444f563203ec914d70e09b1e8", 80001 ]
Inputs (0)
Contract inputs (0)
Unspent outputs (1)
-
From 00004983...B6E7At 2023-12-02 16:14:13 UTCAmount 0.25935909 UCO
Previous public key
00017B80FC622AE4F9317E9B10296ED2F9DAEC93D9FCE9B6D7D7E878B0A31FE9DC40
Previous signature
825931935D9F99C9536BA196497B5C71545DA16A07ECDF85C041AB953F78475C8745E1867E98C41604CAB613D72C9F3D72679BE0FD3691EB254602B25B6BE00C
Origin signature
30450221008D3425B5D75F61D8C9D4180EA73971F877F407B710EE950CDEEB877099FCCE440220770B03762270AF93CF3E833F18E80D3BE4DE98D3DA28AA519B31353173D1C443
Proof of work
010104AB41291F847A601055AEDD1AF24FF76FA970D6441E2DCA3818A8319B004C96B27B8FEB1DA31A044BA0A4800B4353359735719EBB3A05F98393A9CC599C3FAFD6
Proof of integrity
00FADFB76229C314094DBEC1378B1E396C8190A7C716E194EDE6B34DB2D437D20E
Coordinator signature
98C520A21379FC90F2A1019CDE567DE1F076C4BC7AC1519209F86BB35DE6124A4EAC374CB6F0F6A979F787D3B6A85DE1F6D9FA1C22E6577F4AA1E642B766D20D
Validator #1 public key
0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3
Validator #1 signature
FC20803EF25D9947F2E3778F39362BC3BB020B9BDAF7E5A018A33D792799198246858A3DA11AF5D27BC961095E27EE18B5D46B06A0B39D0A00665FE6DE003201
Validator #2 public key
000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF
Validator #2 signature
D9B659174E2FF10323CEE86213FC0F3D09DE50D12139A3102C942266774720C93A8F0B00E239C0CC5551B412E32D1D26E3DCD4E0C5A8268A59B989D08FB1210D