@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: 1702537140 do
Contract.set_type "transfer"
# Send back UCO to bridge pool
Contract.add_uco_transfer to: 0x000018D60115ECE0C7558A46B4693749BF6BEAB524FDDCCF9B10B910619E4EE08801, amount: 1.194
Contract.set_code ""
end
condition triggered_by: transaction, on: refund(), as: [
timestamp: timestamp >= 1702537140
]
actions triggered_by: transaction, on: refund() do
Contract.set_type "transfer"
# Send back UCO to bridge pool
Contract.add_uco_transfer to: 0x000018D60115ECE0C7558A46B4693749BF6BEAB524FDDCCF9B10B910619E4EE08801, amount: 1.194
Contract.set_code ""
end
condition triggered_by: transaction, on: reveal_secret(secret), as: [
content: Crypto.hash(String.to_hex(secret)) == 0x29AF30491ACD1BF7BF1C4CF59083AAE01DD801D2318915E6233EB3648D7E20B7,
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: 0x000086EB3385DB2973C88571098ACC1333C44FE6A936D1E105A0A8AA776509233764, amount: 1.190418
Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.003582
Contract.set_code ""
end
"""
Contract.set_code next_code
end
Content (0 B)
State (0 B)
-
Secret shared with 1 key
Encoded secret
02023FCDB8A95F9121FBD695FDBF4C667A70F36102895BD240B3B55CC9305F5268D71CACF26F52BA4387E8E20CFEBD48598312B0397307D8C4EFA885
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
-
Resolved 0000A716...FC41request_funds
[ 1702537140, 1.194, "000086eb3385db2973c88571098acc1333c44fe6a936d1e105a0a8aa776509233764", "29af30491acd1bf7bf1c4cf59083aae01dd801d2318915e6233eb3648d7e20b7", "0xdcb0598dba4db58157e9a46330bfd0724d174f609ada36dc9c8181f15f5a5fee", "0x966bf6e02ff9eec6b7f015f60a96f274a749fded", 80001 ]
Inputs (0)
Contract inputs (0)
Unspent outputs (1)
-
From 0000162B...5DCCAt 2023-12-14 05:00:29 UTCAmount 0.26915927 UCO
Previous public key
00013EE24024DEACA5A6D56190C96B7DAC5E39B83A6F62BDF49032B50445412AB9CA
Previous signature
AE9048F3A94197B5DEADC5484B9423D2BB861F8F10250CA3FABFE978A0AFC959B1122CAC03D36F93FA5D0726FA65C50BED4723A51BA046EDE6CF5EB34020B601
Origin signature
3044022006F8494D854BD10AB950A66BA936FC5127496DA67F3A4DC9B33708E432765F1B0220021754CAFB60EEECCCEAC9BB803B84EAA28B7ADD6EB6B18793EF0BC4906B8CD1
Proof of work
010104AB41291F847A601055AEDD1AF24FF76FA970D6441E2DCA3818A8319B004C96B27B8FEB1DA31A044BA0A4800B4353359735719EBB3A05F98393A9CC599C3FAFD6
Proof of integrity
00A686095402FB8867564A94256041D36BAB7093281991419F8285D7C3592CFE36
Coordinator signature
C7ED680E3427C8DDF5703CAE2205C2074FF775D596E83668C74B56E6A150D3D4FE0888B8FF28F53FCC4BB348CB03A71D61AE4C95867785E1207BFD26B985DC0C
Validator #1 public key
000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF
Validator #1 signature
002F99A7D037649DA34A6E7AC8A850575F39D58A16991693AD322CC1C14C0EE57161F5D9FD39A7533E21E4E5B1AE44BF3572A8CED4626673E17A2A26105E5A0F
Validator #2 public key
0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3
Validator #2 signature
2F0D6C198723CB0C42E2829C955D69B9A13A804A69A4591610D58BABFADF71E7A73BB9C36779F0ACA114A39A2A39D320765FCDBE516810F1F980B6D6A0809D0B