@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: 1701345120 do
Contract.set_type "transfer"
# Send back UCO to bridge pool
Contract.add_uco_transfer to: 0x000018D60115ECE0C7558A46B4693749BF6BEAB524FDDCCF9B10B910619E4EE08801, amount: 29.76045
Contract.set_code ""
end
condition triggered_by: transaction, on: refund(), as: [
timestamp: timestamp >= 1701345120
]
actions triggered_by: transaction, on: refund() do
Contract.set_type "transfer"
# Send back UCO to bridge pool
Contract.add_uco_transfer to: 0x000018D60115ECE0C7558A46B4693749BF6BEAB524FDDCCF9B10B910619E4EE08801, amount: 29.76045
Contract.set_code ""
end
condition triggered_by: transaction, on: reveal_secret(secret), as: [
content: Crypto.hash(String.to_hex(secret)) == 0xEE2A6DF51912FD444E00B7811941E7C83F7474A40D2889E1FFF028B98AB04065,
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: 0x0000DB55524F25C26976DD89C98073E614667F656B931042CE612EC33DF32AC25E67, amount: 29.67116865
Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.08928135
Contract.set_code ""
end
"""
Contract.set_code next_code
end
Content (0 B)
State (0 B)
-
Secret shared with 1 key
Encoded secret
605C281DDB524C1A8520A86C1C619924076E26129212004D07DC55C2B3B0BD1612FF7BB906555C3FC31C2836068EEFDFC0623F44D698AFD2FAC92362
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
-
Resolved 000012FA...E030request_funds
[ 1701345120, 29.76045, "0000db55524f25c26976dd89c98073e614667f656b931042ce612ec33df32ac25e67", "ee2a6df51912fd444e00b7811941e7c83f7474a40d2889e1fff028b98ab04065", "0x6043886d71c30783ed2b45527a3b0c46c3f53cc7ddd8f3e60e9bee2544600a13", "0xba659d6cd3d5c2b3421d83508d066918a1773aab", 11155111 ]
Inputs (0)
Contract inputs (0)
Unspent outputs (1)
-
From 0000E9C3...515BAt 2023-11-30 09:52:56 UTCAmount 0.25547162 UCO
Previous public key
0001644FFCFE24DC8337CB434F461D86F87588E8272A78B1F5721A15B5BD2267648E
Previous signature
4B9077640C9CBF80A0A73103DE2D7926866A7D64E319314998A86008540514698099E73C64332D3AD9DF99727C536310213EC9811BD207ABAE0294616F84A900
Origin signature
3045022100B15E8E240F010BF729F2951A4D8D7383D064DB8A41A96CC78FC6BC39D4B0C23C022062C29FC4C83808AC7C08F2B5B030CE32EA881315AF699E484DF047D71C2D3121
Proof of work
010104AB41291F847A601055AEDD1AF24FF76FA970D6441E2DCA3818A8319B004C96B27B8FEB1DA31A044BA0A4800B4353359735719EBB3A05F98393A9CC599C3FAFD6
Proof of integrity
00CC1C7C356CAAAB1030BB6B8B12D33CEC0819323A3F1B06968F113C59D91C689B
Coordinator signature
C362C0CC20B8DA72CBFBA177A043601EA9B7B9A146ED17769A93F58FCD8FEFAD52488A0D63861836C8468DC19488722F2C08FAC85F70B2000945D898BE298504
Validator #1 public key
0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3
Validator #1 signature
37CF1B2D53A1C4C4BC6FB25913DB4B067F5B28207CBC1EBF022950A3A9B6EFF52AA2FDE907E2EB0A0E51F824C3FE8D14C8E3F08B7DD0A7D8ACC5C2648D2A0000
Validator #2 public key
00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947
Validator #2 signature
792E71FDAF4B9EFA30E223EA485A8C4C2E1A68CBC316AC8A18898EA115E35D7E5931C14760728BF34C5B4896412ECC2F378E99865D96D626A1B90CE61DAF4D0D