Router is the main contract for all the interactions. It checks signatures, transfers tokens to the Core, and calls Core with the correct parameters. Most of security checks are done here. Although the Core contract can be called directly, we still recommend interacting with our system via the Router contract to make sure no funds are lost on Core or Router contracts.
Core is the contract with main logic. It iterates over the array of actions and consecutively executes them. Also, it is responsible for sending the required tokens back to the user.
ProtocolAdapterRegistry is a contract that maintains a list of ProtocolAdapters and is called to fetch user's balances.
ProtocolAdapter is a special contract for every protocol. Its main purpose is to wrap all the protocol interactions. There are different types of protocol adapters: some of adapters (asset adapters) returns the amount of the account's tokens held on the protocol (owned by the user or staked) or the account's debt to the protocol in case the returned amount is negative. Some adapters do not return any balance and used only for tokens exchange.
InteractiveAdapter is a special contract for every protocol. It inherits from ProtocolAdapter and its main purpose is to wrap all the protocol interactions, namely “withdraw” and “deposit”. Deposit is the action when tokens are transferred to the protocol (lend tokens, add pool liquidity). Withdraw is the action when tokens are transferred from the protocol (withdraw deposit, return pool liquidity).
Technically, InteractiveAdapter is a base contract for all the interactive adapters.
TokenAdapterRegistry is a contract that maintains a list of TokenAdapters and is called to fetch token's metadata and rates to underlying tokens. Some protocols do not use "simple" ERC20 tokens but instead have complex derivatives, for example the Compound protocol has cTokens. The TokenAdapterRegistry contract also provides information about the type of tokens.
TokenAdapter is a contract for every derivative token type (e.g cTokens, aTokens, yTokens, etc.) Its main purpose is to provide ERC20-style token metadata as well as information about the underlying ERC20 tokens (like DAI for cDAI). Namely, it provides addresses and rates of underlying tokens.