Provide a sample Cosmos smart contract that can do the following:
- Starting with a specific token, perform a swap on a DEX (e.g. Osmosis) and then bridge the resulting tokens to another chain using a bridge (e.g. Gravity).
- This must all be done in a single transaction.
Describe how your example can be scaled to handle multiple chains (e.g. more than 2 steps).
- divide the contract logic into separate modules, each for a particular DEX, bridge, or chain.
- message passing between different modules within the contract, where each module can process its respective step and pass the result to the other module.
- add error handling, input validation, and provide appropriate error messages for each step.
- manage state and dependencies with using storage facilities like singletons or multistore (here can be implemented other patterns).
- use separate modules or extensions for each chain, which should encapsulate the specific logic and integration details required to interact with the specific dex, bridge, or chain.