Feature Tip: Add private address tag to any address under My Name Tag !
Source Code
| Transaction Hash |
Method
|
Block
|
From
|
|
To
|
||||
|---|---|---|---|---|---|---|---|---|---|
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Loading...
Loading
Cross-Chain Transactions
Loading...
Loading
Contract Name:
PendleCUSDAdapter
Compiler Version
v0.8.24+commit.e11b9ed9
Optimization Enabled:
Yes with 1000000 runs
Other Settings:
shanghai EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.0;
import "../../../../interfaces/Cap/ICUSD.sol";
import "../../../../interfaces/IStandardizedYieldAdapter.sol";
import "../../../libraries/TokenHelper.sol";
contract PendleCUSDAdapter is IStandardizedYieldAdapter, TokenHelper {
address public constant cUSD = 0xcCcc62962d17b8914c62D74FfB843d73B2a3cccC;
address public constant PIVOT_TOKEN = cUSD;
uint256 internal constant MAX_DEADLINE = type(uint256).max;
function convertToDeposit(address tokenIn, uint256 amountTokenIn) external returns (uint256 amountOut) {
_safeApproveInf(tokenIn, cUSD);
return ICUSD(cUSD).mint(tokenIn, amountTokenIn, 0, msg.sender, MAX_DEADLINE);
}
function convertToRedeem(address tokenOut, uint256 amountPivotTokenIn) external returns (uint256 amountOut) {
return ICUSD(cUSD).burn(tokenOut, amountPivotTokenIn, 0, msg.sender, MAX_DEADLINE);
}
function previewConvertToDeposit(address tokenIn, uint256 amountTokenIn)
external
view
returns (uint256 amountOut)
{
(amountOut,) = ICUSD(cUSD).getMintAmount(tokenIn, amountTokenIn);
}
function previewConvertToRedeem(address tokenOut, uint256 amountPivotTokenIn)
external
view
returns (uint256 amountOut)
{
(amountOut,) = ICUSD(cUSD).getBurnAmount(tokenOut, amountPivotTokenIn);
}
function getAdapterTokensDeposit() external view returns (address[] memory tokens) {
address[] memory allAssets = ICUSD(cUSD).assets();
tokens = new address[](allAssets.length);
uint256 supportedAssetsLength;
for (uint256 i = 0; i < allAssets.length;) {
if (!ICUSD(cUSD).paused(allAssets[i])) {
tokens[supportedAssetsLength++] = allAssets[i];
}
unchecked {
++i;
}
}
assembly {
mstore(tokens, supportedAssetsLength)
}
}
function getAdapterTokensRedeem() external view returns (address[] memory tokens) {
return ICUSD(cUSD).assets();
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)
pragma solidity ^0.8.0;
import "../IERC20.sol";
/**
* @dev Interface for the optional metadata functions from the ERC20 standard.
*
* _Available since v4.1._
*/
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);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/IERC20Permit.sol)
pragma solidity ^0.8.0;
/**
* @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);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)
pragma solidity ^0.8.0;
/**
* @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);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.3) (token/ERC20/utils/SafeERC20.sol)
pragma solidity ^0.8.0;
import "../IERC20.sol";
import "../extensions/IERC20Permit.sol";
import "../../../utils/Address.sol";
/**
* @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;
/**
* @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*/
function safeTransfer(IERC20 token, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
/**
* @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the
* calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.
*/
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));
}
/**
* @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*/
function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 oldAllowance = token.allowance(address(this), spender);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value));
}
/**
* @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*/
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");
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value));
}
}
/**
* @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval
* to be set to zero before setting it to a non-zero value, such as USDT.
*/
function forceApprove(IERC20 token, address spender, uint256 value) internal {
bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value);
if (!_callOptionalReturnBool(token, approvalCall)) {
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0));
_callOptionalReturn(token, approvalCall);
}
}
/**
* @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`.
* Revert on invalid signature.
*/
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");
require(returndata.length == 0 || abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation 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).
*
* This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.
*/
function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {
// 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 cannot use {Address-functionCall} here since this should return false
// and not revert is the subcall reverts.
(bool success, bytes memory returndata) = address(token).call(data);
return
success && (returndata.length == 0 || abi.decode(returndata, (bool))) && Address.isContract(address(token));
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)
pragma solidity ^0.8.1;
/**
* @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
*
* 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]
* ====
* 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://consensys.net/diligence/blog/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.8.0/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);
}
}
}// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "../../interfaces/IWETH.sol";
abstract contract TokenHelper {
using SafeERC20 for IERC20;
address internal constant NATIVE = address(0);
uint256 internal constant LOWER_BOUND_APPROVAL = type(uint96).max / 2; // some tokens use 96 bits for approval
function _transferIn(address token, address from, uint256 amount) internal {
if (token == NATIVE) require(msg.value == amount, "eth mismatch");
else if (amount != 0) IERC20(token).safeTransferFrom(from, address(this), amount);
}
function _transferFrom(IERC20 token, address from, address to, uint256 amount) internal {
if (amount != 0) token.safeTransferFrom(from, to, amount);
}
function _transferOut(address token, address to, uint256 amount) internal {
if (amount == 0) return;
if (token == NATIVE) {
(bool success, ) = to.call{value: amount}("");
require(success, "eth send failed");
} else {
IERC20(token).safeTransfer(to, amount);
}
}
function _transferOut(address[] memory tokens, address to, uint256[] memory amounts) internal {
uint256 numTokens = tokens.length;
require(numTokens == amounts.length, "length mismatch");
for (uint256 i = 0; i < numTokens; ) {
_transferOut(tokens[i], to, amounts[i]);
unchecked {
i++;
}
}
}
function _selfBalance(address token) internal view returns (uint256) {
return (token == NATIVE) ? address(this).balance : IERC20(token).balanceOf(address(this));
}
function _selfBalance(IERC20 token) internal view returns (uint256) {
return token.balanceOf(address(this));
}
/// @notice Approves the stipulated contract to spend the given allowance in the given token
/// @dev PLS PAY ATTENTION to tokens that requires the approval to be set to 0 before changing it
function _safeApprove(address token, address to, uint256 value) internal {
(bool success, bytes memory data) = token.call(abi.encodeWithSelector(IERC20.approve.selector, to, value));
require(success && (data.length == 0 || abi.decode(data, (bool))), "Safe Approve");
}
function _safeApproveInf(address token, address to) internal {
if (token == NATIVE) return;
if (IERC20(token).allowance(address(this), to) < LOWER_BOUND_APPROVAL) {
_safeApprove(token, to, 0);
_safeApprove(token, to, type(uint256).max);
}
}
function _wrap_unwrap_ETH(address tokenIn, address tokenOut, uint256 netTokenIn) internal {
if (tokenIn == NATIVE) IWETH(tokenOut).deposit{value: netTokenIn}();
else IWETH(tokenIn).withdraw(netTokenIn);
}
}// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.0;
interface ICUSD {
function mint(address _asset, uint256 _amountIn, uint256 _minAmountOut, address _receiver, uint256 _deadline)
external
returns (uint256 amountOut);
function burn(address _asset, uint256 _amountIn, uint256 _minAmountOut, address _receiver, uint256 _deadline)
external
returns (uint256 amountOut);
function assets() external view returns (address[] memory assetList);
function paused(address _asset) external view returns (bool isPaused);
function getMintAmount(address _asset, uint256 _amountIn) external view returns (uint256 amountOut, uint256 fee);
function getBurnAmount(address _asset, uint256 _amountIn) external view returns (uint256 amountOut, uint256 fee);
}// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.0;
/**
*/
interface IStandardizedYieldAdapter {
/**
* @notice Retrieves the address of the pivot token.
* @return pivotToken The address of the pivot token.
*/
function PIVOT_TOKEN() external view returns (address pivotToken);
/**
* @notice Converts a specified amount of an input token to pivotToken.
* @dev This function should expect the token has already been transferred to the adapter.
* @param tokenIn The address of the input token.
* @param amountTokenIn The amount of the input token to convert.
* @return amountOut The amount of the pivot token.
*/
function convertToDeposit(address tokenIn, uint256 amountTokenIn) external returns (uint256 amountOut);
/**
* @notice Converts pivotToken to the token requested for redemption.
* @dev This function should expect pivotToken has already been transferred to the adapter.
* @param tokenOut The address of the output token.
* @param amountPivotTokenIn The amount of pivot token to convert.
* @return amountOut The amount of the output token out.
*/
function convertToRedeem(address tokenOut, uint256 amountPivotTokenIn) external returns (uint256 amountOut);
/**
* @notice Previews the conversion of a specified amount of an input token to pivotToken.
* @param tokenIn The address of the input token.
* @param amountTokenIn The amount of the input token to convert.
* @return amountOut The estimated amount of the pivot token.
*/
function previewConvertToDeposit(address tokenIn, uint256 amountTokenIn) external view returns (uint256 amountOut);
/**
* @notice Previews the conversion of pivot token to the amount requested for redemption.
* @param tokenOut The address of the output token.
* @param amountPivotTokenIn The amount of pivot token to convert.
* @return amountOut The estimated amount of the output token out.
*/
function previewConvertToRedeem(
address tokenOut,
uint256 amountPivotTokenIn
) external view returns (uint256 amountOut);
/**
* @notice Retrieves the list of tokens supported for deposits by the adapter.
* @return tokens An array of addresses of tokens supported for deposits.
*/
function getAdapterTokensDeposit() external view returns (address[] memory tokens);
/**
* @notice Retrieves the list of tokens supported for redemptions by the adapter.
* @return tokens An array of addresses of tokens supported for redemptions.
*/
function getAdapterTokensRedeem() external view returns (address[] memory tokens);
}// SPDX-License-Identifier: GPL-3.0-or-later
/*
* MIT License
* ===========
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
*/
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
interface IWETH is IERC20 {
event Deposit(address indexed dst, uint256 wad);
event Withdrawal(address indexed src, uint256 wad);
function deposit() external payable;
function withdraw(uint256 wad) external;
}{
"optimizer": {
"enabled": true,
"runs": 1000000
},
"viaIR": true,
"evmVersion": "shanghai",
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[],"name":"PIVOT_TOKEN","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"cUSD","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"tokenIn","type":"address"},{"internalType":"uint256","name":"amountTokenIn","type":"uint256"}],"name":"convertToDeposit","outputs":[{"internalType":"uint256","name":"amountOut","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"tokenOut","type":"address"},{"internalType":"uint256","name":"amountPivotTokenIn","type":"uint256"}],"name":"convertToRedeem","outputs":[{"internalType":"uint256","name":"amountOut","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getAdapterTokensDeposit","outputs":[{"internalType":"address[]","name":"tokens","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getAdapterTokensRedeem","outputs":[{"internalType":"address[]","name":"tokens","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"tokenIn","type":"address"},{"internalType":"uint256","name":"amountTokenIn","type":"uint256"}],"name":"previewConvertToDeposit","outputs":[{"internalType":"uint256","name":"amountOut","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"tokenOut","type":"address"},{"internalType":"uint256","name":"amountPivotTokenIn","type":"uint256"}],"name":"previewConvertToRedeem","outputs":[{"internalType":"uint256","name":"amountOut","type":"uint256"}],"stateMutability":"view","type":"function"}]Contract Creation Code
6080806040523461001657610da1908161001b8239f35b5f80fdfe60806040526004361015610011575f80fd5b5f3560e01c806310a533861461008f5780631fccf672146100715780634e32a1e21461008a57806356e2816e146100855780635c727c7d14610080578063b8f861711461007b578063cad107dd146100765763dfbe7c8214610071575f80fd5b610205565b6106a2565b6105af565b610549565b61036a565b610251565b346101a657602060807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff806101396100c5366101c8565b7f5612798700000000000000000000000000000000000000000000000000000000855273ffffffffffffffffffffffffffffffffffffffff90911660845260a4525f60c4523360e4527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6101045261012490565b01815f73cccc62962d17b8914c62d74ffb843d73b2a3cccc5af180156101a1575f9061016f575b604051908152602090f35b0390f35b5060203d60201161019a575b6101938161018b61016b93610777565b6080016107ff565b9050610160565b503d61017b565b61083e565b5f80fd5b73ffffffffffffffffffffffffffffffffffffffff8116036101a657565b7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc60409101126101a6576004356101fe816101aa565b9060243590565b346101a6575f7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101a657602060405173cccc62962d17b8914c62d74ffb843d73b2a3cccc8152f35b346101a6576102b76040610264366101c8565b82517fb7c4a6bf00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff9092166004830152602482015291829081906044820190565b038173cccc62962d17b8914c62d74ffb843d73b2a3cccc5afa80156101a1576020915f916102e9575b50604051908152f35b61030b915060403d604011610312575b61030381836107be565b810190610849565b505f6102e0565b503d6102f9565b60209060206040818301928281528551809452019301915f5b828110610340575050505090565b835173ffffffffffffffffffffffffffffffffffffffff1685529381019392810192600101610332565b346101a6575f7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101a657604080517f71a9730500000000000000000000000000000000000000000000000000000000815273cccc62962d17b8914c62d74ffb843d73b2a3cccc916004915f818481875afa9081156101a1575f91610527575b506103f881516108fb565b905f805b82518110156105165780610430610416610482938661094a565b5173ffffffffffffffffffffffffffffffffffffffff1690565b8651907f2e48152c000000000000000000000000000000000000000000000000000000008252818060209586938c830191909173ffffffffffffffffffffffffffffffffffffffff6020820193169052565b03818c5afa9081156101a1576001935f926104e9575b5050156104a6575b016103fc565b6104e46104b6610416838761094a565b6104c96104c2866109a3565b958861094a565b9073ffffffffffffffffffffffffffffffffffffffff169052565b6104a0565b6105089250803d1061050f575b61050081836107be565b81019061098b565b5f80610498565b503d6104f6565b8184526040518061016b8682610319565b61054391503d805f833e61053b81836107be565b810190610877565b5f6103ed565b346101a6576102b7604061055c366101c8565b82517f195d0e2800000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff9092166004830152602482015291829081906044820190565b346101a6576105bd366101c8565b6105c6826109fd565b73ffffffffffffffffffffffffffffffffffffffff604051927fa445058700000000000000000000000000000000000000000000000000000000845216600483015260248201525f60448201523360648201527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff608482015260208160a4815f73cccc62962d17b8914c62d74ffb843d73b2a3cccc5af180156101a1576020915f916106755750604051908152f35b6106959150823d841161069b575b61068d81836107be565b81019061082f565b5f6102e0565b503d610683565b346101a6575f7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101a6576040517f71a973050000000000000000000000000000000000000000000000000000000081525f8160048173cccc62962d17b8914c62d74ffb843d73b2a3cccc5afa80156101a15761016b915f91610730575b5060405191829182610319565b61074491503d805f833e61053b81836107be565b5f610723565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09101166080016080811067ffffffffffffffff8211176107b957604052565b61074a565b90601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0910116810190811067ffffffffffffffff8211176107b957604052565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8060209101126101a65760805190565b908160209103126101a6575190565b6040513d5f823e3d90fd5b91908260409103126101a6576020825192015190565b67ffffffffffffffff81116107b95760051b60200190565b60209081818403126101a65780519067ffffffffffffffff82116101a657019180601f840112156101a65782516108ad8161085f565b936108bb60405195866107be565b818552838086019260051b8201019283116101a6578301905b8282106108e2575050505090565b83809183516108f0816101aa565b8152019101906108d4565b906109058261085f565b61091260405191826107be565b8281527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0610940829461085f565b0190602036910137565b805182101561095e5760209160051b010190565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603260045260245ffd5b908160209103126101a6575180151581036101a65790565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff81146109d05760010190565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b73ffffffffffffffffffffffffffffffffffffffff8116908115610bd15760405180927fdd62ed3e00000000000000000000000000000000000000000000000000000000825230600483015273cccc62962d17b8914c62d74ffb843d73b2a3cccc602483015281604460209586935afa80156101a1576b7fffffffffffffffffffffff915f91610bb4575b5010610a92575050565b604051915f808285017f095ea7b300000000000000000000000000000000000000000000000000000000815285610aea60248201905f6020604084019373cccc62962d17b8914c62d74ffb843d73b2a3cccc81520152565b0395610b1c7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0978881018352826107be565b519082865af13d15610ba4573d9167ffffffffffffffff83116107b957610b7094610b6b93610b558360405193601f84011601836107be565b81523d5f8383013e5b82610b72575b5050610bd5565b610c3a565b565b8091925051918215928315610b8c575b5050505f80610b64565b610b9c935082018101910161098b565b5f8080610b82565b610b709350610b6b916060610b5e565b610bcb9150843d861161069b5761068d81836107be565b5f610a88565b5050565b15610bdc57565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f5361666520417070726f766500000000000000000000000000000000000000006044820152fd5b5f8060405192602084017f095ea7b30000000000000000000000000000000000000000000000000000000081528285610cb460248201907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6020604084019373cccc62962d17b8914c62d74ffb843d73b2a3cccc81520152565b0395610ce67fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0978881018352826107be565b51925af13d15610d5f573d9167ffffffffffffffff83116107b957610b7092610d1a602060405193601f84011601836107be565b81523d5f602083013e5b81610d30575b50610bd5565b8051801592508215610d45575b50505f610d2a565b610d58925060208091830101910161098b565b5f80610d3d565b610b7091506060610d2456fea26469706673582212207aea44993b51fe4f61908542a375dabd0024ffff8c97a455333f16a18f225e6a64736f6c63430008180033
Deployed Bytecode
0x60806040526004361015610011575f80fd5b5f3560e01c806310a533861461008f5780631fccf672146100715780634e32a1e21461008a57806356e2816e146100855780635c727c7d14610080578063b8f861711461007b578063cad107dd146100765763dfbe7c8214610071575f80fd5b610205565b6106a2565b6105af565b610549565b61036a565b610251565b346101a657602060807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff806101396100c5366101c8565b7f5612798700000000000000000000000000000000000000000000000000000000855273ffffffffffffffffffffffffffffffffffffffff90911660845260a4525f60c4523360e4527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6101045261012490565b01815f73cccc62962d17b8914c62d74ffb843d73b2a3cccc5af180156101a1575f9061016f575b604051908152602090f35b0390f35b5060203d60201161019a575b6101938161018b61016b93610777565b6080016107ff565b9050610160565b503d61017b565b61083e565b5f80fd5b73ffffffffffffffffffffffffffffffffffffffff8116036101a657565b7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc60409101126101a6576004356101fe816101aa565b9060243590565b346101a6575f7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101a657602060405173cccc62962d17b8914c62d74ffb843d73b2a3cccc8152f35b346101a6576102b76040610264366101c8565b82517fb7c4a6bf00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff9092166004830152602482015291829081906044820190565b038173cccc62962d17b8914c62d74ffb843d73b2a3cccc5afa80156101a1576020915f916102e9575b50604051908152f35b61030b915060403d604011610312575b61030381836107be565b810190610849565b505f6102e0565b503d6102f9565b60209060206040818301928281528551809452019301915f5b828110610340575050505090565b835173ffffffffffffffffffffffffffffffffffffffff1685529381019392810192600101610332565b346101a6575f7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101a657604080517f71a9730500000000000000000000000000000000000000000000000000000000815273cccc62962d17b8914c62d74ffb843d73b2a3cccc916004915f818481875afa9081156101a1575f91610527575b506103f881516108fb565b905f805b82518110156105165780610430610416610482938661094a565b5173ffffffffffffffffffffffffffffffffffffffff1690565b8651907f2e48152c000000000000000000000000000000000000000000000000000000008252818060209586938c830191909173ffffffffffffffffffffffffffffffffffffffff6020820193169052565b03818c5afa9081156101a1576001935f926104e9575b5050156104a6575b016103fc565b6104e46104b6610416838761094a565b6104c96104c2866109a3565b958861094a565b9073ffffffffffffffffffffffffffffffffffffffff169052565b6104a0565b6105089250803d1061050f575b61050081836107be565b81019061098b565b5f80610498565b503d6104f6565b8184526040518061016b8682610319565b61054391503d805f833e61053b81836107be565b810190610877565b5f6103ed565b346101a6576102b7604061055c366101c8565b82517f195d0e2800000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff9092166004830152602482015291829081906044820190565b346101a6576105bd366101c8565b6105c6826109fd565b73ffffffffffffffffffffffffffffffffffffffff604051927fa445058700000000000000000000000000000000000000000000000000000000845216600483015260248201525f60448201523360648201527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff608482015260208160a4815f73cccc62962d17b8914c62d74ffb843d73b2a3cccc5af180156101a1576020915f916106755750604051908152f35b6106959150823d841161069b575b61068d81836107be565b81019061082f565b5f6102e0565b503d610683565b346101a6575f7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101a6576040517f71a973050000000000000000000000000000000000000000000000000000000081525f8160048173cccc62962d17b8914c62d74ffb843d73b2a3cccc5afa80156101a15761016b915f91610730575b5060405191829182610319565b61074491503d805f833e61053b81836107be565b5f610723565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09101166080016080811067ffffffffffffffff8211176107b957604052565b61074a565b90601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0910116810190811067ffffffffffffffff8211176107b957604052565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8060209101126101a65760805190565b908160209103126101a6575190565b6040513d5f823e3d90fd5b91908260409103126101a6576020825192015190565b67ffffffffffffffff81116107b95760051b60200190565b60209081818403126101a65780519067ffffffffffffffff82116101a657019180601f840112156101a65782516108ad8161085f565b936108bb60405195866107be565b818552838086019260051b8201019283116101a6578301905b8282106108e2575050505090565b83809183516108f0816101aa565b8152019101906108d4565b906109058261085f565b61091260405191826107be565b8281527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0610940829461085f565b0190602036910137565b805182101561095e5760209160051b010190565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603260045260245ffd5b908160209103126101a6575180151581036101a65790565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff81146109d05760010190565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b73ffffffffffffffffffffffffffffffffffffffff8116908115610bd15760405180927fdd62ed3e00000000000000000000000000000000000000000000000000000000825230600483015273cccc62962d17b8914c62d74ffb843d73b2a3cccc602483015281604460209586935afa80156101a1576b7fffffffffffffffffffffff915f91610bb4575b5010610a92575050565b604051915f808285017f095ea7b300000000000000000000000000000000000000000000000000000000815285610aea60248201905f6020604084019373cccc62962d17b8914c62d74ffb843d73b2a3cccc81520152565b0395610b1c7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0978881018352826107be565b519082865af13d15610ba4573d9167ffffffffffffffff83116107b957610b7094610b6b93610b558360405193601f84011601836107be565b81523d5f8383013e5b82610b72575b5050610bd5565b610c3a565b565b8091925051918215928315610b8c575b5050505f80610b64565b610b9c935082018101910161098b565b5f8080610b82565b610b709350610b6b916060610b5e565b610bcb9150843d861161069b5761068d81836107be565b5f610a88565b5050565b15610bdc57565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f5361666520417070726f766500000000000000000000000000000000000000006044820152fd5b5f8060405192602084017f095ea7b30000000000000000000000000000000000000000000000000000000081528285610cb460248201907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6020604084019373cccc62962d17b8914c62d74ffb843d73b2a3cccc81520152565b0395610ce67fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0978881018352826107be565b51925af13d15610d5f573d9167ffffffffffffffff83116107b957610b7092610d1a602060405193601f84011601836107be565b81523d5f602083013e5b81610d30575b50610bd5565b8051801592508215610d45575b50505f610d2a565b610d58925060208091830101910161098b565b5f80610d3d565b610b7091506060610d2456fea26469706673582212207aea44993b51fe4f61908542a375dabd0024ffff8c97a455333f16a18f225e6a64736f6c63430008180033
Loading...
Loading
Loading...
Loading
Net Worth in USD
$0.00
Net Worth in ETH
0
Multichain Portfolio | 33 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|
Loading...
Loading
Loading...
Loading
Loading...
Loading
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.