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.
AdapterRegistry is a contract that a) maintains a list of ProtocolAdapters and TokenAdapters and b) is called to fetch user 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) and the other adapters (debt adapters) return the amount of the account's debt to the protocol. There is a type of adapters (exchange adapters) that do not return any balance and used only for tokens exchange. Type of the protocol adapter is stored as the last byte of its name (read more in Naming convention section). Some protocols do not use "simple" ERC20 tokens but instead have complex derivatives, for example the Compound protocol has cTokens. The ProtocolAdapter contract also provides information about the type of tokens used within it.
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.
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 rates of underlying tokens.