-
Notifications
You must be signed in to change notification settings - Fork 258
AdapterRegistry v2
AdapterRegistry is ProtocolManager, TokenAdapterManager
Registry holding array of protocol adapters and checking balances and rates via these adapters.
function getBalances(address account) returns (ProtocolBalance[])
Iterates over all the supported protocols, their adapters and supported tokens and appends balances.
NOTE! Filters out zero balances, adapters, and protocols without positive balances.
function getProtocolBalances(address account, string[] protocolNames) returns (ProtocolBalance[])
Iterates over the protocolNames
, their adapters and supported tokens and appends balances.
NOTE! Filters out zero balances, adapters, and protocols without positive balances.
function getAdapterBalances(address account, address[] adapters) returns (AdapterBalance[])
Iterates over adapters
and their tokens and appends balances.
NOTE! Filters out zero balances and adapters without positive balances.
function getAdapterBalance(address account, address adapter, address[] tokens) returns (AdapterBalance)
Iterates over tokens
and appends balances.
NOTE! Filters out zero balances.
function getFullTokenBalance(string tokenType, address token) returns (FullTokenBalance)
Returns the representation of the token's full share (1e18) in the underlying tokens. This function will show the real underlying tokens (e.g. cDAI and cUSDC for Curve Compound pool).
function getFinalFullTokenBalance(string tokenType, address token) returns (FullTokenBalance)
Returns the representation of the token's full share (1e18) in the underlying tokens. This function will try to recover the "deepest" underlying tokens (e.g. DAI and USDC for Curve Compound pool).
ProtocolManager is Ownable (abstract contract)
Base contract for AdapterRegistry
contract.
Implements logic connected with ProtocolName
s, ProtocolAdapter
s, and their supportedTokens
management.
mapping (string => string) internal nextProtocolName;
mapping (string => ProtocolMetadata) internal protocolMetadata;
mapping (string => address[]) internal protocolAdapters;
mapping (address => address[]) internal supportedTokens;
function addProtocols(string[] protocolNames, ProtocolMetadata[] metadata, address[][] adapters, address[][][] tokens)
function removeProtocols(string[] protocolNames)
function updateProtocolMetadata(string protocolName, string name, string description, string websiteURL, string iconURL)
Increases protocol version by 1.
function addProtocolAdapters(string protocolName, address[] adapters, address[][] tokens)
Increases protocol version by 1.
function removeProtocolAdapters(string protocolName, uint256[] adapterIndices)
Increases protocol version by 1.
function updateProtocolAdapter(string protocolName, uint256 index, address newAdapterAddress, address[] newSupportedTokens)
Increases protocol version by 1.
function getProtocolNames() returns (string[])
Returns list of protocols' names.
function getProtocolMetadata(string protocolName) returns (ProtocolMetadata)
Returns name, description, websiteURL, iconURL and version of the protocol.
function getProtocolAdapters(string protocolName) returns (address[])
Returns adapters addresses.
function getSupportedTokens(address adapter) returns (address[])
Returns adapter's supported tokens.
function isValidProtocol(string protocolName) returns (bool)
Returns true
if protocol name is listed in the registry and false
otherwise.
TokenAdapterManager is Ownable (abstract contract)
Base contract for AdapterRegistry
contract.
Implements logic connected with ProtocolName
s, ProtocolAdapter
s, and their supportedTokens
management.
mapping (string => string) internal nextTokenAdapterName;
mapping (string => address) internal tokenAdapter;
function addTokenAdapters(string[] tokenAdapterNames, address[] adapters)
function removeTokenAdapters(string[] tokenAdapterNames)
function updateTokenAdapter(string tokenAdapterName, address adapter)
function getTokenAdapterNames() returns (string[])
Returns list of token adapters' names.
function getTokenAdapter(string tokenAdapterName) returns (address)
Returns token adapter address.
function isValidTokenAdapter(string tokenAdapterName) returns (bool)
Returns true
if token adapter name is listed in the registry and false
otherwise.
Base contract for ProtocolManager
and TokenAdapterManager
contracts.
Implements Ownable
logic.
Includes onlyOwner
modifier, transferOwnership()
function, and public state variable owner
.
If you have any questions about DeFi SDK, feel free to reach out to us on our Discord server.