IPOR Protocol
Search…
⌃K

Stanley - Assets Management

I am always amazed how much a certain facility with a special and apparently narrow technique can accomplish.

Stanisław Ulam
Stanley's responsibility is to put funds kept on Milton to work so that they can earn additional interest on money markets. When they arrive, as delegated by Milton are assigned via its "strategies" to lending platforms as collateral.
Stanley issues ivTokens to Milton to account for the funds in stablecoins. The below graphs show how the funds flow between IPOR components with regard to Stanley:
Depositing funds from Milton to Stanley
Withdrawing funds from Stanley to Milton

Deposit and withdraw

Both deposit and withdrawal from Stanley can only be made by an appointed entity. At inception, only Joseph is authorized to perform those actions. At the moment of deposit, the finds are piped to AAVE or Compound, depending on the algorithm currently used in Stanley.

ivTokens

ivDAI, ivUSDC, and ivUSDT are special types of ERC20 tokens minted and issued to the entity depositing to Stanley and are meant to be fungible tokens representing addresses stake in the holdings of the Stanley contract. ivTokens are not upgradable ERC20 tokens and can be redeemed for an underlying token, namely DAI, USDC, or USDT by Stanley.

Governance Tokens

When delegating liquidity via Asset Management, it may happen that platforms, where the liquidity is delegated will issue governance tokens. Those tokens are kept in Stanley's balance and can only be moved by a designated administrator to an appointed DAO's address, where the community can manage them.

Strategies

Stanley has logic on how to allocate the funds to various different protocols (AAVE and Compound at its inception). Since different contracts have different APIs some form of middleware is needed. This middleware is called strategy. It allows interacting with external protocols in a standard way.

Public functions

Stanley, like many other contracts in IPOR Protocol, is issued on a per-asset basis. So at inception, we have DAI Stanley, USDC Stanley, and USDT Stanley.
For detailed developer comments refer directly to deployed contracts.
Function
Notes
totalBalance
It returns the total value of assets held by a given address. The value is denominated in the underlying tokens
calculateExchangeRate
As interest is accrued by the ivToken, the exchange rate between it and the underlying asset changes. This function calculates what the current ratio is.
deposit
Allows for transferring stablecoin to asset management. ivTokens are issued to the depositary. At its inception only available to Milton.
withdraw
Redeems ivTokens for the underlying asset. At its inception only available to Milton.
withdrawAll
Redeems all ivTokens and transfers all the underlying assets back to the depositary. At its inception only available to Milton.
migrateAssetToStrategyWithMaxApr
Allows for moving of all assets to a strategy with higher APR. This function is limited to the administrator of the contract.
setStrategyAave
Sets the address of AAVE strategy implementation
setStrategyCompound
Sets the address of Compound strategy implementation
setMilton
Sets the address of Milton.