---
# System prepended metadata

title: Security considerations

---

## Security considerations

The Dex smart contracts are designed such that the contracts that interact with the relayers are seperated from the contracts that handle trades of assets.

There are 3 contracts

- Storage Oracle - this contract acts as the endpoint for the relayer to update a trade from other chains and verifies the consistency of the data
- Interchain Trade Contract - This smart contract handles all transactions pertaining to Interchain trades.Allows users to define destination chain and assets they would like to trade
- Intra-chain Trades Smart contract - This smart contract all the trades that happen within the same chain and does not require relayers.

This makes sure that the relayers cannot directly handle user funds.

### Security considerations for relayers

The relayers update trade metadata between the participating chains. It interacts with the storage oracle to update the trade details whenever created or updated.

To verify the consistency of data relayed from the orgin to destination chains, Validators are hosted at each chain. 
- These validators verify if the metadata at the destination chain is consistent with the data written to origin chain.
- The message relayed by the relayer is verified and only if consistent will allow the transaction to be dispatched.
- Failure of which the transaction reverts and the relayer is flagged as a bad actor.
- The relayers also verify the data against the database of Chaidex to which new trades are recorded.
All these mechanisms combined form a 3 layer security and verification system for our relayers.These validators can be hosted permissionlessly.
The relayers and validators can queried with or api for any data to enable Decentralization and transparency.