EVM Sidechain lending internals
Last updated
Last updated
Let's take a deeper look at how the contracts work together to produce a working money market. This is a zoomed-in view of the EVM Sidechain part of Deposit and repayment and Withdrawal and borrowing.
Core contract manages data and executes core money market logics. This is where the deposit and debt of all users are stored.
For withdrawal and borrowing, the core contract will send back messages again through Axelar ITS contract to XRPL.
For each asset supported, there is an independent connector contract. Handling the oracle prices separately in an oracle connector contract gives us more flexibility on integrating or changing to another oracle later.
All that the connector contract does is to retrieve price data from Band Protocol and return it to the core contract.
For each asset supported, there will be different parameters that will determine interest rates. Please refer to Interest rate strategies for more information.
The interest rate strategy contracts will calculate lending and borrowing rate based on current supply, debt and its parameters.
Separating interest rate strategies into independent contracts allows for greater composability and separation of concerns: it allows us to replace to another interest rate strategy when needed, or use the same interest rate strategy by pointing to the same interest rate model contract if we wanted to.
The Gateway contract is used by Axelar network to execute cross-chain transactions. Transactions must be confirmed by a vote of validators before they are authorized by the Gateway. This allows Axelar to securely mint and burn tokens or approve General Message Passing transactions across all connected chains.
The interchain token service orchestrates the operation among the core contract and interchain token contracts. This will call functions in the core contract to initiate transactions from XRPL, and the core contract will call functions in the ITS contract to send back tokens in case of withdrawal and repayment.
This contract interacts with the Axelar ITS contract directly. All of deposit, withdrawal, borrowing, repayment requests from the users come through Axelar ITS contract into the core contract. This implies that the core contract inherits , which allows Axelar ITS contract to safely execute functions on the core contract.
These are the token contracts deployed according to . Any assets that Strobe Protocol supports will be represented in the form of an interchain token.
The gateway contract is an entry point to a chain from all other Axelar-connected chains. Axelar uses Gateway contracts to connect EVM chains, enabling . Each contract is controlled by a cryptographically shared key among validators, divided into key shares based on staked AXL tokens. Actions require approval from a threshold number of validators.
Not mentioned in the diagram above is the serving the equivalent role of a gateway contract on other chains. The reason for this difference is that there is no smart contract functionality on XRPL. Therefore, Axelar uses a multisig account that works the same way as Axelar Gateway contracts on other blockchains where smart contracts are enabled.