More Info
Private Name Tags
ContractCreator
TokenTracker
Latest 7 from a total of 7 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Redeem | 5270125 | 6 days ago | IN | 0 S | 0.01046246 | ||||
Redeem | 5064627 | 8 days ago | IN | 0 S | 0.01145633 | ||||
Redeem | 5011711 | 8 days ago | IN | 0 S | 0.01173979 | ||||
Borrow | 4737325 | 10 days ago | IN | 0 S | 0.02151844 | ||||
Borrow | 4734999 | 10 days ago | IN | 0 S | 0.02058562 | ||||
Redeem | 4734568 | 10 days ago | IN | 0 S | 0.0114467 | ||||
Redeem | 4733921 | 10 days ago | IN | 0 S | 0.01033285 |
Loading...
Loading
Minimal Proxy Contract for 0x85b0273b0b415f9e28b9ce820240f4aa097f2a29
Contract Name:
Silo
Compiler Version
v0.8.28+commit.7893614a
Optimization Enabled:
Yes with 200 runs
Other Settings:
cancun EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
1234567891011121314151617181920212223242526// SPDX-License-Identifier: BUSL-1.1pragma solidity 0.8.28;import {SafeERC20} from "openzeppelin5/token/ERC20/utils/SafeERC20.sol";import {IERC20} from "openzeppelin5/token/ERC20/IERC20.sol";import {ISilo, IERC4626, IERC3156FlashLender} from "./interfaces/ISilo.sol";import {IShareToken} from "./interfaces/IShareToken.sol";import {IERC3156FlashBorrower} from "./interfaces/IERC3156FlashBorrower.sol";import {ISiloConfig} from "./interfaces/ISiloConfig.sol";import {ISiloFactory} from "./interfaces/ISiloFactory.sol";import {ShareCollateralToken} from "./utils/ShareCollateralToken.sol";import {Actions} from "./lib/Actions.sol";import {Views} from "./lib/Views.sol";import {SiloStdLib} from "./lib/SiloStdLib.sol";import {SiloLendingLib} from "./lib/SiloLendingLib.sol";import {SiloERC4626Lib} from "./lib/SiloERC4626Lib.sol";import {SiloMathLib} from "./lib/SiloMathLib.sol";import {Rounding} from "./lib/Rounding.sol";import {Hook} from "./lib/Hook.sol";import {ShareTokenLib} from "./lib/ShareTokenLib.sol";import {SiloStorageLib} from "./lib/SiloStorageLib.sol";
1234567891011121314151617181920212223242526// SPDX-License-Identifier: MIT// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/utils/SafeERC20.sol)pragma solidity ^0.8.20;import {IERC20} from "../IERC20.sol";import {IERC1363} from "../../../interfaces/IERC1363.sol";import {Address} from "../../../utils/Address.sol";/*** @title SafeERC20* @dev Wrappers around ERC-20 operations that throw on failure (when the token* contract returns false). Tokens that return no value (and instead revert or* throw on failure) are also supported, non-reverting calls are assumed to be* successful.* To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,* which allows you to call the safe operations as `token.safeTransfer(...)`, etc.*/library SafeERC20 {using Address for address;/*** @dev An operation with an ERC-20 token failed.*/error SafeERC20FailedOperation(address token);
1234567891011121314151617181920212223242526// SPDX-License-Identifier: MIT// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol)pragma solidity ^0.8.20;/*** @dev Interface of the ERC-20 standard as defined in the ERC.*/interface IERC20 {/*** @dev Emitted when `value` tokens are moved from one account (`from`) to* another (`to`).** Note that `value` may be zero.*/event Transfer(address indexed from, address indexed to, uint256 value);/*** @dev Emitted when the allowance of a `spender` for an `owner` is set by* a call to {approve}. `value` is the new allowance.*/event Approval(address indexed owner, address indexed spender, uint256 value);/*** @dev Returns the value of tokens in existence.*/
1234567891011121314151617181920212223242526// SPDX-License-Identifier: MITpragma solidity >=0.5.0;import {IERC4626, IERC20, IERC20Metadata} from "openzeppelin5/interfaces/IERC4626.sol";import {IERC3156FlashLender} from "./IERC3156FlashLender.sol";import {ISiloConfig} from "./ISiloConfig.sol";import {ISiloFactory} from "./ISiloFactory.sol";import {IHookReceiver} from "./IHookReceiver.sol";// solhint-disable orderinginterface ISilo is IERC20, IERC4626, IERC3156FlashLender {/// @dev Interest accrual happens on each deposit/withdraw/borrow/repay. View methods work on storage that might be/// outdate. Some calculations require accrued interest to return current state of Silo. This struct is used/// to make a decision inside functions if interest should be accrued in memory to work on updated values.enum AccrueInterestInMemory {No,Yes}/// @dev Silo has two separate oracles for solvency and maxLtv calculations. MaxLtv oracle is optional. Solvency/// oracle can also be optional if asset is used as denominator in Silo config. For example, in ETH/USDC Silo/// one could setup only solvency oracle for ETH that returns price in USDC. Then USDC does not need an oracle/// because it's used as denominator for ETH and it's "price" can be assume as 1.enum OracleType {
1234567891011121314151617181920212223242526// SPDX-License-Identifier: MITpragma solidity >=0.5.0;import {IERC20Metadata} from "openzeppelin5/token/ERC20/extensions/IERC20Metadata.sol";import {ISiloConfig} from "./ISiloConfig.sol";import {ISilo} from "./ISilo.sol";interface IShareToken is IERC20Metadata {struct HookSetup {/// @param this is the same as in siloConfigaddress hookReceiver;/// @param hooks bitmapuint24 hooksBefore;/// @param hooks bitmapuint24 hooksAfter;/// @param tokenType must be one of this hooks values: COLLATERAL_TOKEN, PROTECTED_TOKEN, DEBT_TOKENuint24 tokenType;}struct ShareTokenStorage {/// @notice Silo address for which tokens was deployedISilo silo;/// @dev cached silo config addressISiloConfig siloConfig;
123456789101112131415161718// SPDX-License-Identifier: MITpragma solidity >=0.5.0;interface IERC3156FlashBorrower {/// @notice During the execution of the flashloan, Silo methods are not taking into consideration the fact,/// that some (or all) tokens were transferred as flashloan, therefore some methods can return invalid state/// eg. maxWithdraw can return amount that are not available to withdraw during flashlon./// @dev Receive a flash loan./// @param _initiator The initiator of the loan./// @param _token The loan currency./// @param _amount The amount of tokens lent./// @param _fee The additional amount of tokens to repay./// @param _data Arbitrary data structure, intended to contain user-defined parameters./// @return The keccak256 hash of "ERC3156FlashBorrower.onFlashLoan"function onFlashLoan(address _initiator, address _token, uint256 _amount, uint256 _fee, bytes calldata _data)externalreturns (bytes32);}
1234567891011121314151617181920212223242526// SPDX-License-Identifier: MITpragma solidity >=0.5.0;import {ISilo} from "./ISilo.sol";import {ICrossReentrancyGuard} from "./ICrossReentrancyGuard.sol";interface ISiloConfig is ICrossReentrancyGuard {struct InitData {/// @notice Can be address zero if deployer fees are not to be collected. If deployer address is zero then/// deployer fee must be zero as well. Deployer will be minted an NFT that gives the right to claim deployer/// fees. NFT can be transferred with the right to claim.address deployer;/// @notice Address of the hook receiver called on every before/after action on Silo. Hook contract also/// implements liquidation logic and veSilo gauge connection.address hookReceiver;/// @notice Deployer's fee in 18 decimals points. Deployer will earn this fee based on the interest earned/// by the Silo. Max deployer fee is set by the DAO. At deployment it is 15%.uint256 deployerFee;/// @notice DAO's fee in 18 decimals points. DAO will earn this fee based on the interest earned/// by the Silo. Acceptable fee range fee is set by the DAO. Default at deployment is 5% - 50%.uint256 daoFee;/// @notice Address of the first token
1234567891011121314151617181920212223242526// SPDX-License-Identifier: MITpragma solidity >=0.5.0;import {IERC721} from "openzeppelin5/interfaces/IERC721.sol";import {ISiloConfig} from "./ISiloConfig.sol";interface ISiloFactory is IERC721 {struct Range {uint128 min;uint128 max;}/// @notice Emitted on the creation of a Silo./// @param implementation Address of the Silo implementation./// @param token0 Address of the first Silo token./// @param token1 Address of the second Silo token./// @param silo0 Address of the first Silo./// @param silo1 Address of the second Silo./// @param siloConfig Address of the SiloConfig.event NewSilo(address indexed implementation,address indexed token0,address indexed token1,address silo0,address silo1,address siloConfig
1234567891011121314151617181920212223242526// SPDX-License-Identifier: BUSL-1.1pragma solidity 0.8.28;import {ShareTokenLib} from "../lib/ShareTokenLib.sol";import {SiloMathLib} from "../lib/SiloMathLib.sol";import {ShareCollateralTokenLib} from "../lib/ShareCollateralTokenLib.sol";import {IShareToken, ShareToken, ISilo} from "./ShareToken.sol";/// @title ShareCollateralToken/// @notice ERC20 compatible token representing collateral in Silo/// @custom:security-contact security@silo.financeabstract contract ShareCollateralToken is ShareToken {/// @inheritdoc IShareTokenfunction mint(address _owner, address /* _spender */, uint256 _amount) external virtual override onlySilo {_mint(_owner, _amount);}/// @inheritdoc IShareTokenfunction burn(address _owner, address _spender, uint256 _amount) external virtual override onlySilo {if (_owner != _spender) _spendAllowance(_owner, _spender, _amount);_burn(_owner, _amount);}/// @dev decimals of share tokenfunction decimals() public view virtual override(ShareToken) returns (uint8) {return ShareTokenLib.decimals() + uint8(SiloMathLib._DECIMALS_OFFSET);
1234567891011121314151617181920212223242526// SPDX-License-Identifier: BUSL-1.1pragma solidity ^0.8.28;import {IERC20} from "openzeppelin5/token/ERC20/IERC20.sol";import {SafeERC20} from "openzeppelin5/token/ERC20/utils/SafeERC20.sol";import {ISiloConfig} from "../interfaces/ISiloConfig.sol";import {IInterestRateModelV2} from "../interfaces/IInterestRateModelV2.sol";import {ISilo} from "../interfaces/ISilo.sol";import {IShareToken} from "../interfaces/IShareToken.sol";import {IERC3156FlashBorrower} from "../interfaces/IERC3156FlashBorrower.sol";import {IHookReceiver} from "../interfaces/IHookReceiver.sol";import {SiloERC4626Lib} from "./SiloERC4626Lib.sol";import {SiloSolvencyLib} from "./SiloSolvencyLib.sol";import {SiloLendingLib} from "./SiloLendingLib.sol";import {SiloStdLib} from "./SiloStdLib.sol";import {Hook} from "./Hook.sol";import {CallBeforeQuoteLib} from "./CallBeforeQuoteLib.sol";import {NonReentrantLib} from "./NonReentrantLib.sol";import {ShareTokenLib} from "./ShareTokenLib.sol";import {SiloStorageLib} from "./SiloStorageLib.sol";import {Views} from "./Views.sol";library Actions {using SafeERC20 for IERC20;
1234567891011121314151617181920212223242526// SPDX-License-Identifier: BUSL-1.1pragma solidity ^0.8.28;import {IERC20} from "openzeppelin5/token/ERC20/IERC20.sol";import {ISiloConfig} from "../interfaces/ISiloConfig.sol";import {ISilo} from "../interfaces/ISilo.sol";import {ISiloOracle} from "../interfaces/ISiloOracle.sol";import {IShareToken} from "../interfaces/IShareToken.sol";import {ISiloFactory} from "../interfaces/ISiloFactory.sol";import {SiloERC4626Lib} from "./SiloERC4626Lib.sol";import {SiloSolvencyLib} from "./SiloSolvencyLib.sol";import {SiloLendingLib} from "./SiloLendingLib.sol";import {SiloStdLib} from "./SiloStdLib.sol";import {SiloMathLib} from "./SiloMathLib.sol";import {Rounding} from "./Rounding.sol";import {ShareTokenLib} from "./ShareTokenLib.sol";import {SiloStorageLib} from "./SiloStorageLib.sol";// solhint-disable orderinglibrary Views {uint256 internal constant _100_PERCENT = 1e18;bytes32 internal constant _FLASHLOAN_CALLBACK = keccak256("ERC3156FlashBorrower.onFlashLoan");
1234567891011121314151617181920212223242526// SPDX-License-Identifier: BUSL-1.1pragma solidity ^0.8.28;import {SafeERC20} from "openzeppelin5/token/ERC20/utils/SafeERC20.sol";import {IERC20} from "openzeppelin5/token/ERC20/IERC20.sol";import {ISiloConfig} from "../interfaces/ISiloConfig.sol";import {ISilo} from "../interfaces/ISilo.sol";import {IInterestRateModel} from "../interfaces/IInterestRateModel.sol";import {IShareToken} from "../interfaces/IShareToken.sol";import {SiloMathLib} from "./SiloMathLib.sol";library SiloStdLib {using SafeERC20 for IERC20;uint256 internal constant _PRECISION_DECIMALS = 1e18;/// @notice Returns flash fee amount/// @param _config address of config contract for Silo/// @param _token for which fee is calculated/// @param _amount for which fee is calculated/// @return fee flash fee amountfunction flashFee(ISiloConfig _config, address _token, uint256 _amount) internal view returns (uint256 fee) {if (_amount == 0) return 0;// all user set fees are in 18 decimals points
1234567891011121314151617181920212223242526// SPDX-License-Identifier: BUSL-1.1pragma solidity ^0.8.28;import {SafeERC20} from "openzeppelin5/token/ERC20/utils/SafeERC20.sol";import {IERC20} from "openzeppelin5/token/ERC20/IERC20.sol";import {Math} from "openzeppelin5/utils/math/Math.sol";import {ISiloOracle} from "../interfaces/ISiloOracle.sol";import {ISilo} from "../interfaces/ISilo.sol";import {IShareToken} from "../interfaces/IShareToken.sol";import {IInterestRateModel} from "../interfaces/IInterestRateModel.sol";import {ISiloConfig} from "../interfaces/ISiloConfig.sol";import {SiloSolvencyLib} from "./SiloSolvencyLib.sol";import {SiloStdLib} from "./SiloStdLib.sol";import {SiloMathLib} from "./SiloMathLib.sol";import {Rounding} from "./Rounding.sol";import {ShareTokenLib} from "./ShareTokenLib.sol";import {SiloStorageLib} from "./SiloStorageLib.sol";library SiloLendingLib {using SafeERC20 for IERC20;using Math for uint256;uint256 internal constant _PRECISION_DECIMALS = 1e18;/// @notice Allows repaying borrowed assets either partially or in full
1234567891011121314151617181920212223242526// SPDX-License-Identifier: BUSL-1.1pragma solidity ^0.8.28;import {SafeERC20} from "openzeppelin5/token/ERC20/utils/SafeERC20.sol";import {IERC20} from "openzeppelin5/token/ERC20/IERC20.sol";import {Math} from "openzeppelin5/utils/math/Math.sol";import {ISiloConfig} from "../interfaces/ISiloConfig.sol";import {ISilo} from "../interfaces/ISilo.sol";import {IShareToken} from "../interfaces/IShareToken.sol";import {SiloSolvencyLib} from "./SiloSolvencyLib.sol";import {SiloMathLib} from "./SiloMathLib.sol";import {SiloStdLib} from "./SiloStdLib.sol";import {SiloLendingLib} from "./SiloLendingLib.sol";import {Rounding} from "./Rounding.sol";import {Hook} from "./Hook.sol";import {ShareTokenLib} from "./ShareTokenLib.sol";import {SiloStorageLib} from "./SiloStorageLib.sol";// solhint-disable function-max-lineslibrary SiloERC4626Lib {using SafeERC20 for IERC20;using Math for uint256;uint256 internal constant _PRECISION_DECIMALS = 1e18;
1234567891011121314151617181920212223242526// SPDX-License-Identifier: BUSL-1.1pragma solidity ^0.8.28;import {Math} from "openzeppelin5/utils/math/Math.sol";import {Rounding} from "../lib/Rounding.sol";import {ISilo} from "../interfaces/ISilo.sol";library SiloMathLib {using Math for uint256;uint256 internal constant _PRECISION_DECIMALS = 1e18;uint256 internal constant _DECIMALS_OFFSET = 3;/// @dev this is constant version of openzeppelin5/contracts/token/ERC20/extensions/ERC4626._decimalsOffsetuint256 internal constant _DECIMALS_OFFSET_POW = 10 ** _DECIMALS_OFFSET;/// @notice Returns available liquidity to be borrowed/// @dev Accrued interest is entirely added to `debtAssets` but only part of it is added to `collateralAssets`. The/// difference is DAO's and deployer's cut. That means DAO's and deployer's cut is not considered a borrowable/// liquidity.function liquidity(uint256 _collateralAssets, uint256 _debtAssets) internal pure returns (uint256 liquidAssets) {unchecked {// we checked the underflowliquidAssets = _debtAssets > _collateralAssets ? 0 : _collateralAssets - _debtAssets;}
1234567891011121314151617181920212223242526// SPDX-License-Identifier: GPL-2.0-or-laterpragma solidity ^0.8.28;import {Math} from "openzeppelin5/utils/math/Math.sol";// solhint-disable private-vars-leading-underscorelibrary Rounding {Math.Rounding internal constant UP = (Math.Rounding.Ceil);Math.Rounding internal constant DOWN = (Math.Rounding.Floor);Math.Rounding internal constant DEBT_TO_ASSETS = (Math.Rounding.Ceil);// COLLATERAL_TO_ASSETS is used to calculate borrower collateral (so we want to round down)Math.Rounding internal constant COLLATERAL_TO_ASSETS = (Math.Rounding.Floor);// why DEPOSIT_TO_ASSETS is Up if COLLATERAL_TO_ASSETS is Down?// DEPOSIT_TO_ASSETS is used for preview deposit and deposit, based on provided shares we want to pull "more" tokens// so we rounding up, "token flow" is in different direction than for COLLATERAL_TO_ASSETS, that's why// different rounding policyMath.Rounding internal constant DEPOSIT_TO_ASSETS = (Math.Rounding.Ceil);Math.Rounding internal constant DEPOSIT_TO_SHARES = (Math.Rounding.Floor);Math.Rounding internal constant BORROW_TO_ASSETS = (Math.Rounding.Floor);Math.Rounding internal constant BORROW_TO_SHARES = (Math.Rounding.Ceil);Math.Rounding internal constant MAX_BORROW_TO_ASSETS = (Math.Rounding.Floor);Math.Rounding internal constant MAX_BORROW_TO_SHARES = (Math.Rounding.Floor);Math.Rounding internal constant MAX_BORROW_VALUE = (Math.Rounding.Floor);Math.Rounding internal constant REPAY_TO_ASSETS = (Math.Rounding.Ceil);Math.Rounding internal constant REPAY_TO_SHARES = (Math.Rounding.Floor);Math.Rounding internal constant MAX_REPAY_TO_ASSETS = (Math.Rounding.Ceil);
1234567891011121314151617181920212223242526// SPDX-License-Identifier: GPL-2.0-or-laterpragma solidity ^0.8.28;import {ISilo} from "../interfaces/ISilo.sol";// solhint-disable private-vars-leading-underscorelibrary Hook {/// @notice The data structure for the deposit hook/// @param assets The amount of assets deposited/// @param shares The amount of shares deposited/// @param receiver The receiver of the depositstruct BeforeDepositInput {uint256 assets;uint256 shares;address receiver;}/// @notice The data structure for the deposit hook/// @param assets The amount of assets deposited/// @param shares The amount of shares deposited/// @param receiver The receiver of the deposit/// @param receivedAssets The exact amount of assets being deposited/// @param mintedShares The exact amount of shares being mintedstruct AfterDepositInput {uint256 assets;uint256 shares;
1234567891011121314151617181920212223242526// SPDX-License-Identifier: BUSL-1.1pragma solidity ^0.8.0;import {Strings} from "openzeppelin5/utils/Strings.sol";import {ISilo} from "../interfaces/ISilo.sol";import {IShareToken} from "../interfaces/IShareToken.sol";import {ISiloConfig} from "../interfaces/ISiloConfig.sol";import {TokenHelper} from "../lib/TokenHelper.sol";import {CallBeforeQuoteLib} from "../lib/CallBeforeQuoteLib.sol";import {Hook} from "../lib/Hook.sol";// solhint-disable orderinglibrary ShareTokenLib {using Hook for uint24;using CallBeforeQuoteLib for ISiloConfig.ConfigData;// keccak256(abi.encode(uint256(keccak256("silo.storage.ShareToken")) - 1)) & ~bytes32(uint256(0xff))bytes32 private constant _STORAGE_LOCATION = 0x01b0b3f9d6e360167e522fa2b18ba597ad7b2b35841fec7e1ca4dbb0adea1200;function getShareTokenStorage() internal pure returns (IShareToken.ShareTokenStorage storage $) {// solhint-disable-next-line no-inline-assemblyassembly {$.slot := _STORAGE_LOCATION
12345678910111213141516// SPDX-License-Identifier: BUSL-1.1pragma solidity 0.8.28;import {ISilo} from "silo-core/contracts/interfaces/ISilo.sol";library SiloStorageLib {// keccak256(abi.encode(uint256(keccak256("silo.storage.SiloVault")) - 1)) & ~bytes32(uint256(0xff));bytes32 private constant _STORAGE_LOCATION = 0xd7513ffe3a01a9f6606089d1b67011bca35bec018ac0faa914e1c529408f8300;function getSiloStorage() internal pure returns (ISilo.SiloStorage storage $) {// solhint-disable-next-line no-inline-assemblyassembly {$.slot := _STORAGE_LOCATION}}}
1234567891011121314151617181920212223242526// SPDX-License-Identifier: MIT// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC1363.sol)pragma solidity ^0.8.20;import {IERC20} from "./IERC20.sol";import {IERC165} from "./IERC165.sol";/*** @title IERC1363* @dev Interface of the ERC-1363 standard as defined in the https://eips.ethereum.org/EIPS/eip-1363[ERC-1363].** Defines an extension interface for ERC-20 tokens that supports executing code on a recipient contract* after `transfer` or `transferFrom`, or code on a spender contract after `approve`, in a single transaction.*/interface IERC1363 is IERC20, IERC165 {/** Note: the ERC-165 identifier for this interface is 0xb0202a11.* 0xb0202a11 ===* bytes4(keccak256('transferAndCall(address,uint256)')) ^* bytes4(keccak256('transferAndCall(address,uint256,bytes)')) ^* bytes4(keccak256('transferFromAndCall(address,address,uint256)')) ^* bytes4(keccak256('transferFromAndCall(address,address,uint256,bytes)')) ^* bytes4(keccak256('approveAndCall(address,uint256)')) ^* bytes4(keccak256('approveAndCall(address,uint256,bytes)'))*/
1234567891011121314151617181920212223242526// SPDX-License-Identifier: MIT// OpenZeppelin Contracts (last updated v5.0.0) (utils/Address.sol)pragma solidity ^0.8.20;import {Errors} from "./Errors.sol";/*** @dev Collection of functions related to the address type*/library Address {/*** @dev There's no code at `target` (it is not a contract).*/error AddressEmptyCode(address target);/*** @dev Replacement for Solidity's `transfer`: sends `amount` wei to* `recipient`, forwarding all available gas and reverting on errors.** https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost* of certain opcodes, possibly making contracts go over the 2300 gas limit* imposed by `transfer`, making them unable to receive funds via* `transfer`. {sendValue} removes this limitation.** https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].
1234567891011121314151617181920212223242526// SPDX-License-Identifier: MIT// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC4626.sol)pragma solidity ^0.8.20;import {IERC20} from "../token/ERC20/IERC20.sol";import {IERC20Metadata} from "../token/ERC20/extensions/IERC20Metadata.sol";/*** @dev Interface of the ERC-4626 "Tokenized Vault Standard", as defined in* https://eips.ethereum.org/EIPS/eip-4626[ERC-4626].*/interface IERC4626 is IERC20, IERC20Metadata {event Deposit(address indexed sender, address indexed owner, uint256 assets, uint256 shares);event Withdraw(address indexed sender,address indexed receiver,address indexed owner,uint256 assets,uint256 shares);/*** @dev Returns the address of the underlying token used for the Vault for accounting, depositing, and withdrawing.*
1234567891011121314151617181920212223242526// SPDX-License-Identifier: MITpragma solidity >=0.5.0;import {IERC3156FlashBorrower} from "./IERC3156FlashBorrower.sol";/// @notice https://eips.ethereum.org/EIPS/eip-3156interface IERC3156FlashLender {/// @notice Protected deposits are not available for a flash loan./// During the execution of the flashloan, Silo methods are not taking into consideration the fact,/// that some (or all) tokens were transferred as flashloan, therefore some methods can return invalid state/// eg. maxWithdraw can return amount that are not available to withdraw during flashlon./// @dev Initiate a flash loan./// @param _receiver The receiver of the tokens in the loan, and the receiver of the callback./// @param _token The loan currency./// @param _amount The amount of tokens lent./// @param _data Arbitrary data structure, intended to contain user-defined parameters.function flashLoan(IERC3156FlashBorrower _receiver, address _token, uint256 _amount, bytes calldata _data)externalreturns (bool);/// @dev The amount of currency available to be lent./// @param _token The loan currency./// @return The amount of `token` that can be borrowed.function maxFlashLoan(address _token) external view returns (uint256);/// @dev The fee to be charged for a given loan.
1234567891011121314151617181920212223242526// SPDX-License-Identifier: MITpragma solidity >=0.5.0;import {ISiloConfig} from "./ISiloConfig.sol";interface IHookReceiver {struct HookConfig {uint24 hooksBefore;uint24 hooksAfter;}event HookConfigured(address silo, uint24 hooksBefore, uint24 hooksAfter);/// @notice Initialize a hook receiver/// @param _siloConfig Silo configuration with all the details about the silo/// @param _data Data to initialize the hook receiver (if needed)function initialize(ISiloConfig _siloConfig, bytes calldata _data) external;/// @notice state of Silo before action, can be also without interest, if you need them, call silo.accrueInterest()function beforeAction(address _silo, uint256 _action, bytes calldata _input) external;function afterAction(address _silo, uint256 _action, bytes calldata _inputAndOutput) external;/// @notice return hooksBefore and hooksAfter configurationfunction hookReceiverConfig(address _silo) external view returns (uint24 hooksBefore, uint24 hooksAfter);}
1234567891011121314151617181920212223242526// SPDX-License-Identifier: MIT// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Metadata.sol)pragma solidity ^0.8.20;import {IERC20} from "../IERC20.sol";/*** @dev Interface for the optional metadata functions from the ERC-20 standard.*/interface IERC20Metadata is IERC20 {/*** @dev Returns the name of the token.*/function name() external view returns (string memory);/*** @dev Returns the symbol of the token.*/function symbol() external view returns (string memory);/*** @dev Returns the decimals places of the token.*/function decimals() external view returns (uint8);}
123456789101112131415161718// SPDX-License-Identifier: MITpragma solidity >=0.5.0;interface ICrossReentrancyGuard {error CrossReentrantCall();error CrossReentrancyNotActive();/// @notice only silo method for cross Silo reentrancyfunction turnOnReentrancyProtection() external;/// @notice only silo method for cross Silo reentrancyfunction turnOffReentrancyProtection() external;/// @notice view method for checking cross Silo reentrancy flag/// @return entered true if the reentrancy guard is currently set to "entered", which indicates there is a/// `nonReentrant` function in the call stack.function reentrancyGuardEntered() external view returns (bool entered);}
123456// SPDX-License-Identifier: MIT// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC721.sol)pragma solidity ^0.8.20;import {IERC721} from "../token/ERC721/IERC721.sol";
1234567891011121314151617181920212223242526// SPDX-License-Identifier: UNLICENSEDpragma solidity ^0.8.0;import {ISilo} from "../interfaces/ISilo.sol";import {IShareToken} from "../interfaces/IShareToken.sol";import {ISiloConfig} from "../interfaces/ISiloConfig.sol";import {ShareTokenLib} from "./ShareTokenLib.sol";import {CallBeforeQuoteLib} from "./CallBeforeQuoteLib.sol";import {SiloSolvencyLib} from "./SiloSolvencyLib.sol";library ShareCollateralTokenLib {using CallBeforeQuoteLib for ISiloConfig.ConfigData;function isSolventAfterCollateralTransfer(address _sender) external returns (bool isSolvent) {IShareToken.ShareTokenStorage storage $ = ShareTokenLib.getShareTokenStorage();ISiloConfig siloConfig = $.siloConfig;(ISiloConfig.DepositConfig memory deposit,ISiloConfig.ConfigData memory collateral,ISiloConfig.ConfigData memory debt) = siloConfig.getConfigsForWithdraw(address($.silo), _sender);// when deposit silo is collateral silo, that means this sToken is collateral for debtif (collateral.silo != deposit.silo) return true;
1234567891011121314151617181920212223242526// SPDX-License-Identifier: BUSL-1.1pragma solidity 0.8.28;import {IERC20Permit} from "openzeppelin5/token/ERC20/extensions/ERC20Permit.sol";import {ERC20PermitUpgradeable} from "openzeppelin5-upgradeable/token/ERC20/extensions/ERC20PermitUpgradeable.sol";import {ERC20Upgradeable} from "openzeppelin5-upgradeable/token/ERC20/ERC20Upgradeable.sol";import {IERC20Metadata, IERC20} from "openzeppelin5/token/ERC20/ERC20.sol";import {IHookReceiver} from "../interfaces/IHookReceiver.sol";import {IShareToken, ISilo} from "../interfaces/IShareToken.sol";import {ISiloConfig} from "../SiloConfig.sol";import {Hook} from "../lib/Hook.sol";import {CallBeforeQuoteLib} from "../lib/CallBeforeQuoteLib.sol";import {NonReentrantLib} from "../lib/NonReentrantLib.sol";import {ShareTokenLib} from "../lib/ShareTokenLib.sol";/// @title ShareToken/// @notice Implements common interface for Silo tokens representing debt or collateral./// @dev Docs borrowed from https://github.com/OpenZeppelin/openzeppelin-contracts/tree/v4.9.3////// Implementation of the ERC4626 "Tokenized Vault Standard" as defined in/// https://eips.ethereum.org/EIPS/eip-4626[EIP-4626].////// This extension allows the minting and burning of "shares" (represented using the ERC20 inheritance) in exchange for/// underlying "assets" through standardized {deposit}, {mint}, {redeem} and {burn} workflows. This contract extends
1234567891011121314151617181920212223242526// SPDX-License-Identifier: MITpragma solidity >=0.5.0;import {IInterestRateModelV2Config} from "./IInterestRateModelV2Config.sol";interface IInterestRateModelV2 {struct Config {// uopt ∈ (0, 1) – optimal utilization;int256 uopt;// ucrit ∈ (uopt, 1) – threshold of large utilization;int256 ucrit;// ulow ∈ (0, uopt) – threshold of low utilizationint256 ulow;// ki > 0 – integrator gainint256 ki;// kcrit > 0 – proportional gain for large utilizationint256 kcrit;// klow ≥ 0 – proportional gain for low utilizationint256 klow;// klin ≥ 0 – coefficient of the lower linear boundint256 klin;// beta ≥ 0 - a scaling factorint256 beta;// ri ≥ 0 – initial value of the integratorint112 ri;// Tcrit ≥ 0 - initial value of the time during which the utilization exceeds the critical value
1234567891011121314151617181920212223242526// SPDX-License-Identifier: BUSL-1.1pragma solidity ^0.8.28;import {Math} from "openzeppelin5/utils/math/Math.sol";import {ISiloOracle} from "../interfaces/ISiloOracle.sol";import {SiloStdLib, ISiloConfig, IShareToken, ISilo} from "./SiloStdLib.sol";import {SiloMathLib} from "./SiloMathLib.sol";import {Rounding} from "./Rounding.sol";library SiloSolvencyLib {using Math for uint256;struct LtvData {ISiloOracle collateralOracle;ISiloOracle debtOracle;uint256 borrowerProtectedAssets;uint256 borrowerCollateralAssets;uint256 borrowerDebtAssets;}uint256 internal constant _PRECISION_DECIMALS = 1e18;uint256 internal constant _INFINITY = type(uint256).max;/// @notice Determines if a borrower is solvent based on the Loan-to-Value (LTV) ratio/// @param _collateralConfig Configuration data for the collateral
1234567891011121314151617181920212223// SPDX-License-Identifier: BUSL-1.1pragma solidity ^0.8.28;import {ISiloConfig} from "../interfaces/ISiloConfig.sol";import {ISiloOracle} from "../interfaces/ISiloOracle.sol";library CallBeforeQuoteLib {/// @dev Call `beforeQuote` on the `solvencyOracle` oracle/// @param _config Silo config datafunction callSolvencyOracleBeforeQuote(ISiloConfig.ConfigData memory _config) internal {if (_config.callBeforeQuote && _config.solvencyOracle != address(0)) {ISiloOracle(_config.solvencyOracle).beforeQuote(_config.token);}}/// @dev Call `beforeQuote` on the `maxLtvOracle` oracle/// @param _config Silo config datafunction callMaxLtvOracleBeforeQuote(ISiloConfig.ConfigData memory _config) internal {if (_config.callBeforeQuote && _config.maxLtvOracle != address(0)) {ISiloOracle(_config.maxLtvOracle).beforeQuote(_config.token);}}}
1234567891011// SPDX-License-Identifier: BUSL-1.1pragma solidity ^0.8.28;import {ISiloConfig} from "../interfaces/ISiloConfig.sol";import {ICrossReentrancyGuard} from "../interfaces/ICrossReentrancyGuard.sol";library NonReentrantLib {function nonReentrant(ISiloConfig _config) internal view {require(!_config.reentrancyGuardEntered(), ICrossReentrancyGuard.CrossReentrantCall());}}
12345678910111213141516171819// SPDX-License-Identifier: MITpragma solidity >=0.5.0;interface ISiloOracle {/// @notice Hook function to call before `quote` function reads price/// @dev This hook function can be used to change state right before the price is read. For example it can be used/// for curve read only reentrancy protection. In majority of implementations this will be an empty function./// WARNING: reverts are propagated to Silo so if `beforeQuote` reverts, Silo reverts as well./// @param _baseToken Address of priced tokenfunction beforeQuote(address _baseToken) external;/// @return quoteAmount Returns quote price for _baseAmount of _baseToken/// @param _baseAmount Amount of priced token/// @param _baseToken Address of priced tokenfunction quote(uint256 _baseAmount, address _baseToken) external view returns (uint256 quoteAmount);/// @return address of token in which quote (price) is denominatedfunction quoteToken() external view returns (address);}
1234567891011121314151617181920212223242526// SPDX-License-Identifier: MITpragma solidity >=0.5.0;interface IInterestRateModel {event InterestRateModelError();/// @dev Sets config address for all Silos that will use this model/// @param _irmConfig address of IRM config contractfunction initialize(address _irmConfig) external;/// @dev get compound interest rate and update model storage for current block.timestamp/// @param _collateralAssets total silo collateral assets/// @param _debtAssets total silo debt assets/// @param _interestRateTimestamp last IRM timestamp/// @return rcomp compounded interest rate from last update until now (1e18 == 100%)function getCompoundInterestRateAndUpdate(uint256 _collateralAssets,uint256 _debtAssets,uint256 _interestRateTimestamp)externalreturns (uint256 rcomp);/// @dev get compound interest rate/// @param _silo address of Silo for which interest rate should be calculated/// @param _blockTimestamp current block timestamp
1234567891011121314151617181920212223242526// SPDX-License-Identifier: MIT// OpenZeppelin Contracts (last updated v5.0.0) (utils/math/Math.sol)pragma solidity ^0.8.20;import {Panic} from "../Panic.sol";import {SafeCast} from "./SafeCast.sol";/*** @dev Standard math utilities missing in the Solidity language.*/library Math {enum Rounding {Floor, // Toward negative infinityCeil, // Toward positive infinityTrunc, // Toward zeroExpand // Away from zero}/*** @dev Returns the addition of two unsigned integers, with an success flag (no overflow).*/function tryAdd(uint256 a, uint256 b) internal pure returns (bool success, uint256 result) {unchecked {uint256 c = a + b;if (c < a) return (false, 0);
1234567891011121314151617181920212223242526// SPDX-License-Identifier: MIT// OpenZeppelin Contracts (last updated v5.0.0) (utils/Strings.sol)pragma solidity ^0.8.20;import {Math} from "./math/Math.sol";import {SignedMath} from "./math/SignedMath.sol";/*** @dev String operations.*/library Strings {bytes16 private constant HEX_DIGITS = "0123456789abcdef";uint8 private constant ADDRESS_LENGTH = 20;/*** @dev The `value` string doesn't fit in the specified `length`.*/error StringsInsufficientHexLength(uint256 value, uint256 length);/*** @dev Converts a `uint256` to its ASCII `string` decimal representation.*/function toString(uint256 value) internal pure returns (string memory) {unchecked {uint256 length = Math.log10(value) + 1;
1234567891011121314151617181920212223242526// SPDX-License-Identifier: BUSL-1.1pragma solidity ^0.8.28;import {IERC20Metadata} from "openzeppelin5/token/ERC20/extensions/IERC20Metadata.sol";import {IsContract} from "./IsContract.sol";library TokenHelper {uint256 private constant _BYTES32_SIZE = 32;error TokenIsNotAContract();function assertAndGetDecimals(address _token) internal view returns (uint256) {(bool hasMetadata, bytes memory data) =_tokenMetadataCall(_token, abi.encodeCall(IERC20Metadata.decimals, ()));// decimals() is optional in the ERC20 standard, so if metadata is not accessible// we assume there are no decimals and use 0.if (!hasMetadata) {return 0;}return abi.decode(data, (uint8));}/// @dev Returns the symbol for the provided ERC20 token.
123456// SPDX-License-Identifier: MIT// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC20.sol)pragma solidity ^0.8.20;import {IERC20} from "../token/ERC20/IERC20.sol";
123456// SPDX-License-Identifier: MIT// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC165.sol)pragma solidity ^0.8.20;import {IERC165} from "../utils/introspection/IERC165.sol";
1234567891011121314151617181920212223242526// SPDX-License-Identifier: MITpragma solidity ^0.8.20;/*** @dev Collection of common custom errors used in multiple contracts** IMPORTANT: Backwards compatibility is not guaranteed in future versions of the library.* It is recommended to avoid relying on the error API for critical functionality.*/library Errors {/*** @dev The ETH balance of the account is not enough to perform the operation.*/error InsufficientBalance(uint256 balance, uint256 needed);/*** @dev A call to an address target failed. The target may have reverted.*/error FailedCall();/*** @dev The deployment failed.*/error FailedDeployment();}
1234567891011121314151617181920212223242526// SPDX-License-Identifier: MIT// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC721/IERC721.sol)pragma solidity ^0.8.20;import {IERC165} from "../../utils/introspection/IERC165.sol";/*** @dev Required interface of an ERC-721 compliant contract.*/interface IERC721 is IERC165 {/*** @dev Emitted when `tokenId` token is transferred from `from` to `to`.*/event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);/*** @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.*/event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);/*** @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.*/event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
1234567891011121314151617181920212223242526// SPDX-License-Identifier: MIT// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/ERC20Permit.sol)pragma solidity ^0.8.20;import {IERC20Permit} from "./IERC20Permit.sol";import {ERC20} from "../ERC20.sol";import {ECDSA} from "../../../utils/cryptography/ECDSA.sol";import {EIP712} from "../../../utils/cryptography/EIP712.sol";import {Nonces} from "../../../utils/Nonces.sol";/*** @dev Implementation of the ERC-20 Permit extension allowing approvals to be made via signatures, as defined in* https://eips.ethereum.org/EIPS/eip-2612[ERC-2612].** Adds the {permit} method, which can be used to change an account's ERC-20 allowance (see {IERC20-allowance}) by* presenting a message signed by the account. By not relying on `{IERC20-approve}`, the token holder account doesn't* need to send a transaction, and thus is not required to hold Ether at all.*/abstract contract ERC20Permit is ERC20, IERC20Permit, EIP712, Nonces {bytes32 private constant PERMIT_TYPEHASH =keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)");/*** @dev Permit deadline has expired.*/
1234567891011121314151617181920212223242526// SPDX-License-Identifier: MIT// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/ERC20Permit.sol)pragma solidity ^0.8.20;import {IERC20Permit} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol";import {ERC20Upgradeable} from "../ERC20Upgradeable.sol";import {ECDSA} from "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";import {EIP712Upgradeable} from "../../../utils/cryptography/EIP712Upgradeable.sol";import {NoncesUpgradeable} from "../../../utils/NoncesUpgradeable.sol";import {Initializable} from "../../../proxy/utils/Initializable.sol";/*** @dev Implementation of the ERC-20 Permit extension allowing approvals to be made via signatures, as defined in* https://eips.ethereum.org/EIPS/eip-2612[ERC-2612].** Adds the {permit} method, which can be used to change an account's ERC-20 allowance (see {IERC20-allowance}) by* presenting a message signed by the account. By not relying on `{IERC20-approve}`, the token holder account doesn't* need to send a transaction, and thus is not required to hold Ether at all.*/abstract contract ERC20PermitUpgradeable is Initializable, ERC20Upgradeable, IERC20Permit, EIP712Upgradeable, NoncesUpgradeable {bytes32 private constant PERMIT_TYPEHASH =keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)");/*** @dev Permit deadline has expired.
1234567891011121314151617181920212223242526// SPDX-License-Identifier: MIT// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/ERC20.sol)pragma solidity ^0.8.20;import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";import {IERC20Metadata} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";import {ContextUpgradeable} from "../../utils/ContextUpgradeable.sol";import {IERC20Errors} from "@openzeppelin/contracts/interfaces/draft-IERC6093.sol";import {Initializable} from "../../proxy/utils/Initializable.sol";/*** @dev Implementation of the {IERC20} interface.** This implementation is agnostic to the way tokens are created. This means* that a supply mechanism has to be added in a derived contract using {_mint}.** TIP: For a detailed writeup see our guide* https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How* to implement supply mechanisms].** The default value of {decimals} is 18. To change this, you should override* this function so it returns a different value.** We have followed general OpenZeppelin Contracts guidelines: functions revert* instead returning `false` on failure. This behavior is nonetheless
1234567891011121314151617181920212223242526// SPDX-License-Identifier: MIT// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/ERC20.sol)pragma solidity ^0.8.20;import {IERC20} from "./IERC20.sol";import {IERC20Metadata} from "./extensions/IERC20Metadata.sol";import {Context} from "../../utils/Context.sol";import {IERC20Errors} from "../../interfaces/draft-IERC6093.sol";/*** @dev Implementation of the {IERC20} interface.** This implementation is agnostic to the way tokens are created. This means* that a supply mechanism has to be added in a derived contract using {_mint}.** TIP: For a detailed writeup see our guide* https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How* to implement supply mechanisms].** The default value of {decimals} is 18. To change this, you should override* this function so it returns a different value.** We have followed general OpenZeppelin Contracts guidelines: functions revert* instead returning `false` on failure. This behavior is nonetheless* conventional and does not conflict with the expectations of ERC-20
1234567891011121314151617181920212223242526// SPDX-License-Identifier: BUSL-1.1pragma solidity 0.8.28;import {IERC20} from "openzeppelin5/token/ERC20/IERC20.sol";import {ISilo} from "./interfaces/ISilo.sol";import {ISiloConfig} from "./interfaces/ISiloConfig.sol";import {CrossReentrancyGuard} from "./utils/CrossReentrancyGuard.sol";import {Hook} from "./lib/Hook.sol";/// @notice SiloConfig stores full configuration of Silo in immutable manner/// @dev Immutable contract is more expensive to deploy than minimal proxy however it provides nearly 10x cheaper/// data access using immutable variables.contract SiloConfig is ISiloConfig, CrossReentrancyGuard {using Hook for uint256;uint256 public immutable SILO_ID;uint256 internal immutable _DAO_FEE;uint256 internal immutable _DEPLOYER_FEE;address internal immutable _HOOK_RECEIVER;// TOKEN #0address internal immutable _SILO0;
123456789// SPDX-License-Identifier: MITpragma solidity >=0.5.0;import {IInterestRateModelV2} from "./IInterestRateModelV2.sol";interface IInterestRateModelV2Config {/// @return config returns immutable IRM configuration that is present in contractfunction getConfig() external view returns (IInterestRateModelV2.Config memory config);}
1234567891011121314151617181920212223242526// SPDX-License-Identifier: MITpragma solidity ^0.8.20;/*** @dev Helper library for emitting standardized panic codes.** ```solidity* contract Example {* using Panic for uint256;** // Use any of the declared internal constants* function foo() { Panic.GENERIC.panic(); }** // Alternatively* function foo() { Panic.panic(Panic.GENERIC); }* }* ```** Follows the list from https://github.com/ethereum/solidity/blob/v0.8.24/libsolutil/ErrorCodes.h[libsolutil].*/// slither-disable-next-line unused-statelibrary Panic {/// @dev generic / unspecified erroruint256 internal constant GENERIC = 0x00;/// @dev used by the assert() builtin
1234567891011121314151617181920212223242526// SPDX-License-Identifier: MIT// OpenZeppelin Contracts (last updated v5.0.0) (utils/math/SafeCast.sol)// This file was procedurally generated from scripts/generate/templates/SafeCast.js.pragma solidity ^0.8.20;/*** @dev Wrappers over Solidity's uintXX/intXX/bool casting operators with added overflow* checks.** Downcasting from uint256/int256 in Solidity does not revert on overflow. This can* easily result in undesired exploitation or bugs, since developers usually* assume that overflows raise errors. `SafeCast` restores this intuition by* reverting the transaction when such an operation overflows.** Using this library instead of the unchecked operations eliminates an entire* class of bugs, so it's recommended to use it always.*/library SafeCast {/*** @dev Value doesn't fit in an uint of `bits` size.*/error SafeCastOverflowedUintDowncast(uint8 bits, uint256 value);/*** @dev An int value doesn't fit in an uint of `bits` size.
1234567891011121314151617181920212223242526// SPDX-License-Identifier: MIT// OpenZeppelin Contracts (last updated v5.0.0) (utils/math/SignedMath.sol)pragma solidity ^0.8.20;/*** @dev Standard signed math utilities missing in the Solidity language.*/library SignedMath {/*** @dev Returns the largest of two signed numbers.*/function max(int256 a, int256 b) internal pure returns (int256) {return a > b ? a : b;}/*** @dev Returns the smallest of two signed numbers.*/function min(int256 a, int256 b) internal pure returns (int256) {return a < b ? a : b;}/*** @dev Returns the average of two signed numbers without overflow.* The result is rounded towards zero.
1234567891011121314151617181920212223242526// SPDX-License-Identifier: BUSL-1.1pragma solidity ^0.8.24;library IsContract {/*** @dev Returns true if `account` is a contract.** [IMPORTANT]* ====* It is unsafe to assume that an address for which this function returns* false is an externally-owned account (EOA) and not a contract.** Among others, `isContract` will return false for the following* types of addresses:** - an externally-owned account* - a contract in construction* - an address where a contract will be created* - an address where a contract lived, but was destroyed** Furthermore, `isContract` will also return true if the target contract within* the same transaction is already scheduled for destruction by `SELFDESTRUCT`,* which only has an effect at the end of a transaction.* ====** [IMPORTANT]
12345678910111213141516171819202122232425// SPDX-License-Identifier: MIT// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/IERC165.sol)pragma solidity ^0.8.20;/*** @dev Interface of the ERC-165 standard, as defined in the* https://eips.ethereum.org/EIPS/eip-165[ERC].** Implementers can declare support of contract interfaces, which can then be* queried by others ({ERC165Checker}).** For an implementation, see {ERC165}.*/interface IERC165 {/*** @dev Returns true if this contract implements the interface defined by* `interfaceId`. See the corresponding* https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[ERC section]* to learn more about how these ids are created.** This function call must use less than 30 000 gas.*/function supportsInterface(bytes4 interfaceId) external view returns (bool);}
1234567891011121314151617181920212223242526// SPDX-License-Identifier: MIT// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Permit.sol)pragma solidity ^0.8.20;/*** @dev Interface of the ERC-20 Permit extension allowing approvals to be made via signatures, as defined in* https://eips.ethereum.org/EIPS/eip-2612[ERC-2612].** Adds the {permit} method, which can be used to change an account's ERC-20 allowance (see {IERC20-allowance}) by* presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't* need to send a transaction, and thus is not required to hold Ether at all.** ==== Security Considerations** There are two important considerations concerning the use of `permit`. The first is that a valid permit signature* expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be* considered as an intention to spend the allowance in any specific way. The second is that because permits have* built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should* take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be* generally recommended is:** ```solidity* function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public {* try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {}* doThing(..., value);
1234567891011121314151617181920212223242526// SPDX-License-Identifier: MIT// OpenZeppelin Contracts (last updated v5.0.0) (utils/cryptography/ECDSA.sol)pragma solidity ^0.8.20;/*** @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.** These functions can be used to verify that a message was signed by the holder* of the private keys of a given address.*/library ECDSA {enum RecoverError {NoError,InvalidSignature,InvalidSignatureLength,InvalidSignatureS}/*** @dev The signature derives the `address(0)`.*/error ECDSAInvalidSignature();/*** @dev The signature has an invalid length.
1234567891011121314151617181920212223242526// SPDX-License-Identifier: MIT// OpenZeppelin Contracts (last updated v5.0.0) (utils/cryptography/EIP712.sol)pragma solidity ^0.8.20;import {MessageHashUtils} from "./MessageHashUtils.sol";import {ShortStrings, ShortString} from "../ShortStrings.sol";import {IERC5267} from "../../interfaces/IERC5267.sol";/*** @dev https://eips.ethereum.org/EIPS/eip-712[EIP-712] is a standard for hashing and signing of typed structured data.** The encoding scheme specified in the EIP requires a domain separator and a hash of the typed structured data, whose* encoding is very generic and therefore its implementation in Solidity is not feasible, thus this contract* does not implement the encoding itself. Protocols need to implement the type-specific encoding they need in order to* produce the hash of their typed data using a combination of `abi.encode` and `keccak256`.** This contract implements the EIP-712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding* scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA* ({_hashTypedDataV4}).** The implementation of the domain separator was designed to be as efficient as possible while still properly updating* the chain id to protect against replay attacks on an eventual fork of the chain.** NOTE: This contract implements the version of the encoding known as "v4", as implemented by the JSON RPC method* https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask].
1234567891011121314151617181920212223242526// SPDX-License-Identifier: MIT// OpenZeppelin Contracts (last updated v5.0.0) (utils/Nonces.sol)pragma solidity ^0.8.20;/*** @dev Provides tracking nonces for addresses. Nonces will only increment.*/abstract contract Nonces {/*** @dev The nonce used for an `account` is not the expected current nonce.*/error InvalidAccountNonce(address account, uint256 currentNonce);mapping(address account => uint256) private _nonces;/*** @dev Returns the next unused nonce for an address.*/function nonces(address owner) public view virtual returns (uint256) {return _nonces[owner];}/*** @dev Consumes a nonce.** Returns the current value and increments nonce.
1234567891011121314151617181920212223242526// SPDX-License-Identifier: MIT// OpenZeppelin Contracts (last updated v5.0.0) (utils/cryptography/EIP712.sol)pragma solidity ^0.8.20;import {MessageHashUtils} from "@openzeppelin/contracts/utils/cryptography/MessageHashUtils.sol";import {IERC5267} from "@openzeppelin/contracts/interfaces/IERC5267.sol";import {Initializable} from "../../proxy/utils/Initializable.sol";/*** @dev https://eips.ethereum.org/EIPS/eip-712[EIP-712] is a standard for hashing and signing of typed structured data.** The encoding scheme specified in the EIP requires a domain separator and a hash of the typed structured data, whose* encoding is very generic and therefore its implementation in Solidity is not feasible, thus this contract* does not implement the encoding itself. Protocols need to implement the type-specific encoding they need in order to* produce the hash of their typed data using a combination of `abi.encode` and `keccak256`.** This contract implements the EIP-712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding* scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA* ({_hashTypedDataV4}).** The implementation of the domain separator was designed to be as efficient as possible while still properly updating* the chain id to protect against replay attacks on an eventual fork of the chain.** NOTE: This contract implements the version of the encoding known as "v4", as implemented by the JSON RPC method* https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask].
1234567891011121314151617181920212223242526// SPDX-License-Identifier: MIT// OpenZeppelin Contracts (last updated v5.0.0) (utils/Nonces.sol)pragma solidity ^0.8.20;import {Initializable} from "../proxy/utils/Initializable.sol";/*** @dev Provides tracking nonces for addresses. Nonces will only increment.*/abstract contract NoncesUpgradeable is Initializable {/*** @dev The nonce used for an `account` is not the expected current nonce.*/error InvalidAccountNonce(address account, uint256 currentNonce);/// @custom:storage-location erc7201:openzeppelin.storage.Noncesstruct NoncesStorage {mapping(address account => uint256) _nonces;}// keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.Nonces")) - 1)) & ~bytes32(uint256(0xff))bytes32 private constant NoncesStorageLocation = 0x5ab42ced628888259c08ac98db1eb0cf702fc1501344311d8b100cd1bfe4bb00;function _getNoncesStorage() private pure returns (NoncesStorage storage $) {assembly {$.slot := NoncesStorageLocation}
1234567891011121314151617181920212223242526// SPDX-License-Identifier: MIT// OpenZeppelin Contracts (last updated v5.0.0) (proxy/utils/Initializable.sol)pragma solidity ^0.8.20;/*** @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed* behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an* external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer* function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.** The initialization functions use a version number. Once a version number is used, it is consumed and cannot be* reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in* case an upgrade adds a module that needs to be initialized.** For example:** [.hljs-theme-light.nopadding]* ```solidity* contract MyToken is ERC20Upgradeable {* function initialize() initializer public {* __ERC20_init("MyToken", "MTK");* }* }** contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {
1234567891011121314151617181920212223242526// SPDX-License-Identifier: MIT// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)pragma solidity ^0.8.20;import {Initializable} from "../proxy/utils/Initializable.sol";/*** @dev Provides information about the current execution context, including the* sender of the transaction and its data. While these are generally available* via msg.sender and msg.data, they should not be accessed in such a direct* manner, since when dealing with meta-transactions the account sending and* paying for execution may not be the actual sender (as far as an application* is concerned).** This contract is only required for intermediate, library-like contracts.*/abstract contract ContextUpgradeable is Initializable {function __Context_init() internal onlyInitializing {}function __Context_init_unchained() internal onlyInitializing {}function _msgSender() internal view virtual returns (address) {return msg.sender;}
1234567891011121314151617181920212223242526// SPDX-License-Identifier: MIT// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/draft-IERC6093.sol)pragma solidity ^0.8.20;/*** @dev Standard ERC-20 Errors* Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC-20 tokens.*/interface IERC20Errors {/*** @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.* @param sender Address whose tokens are being transferred.* @param balance Current balance for the interacting account.* @param needed Minimum amount required to perform a transfer.*/error ERC20InsufficientBalance(address sender, uint256 balance, uint256 needed);/*** @dev Indicates a failure with the token `sender`. Used in transfers.* @param sender Address whose tokens are being transferred.*/error ERC20InvalidSender(address sender);/*** @dev Indicates a failure with the token `receiver`. Used in transfers.* @param receiver Address to which tokens are being transferred.
1234567891011121314151617181920212223242526// SPDX-License-Identifier: MIT// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)pragma solidity ^0.8.20;/*** @dev Provides information about the current execution context, including the* sender of the transaction and its data. While these are generally available* via msg.sender and msg.data, they should not be accessed in such a direct* manner, since when dealing with meta-transactions the account sending and* paying for execution may not be the actual sender (as far as an application* is concerned).** This contract is only required for intermediate, library-like contracts.*/abstract contract Context {function _msgSender() internal view virtual returns (address) {return msg.sender;}function _msgData() internal view virtual returns (bytes calldata) {return msg.data;}function _contextSuffixLength() internal view virtual returns (uint256) {return 0;
1234567891011121314151617181920212223242526// SPDX-License-Identifier: BUSL-1.1pragma solidity 0.8.28;import {ICrossReentrancyGuard} from "../interfaces/ICrossReentrancyGuard.sol";abstract contract CrossReentrancyGuard is ICrossReentrancyGuard {uint256 private constant _NOT_ENTERED = 0;uint256 private constant _ENTERED = 1;uint256 private transient _crossReentrantStatus;/// @inheritdoc ICrossReentrancyGuardfunction turnOnReentrancyProtection() external virtual {_onlySiloOrTokenOrHookReceiver();require(_crossReentrantStatus != _ENTERED, CrossReentrantCall());_crossReentrantStatus = _ENTERED;}/// @inheritdoc ICrossReentrancyGuardfunction turnOffReentrancyProtection() external virtual {_onlySiloOrTokenOrHookReceiver();// Leaving it unprotected may lead to a bug in the reentrancy protection system,// as it can be used in the function without activating the protection before deactivating it.
1234567891011121314151617181920212223242526// SPDX-License-Identifier: MIT// OpenZeppelin Contracts (last updated v5.0.0) (utils/cryptography/MessageHashUtils.sol)pragma solidity ^0.8.20;import {Strings} from "../Strings.sol";/*** @dev Signature message hash utilities for producing digests to be consumed by {ECDSA} recovery or signing.** The library provides methods for generating a hash of a message that conforms to the* https://eips.ethereum.org/EIPS/eip-191[ERC-191] and https://eips.ethereum.org/EIPS/eip-712[EIP 712]* specifications.*/library MessageHashUtils {/*** @dev Returns the keccak256 digest of an ERC-191 signed data with version* `0x45` (`personal_sign` messages).** The digest is calculated by prefixing a bytes32 `messageHash` with* `"\x19Ethereum Signed Message:\n32"` and hashing the result. It corresponds with the* hash signed when using the https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] JSON-RPC method.** NOTE: The `messageHash` parameter is intended to be the result of hashing a raw message with* keccak256, although any bytes32 value can be safely used because the final digest will* be re-hashed.
1234567891011121314151617181920212223242526// SPDX-License-Identifier: MIT// OpenZeppelin Contracts (last updated v5.0.0) (utils/ShortStrings.sol)pragma solidity ^0.8.20;import {StorageSlot} from "./StorageSlot.sol";// | string | 0xAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA |// | length | 0x BB |type ShortString is bytes32;/*** @dev This library provides functions to convert short memory strings* into a `ShortString` type that can be used as an immutable variable.** Strings of arbitrary length can be optimized using this library if* they are short enough (up to 31 bytes) by packing them with their* length (1 byte) in a single EVM word (32 bytes). Additionally, a* fallback mechanism can be used for every other case.** Usage example:** ```solidity* contract Named {* using ShortStrings for *;*
1234567891011121314151617181920212223242526// SPDX-License-Identifier: MIT// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC5267.sol)pragma solidity ^0.8.20;interface IERC5267 {/*** @dev MAY be emitted to signal that the domain could have changed.*/event EIP712DomainChanged();/*** @dev returns the fields and values that describe the domain separator used by this contract for EIP-712* signature.*/function eip712Domain()externalviewreturns (bytes1 fields,string memory name,string memory version,uint256 chainId,address verifyingContract,bytes32 salt,uint256[] memory extensions
1234567891011121314151617181920212223242526// SPDX-License-Identifier: MIT// OpenZeppelin Contracts (last updated v5.0.0) (utils/StorageSlot.sol)// This file was procedurally generated from scripts/generate/templates/StorageSlot.js.pragma solidity ^0.8.20;/*** @dev Library for reading and writing primitive types to specific storage slots.** Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.* This library helps with reading and writing to such slots without the need for inline assembly.** The functions in this library return Slot structs that contain a `value` member that can be used to read or write.** Example usage to set ERC-1967 implementation slot:* ```solidity* contract ERC1967 {* bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;** function _getImplementation() internal view returns (address) {* return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;* }** function _setImplementation(address newImplementation) internal {* require(newImplementation.code.length > 0);* StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;
1234567891011121314151617181920212223242526{"remappings": ["forge-std/=gitmodules/forge-std/src/","silo-foundry-utils/=gitmodules/silo-foundry-utils/contracts/","properties/=gitmodules/crytic/properties/contracts/","silo-core/=silo-core/","silo-oracles/=silo-oracles/","silo-vaults/=silo-vaults/","ve-silo/=ve-silo/","@openzeppelin/=gitmodules/openzeppelin-contracts-5/contracts/","morpho-blue/=gitmodules/morpho-blue/src/","openzeppelin5/=gitmodules/openzeppelin-contracts-5/contracts/","openzeppelin5-upgradeable/=gitmodules/openzeppelin-contracts-upgradeable-5/contracts/","chainlink/=gitmodules/chainlink/contracts/src/","chainlink-ccip/=gitmodules/chainlink-ccip/contracts/src/","uniswap/=gitmodules/uniswap/","@uniswap/v3-core/=gitmodules/uniswap/v3-core/","balancer-labs/v2-solidity-utils/=external/balancer-v2-monorepo/pkg/solidity-utils/contracts/","balancer-labs/v2-interfaces/=external/balancer-v2-monorepo/pkg/interfaces/contracts/","balancer-labs/v2-liquidity-mining/=external/balancer-v2-monorepo/pkg/liquidity-mining/contracts/","@balancer-labs/=node_modules/@balancer-labs/","@ensdomains/=node_modules/@ensdomains/","@openzeppelin/contracts-upgradeable/=gitmodules/openzeppelin-contracts-upgradeable-5/contracts/","@openzeppelin/contracts/=gitmodules/openzeppelin-contracts-5/contracts/","@solidity-parser/=node_modules/@solidity-parser/","ERC4626/=gitmodules/crytic/properties/lib/ERC4626/contracts/",
[{"inputs":[{"internalType":"contract ISiloFactory","name":"_siloFactory","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AboveMaxLtv","type":"error"},{"inputs":[],"name":"AmountExceedsAllowance","type":"error"},{"inputs":[],"name":"BorrowNotPossible","type":"error"},{"inputs":[],"name":"CollateralSiloAlreadySet","type":"error"},{"inputs":[],"name":"CrossReentrantCall","type":"error"},{"inputs":[],"name":"ECDSAInvalidSignature","type":"error"},{"inputs":[{"internalType":"uint256","name":"length","type":"uint256"}],"name":"ECDSAInvalidSignatureLength","type":"error"},{"inputs":[{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"ECDSAInvalidSignatureS","type":"error"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"allowance","type":"uint256"},{"internalType":"uint256","name":"needed","type":"uint256"}],"name":"ERC20InsufficientAllowance","type":"error"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"uint256","name":"balance","type":"uint256"},{"internalType":"uint256","name":"needed","type":"uint256"}],"name":"ERC20InsufficientBalance","type":"error"},{"inputs":[{"internalType":"address","name":"approver","type":"address"}],"name":"ERC20InvalidApprover","type":"error"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"}],"name":"ERC20InvalidReceiver","type":"error"},{"inputs":[{"internalType":"address","name":"sender","type":"address"}],"name":"ERC20InvalidSender","type":"error"},{"inputs":[{"internalType":"address","name":"spender","type":"address"}],"name":"ERC20InvalidSpender","type":"error"},{"inputs":[{"internalType":"uint256","name":"deadline","type":"uint256"}],"name":"ERC2612ExpiredSignature","type":"error"},{"inputs":[{"internalType":"address","name":"signer","type":"address"},{"internalType":"address","name":"owner","type":"address"}],"name":"ERC2612InvalidSigner","type":"error"},{"inputs":[],"name":"EarnedZero","type":"error"},{"inputs":[],"name":"FlashloanFailed","type":"error"},{"inputs":[],"name":"InputCanBeAssetsOrShares","type":"error"},{"inputs":[],"name":"InputZeroShares","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"currentNonce","type":"uint256"}],"name":"InvalidAccountNonce","type":"error"},{"inputs":[],"name":"InvalidInitialization","type":"error"},{"inputs":[],"name":"NoLiquidity","type":"error"},{"inputs":[],"name":"NotEnoughLiquidity","type":"error"},{"inputs":[],"name":"NotInitializing","type":"error"},{"inputs":[],"name":"NotSolvent","type":"error"},{"inputs":[],"name":"NothingToWithdraw","type":"error"},{"inputs":[],"name":"OnlyHookReceiver","type":"error"},{"inputs":[],"name":"OnlySilo","type":"error"},{"inputs":[],"name":"OnlySiloConfig","type":"error"},{"inputs":[],"name":"OwnerIsZero","type":"error"},{"inputs":[],"name":"RecipientIsZero","type":"error"},{"inputs":[],"name":"RecipientNotSolventAfterTransfer","type":"error"},{"inputs":[],"name":"RepayTooHigh","type":"error"},{"inputs":[],"name":"ReturnZeroAssets","type":"error"},{"inputs":[],"name":"ReturnZeroShares","type":"error"},{"inputs":[],"name":"SenderNotSolventAfterTransfer","type":"error"},{"inputs":[],"name":"SiloInitialized","type":"error"},{"inputs":[],"name":"Unsupported","type":"error"},{"inputs":[],"name":"ZeroAmount","type":"error"},{"inputs":[],"name":"ZeroTransfer","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"hooksBefore","type":"uint256"}],"name":"AccruedInterest","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":true,"internalType":"address","name":"receiver","type":"address"},{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":false,"internalType":"uint256","name":"assets","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"shares","type":"uint256"}],"name":"Borrow","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"borrower","type":"address"}],"name":"CollateralTypeChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":false,"internalType":"uint256","name":"assets","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"shares","type":"uint256"}],"name":"Deposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":false,"internalType":"uint256","name":"assets","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"shares","type":"uint256"}],"name":"DepositProtected","type":"event"},{"anonymous":false,"inputs":[],"name":"EIP712DomainChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"FlashLoan","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint24","name":"hooksBefore","type":"uint24"},{"indexed":false,"internalType":"uint24","name":"hooksAfter","type":"uint24"}],"name":"HooksUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint64","name":"version","type":"uint64"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"notificationReceiver","type":"address"},{"indexed":false,"internalType":"bool","name":"success","type":"bool"}],"name":"NotificationSent","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":false,"internalType":"uint256","name":"assets","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"shares","type":"uint256"}],"name":"Repay","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":true,"internalType":"address","name":"receiver","type":"address"},{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":false,"internalType":"uint256","name":"assets","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"shares","type":"uint256"}],"name":"Withdraw","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":true,"internalType":"address","name":"receiver","type":"address"},{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":false,"internalType":"uint256","name":"assets","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"shares","type":"uint256"}],"name":"WithdrawProtected","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"daoFees","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"deployerFees","type":"uint256"}],"name":"WithdrawnFeed","type":"event"},{"inputs":[],"name":"DOMAIN_SEPARATOR","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"accrueInterest","outputs":[{"internalType":"uint256","name":"accruedInterest","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_interestRateModel","type":"address"},{"internalType":"uint256","name":"_daoFee","type":"uint256"},{"internalType":"uint256","name":"_deployerFee","type":"uint256"}],"name":"accrueInterestForConfig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"result","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"asset","outputs":[{"internalType":"address","name":"assetTokenAddress","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"}],"name":"balanceOfAndTotalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_assets","type":"uint256"},{"internalType":"address","name":"_receiver","type":"address"},{"internalType":"address","name":"_borrower","type":"address"}],"name":"borrow","outputs":[{"internalType":"uint256","name":"shares","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_assets","type":"uint256"},{"internalType":"address","name":"_receiver","type":"address"},{"internalType":"address","name":"_borrower","type":"address"}],"name":"borrowSameAsset","outputs":[{"internalType":"uint256","name":"shares","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_shares","type":"uint256"},{"internalType":"address","name":"_receiver","type":"address"},{"internalType":"address","name":"_borrower","type":"address"}],"name":"borrowShares","outputs":[{"internalType":"uint256","name":"assets","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"},{"internalType":"address","name":"_spender","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"burn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_target","type":"address"},{"internalType":"uint256","name":"_value","type":"uint256"},{"internalType":"enum ISilo.CallType","name":"_callType","type":"uint8"},{"internalType":"bytes","name":"_input","type":"bytes"}],"name":"callOnBehalfOfSilo","outputs":[{"internalType":"bool","name":"success","type":"bool"},{"internalType":"bytes","name":"result","type":"bytes"}],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"config","outputs":[{"internalType":"contract ISiloConfig","name":"siloConfig","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_shares","type":"uint256"}],"name":"convertToAssets","outputs":[{"internalType":"uint256","name":"assets","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_shares","type":"uint256"},{"internalType":"enum ISilo.AssetType","name":"_assetType","type":"uint8"}],"name":"convertToAssets","outputs":[{"internalType":"uint256","name":"assets","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_assets","type":"uint256"},{"internalType":"enum ISilo.AssetType","name":"_assetType","type":"uint8"}],"name":"convertToShares","outputs":[{"internalType":"uint256","name":"shares","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_assets","type":"uint256"}],"name":"convertToShares","outputs":[{"internalType":"uint256","name":"shares","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_assets","type":"uint256"},{"internalType":"address","name":"_receiver","type":"address"}],"name":"deposit","outputs":[{"internalType":"uint256","name":"shares","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_assets","type":"uint256"},{"internalType":"address","name":"_receiver","type":"address"},{"internalType":"enum ISilo.CollateralType","name":"_collateralType","type":"uint8"}],"name":"deposit","outputs":[{"internalType":"uint256","name":"shares","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"eip712Domain","outputs":[{"internalType":"bytes1","name":"fields","type":"bytes1"},{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"version","type":"string"},{"internalType":"uint256","name":"chainId","type":"uint256"},{"internalType":"address","name":"verifyingContract","type":"address"},{"internalType":"bytes32","name":"salt","type":"bytes32"},{"internalType":"uint256[]","name":"extensions","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"factory","outputs":[{"internalType":"contract ISiloFactory","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"flashFee","outputs":[{"internalType":"uint256","name":"fee","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IERC3156FlashBorrower","name":"_receiver","type":"address"},{"internalType":"address","name":"_token","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"flashLoan","outputs":[{"internalType":"bool","name":"success","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_from","type":"address"},{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"forwardTransferFromNoChecks","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getCollateralAndDebtTotalsStorage","outputs":[{"internalType":"uint256","name":"totalCollateralAssets","type":"uint256"},{"internalType":"uint256","name":"totalDebtAssets","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getCollateralAndProtectedTotalsStorage","outputs":[{"internalType":"uint256","name":"totalCollateralAssets","type":"uint256"},{"internalType":"uint256","name":"totalProtectedAssets","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getCollateralAssets","outputs":[{"internalType":"uint256","name":"totalCollateralAssets","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getDebtAssets","outputs":[{"internalType":"uint256","name":"totalDebtAssets","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getLiquidity","outputs":[{"internalType":"uint256","name":"liquidity","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getSiloStorage","outputs":[{"internalType":"uint192","name":"daoAndDeployerRevenue","type":"uint192"},{"internalType":"uint64","name":"interestRateTimestamp","type":"uint64"},{"internalType":"uint256","name":"protectedAssets","type":"uint256"},{"internalType":"uint256","name":"collateralAssets","type":"uint256"},{"internalType":"uint256","name":"debtAssets","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"enum ISilo.AssetType","name":"_assetType","type":"uint8"}],"name":"getTotalAssetsStorage","outputs":[{"internalType":"uint256","name":"totalAssetsByType","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"hookReceiver","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"hookSetup","outputs":[{"components":[{"internalType":"address","name":"hookReceiver","type":"address"},{"internalType":"uint24","name":"hooksBefore","type":"uint24"},{"internalType":"uint24","name":"hooksAfter","type":"uint24"},{"internalType":"uint24","name":"tokenType","type":"uint24"}],"internalType":"struct IShareToken.HookSetup","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract ISiloConfig","name":"_config","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_borrower","type":"address"}],"name":"isSolvent","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_borrower","type":"address"}],"name":"maxBorrow","outputs":[{"internalType":"uint256","name":"maxAssets","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_borrower","type":"address"}],"name":"maxBorrowSameAsset","outputs":[{"internalType":"uint256","name":"maxAssets","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_borrower","type":"address"}],"name":"maxBorrowShares","outputs":[{"internalType":"uint256","name":"maxShares","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"maxDeposit","outputs":[{"internalType":"uint256","name":"maxAssets","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"}],"name":"maxFlashLoan","outputs":[{"internalType":"uint256","name":"maxLoan","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"maxMint","outputs":[{"internalType":"uint256","name":"maxShares","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"},{"internalType":"enum ISilo.CollateralType","name":"_collateralType","type":"uint8"}],"name":"maxRedeem","outputs":[{"internalType":"uint256","name":"maxShares","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"}],"name":"maxRedeem","outputs":[{"internalType":"uint256","name":"maxShares","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_borrower","type":"address"}],"name":"maxRepay","outputs":[{"internalType":"uint256","name":"assets","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_borrower","type":"address"}],"name":"maxRepayShares","outputs":[{"internalType":"uint256","name":"shares","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"},{"internalType":"enum ISilo.CollateralType","name":"_collateralType","type":"uint8"}],"name":"maxWithdraw","outputs":[{"internalType":"uint256","name":"maxAssets","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"}],"name":"maxWithdraw","outputs":[{"internalType":"uint256","name":"maxAssets","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_shares","type":"uint256"},{"internalType":"address","name":"_receiver","type":"address"}],"name":"mint","outputs":[{"internalType":"uint256","name":"assets","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_shares","type":"uint256"},{"internalType":"address","name":"_receiver","type":"address"},{"internalType":"enum ISilo.CollateralType","name":"_collateralType","type":"uint8"}],"name":"mint","outputs":[{"internalType":"uint256","name":"assets","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"mint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"nonces","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"permit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_assets","type":"uint256"}],"name":"previewBorrow","outputs":[{"internalType":"uint256","name":"shares","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_shares","type":"uint256"}],"name":"previewBorrowShares","outputs":[{"internalType":"uint256","name":"assets","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_assets","type":"uint256"},{"internalType":"enum ISilo.CollateralType","name":"_collateralType","type":"uint8"}],"name":"previewDeposit","outputs":[{"internalType":"uint256","name":"shares","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_assets","type":"uint256"}],"name":"previewDeposit","outputs":[{"internalType":"uint256","name":"shares","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_shares","type":"uint256"},{"internalType":"enum ISilo.CollateralType","name":"_collateralType","type":"uint8"}],"name":"previewMint","outputs":[{"internalType":"uint256","name":"assets","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_shares","type":"uint256"}],"name":"previewMint","outputs":[{"internalType":"uint256","name":"assets","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_shares","type":"uint256"}],"name":"previewRedeem","outputs":[{"internalType":"uint256","name":"assets","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_shares","type":"uint256"},{"internalType":"enum ISilo.CollateralType","name":"_collateralType","type":"uint8"}],"name":"previewRedeem","outputs":[{"internalType":"uint256","name":"assets","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_assets","type":"uint256"}],"name":"previewRepay","outputs":[{"internalType":"uint256","name":"shares","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_shares","type":"uint256"}],"name":"previewRepayShares","outputs":[{"internalType":"uint256","name":"assets","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_assets","type":"uint256"}],"name":"previewWithdraw","outputs":[{"internalType":"uint256","name":"shares","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_assets","type":"uint256"},{"internalType":"enum ISilo.CollateralType","name":"_collateralType","type":"uint8"}],"name":"previewWithdraw","outputs":[{"internalType":"uint256","name":"shares","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_shares","type":"uint256"},{"internalType":"address","name":"_receiver","type":"address"},{"internalType":"address","name":"_owner","type":"address"}],"name":"redeem","outputs":[{"internalType":"uint256","name":"assets","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_shares","type":"uint256"},{"internalType":"address","name":"_receiver","type":"address"},{"internalType":"address","name":"_owner","type":"address"},{"internalType":"enum ISilo.CollateralType","name":"_collateralType","type":"uint8"}],"name":"redeem","outputs":[{"internalType":"uint256","name":"assets","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_assets","type":"uint256"},{"internalType":"address","name":"_borrower","type":"address"}],"name":"repay","outputs":[{"internalType":"uint256","name":"shares","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_shares","type":"uint256"},{"internalType":"address","name":"_borrower","type":"address"}],"name":"repayShares","outputs":[{"internalType":"uint256","name":"assets","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"silo","outputs":[{"internalType":"contract ISilo","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"siloConfig","outputs":[{"internalType":"contract ISiloConfig","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"switchCollateralToThisSilo","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint24","name":"_hooksBefore","type":"uint24"},{"internalType":"uint24","name":"_hooksAfter","type":"uint24"}],"name":"synchronizeHooks","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"totalAssets","outputs":[{"internalType":"uint256","name":"totalManagedAssets","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"result","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_from","type":"address"},{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"result","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_shares","type":"uint256"},{"internalType":"address","name":"_owner","type":"address"},{"internalType":"enum ISilo.CollateralType","name":"_transitionFrom","type":"uint8"}],"name":"transitionCollateral","outputs":[{"internalType":"uint256","name":"assets","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"updateHooks","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"utilizationData","outputs":[{"components":[{"internalType":"uint256","name":"collateralAssets","type":"uint256"},{"internalType":"uint256","name":"debtAssets","type":"uint256"},{"internalType":"uint64","name":"interestRateTimestamp","type":"uint64"}],"internalType":"struct ISilo.UtilizationData","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_assets","type":"uint256"},{"internalType":"address","name":"_receiver","type":"address"},{"internalType":"address","name":"_owner","type":"address"}],"name":"withdraw","outputs":[{"internalType":"uint256","name":"shares","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_assets","type":"uint256"},{"internalType":"address","name":"_receiver","type":"address"},{"internalType":"address","name":"_owner","type":"address"},{"internalType":"enum ISilo.CollateralType","name":"_collateralType","type":"uint8"}],"name":"withdraw","outputs":[{"internalType":"uint256","name":"shares","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdrawFees","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
[ Download: CSV Export ]
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.