Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
ContractCreator
Latest 25 from a total of 128 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Manage Position | 20961353 | 74 days ago | IN | 0 ETH | 0.00213239 | ||||
Manage Position | 20061268 | 200 days ago | IN | 0 ETH | 0.00237001 | ||||
Manage Position | 18567422 | 409 days ago | IN | 0 ETH | 0.00503095 | ||||
Manage Position | 18549541 | 412 days ago | IN | 0 ETH | 0.00771276 | ||||
Manage Position | 18549130 | 412 days ago | IN | 0 ETH | 0.00513695 | ||||
Manage Position | 18494286 | 420 days ago | IN | 0 ETH | 0.00360615 | ||||
Manage Position | 18433841 | 428 days ago | IN | 0 ETH | 0.00357675 | ||||
Manage Position | 18433567 | 428 days ago | IN | 0 ETH | 0.00552342 | ||||
Manage Position | 18433257 | 428 days ago | IN | 0 ETH | 0.00420204 | ||||
Manage Position | 18413423 | 431 days ago | IN | 0 ETH | 0.003871 | ||||
Manage Position | 18340070 | 441 days ago | IN | 0 ETH | 0.00118771 | ||||
Manage Position | 18336915 | 442 days ago | IN | 0 ETH | 0.00139101 | ||||
Manage Position | 18332151 | 442 days ago | IN | 0 ETH | 0.00194674 | ||||
Manage Position | 18327732 | 443 days ago | IN | 0 ETH | 0.00221408 | ||||
Manage Position | 18327324 | 443 days ago | IN | 0 ETH | 0.00208171 | ||||
Manage Position | 18325707 | 443 days ago | IN | 0 ETH | 0.00127345 | ||||
Manage Position | 18325268 | 443 days ago | IN | 0 ETH | 0.00109637 | ||||
Manage Position | 18221466 | 458 days ago | IN | 0 ETH | 0.00600058 | ||||
Manage Position | 18168832 | 465 days ago | IN | 0 ETH | 0.00213674 | ||||
Manage Position | 18168432 | 465 days ago | IN | 0 ETH | 0.00268564 | ||||
Manage Position | 18168309 | 465 days ago | IN | 0 ETH | 0.00255528 | ||||
Manage Position | 18147432 | 468 days ago | IN | 0 ETH | 0.00202328 | ||||
Manage Position | 18144411 | 469 days ago | IN | 0 ETH | 0.00232417 | ||||
Manage Position | 18118863 | 472 days ago | IN | 0 ETH | 0.00187035 | ||||
Manage Position | 18118704 | 472 days ago | IN | 0 ETH | 0.00176057 |
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Contract Name:
PositionManagerWrappedCollateralToken
Compiler Version
v0.8.19+commit.7dd6d404
Optimization Enabled:
Yes with 200000 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.8.19; // OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol) /** * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612]. * * Adds the {permit} method, which can be used to change an account's ERC20 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. */ interface IERC20Permit { /** * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens, * given ``owner``'s signed approval. * * IMPORTANT: The same issues {IERC20-approve} has related to transaction * ordering also apply here. * * Emits an {Approval} event. * * Requirements: * * - `spender` cannot be the zero address. * - `deadline` must be a timestamp in the future. * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner` * over the EIP712-formatted function arguments. * - the signature must use ``owner``'s current nonce (see {nonces}). * * For more information on the signature format, see the * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP * section]. */ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external; /** * @dev Returns the current nonce for `owner`. This value must be * included whenever a signature is generated for {permit}. * * Every successful call to {permit} increases ``owner``'s nonce by one. This * prevents a signature from being used multiple times. */ function nonces(address owner) external view returns (uint256); /** * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}. */ // solhint-disable-next-line func-name-mixedcase function DOMAIN_SEPARATOR() external view returns (bytes32); } // OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/utils/SafeERC20.sol) // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol) /** * @dev Interface of the ERC20 standard as defined in the EIP. */ 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 amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `from` to `to` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 amount ) external returns (bool); } // OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol) /** * @dev Collection of functions related to the address type */ library Address { /** * @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 * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @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://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract. * * _Available since v4.8._ */ function verifyCallResultFromTarget( address target, bool success, bytes memory returndata, string memory errorMessage ) internal view returns (bytes memory) { if (success) { if (returndata.length == 0) { // only check isContract if the call was successful and the return data is empty // otherwise we already know that it was a contract require(isContract(target), "Address: call to non-contract"); } return returndata; } else { _revert(returndata, errorMessage); } } /** * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason or using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { _revert(returndata, errorMessage); } } function _revert(bytes memory returndata, string memory errorMessage) private pure { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } /** * @title SafeERC20 * @dev Wrappers around ERC20 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; function safeTransfer( IERC20 token, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom( IERC20 token, address from, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove( IERC20 token, address spender, uint256 value ) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' require( (value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } function safeIncreaseAllowance( IERC20 token, address spender, uint256 value ) internal { uint256 newAllowance = token.allowance(address(this), spender) + value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance( IERC20 token, address spender, uint256 value ) internal { unchecked { uint256 oldAllowance = token.allowance(address(this), spender); require(oldAllowance >= value, "SafeERC20: decreased allowance below zero"); uint256 newAllowance = oldAllowance - value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } } function safePermit( IERC20Permit token, address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) internal { uint256 nonceBefore = token.nonces(owner); token.permit(owner, spender, value, deadline, v, r, s); uint256 nonceAfter = token.nonces(owner); require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed"); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } } /// Parameters for ERC20Permit.permit call struct ERC20PermitSignature { IERC20Permit token; uint256 value; uint256 deadline; uint8 v; bytes32 r; bytes32 s; } library PermitHelper { function applyPermit( ERC20PermitSignature calldata p, address owner, address spender ) internal { p.token.permit(owner, spender, p.value, p.deadline, p.v, p.r, p.s); } function applyPermits( ERC20PermitSignature[] calldata permits, address owner, address spender ) internal { for (uint256 i = 0; i < permits.length; i++) { applyPermit(permits[i], owner, spender); } } } interface IStETH is IERC20 { // --- Functions --- function getPooledEthByShares(uint256 sharesAmount) external view returns (uint256); function getSharesByPooledEth(uint256 pooledEthAmount) external view returns (uint256); function submit(address referral) external payable returns (uint256); } interface IWstETH is IERC20 { // --- Functions --- function stETH() external returns (IERC20); /// @notice Exchanges stETH to wstETH /// @param stETHAmount amount of stETH to wrap in exchange for wstETH /// @dev Requirements: /// - `stETHAmount` must be non-zero /// - msg.sender must approve at least `stETHAmount` stETH to this /// contract. /// - msg.sender must have at least `stETHAmount` of stETH. /// User should first approve `stETHAmount` to the WstETH contract /// @return Amount of wstETH user receives after wrap function wrap(uint256 stETHAmount) external returns (uint256); /// @notice Exchanges wstETH to stETH. /// @param wstETHAmount Amount of wstETH to unwrap in exchange for stETH. /// @dev Requirements: /// - `wstETHAmount` must be non-zero /// - msg.sender must have at least `wstETHAmount` wstETH. /// @return Amount of stETH user receives after unwrap. function unwrap(uint256 wstETHAmount) external returns (uint256); /// @notice Get amount of wstETH for a given amount of stETH. /// @param stETHAmount Amount of stETH. /// @return Amount of wstETH for a given stETH amount. function getWstETHByStETH(uint256 stETHAmount) external view returns (uint256); /// @notice Get amount of stETH for a given amount of wstETH. /// @param wstETHAmount amount of wstETH. /// @return Amount of stETH for a given wstETH amount. function getStETHByWstETH(uint256 wstETHAmount) external view returns (uint256); /// @notice Get amount of stETH for a one wstETH. /// @return Amount of stETH for 1 wstETH. function stEthPerToken() external view returns (uint256); /// @notice Get amount of wstETH for a one stETH. /// @return Amount of wstETH for a 1 stETH. function tokensPerStEth() external view returns (uint256); } interface IPositionManagerDependent { // --- Errors --- /// @dev Position Manager cannot be zero. error PositionManagerCannotBeZero(); /// @dev Caller is not Position Manager. error CallerIsNotPositionManager(address caller); // --- Functions --- /// @dev Returns address of the PositionManager contract. function positionManager() external view returns (address); } interface IERC20Indexable is IERC20, IPositionManagerDependent { // --- Events --- /// @dev New token is deployed. /// @param positionManager Address of the PositionManager contract that is authorized to mint and burn new tokens. event ERC20IndexableDeployed(address positionManager); /// @dev New index has been set. /// @param newIndex Value of the new index. event IndexUpdated(uint256 newIndex); // --- Errors --- /// @dev Unsupported action for ERC20Indexable contract. error NotSupported(); // --- Functions --- /// @return Precision for token index. Represents index that is equal to 1. function INDEX_PRECISION() external view returns (uint256); /// @return Current index value. function currentIndex() external view returns (uint256); /// @dev Sets new token index. Callable only by PositionManager contract. /// @param backingAmount Amount of backing token that is covered by total supply. function setIndex(uint256 backingAmount) external; /// @dev Mints new tokens. Callable only by PositionManager contract. /// @param to Address that will receive newly minted tokens. /// @param amount Amount of tokens to mint. function mint(address to, uint256 amount) external; /// @dev Mints new tokens. Callable only by PositionManager contract. /// @param from Address of user whose tokens are burnt. /// @param amount Amount of tokens to burn. function burn(address from, uint256 amount) external; } /// @dev Helper interface for easier integrations with wrapped collateral tokens. interface IERC20Wrapped is IERC20 { function underlying() external view returns (IERC20); function depositFor(address account, uint256 amount) external returns (bool); function withdrawTo(address account, uint256 amount) external returns (bool); } interface IWrappedCollateralToken is IERC20, IERC20Permit { /// @dev User's balance cannot be larger than `maxBalance`. error ExceedsMaxBalance(); /// @dev Total supply of the token cannot exceed `cap`. error ExceedsCap(); /// @dev Invalid address for whitelist. error InvalidWhitelistAddress(); /// @dev Address is not whitelisted. error AddressIsNotWhitelisted(address); /// @dev Method not supported. error Unsupported(); /// @dev New `maxBalance` value is set. /// @param maxBalance_ Maximum balance of single user. event MaxBalanceSet(uint256 maxBalance_); /// @dev New `cap` value is set. /// @param cap_ Maximum total supply of the token. event CapSet(uint256 cap_); /// @dev Address is whitelisted or unwhitelisted. /// @param addressForWhitelist Address to whitelist or unwhitelist. /// @param whitelisted True if address is whitelisted, false if unwhitelisted. event AddressWhitelisted(address indexed addressForWhitelist, bool whitelisted); /// @dev Maximum balance of single user. function maxBalance() external view returns (uint256); /// @dev Maximum total supply of the token. function cap() external view returns (uint256); /// @dev Checks if address is whitelisted. /// @param _addressToCheck Address to check is whitelisted. function isWhitelisted(address _addressToCheck) external view returns (bool); /// @dev Sets new maximum balance of a user. function setMaxBalance(uint256 newMaxBalance) external; /// @dev Sets new cap for the token. function setCap(uint256 newCap) external; /// @dev Whitelist or unwhitelist address. /// @param addressForWhitelist Address to whitelist or unwhitelist. /// @param whitelisted True if address is whitelisted, false if unwhitelisted. function whitelistAddress(address addressForWhitelist, bool whitelisted) external; /// @dev Mint wrapped token to cover any underlyingTokens that would have been transferred by mistake. /// @param account Address to mint wrapped tokens to. function recover(address account) external returns (uint256); /// @dev Deposits underlying tokens on behalf of user. /// @param to Address to receive minted wrapped tokens. /// @param accountToCheck Address of the user which token balances we need to check. /// @param amount Amount of underlying being deposited. function depositForWithAccountCheck(address to, address accountToCheck, uint256 amount) external returns (bool); } /// @dev Interface to be used by contracts that collect fees. Contains fee recipient that can be changed by owner. interface IFeeCollector { // --- Events --- /// @dev Fee Recipient is changed to @param feeRecipient address. /// @param feeRecipient New fee recipient address. event FeeRecipientChanged(address feeRecipient); // --- Errors --- /// @dev Invalid fee recipient. error InvalidFeeRecipient(); // --- Functions --- /// @return Address of the current fee recipient. function feeRecipient() external view returns (address); /// @dev Sets new fee recipient address /// @param newFeeRecipient Address of the new fee recipient. function setFeeRecipient(address newFeeRecipient) external; } interface IPriceOracle { // --- Errors --- /// @dev Contract initialized with an invalid deviation parameter. error InvalidDeviation(); // --- Types --- struct PriceOracleResponse { bool isBrokenOrFrozen; bool priceChangeAboveMax; uint256 price; } // --- Functions --- /// @dev Return price oracle response which consists the following information: oracle is broken or frozen, the /// price change between two rounds is more than max, and the price. function getPriceOracleResponse() external returns (PriceOracleResponse memory); /// @dev Maximum time period allowed since oracle latest round data timestamp, beyond which oracle is considered /// frozen. function timeout() external view returns (uint256); /// @dev Used to convert a price answer to an 18-digit precision uint. function TARGET_DIGITS() external view returns (uint256); /// @dev price deviation for the oracle in percentage. function DEVIATION() external view returns (uint256); } interface IPriceFeed { // --- Events --- /// @dev Last good price has been updated. event LastGoodPriceUpdated(uint256 lastGoodPrice); /// @dev Price difference between oracles has been updated. /// @param priceDifferenceBetweenOracles New price difference between oracles. event PriceDifferenceBetweenOraclesUpdated(uint256 priceDifferenceBetweenOracles); /// @dev Primary oracle has been updated. /// @param primaryOracle New primary oracle. event PrimaryOracleUpdated(IPriceOracle primaryOracle); /// @dev Secondary oracle has been updated. /// @param secondaryOracle New secondary oracle. event SecondaryOracleUpdated(IPriceOracle secondaryOracle); // --- Errors --- /// @dev Invalid primary oracle. error InvalidPrimaryOracle(); /// @dev Invalid secondary oracle. error InvalidSecondaryOracle(); /// @dev Primary oracle is broken or frozen or has bad result. error PrimaryOracleBrokenOrFrozenOrBadResult(); /// @dev Invalid price difference between oracles. error InvalidPriceDifferenceBetweenOracles(); // --- Functions --- /// @dev Return primary oracle address. function primaryOracle() external returns (IPriceOracle); /// @dev Return secondary oracle address function secondaryOracle() external returns (IPriceOracle); /// @dev The last good price seen from an oracle by Raft. function lastGoodPrice() external returns (uint256); /// @dev The maximum relative price difference between two oracle responses. function priceDifferenceBetweenOracles() external returns (uint256); /// @dev Set primary oracle address. /// @param newPrimaryOracle Primary oracle address. function setPrimaryOracle(IPriceOracle newPrimaryOracle) external; /// @dev Set secondary oracle address. /// @param newSecondaryOracle Secondary oracle address. function setSecondaryOracle(IPriceOracle newSecondaryOracle) external; /// @dev Set the maximum relative price difference between two oracle responses. /// @param newPriceDifferenceBetweenOracles The maximum relative price difference between two oracle responses. function setPriceDifferenceBetweenOracles(uint256 newPriceDifferenceBetweenOracles) external; /// @dev Returns the latest price obtained from the Oracle. Called by Raft functions that require a current price. /// /// Also callable by anyone externally. /// Non-view function - it stores the last good price seen by Raft. /// /// Uses a primary oracle and a fallback oracle in case primary fails. If both fail, /// it uses the last good price seen by Raft. /// /// @return currentPrice Returned price. /// @return deviation Deviation of the reported price in percentage. /// @notice Actual returned price is in range `currentPrice` +/- `currentPrice * deviation / ONE` function fetchPrice() external returns (uint256 currentPrice, uint256 deviation); } // OpenZeppelin Contracts v4.4.1 (interfaces/IERC3156FlashLender.sol) // OpenZeppelin Contracts (last updated v4.7.0) (interfaces/IERC3156FlashBorrower.sol) /** * @dev Interface of the ERC3156 FlashBorrower, as defined in * https://eips.ethereum.org/EIPS/eip-3156[ERC-3156]. * * _Available since v4.1._ */ interface IERC3156FlashBorrower { /** * @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 "IERC3156FlashBorrower.onFlashLoan" */ function onFlashLoan( address initiator, address token, uint256 amount, uint256 fee, bytes calldata data ) external returns (bytes32); } /** * @dev Interface of the ERC3156 FlashLender, as defined in * https://eips.ethereum.org/EIPS/eip-3156[ERC-3156]. * * _Available since v4.1._ */ interface IERC3156FlashLender { /** * @dev The amount of currency available to be lended. * @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. * @param token The loan currency. * @param amount The amount of tokens lent. * @return The amount of `token` to be charged for the loan, on top of the returned principal. */ function flashFee(address token, uint256 amount) external view returns (uint256); /** * @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 ) external returns (bool); } /// @dev Interface of R stablecoin token. Implements some standards like IERC20, IERC20Permit, and IERC3156FlashLender. /// Raft's specific implementation contains IFeeCollector and IPositionManagerDependent. /// PositionManager can mint and burn R when particular actions happen with user's position. interface IRToken is IERC20, IERC20Permit, IERC3156FlashLender, IFeeCollector, IPositionManagerDependent { // --- Events --- /// @dev New R token is deployed /// @param positionManager Address of the PositionManager contract that is authorized to mint and burn new tokens. /// @param flashMintFeeRecipient Address of flash mint fee recipient. event RDeployed(address positionManager, address flashMintFeeRecipient); /// @dev The Flash Mint Fee Percentage has been changed. /// @param flashMintFeePercentage The new Flash Mint Fee Percentage value. event FlashMintFeePercentageChanged(uint256 flashMintFeePercentage); /// --- Errors --- /// @dev Proposed flash mint fee percentage is too big. /// @param feePercentage Proposed flash mint fee percentage. error FlashFeePercentageTooBig(uint256 feePercentage); // --- Functions --- /// @return Number representing 100 percentage. function PERCENTAGE_BASE() external view returns (uint256); /// @dev Mints new tokens. Callable only by PositionManager contract. /// @param to Address that will receive newly minted tokens. /// @param amount Amount of tokens to mint. function mint(address to, uint256 amount) external; /// @dev Mints new tokens. Callable only by PositionManager contract. /// @param from Address of user whose tokens are burnt. /// @param amount Amount of tokens to burn. function burn(address from, uint256 amount) external; /// @return Maximum flash mint fee percentage that can be set by owner. function MAX_FLASH_MINT_FEE_PERCENTAGE() external view returns (uint256); /// @return Current flash mint fee percentage. function flashMintFeePercentage() external view returns (uint256); /// @dev Sets new flash mint fee percentage. Callable only by owner. /// @notice The proposed flash mint fee percentage cannot exceed `MAX_FLASH_MINT_FEE_PERCENTAGE`. /// @param feePercentage New flash fee percentage. function setFlashMintFeePercentage(uint256 feePercentage) external; } interface ISplitLiquidationCollateral { // --- Functions --- /// @dev Returns lowest total debt that will be split. function LOW_TOTAL_DEBT() external view returns (uint256); /// @dev Minimum collateralization ratio for position function MCR() external view returns (uint256); /// @dev Splits collateral between protocol and liquidator. /// @param totalCollateral Amount of collateral to split. /// @param totalDebt Amount of debt to split. /// @param price Price of collateral. /// @param isRedistribution True if this is a redistribution. /// @return collateralToSendToProtocol Amount of collateral to send to protocol. /// @return collateralToSentToLiquidator Amount of collateral to send to liquidator. function split( uint256 totalCollateral, uint256 totalDebt, uint256 price, bool isRedistribution ) external view returns (uint256 collateralToSendToProtocol, uint256 collateralToSentToLiquidator); } /// @dev Common interface for the Position Manager. interface IPositionManager is IFeeCollector { // --- Types --- /// @dev Information for a Raft indexable collateral token. /// @param collateralToken The Raft indexable collateral token. /// @param debtToken Corresponding Raft indexable debt token. /// @param priceFeed The contract that provides a price for the collateral token. /// @param splitLiquidation The contract that calculates collateral split in case of liquidation. /// @param isEnabled Whether the token can be used as collateral or not. /// @param lastFeeOperationTime Timestamp of the last operation for the collateral token. /// @param borrowingSpread The current borrowing spread. /// @param baseRate The current base rate. /// @param redemptionSpread The current redemption spread. /// @param redemptionRebate Percentage of the redemption fee returned to redeemed positions. struct CollateralTokenInfo { IERC20Indexable collateralToken; IERC20Indexable debtToken; IPriceFeed priceFeed; ISplitLiquidationCollateral splitLiquidation; bool isEnabled; uint256 lastFeeOperationTime; uint256 borrowingSpread; uint256 baseRate; uint256 redemptionSpread; uint256 redemptionRebate; } // --- Events --- /// @dev New position manager has been token deployed. /// @param rToken The R token used by the position manager. /// @param feeRecipient The address of fee recipient. event PositionManagerDeployed(IRToken rToken, address feeRecipient); /// @dev New collateral token has been added added to the system. /// @param collateralToken The token used as collateral. /// @param raftCollateralToken The Raft indexable collateral token for the given collateral token. /// @param raftDebtToken The Raft indexable debt token for given collateral token. /// @param priceFeed The contract that provides price for the collateral token. event CollateralTokenAdded( IERC20 collateralToken, IERC20Indexable raftCollateralToken, IERC20Indexable raftDebtToken, IPriceFeed priceFeed ); /// @dev Collateral token has been enabled or disabled. /// @param collateralToken The token used as collateral. /// @param isEnabled True if the token is enabled, false otherwise. event CollateralTokenModified(IERC20 collateralToken, bool isEnabled); /// @dev A delegate has been whitelisted for a certain position. /// @param position The position for which the delegate was whitelisted. /// @param delegate The delegate which was whitelisted. /// @param whitelisted Specifies whether the delegate whitelisting has been enabled (true) or disabled (false). event DelegateWhitelisted(address indexed position, address indexed delegate, bool whitelisted); /// @dev New position has been created. /// @param position The address of the user opening new position. /// @param collateralToken The token used as collateral for the created position. event PositionCreated(address indexed position, IERC20 indexed collateralToken); /// @dev The position has been closed by either repayment, liquidation, or redemption. /// @param position The address of the user whose position is closed. event PositionClosed(address indexed position); /// @dev Collateral amount for the position has been changed. /// @param position The address of the user that has opened the position. /// @param collateralToken The address of the collateral token being added to position. /// @param collateralAmount The amount of collateral added or removed. /// @param isCollateralIncrease Whether the collateral is added to the position or removed from it. event CollateralChanged( address indexed position, IERC20 indexed collateralToken, uint256 collateralAmount, bool isCollateralIncrease ); /// @dev Debt amount for position has been changed. /// @param position The address of the user that has opened the position. /// @param collateralToken The address of the collateral token backing the debt. /// @param debtAmount The amount of debt added or removed. /// @param isDebtIncrease Whether the debt is added to the position or removed from it. event DebtChanged( address indexed position, IERC20 indexed collateralToken, uint256 debtAmount, bool isDebtIncrease ); /// @dev Borrowing fee has been paid. Emitted only if the actual fee was paid - doesn't happen with no fees are /// paid. /// @param collateralToken Collateral token used to mint R. /// @param position The address of position's owner that triggered the fee payment. /// @param feeAmount The amount of tokens paid as the borrowing fee. event RBorrowingFeePaid(IERC20 collateralToken, address indexed position, uint256 feeAmount); /// @dev Liquidation has been executed. /// @param liquidator The liquidator that executed the liquidation. /// @param position The address of position's owner whose position was liquidated. /// @param collateralToken The collateral token used for the liquidation. /// @param debtLiquidated The total debt that was liquidated or redistributed. /// @param collateralLiquidated The total collateral liquidated. /// @param collateralSentToLiquidator The collateral amount sent to the liquidator. /// @param collateralLiquidationFeePaid The total collateral paid as the liquidation fee to the fee recipient. /// @param isRedistribution Whether the executed liquidation was redistribution or not. event Liquidation( address indexed liquidator, address indexed position, IERC20 indexed collateralToken, uint256 debtLiquidated, uint256 collateralLiquidated, uint256 collateralSentToLiquidator, uint256 collateralLiquidationFeePaid, bool isRedistribution ); /// @dev Redemption has been executed. /// @param redeemer User that redeemed R. /// @param amount Amount of R that was redeemed. /// @param collateralSent The amount of collateral sent to the redeemer. /// @param fee The amount of fee paid to the fee recipient. /// @param rebate Redemption rebate amount. event Redemption(address indexed redeemer, uint256 amount, uint256 collateralSent, uint256 fee, uint256 rebate); /// @dev Borrowing spread has been updated. /// @param borrowingSpread The new borrowing spread. event BorrowingSpreadUpdated(uint256 borrowingSpread); /// @dev Redemption rebate has been updated. /// @param redemptionRebate The new redemption rebate. event RedemptionRebateUpdated(uint256 redemptionRebate); /// @dev Redemption spread has been updated. /// @param collateralToken Collateral token that the spread was set for. /// @param redemptionSpread The new redemption spread. event RedemptionSpreadUpdated(IERC20 collateralToken, uint256 redemptionSpread); /// @dev Base rate has been updated. /// @param collateralToken Collateral token that the baser rate was updated for. /// @param baseRate The new base rate. event BaseRateUpdated(IERC20 collateralToken, uint256 baseRate); /// @dev Last fee operation time has been updated. /// @param collateralToken Collateral token that the baser rate was updated for. /// @param lastFeeOpTime The new operation time. event LastFeeOpTimeUpdated(IERC20 collateralToken, uint256 lastFeeOpTime); /// @dev Split liquidation collateral has been changed. /// @param collateralToken Collateral token whose split liquidation collateral contract is set. /// @param newSplitLiquidationCollateral New value that was set to be split liquidation collateral. event SplitLiquidationCollateralChanged( IERC20 collateralToken, ISplitLiquidationCollateral indexed newSplitLiquidationCollateral ); // --- Errors --- /// @dev Max fee percentage must be between borrowing spread and 100%. error InvalidMaxFeePercentage(); /// @dev Max fee percentage must be between 0.5% and 100%. error MaxFeePercentageOutOfRange(); /// @dev Amount is zero. error AmountIsZero(); /// @dev Nothing to liquidate. error NothingToLiquidate(); /// @dev Cannot liquidate last position. error CannotLiquidateLastPosition(); /// @dev Cannot redeem collateral below minimum debt threshold. /// @param collateralToken Collateral token used to redeem. /// @param newTotalDebt New total debt backed by collateral, which is lower than minimum debt. error TotalDebtCannotBeLowerThanMinDebt(IERC20 collateralToken, uint256 newTotalDebt); /// @dev Cannot redeem collateral /// @param collateralToken Collateral token used to redeem. /// @param newTotalCollateral New total collateral, which is lower than minimum collateral. /// @param minimumCollateral Minimum collateral required to complete redeem error TotalCollateralCannotBeLowerThanMinCollateral( IERC20 collateralToken, uint256 newTotalCollateral, uint256 minimumCollateral ); /// @dev Fee would eat up all returned collateral. error FeeEatsUpAllReturnedCollateral(); /// @dev Borrowing spread exceeds maximum. error BorrowingSpreadExceedsMaximum(); /// @dev Redemption rebate exceeds maximum. error RedemptionRebateExceedsMaximum(); /// @dev Redemption spread is out of allowed range. error RedemptionSpreadOutOfRange(); /// @dev There must be either a collateral change or a debt change. error NoCollateralOrDebtChange(); /// @dev There is some collateral for position that doesn't have debt. error InvalidPosition(); /// @dev An operation that would result in ICR < MCR is not permitted. /// @param newICR Resulting ICR that is bellow MCR. error NewICRLowerThanMCR(uint256 newICR); /// @dev Position's net debt must be greater than minimum. /// @param netDebt Net debt amount that is below minimum. error NetDebtBelowMinimum(uint256 netDebt); /// @dev The provided delegate address is invalid. error InvalidDelegateAddress(); /// @dev A non-whitelisted delegate cannot adjust positions. error DelegateNotWhitelisted(); /// @dev Fee exceeded provided maximum fee percentage. /// @param fee The fee amount. /// @param amount The amount of debt or collateral. /// @param maxFeePercentage The maximum fee percentage. error FeeExceedsMaxFee(uint256 fee, uint256 amount, uint256 maxFeePercentage); /// @dev Borrower uses a different collateral token already. error PositionCollateralTokenMismatch(); /// @dev Collateral token address cannot be zero. error CollateralTokenAddressCannotBeZero(); /// @dev Price feed address cannot be zero. error PriceFeedAddressCannotBeZero(); /// @dev Collateral token already added. error CollateralTokenAlreadyAdded(); /// @dev Collateral token is not added. error CollateralTokenNotAdded(); /// @dev Collateral token is not enabled. error CollateralTokenDisabled(); /// @dev Split liquidation collateral cannot be zero. error SplitLiquidationCollateralCannotBeZero(); /// @dev Cannot change collateral in case of repaying the whole debt. error WrongCollateralParamsForFullRepayment(); // --- Functions --- /// @return The R token used by position manager. function rToken() external view returns (IRToken); /// @dev Retrieves information about certain collateral type. /// @param collateralToken The token used as collateral. /// @return raftCollateralToken The Raft indexable collateral token. /// @return raftDebtToken The Raft indexable debt token. /// @return priceFeed The contract that provides a price for the collateral token. /// @return splitLiquidation The contract that calculates collateral split in case of liquidation. /// @return isEnabled Whether the collateral token can be used as collateral or not. /// @return lastFeeOperationTime Timestamp of the last operation for the collateral token. /// @return borrowingSpread The current borrowing spread. /// @return baseRate The current base rate. /// @return redemptionSpread The current redemption spread. /// @return redemptionRebate Percentage of the redemption fee returned to redeemed positions. function collateralInfo(IERC20 collateralToken) external view returns ( IERC20Indexable raftCollateralToken, IERC20Indexable raftDebtToken, IPriceFeed priceFeed, ISplitLiquidationCollateral splitLiquidation, bool isEnabled, uint256 lastFeeOperationTime, uint256 borrowingSpread, uint256 baseRate, uint256 redemptionSpread, uint256 redemptionRebate ); /// @param collateralToken Collateral token whose raft collateral indexable token is being queried. /// @return Raft collateral token address for given collateral token. function raftCollateralToken(IERC20 collateralToken) external view returns (IERC20Indexable); /// @param collateralToken Collateral token whose raft collateral indexable token is being queried. /// @return Raft debt token address for given collateral token. function raftDebtToken(IERC20 collateralToken) external view returns (IERC20Indexable); /// @param collateralToken Collateral token whose price feed contract is being queried. /// @return Price feed contract address for given collateral token. function priceFeed(IERC20 collateralToken) external view returns (IPriceFeed); /// @param collateralToken Collateral token whose split liquidation collateral is being queried. /// @return Returns address of the split liquidation collateral contract. function splitLiquidationCollateral(IERC20 collateralToken) external view returns (ISplitLiquidationCollateral); /// @param collateralToken Collateral token whose split liquidation collateral is being queried. /// @return Returns whether collateral is enabled or nor. function collateralEnabled(IERC20 collateralToken) external view returns (bool); /// @param collateralToken Collateral token we query last operation time fee for. /// @return The timestamp of the latest fee operation (redemption or new R issuance). function lastFeeOperationTime(IERC20 collateralToken) external view returns (uint256); /// @param collateralToken Collateral token we query borrowing spread for. /// @return The current borrowing spread. function borrowingSpread(IERC20 collateralToken) external view returns (uint256); /// @param collateralToken Collateral token we query base rate for. /// @return rate The base rate. function baseRate(IERC20 collateralToken) external view returns (uint256 rate); /// @param collateralToken Collateral token we query redemption spread for. /// @return The current redemption spread for collateral token. function redemptionSpread(IERC20 collateralToken) external view returns (uint256); /// @param collateralToken Collateral token we query redemption rebate for. /// @return rebate Percentage of the redemption fee returned to redeemed positions. function redemptionRebate(IERC20 collateralToken) external view returns (uint256); /// @param collateralToken Collateral token we query redemption rate for. /// @return rate The current redemption rate for collateral token. function getRedemptionRate(IERC20 collateralToken) external view returns (uint256 rate); /// @dev Returns the collateral token that a given position used for their position. /// @param position The address of the borrower. /// @return collateralToken The collateral token of the borrower's position. function collateralTokenForPosition(address position) external view returns (IERC20 collateralToken); /// @dev Adds a new collateral token to the protocol. /// @param collateralToken The new collateral token. /// @param priceFeed The price feed for the collateral token. /// @param newSplitLiquidationCollateral split liquidation collateral contract address. function addCollateralToken( IERC20 collateralToken, IPriceFeed priceFeed, ISplitLiquidationCollateral newSplitLiquidationCollateral ) external; /// @dev Enables or disables a collateral token. Reverts if the collateral token has not been added. /// @param collateralToken The collateral token. /// @param isEnabled Whether the collateral token can be used as collateral or not. function setCollateralEnabled(IERC20 collateralToken, bool isEnabled) external; /// @dev Sets the new split liquidation collateral contract. /// @param collateralToken Collateral token whose split liquidation collateral is being set. /// @param newSplitLiquidationCollateral New split liquidation collateral contract address. function setSplitLiquidationCollateral( IERC20 collateralToken, ISplitLiquidationCollateral newSplitLiquidationCollateral ) external; /// @dev Liquidates the borrower if its position's ICR is lower than the minimum collateral ratio. /// @param position The address of the borrower. function liquidate(address position) external; /// @dev Redeems the collateral token for a given debt amount. It sends @param debtAmount R to the system and /// redeems the corresponding amount of collateral from as many positions as are needed to fill the redemption /// request. /// @param collateralToken The token used as collateral. /// @param debtAmount The amount of debt to be redeemed. Must be greater than zero. /// @param maxFeePercentage The maximum fee percentage to pay for the redemption. function redeemCollateral(IERC20 collateralToken, uint256 debtAmount, uint256 maxFeePercentage) external; /// @dev Manages the position on behalf of a given borrower. /// @param collateralToken The token the borrower used as collateral. /// @param position The address of the borrower. /// @param collateralChange The amount of collateral to add or remove. /// @param isCollateralIncrease True if the collateral is being increased, false otherwise. /// @param debtChange The amount of R to add or remove. In case of repayment (isDebtIncrease = false) /// `type(uint256).max` value can be used to repay the whole outstanding loan. /// @param isDebtIncrease True if the debt is being increased, false otherwise. /// @param maxFeePercentage The maximum fee percentage to pay for the position management. /// @param permitSignature Optional permit signature for tokens that support IERC20Permit interface. /// @notice `permitSignature` it is ignored if permit signature is not for `collateralToken`. /// @notice In case of full debt repayment, `isCollateralIncrease` is ignored and `collateralChange` must be 0. /// These values are set to `false`(collateral decrease), and the whole collateral balance of the user. /// @return actualCollateralChange Actual amount of collateral added/removed. /// Can be different to `collateralChange` in case of full repayment. /// @return actualDebtChange Actual amount of debt added/removed. /// Can be different to `debtChange` in case of passing type(uint256).max as `debtChange`. function managePosition( IERC20 collateralToken, address position, uint256 collateralChange, bool isCollateralIncrease, uint256 debtChange, bool isDebtIncrease, uint256 maxFeePercentage, ERC20PermitSignature calldata permitSignature ) external returns (uint256 actualCollateralChange, uint256 actualDebtChange); /// @return The max borrowing spread. function MAX_BORROWING_SPREAD() external view returns (uint256); /// @return The max borrowing rate. function MAX_BORROWING_RATE() external view returns (uint256); /// @dev Sets the new borrowing spread. /// @param collateralToken Collateral token we set borrowing spread for. /// @param newBorrowingSpread New borrowing spread to be used. function setBorrowingSpread(IERC20 collateralToken, uint256 newBorrowingSpread) external; /// @param collateralToken Collateral token we query borrowing rate for. /// @return The current borrowing rate. function getBorrowingRate(IERC20 collateralToken) external view returns (uint256); /// @param collateralToken Collateral token we query borrowing rate with decay for. /// @return The current borrowing rate with decay. function getBorrowingRateWithDecay(IERC20 collateralToken) external view returns (uint256); /// @dev Returns the borrowing fee for a given debt amount. /// @param collateralToken Collateral token we query borrowing fee for. /// @param debtAmount The amount of debt. /// @return The borrowing fee. function getBorrowingFee(IERC20 collateralToken, uint256 debtAmount) external view returns (uint256); /// @dev Sets the new redemption spread. /// @param newRedemptionSpread New redemption spread to be used. function setRedemptionSpread(IERC20 collateralToken, uint256 newRedemptionSpread) external; /// @dev Sets new redemption rebate percentage. /// @param newRedemptionRebate Value that is being set as a redemption rebate percentage. function setRedemptionRebate(IERC20 collateralToken, uint256 newRedemptionRebate) external; /// @param collateralToken Collateral token we query redemption rate with decay for. /// @return The current redemption rate with decay. function getRedemptionRateWithDecay(IERC20 collateralToken) external view returns (uint256); /// @dev Returns the redemption fee for a given collateral amount. /// @param collateralToken Collateral token we query redemption fee for. /// @param collateralAmount The amount of collateral. /// @param priceDeviation Deviation for the reported price by oracle in percentage. /// @return The redemption fee. function getRedemptionFee( IERC20 collateralToken, uint256 collateralAmount, uint256 priceDeviation ) external view returns (uint256); /// @dev Returns the redemption fee with decay for a given collateral amount. /// @param collateralToken Collateral token we query redemption fee with decay for. /// @param collateralAmount The amount of collateral. /// @return The redemption fee with decay. function getRedemptionFeeWithDecay( IERC20 collateralToken, uint256 collateralAmount ) external view returns (uint256); /// @return Half-life of 12h (720 min). /// @dev (1/2) = d^720 => d = (1/2)^(1/720) function MINUTE_DECAY_FACTOR() external view returns (uint256); /// @dev Returns if a given delegate is whitelisted for a given borrower. /// @param position The address of the borrower. /// @param delegate The address of the delegate. /// @return isWhitelisted True if the delegate is whitelisted for a given borrower, false otherwise. function isDelegateWhitelisted(address position, address delegate) external view returns (bool isWhitelisted); /// @dev Whitelists a delegate. /// @param delegate The address of the delegate. /// @param whitelisted True if delegate is being whitelisted, false otherwise. function whitelistDelegate(address delegate, bool whitelisted) external; /// @return Parameter by which to divide the redeemed fraction, in order to calc the new base rate from a /// redemption. Corresponds to (1 / ALPHA) in the white paper. function BETA() external view returns (uint256); } /// @notice Interface for the PositionManagerWrappedCollateralToken contract. interface IPositionManagerWrappedCollateralToken is IPositionManagerDependent { // --- Events --- /// @dev The position is changed using the wrapped collateral token. /// @param position The address of the user that has opened the position. /// @param collateralAmount The amount of collateral added or removed. /// @param isCollateralIncrease Whether the collateral is added to the position or removed from it. /// @param debtAmount The amount of debt added or removed. /// @param isDebtIncrease Whether the debt is added to the position or removed from it. event WrappedCollateralTokenPositionChanged( address indexed position, uint256 collateralAmount, bool isCollateralIncrease, uint256 debtAmount, bool isDebtIncrease ); // --- Errors --- /// @dev The wrapped collateral token address cannot be zero. error WrappedCollateralTokenAddressCannotBeZero(); // --- Functions --- /// @dev Returns the wrapped collateral token address. function wrappedCollateralToken() external view returns (IERC20Wrapped); /// @dev Manages the position with the wrapped collateral token. /// @param collateralChange The amount of wrapped collateral token to add or remove. /// @param isCollateralIncrease True if the collateral is being increased, false otherwise. /// @param debtChange The amount of R to add or remove. /// @param isDebtIncrease True if the debt is being increased, false otherwise. /// @param maxFeePercentage The maximum fee percentage to pay for the position management. /// @param permitSignature The permit signature for the R token used for position repayment. Ignored in other /// cases. function managePosition( uint256 collateralChange, bool isCollateralIncrease, uint256 debtChange, bool isDebtIncrease, uint256 maxFeePercentage, ERC20PermitSignature calldata permitSignature ) external; /// @dev Redeems the collateral from a given debt amount. /// @param amount The amount of debt to redeem. /// @param maxFeePercentage The maximum fee percentage to pay for the redemption. /// @param permitSignature The permit signature for the R token. function redeemCollateral( uint256 amount, uint256 maxFeePercentage, ERC20PermitSignature calldata permitSignature ) external; } abstract contract PositionManagerDependent is IPositionManagerDependent { // --- Immutable variables --- address public immutable override positionManager; // --- Modifiers --- modifier onlyPositionManager() { if (msg.sender != positionManager) { revert CallerIsNotPositionManager(msg.sender); } _; } // --- Constructor --- constructor(address positionManager_) { if (positionManager_ == address(0)) { revert PositionManagerCannotBeZero(); } positionManager = positionManager_; } } contract PositionManagerWrappedCollateralToken is IPositionManagerWrappedCollateralToken, PositionManagerDependent { // --- Types --- using SafeERC20 for IERC20; // --- Immutables --- IERC20Wrapped public immutable override wrappedCollateralToken; IERC20 internal immutable _underlyingCollateralToken; IERC20Indexable internal immutable _raftDebtToken; IRToken internal immutable _rToken; constructor( address positionManager_, IERC20Wrapped wrappedCollateralToken_ ) PositionManagerDependent(positionManager_) { if (address(wrappedCollateralToken_) == address(0)) { revert WrappedCollateralTokenAddressCannotBeZero(); } wrappedCollateralToken = wrappedCollateralToken_; _underlyingCollateralToken = wrappedCollateralToken_.underlying(); _raftDebtToken = IPositionManager(positionManager_).raftDebtToken(wrappedCollateralToken); _rToken = IPositionManager(positionManager_).rToken(); _underlyingCollateralToken.safeApprove(address(wrappedCollateralToken), type(uint256).max); wrappedCollateralToken.approve(positionManager, type(uint256).max); } function managePosition( uint256 collateralChange, bool isCollateralIncrease, uint256 debtChange, bool isDebtIncrease, uint256 maxFeePercentage, ERC20PermitSignature calldata permitSignature ) external override { ERC20PermitSignature memory emptySignature; if (!isDebtIncrease) { if (debtChange == type(uint256).max) { debtChange = _raftDebtToken.balanceOf(msg.sender); } _applyPermit(_rToken, permitSignature); _rToken.transferFrom(msg.sender, address(this), debtChange); } if (isCollateralIncrease && collateralChange > 0) { _underlyingCollateralToken.safeTransferFrom(msg.sender, address(this), collateralChange); IWrappedCollateralToken(address(wrappedCollateralToken)).depositForWithAccountCheck( address(this), msg.sender, collateralChange ); } (collateralChange, debtChange) = IPositionManager(positionManager).managePosition( wrappedCollateralToken, msg.sender, collateralChange, isCollateralIncrease, debtChange, isDebtIncrease, maxFeePercentage, emptySignature ); if (!isCollateralIncrease && collateralChange > 0) { wrappedCollateralToken.withdrawTo(msg.sender, collateralChange); } if (isDebtIncrease) { _rToken.transfer(msg.sender, debtChange); } emit WrappedCollateralTokenPositionChanged( msg.sender, collateralChange, isCollateralIncrease, debtChange, isDebtIncrease ); } function redeemCollateral( uint256 debtAmount, uint256 maxFeePercentage, ERC20PermitSignature calldata permitSignature ) external override { _applyPermit(_rToken, permitSignature); _rToken.transferFrom(msg.sender, address(this), debtAmount); IPositionManager(positionManager).redeemCollateral(wrappedCollateralToken, debtAmount, maxFeePercentage); wrappedCollateralToken.withdrawTo(msg.sender, wrappedCollateralToken.balanceOf(address(this))); } function _applyPermit(IERC20Permit token, ERC20PermitSignature calldata permitSignature) internal { if (address(permitSignature.token) == address(token)) { PermitHelper.applyPermit(permitSignature, msg.sender, address(this)); } } }
{ "remappings": [ "@balancer-labs/=node_modules/@balancer-labs/", "@balancer-labs/v2-interfaces/contracts/=lib/balancer-v2-monorepo/pkg/interfaces/contracts/", "@chainlink/=node_modules/@chainlink/", "@eth-optimism/=node_modules/@eth-optimism/", "@openzeppelin/=node_modules/@openzeppelin/", "@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/", "@redstone-finance/=node_modules/@redstone-finance/", "@smartcontractkit/chainlink/=lib/chainlink/contracts/src/v0.8/", "@tempusfinance/=node_modules/@tempusfinance/", "@tempusfinance/tempus-utils/contracts/=lib/tempus-utils/contracts/", "balancer-v2-monorepo/=lib/balancer-v2-monorepo/", "chainlink/=lib/chainlink/", "ds-test/=lib/forge-std/lib/ds-test/src/", "erc4626-tests/=lib/chainlink/contracts/foundry-lib/openzeppelin-contracts/lib/erc4626-tests/", "eth-gas-reporter/=node_modules/eth-gas-reporter/", "forge-std/=lib/forge-std/src/", "hardhat/=node_modules/hardhat/", "openzeppelin-contracts/=lib/openzeppelin-contracts/", "tempus-utils/=lib/tempus-utils/contracts/" ], "optimizer": { "enabled": true, "runs": 200000 }, "metadata": { "bytecodeHash": "ipfs", "appendCBOR": true }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "evmVersion": "london", "viaIR": true, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"address","name":"positionManager_","type":"address"},{"internalType":"contract IERC20Wrapped","name":"wrappedCollateralToken_","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"caller","type":"address"}],"name":"CallerIsNotPositionManager","type":"error"},{"inputs":[],"name":"PositionManagerCannotBeZero","type":"error"},{"inputs":[],"name":"WrappedCollateralTokenAddressCannotBeZero","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"position","type":"address"},{"indexed":false,"internalType":"uint256","name":"collateralAmount","type":"uint256"},{"indexed":false,"internalType":"bool","name":"isCollateralIncrease","type":"bool"},{"indexed":false,"internalType":"uint256","name":"debtAmount","type":"uint256"},{"indexed":false,"internalType":"bool","name":"isDebtIncrease","type":"bool"}],"name":"WrappedCollateralTokenPositionChanged","type":"event"},{"inputs":[{"internalType":"uint256","name":"collateralChange","type":"uint256"},{"internalType":"bool","name":"isCollateralIncrease","type":"bool"},{"internalType":"uint256","name":"debtChange","type":"uint256"},{"internalType":"bool","name":"isDebtIncrease","type":"bool"},{"internalType":"uint256","name":"maxFeePercentage","type":"uint256"},{"components":[{"internalType":"contract IERC20Permit","name":"token","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"}],"internalType":"struct ERC20PermitSignature","name":"permitSignature","type":"tuple"}],"name":"managePosition","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"positionManager","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"debtAmount","type":"uint256"},{"internalType":"uint256","name":"maxFeePercentage","type":"uint256"},{"components":[{"internalType":"contract IERC20Permit","name":"token","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"}],"internalType":"struct ERC20PermitSignature","name":"permitSignature","type":"tuple"}],"name":"redeemCollateral","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"wrappedCollateralToken","outputs":[{"internalType":"contract IERC20Wrapped","name":"","type":"address"}],"stateMutability":"view","type":"function"}]
Contract Creation Code
61012060409080825234620005865781816200169780380380916200002582856200058b565b83398101031262000586578051916001600160a01b0380841690818503620005865760208094015194818616908187036200058657831562000575576080528015620005645760a09586528351636f307dc360e01b815260049593929184908290889082905afa908115620004ca5760009162000527575b5060c052855184516302f816a360e01b8152908216868201526024929084818581855afa9081156200051c57918591889493600091620004d5575b5060e05286516320632fb960e11b815297889182905afa958615620004ca5760009662000485575b506101009586528060c05116908088511690865192636eb1769f60e11b84523085850152828685015260449387818681855afa9081156200047a5760009162000444575b50620003dd57875163095ea7b360e01b888201818152888301959095526000198683018190528683529094909260808301926001600160401b03929083851181861017620003c95760c0810185811085821117620003b557918f917f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648f938f6000968796528952820152519082855af1908a3d156200039f57503d9283116200038b57918a989796959493916200021c938d51926200020d8c601f19601f84011601856200058b565b83523d60008c85013e620005df565b8051806200030c575b505090600091818c51169160805116978a51988997889687528601528401525af180156200030157620002cc575b50505190610fdd9283620006ba84396080518381816101fc01528181610aed0152610d8601525182818161015b015281816105be01528181610b450152610df4015260c0518281816104b50152610549015260e051826109700152518181816102d20152818161076b015281816107eb0152610a5e0152f35b81620002f092903d10620002f9575b620002e781836200058b565b810190620005c5565b50388062000253565b503d620002db565b83513d6000823e3d90fd5b9680620003239394959697988301019101620005c5565b156200033757908694939291388062000225565b875162461bcd60e51b8152808601889052602a818801527f5361666545524332303a204552433230206f7065726174696f6e20646964206e81860152691bdd081cdd58d8d9595960b21b6064820152608490fd5b8960418a634e487b7160e01b600052526000fd5b989796959493916200021c9350606091620005df565b8b60418c634e487b7160e01b600052526000fd5b8a60418b634e487b7160e01b600052526000fd5b875162461bcd60e51b81528086018890526036818801527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f818601527f20746f206e6f6e2d7a65726f20616c6c6f77616e6365000000000000000000006064820152608490fd5b908882813d831162000472575b6200045d81836200058b565b810103126200046f5750513862000144565b80fd5b503d62000451565b89513d6000823e3d90fd5b8481819893983d8311620004c2575b620004a081836200058b565b81010312620004be57519086821682036200046f5750943862000100565b5080fd5b503d62000494565b85513d6000823e3d90fd5b80929495508391933d831162000514575b620004f281836200058b565b81010312620004be57519083821682036200046f5750869291859138620000d8565b503d620004e6565b86513d6000823e3d90fd5b8481813d83116200055c575b6200053f81836200058b565b81010312620004be57519082821682036200046f5750386200009d565b503d62000533565b8351639f5a5def60e01b8152600490fd5b845163179a321360e11b8152600490fd5b600080fd5b601f909101601f19168101906001600160401b03821190821017620005af57604052565b634e487b7160e01b600052604160045260246000fd5b908160209103126200058657518015158103620005865790565b91929015620006445750815115620005f5575090565b3b15620005ff5790565b60405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606490fd5b825190915015620006585750805190602001fd5b6040519062461bcd60e51b82528160208060048301528251908160248401526000935b8285106200069f575050604492506000838284010152601f80199101168101030190fd5b84810182015186860160440152938101938593506200067b56fe608080604052600436101561001357600080fd5b600090813560e01c9081635ab4143814610daa57508063791b98bc14610d3b578063883404e9146109e657639624a10f1461004d57600080fd5b346109e3576101607ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126109e357602435151560243503610921576064351515606435036109215760c07fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff5c3601126109e35760405160443560c0820167ffffffffffffffff8111838210176106c6576040528282528260208301528260408301528260608301528260808301528260a08301526064351561070c575b60243580610701575b6103f8575b604051917f171672b100000000000000000000000000000000000000000000000000000000835260a073ffffffffffffffffffffffffffffffffffffffff91827f000000000000000000000000000000000000000000000000000000000000000016938460048701523360248701526004356044870152602435151560648701526084860152606435151560a486015260843560c48601528281511660e48601526020810151610104860152604081015161012486015260ff606082015116610144860152608081015161016486015201516101848401526040836101a48187857f0000000000000000000000000000000000000000000000000000000000000000165af191821561032e57849385936103b9575b5060243515806103b0575b610339575b50606435610290575b50604051918252602435151560208301526040820152606435151560608201527f497a2b097a5d8a189cbe617ccedc3e56d8a86293ccbd55383914c10eb15ab37860803392a280f35b6040517fa9059cbb00000000000000000000000000000000000000000000000000000000815233600482015260248101839052906020908290604490829088907f0000000000000000000000000000000000000000000000000000000000000000165af1801561032e5715610247576103209060203d602011610327575b6103188183610e2c565b810190610e6d565b5038610247565b503d61030e565b6040513d86823e3d90fd5b6040517f205c287800000000000000000000000000000000000000000000000000000000815233600482015260248101859052906020908290604490829089905af180156103a5571561023e5761039e9060203d602011610327576103188183610e2c565b503861023e565b6040513d87823e3d90fd5b50831515610239565b935091506040833d6040116103f0575b816103d660409383610e2c565b810103126103ec5760208351930151913861022e565b8380fd5b3d91506103c9565b6040517f23b872dd0000000000000000000000000000000000000000000000000000000060208201523360248201523060448201526004356064808301919091528152610446608482610e2c565b6040519081604081011067ffffffffffffffff6040840111176106c65784809160408401604052602084527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c656460208501526020815191018273ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000165af1903d156106f5573d67ffffffffffffffff81116106c65761056e926040519161052860207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f8401160184610e2c565b82523d87602084013e5b73ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000016610e85565b80519081610625575b50506040517fdbda483200000000000000000000000000000000000000000000000000000000815230600480830191909152336024830152356044820152602081606481877f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff165af1801561032e57610606575b50610119565b61061e9060203d602011610327576103188183610e2c565b5038610600565b602080610636938301019101610e6d565b15610642573880610577565b60846040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b61056e91606090610532565b506004351515610114565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8114610926575b60a43573ffffffffffffffffffffffffffffffffffffffff811681036109215773ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff821614610852575b506040517f23b872dd00000000000000000000000000000000000000000000000000000000815233600482015230602482015260448101829052602081606481877f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff165af1801561032e57610833575b5061010b565b61084b9060203d602011610327576103188183610e2c565b503861082d565b6101043560ff811681036109215773ffffffffffffffffffffffffffffffffffffffff82163b156109215760ff60e46000928373ffffffffffffffffffffffffffffffffffffffff60405196879586947fd505accf00000000000000000000000000000000000000000000000000000000865233600487015230602487015260c4356044870152863560648701521660848501526101243560a48501526101443560c4850152165af1801561091557156107a85761090f90610e18565b386107a8565b6040513d6000823e3d90fd5b600080fd5b506040517f70a0823100000000000000000000000000000000000000000000000000000000815233600482015260208160248173ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000165afa9081156109d85783916109a6575b50610734565b90506020813d6020116109d0575b816109c160209383610e2c565b810103126109215751386109a0565b3d91506109b4565b6040513d85823e3d90fd5b80fd5b50346109e3576101007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126109e35760043560c07fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffbc360112610d375773ffffffffffffffffffffffffffffffffffffffff9082827f00000000000000000000000000000000000000000000000000000000000000001692604435818116809103610c8457848114610ca5575b506040517f23b872dd0000000000000000000000000000000000000000000000000000000081523360048201523060248201526044810184905260209485908290606490829087905af180156109d857610c88575b50807f000000000000000000000000000000000000000000000000000000000000000016803b15610c84576064839260405194859384927f7cb19fe80000000000000000000000000000000000000000000000000000000084527f00000000000000000000000000000000000000000000000000000000000000001697886004850152602484015260243560448401525af1801561032e57610c71575b506040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015283918382602481845afa80156109d85784928491610c3c575b506040517f205c2878000000000000000000000000000000000000000000000000000000008152336004820152602481019190915292839190829081604481015b03925af180156109d857610c1f578280f35b81610c3592903d10610327576103188183610e2c565b5038808280f35b9350509082813d8311610c6a575b610c548183610e2c565b8101031261092157905183918391610c0d610bcc565b503d610c4a565b610c7d90939193610e18565b9138610b86565b8280fd5b610c9e90853d8711610327576103188183610e2c565b5038610ae9565b60a43560ff81168091036103ec57813b156103ec57839160e4839260405194859384927fd505accf00000000000000000000000000000000000000000000000000000000845233600485015230602485015260643560448501526084356064850152608484015260c43560a4840152833560c48401525af180156109d85715610a9457610d3190610e18565b38610a94565b5080fd5b50346109e357807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126109e357602060405173ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000168152f35b905034610d3757817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610d375760209073ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000168152f35b67ffffffffffffffff81116106c657604052565b90601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0910116810190811067ffffffffffffffff8211176106c657604052565b90816020910312610921575180151581036109215790565b91929015610f005750815115610e99575090565b3b15610ea25790565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152fd5b825190915015610f135750805190602001fd5b604051907f08c379a000000000000000000000000000000000000000000000000000000000825281602080600483015282519283602484015260005b848110610f90575050507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f836000604480968601015201168101030190fd5b818101830151868201604401528593508201610f4f56fea2646970667358221220afd2545820f2d186d853cbc6c56a6fff558a1403e99f92d6899ce193ad868ed164736f6c634300081300330000000000000000000000005f59b322eb3e16a0c78846195af1f588b77403fc000000000000000000000000b69e35fb4a157028b92f42655090b984609ae598
Deployed Bytecode
0x608080604052600436101561001357600080fd5b600090813560e01c9081635ab4143814610daa57508063791b98bc14610d3b578063883404e9146109e657639624a10f1461004d57600080fd5b346109e3576101607ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126109e357602435151560243503610921576064351515606435036109215760c07fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff5c3601126109e35760405160443560c0820167ffffffffffffffff8111838210176106c6576040528282528260208301528260408301528260608301528260808301528260a08301526064351561070c575b60243580610701575b6103f8575b604051917f171672b100000000000000000000000000000000000000000000000000000000835260a073ffffffffffffffffffffffffffffffffffffffff91827f000000000000000000000000b69e35fb4a157028b92f42655090b984609ae59816938460048701523360248701526004356044870152602435151560648701526084860152606435151560a486015260843560c48601528281511660e48601526020810151610104860152604081015161012486015260ff606082015116610144860152608081015161016486015201516101848401526040836101a48187857f0000000000000000000000005f59b322eb3e16a0c78846195af1f588b77403fc165af191821561032e57849385936103b9575b5060243515806103b0575b610339575b50606435610290575b50604051918252602435151560208301526040820152606435151560608201527f497a2b097a5d8a189cbe617ccedc3e56d8a86293ccbd55383914c10eb15ab37860803392a280f35b6040517fa9059cbb00000000000000000000000000000000000000000000000000000000815233600482015260248101839052906020908290604490829088907f000000000000000000000000183015a9ba6ff60230fdeadc3f43b3d788b13e21165af1801561032e5715610247576103209060203d602011610327575b6103188183610e2c565b810190610e6d565b5038610247565b503d61030e565b6040513d86823e3d90fd5b6040517f205c287800000000000000000000000000000000000000000000000000000000815233600482015260248101859052906020908290604490829089905af180156103a5571561023e5761039e9060203d602011610327576103188183610e2c565b503861023e565b6040513d87823e3d90fd5b50831515610239565b935091506040833d6040116103f0575b816103d660409383610e2c565b810103126103ec5760208351930151913861022e565b8380fd5b3d91506103c9565b6040517f23b872dd0000000000000000000000000000000000000000000000000000000060208201523360248201523060448201526004356064808301919091528152610446608482610e2c565b6040519081604081011067ffffffffffffffff6040840111176106c65784809160408401604052602084527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c656460208501526020815191018273ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000ae78736cd615f374d3085123a210448e74fc6393165af1903d156106f5573d67ffffffffffffffff81116106c65761056e926040519161052860207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f8401160184610e2c565b82523d87602084013e5b73ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000ae78736cd615f374d3085123a210448e74fc639316610e85565b80519081610625575b50506040517fdbda483200000000000000000000000000000000000000000000000000000000815230600480830191909152336024830152356044820152602081606481877f000000000000000000000000b69e35fb4a157028b92f42655090b984609ae59873ffffffffffffffffffffffffffffffffffffffff165af1801561032e57610606575b50610119565b61061e9060203d602011610327576103188183610e2c565b5038610600565b602080610636938301019101610e6d565b15610642573880610577565b60846040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b61056e91606090610532565b506004351515610114565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8114610926575b60a43573ffffffffffffffffffffffffffffffffffffffff811681036109215773ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000183015a9ba6ff60230fdeadc3f43b3d788b13e211673ffffffffffffffffffffffffffffffffffffffff821614610852575b506040517f23b872dd00000000000000000000000000000000000000000000000000000000815233600482015230602482015260448101829052602081606481877f000000000000000000000000183015a9ba6ff60230fdeadc3f43b3d788b13e2173ffffffffffffffffffffffffffffffffffffffff165af1801561032e57610833575b5061010b565b61084b9060203d602011610327576103188183610e2c565b503861082d565b6101043560ff811681036109215773ffffffffffffffffffffffffffffffffffffffff82163b156109215760ff60e46000928373ffffffffffffffffffffffffffffffffffffffff60405196879586947fd505accf00000000000000000000000000000000000000000000000000000000865233600487015230602487015260c4356044870152863560648701521660848501526101243560a48501526101443560c4850152165af1801561091557156107a85761090f90610e18565b386107a8565b6040513d6000823e3d90fd5b600080fd5b506040517f70a0823100000000000000000000000000000000000000000000000000000000815233600482015260208160248173ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000f22cd22b5cf439825c6b75c816a4daf8fb44375b165afa9081156109d85783916109a6575b50610734565b90506020813d6020116109d0575b816109c160209383610e2c565b810103126109215751386109a0565b3d91506109b4565b6040513d85823e3d90fd5b80fd5b50346109e3576101007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126109e35760043560c07fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffbc360112610d375773ffffffffffffffffffffffffffffffffffffffff9082827f000000000000000000000000183015a9ba6ff60230fdeadc3f43b3d788b13e211692604435818116809103610c8457848114610ca5575b506040517f23b872dd0000000000000000000000000000000000000000000000000000000081523360048201523060248201526044810184905260209485908290606490829087905af180156109d857610c88575b50807f0000000000000000000000005f59b322eb3e16a0c78846195af1f588b77403fc16803b15610c84576064839260405194859384927f7cb19fe80000000000000000000000000000000000000000000000000000000084527f000000000000000000000000b69e35fb4a157028b92f42655090b984609ae5981697886004850152602484015260243560448401525af1801561032e57610c71575b506040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015283918382602481845afa80156109d85784928491610c3c575b506040517f205c2878000000000000000000000000000000000000000000000000000000008152336004820152602481019190915292839190829081604481015b03925af180156109d857610c1f578280f35b81610c3592903d10610327576103188183610e2c565b5038808280f35b9350509082813d8311610c6a575b610c548183610e2c565b8101031261092157905183918391610c0d610bcc565b503d610c4a565b610c7d90939193610e18565b9138610b86565b8280fd5b610c9e90853d8711610327576103188183610e2c565b5038610ae9565b60a43560ff81168091036103ec57813b156103ec57839160e4839260405194859384927fd505accf00000000000000000000000000000000000000000000000000000000845233600485015230602485015260643560448501526084356064850152608484015260c43560a4840152833560c48401525af180156109d85715610a9457610d3190610e18565b38610a94565b5080fd5b50346109e357807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126109e357602060405173ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000005f59b322eb3e16a0c78846195af1f588b77403fc168152f35b905034610d3757817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610d375760209073ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000b69e35fb4a157028b92f42655090b984609ae598168152f35b67ffffffffffffffff81116106c657604052565b90601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0910116810190811067ffffffffffffffff8211176106c657604052565b90816020910312610921575180151581036109215790565b91929015610f005750815115610e99575090565b3b15610ea25790565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152fd5b825190915015610f135750805190602001fd5b604051907f08c379a000000000000000000000000000000000000000000000000000000000825281602080600483015282519283602484015260005b848110610f90575050507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f836000604480968601015201168101030190fd5b818101830151868201604401528593508201610f4f56fea2646970667358221220afd2545820f2d186d853cbc6c56a6fff558a1403e99f92d6899ce193ad868ed164736f6c63430008130033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
0000000000000000000000005f59b322eb3e16a0c78846195af1f588b77403fc000000000000000000000000b69e35fb4a157028b92f42655090b984609ae598
-----Decoded View---------------
Arg [0] : positionManager_ (address): 0x5F59b322eB3e16A0C78846195af1F588b77403FC
Arg [1] : wrappedCollateralToken_ (address): 0xb69E35fB4A157028b92F42655090b984609Ae598
-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 0000000000000000000000005f59b322eb3e16a0c78846195af1f588b77403fc
Arg [1] : 000000000000000000000000b69e35fb4a157028b92f42655090b984609ae598
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
Loading...
Loading
[ 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.