Modules
Smart contracts
The buy function on the LiquidityAggregator contract is the initial entrypoint that triggers the cross-chain liquidity aggregation and NFT purchase flow:
- Stores the user's request within the contract storage
- Fetches user funds on the local chain if needed
- Sends interchain messages to the LiquidityAggregators on the remote chains
- Once the remote LiquidityAggregator receives the message, it gets the user's funds on the remote chain and calls transferRemote on the HypERC20 token to send them over to the origin chain.
- Upon a successful interchain transfer, the handleWithToken function on the origin chain's LiquidityAggregator is called and if the funds are all aggregated, an NFT purchase is executed.
Frontend
- Easily view liquidity across multiple chains
- Display the aggregated value of various tokens from multiple chains through the 1inch API
- Support simple swaps across multiple chains using the 1inch Fusion SDK
- Aggregate and display NFT collection information from multiple chains and marketplaces. Also used opensea.io API
- Integrated with the accio.nft smart contract
- View your NFTs distributed across multiple chains
Tech stack
Hyperlane
- Using Hyperlane was essential for making our project since we needed both a general messaging bridge and a token bridge. We had fun trying to deploy Hyperlane on a new chain (Linea) and running validators/relayers ourselves.
- One challenge we encountered was related to relayers--our messages kept failing because the relayer transaction ran out of gas. We ended up digging up the rust code to find out where the gas limit was being set and doubled it to make our transactions go through.
- Another challenge was modifying the Warp Route default contracts so that it could send arbitrary data along with bridging token. We wanted to use hyperlane-deploy, which contains helper scripts for deploying and testing Warp Route, but we couldn't use it as given because it was importing hyperlane-sdk as an npm package. We ended up using git submodule to solve this problem.
1inch
- We implemented 1inch Fusion SDK into our service so that users can swap their assets in the most safe and gas-efficient way
- We used the 1inch quote API to enable a quick glance at the total value of various tokens on each chain.
Metamask (Linea)
- We deployed our contract on Linea Goerli network because we believed that it has potential to become a widely-used L2 chain for NFTs and gaming since it is cheap and is very well integrated with other products such as Metamask and Infura.
Airstack
- We used Airstack to get NFT metadata and the latest transfer information for each NFT collection