Address Contract Verified
Address
0x81DF863E89429B0d4230a2A922DE4f37f718EED3
Balance
0 ETH
Nonce
1
Code Size
7532 bytes
Creator
0x5AC840Fb...7dcd at tx 0x1a1fab50...8b024d
Indexed Transactions
0
Contract Bytecode
7532 bytes
0x6080604052600436106100bc5760003560e01c80634441532d11610074578063ad5c46481161004e578063ad5c46481461022f578063c4cb344d14610263578063f821902d1461028357600080fd5b80634441532d146101a75780634f064086146101db5780635b34b2671461020f57600080fd5b80631b44a220116100a55780631b44a220146101405780631cef99b014610160578063414e3a871461019457600080fd5b806310a42944146100c15780631a73dbb5146100e3575b600080fd5b3480156100cd57600080fd5b506100e16100dc366004611953565b6102b7565b005b3480156100ef57600080fd5b506101177f000000000000000000000000593f39a4ba26a9c8ed2128ac95d109e8e403c48581565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b34801561014c57600080fd5b5061011761015b3660046119e6565b610873565b34801561016c57600080fd5b506101177f000000000000000000000000716fbc68e0c761684d9280484243ff094cc5ffab81565b6100e16101a2366004611907565b6108aa565b3480156101b357600080fd5b506101177f000000000000000000000000c8dc2ec5f5e02be8b37a8444a1931f02374a17ab81565b3480156101e757600080fd5b506101177f000000000000000000000000cb0e14e96f2cefa8550ad8e4aea344f211e5061d81565b34801561021b57600080fd5b506100e161022a3660046118c5565b610caa565b34801561023b57600080fd5b506101177f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc281565b34801561026f57600080fd5b506100e161027e3660046119ff565b610fcf565b34801561028f57600080fd5b506101177f000000000000000000000000cafe001067cdef266afb7eb5a286dcfd277f3de581565b6102c18484611424565b6040517f23b872dd000000000000000000000000000000000000000000000000000000008152336004820152306024820152604481018390527f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc273ffffffffffffffffffffffffffffffffffffffff16906323b872dd90606401602060405180830381600087803b15801561035557600080fd5b505af1158015610369573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061038d91906119a4565b506040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201526000907f000000000000000000000000cafe001067cdef266afb7eb5a286dcfd277f3de573ffffffffffffffffffffffffffffffffffffffff16906370a082319060240160206040518083038186803b15801561041657600080fd5b505afa15801561042a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061044e91906119cd565b6040517f095ea7b300000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000593f39a4ba26a9c8ed2128ac95d109e8e403c48581166004830152602482018390529192507f000000000000000000000000cafe001067cdef266afb7eb5a286dcfd277f3de59091169063095ea7b390604401602060405180830381600087803b15801561050357600080fd5b505af1158015610517573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061053b91906119a4565b506040517f095ea7b300000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000593f39a4ba26a9c8ed2128ac95d109e8e403c48581166004830152602482018590527f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2169063095ea7b390604401602060405180830381600087803b1580156105ec57600080fd5b505af1158015610600573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061062491906119a4565b506040517f1ad66ed800000000000000000000000000000000000000000000000000000000815260048101829052602481018490526044810183905260806064820152600060848201527f000000000000000000000000593f39a4ba26a9c8ed2128ac95d109e8e403c48573ffffffffffffffffffffffffffffffffffffffff1690631ad66ed89060a401600060405180830381600087803b1580156106c957600080fd5b505af11580156106dd573d6000803e3d6000fd5b50506040517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152600092507f000000000000000000000000593f39a4ba26a9c8ed2128ac95d109e8e403c48573ffffffffffffffffffffffffffffffffffffffff1691506370a082319060240160206040518083038186803b15801561076957600080fd5b505afa15801561077d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107a191906119cd565b6040517fa9059cbb000000000000000000000000000000000000000000000000000000008152336004820152602481018290529091507f000000000000000000000000593f39a4ba26a9c8ed2128ac95d109e8e403c48573ffffffffffffffffffffffffffffffffffffffff169063a9059cbb90604401602060405180830381600087803b15801561083257600080fd5b505af1158015610846573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061086a91906119a4565b50505050505050565b6000818154811061088357600080fd5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff16905081565b6108b48383611424565b6040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201526000907f000000000000000000000000cafe001067cdef266afb7eb5a286dcfd277f3de573ffffffffffffffffffffffffffffffffffffffff16906370a082319060240160206040518083038186803b15801561093c57600080fd5b505afa158015610950573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061097491906119cd565b6040517f095ea7b300000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000593f39a4ba26a9c8ed2128ac95d109e8e403c48581166004830152602482018390529192507f000000000000000000000000cafe001067cdef266afb7eb5a286dcfd277f3de59091169063095ea7b390604401602060405180830381600087803b158015610a2957600080fd5b505af1158015610a3d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a6191906119a4565b506040517f18818ccd000000000000000000000000000000000000000000000000000000008152600481018290526024810183905260606044820152600060648201527f000000000000000000000000593f39a4ba26a9c8ed2128ac95d109e8e403c48573ffffffffffffffffffffffffffffffffffffffff16906318818ccd9034906084016000604051808303818588803b158015610b0057600080fd5b505af1158015610b14573d6000803e3d6000fd5b50506040517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152600093507f000000000000000000000000593f39a4ba26a9c8ed2128ac95d109e8e403c48573ffffffffffffffffffffffffffffffffffffffff1692506370a08231915060240160206040518083038186803b158015610ba157600080fd5b505afa158015610bb5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bd991906119cd565b6040517fa9059cbb000000000000000000000000000000000000000000000000000000008152336004820152602481018290529091507f000000000000000000000000593f39a4ba26a9c8ed2128ac95d109e8e403c48573ffffffffffffffffffffffffffffffffffffffff169063a9059cbb90604401602060405180830381600087803b158015610c6a57600080fd5b505af1158015610c7e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ca291906119a4565b505050505050565b610cb48282611424565b6040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201526000907f000000000000000000000000cafe001067cdef266afb7eb5a286dcfd277f3de573ffffffffffffffffffffffffffffffffffffffff16906370a082319060240160206040518083038186803b158015610d3c57600080fd5b505afa158015610d50573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d7491906119cd565b6040517f095ea7b300000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000716fbc68e0c761684d9280484243ff094cc5ffab81166004830152602482018390529192507f000000000000000000000000cafe001067cdef266afb7eb5a286dcfd277f3de59091169063095ea7b390604401602060405180830381600087803b158015610e2957600080fd5b505af1158015610e3d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e6191906119a4565b506040517fb6b55f25000000000000000000000000000000000000000000000000000000008152600481018290527f000000000000000000000000716fbc68e0c761684d9280484243ff094cc5ffab73ffffffffffffffffffffffffffffffffffffffff169063b6b55f2590602401600060405180830381600087803b158015610eea57600080fd5b505af1158015610efe573d6000803e3d6000fd5b50506040517fa9059cbb000000000000000000000000000000000000000000000000000000008152336004820152602481018490527f000000000000000000000000716fbc68e0c761684d9280484243ff094cc5ffab73ffffffffffffffffffffffffffffffffffffffff16925063a9059cbb91506044015b602060405180830381600087803b158015610f9157600080fd5b505af1158015610fa5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fc991906119a4565b50505050565b61102f7f000000000000000000000000c8dc2ec5f5e02be8b37a8444a1931f02374a17ab83838080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061178392505050565b6040517f23b872dd000000000000000000000000000000000000000000000000000000008152336004820152306024820152604481018490527f000000000000000000000000c8dc2ec5f5e02be8b37a8444a1931f02374a17ab73ffffffffffffffffffffffffffffffffffffffff16906323b872dd90606401602060405180830381600087803b1580156110c357600080fd5b505af11580156110d7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110fb91906119a4565b507f000000000000000000000000c8dc2ec5f5e02be8b37a8444a1931f02374a17ab73ffffffffffffffffffffffffffffffffffffffff1663787a08a66040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561116457600080fd5b505af1158015611178573d6000803e3d6000fd5b50506040517f1e9a6950000000000000000000000000000000000000000000000000000000008152306004820152602481018690527f000000000000000000000000c8dc2ec5f5e02be8b37a8444a1931f02374a17ab73ffffffffffffffffffffffffffffffffffffffff169250631e9a69509150604401600060405180830381600087803b15801561120a57600080fd5b505af115801561121e573d6000803e3d6000fd5b50506040517f095ea7b300000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000593f39a4ba26a9c8ed2128ac95d109e8e403c48581166004830152602482018790527f000000000000000000000000cb0e14e96f2cefa8550ad8e4aea344f211e5061d16925063095ea7b39150604401602060405180830381600087803b1580156112d257600080fd5b505af11580156112e6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061130a91906119a4565b506040517fb6b55f25000000000000000000000000000000000000000000000000000000008152600481018490527f000000000000000000000000593f39a4ba26a9c8ed2128ac95d109e8e403c48573ffffffffffffffffffffffffffffffffffffffff169063b6b55f2590602401600060405180830381600087803b15801561139357600080fd5b505af11580156113a7573d6000803e3d6000fd5b50506040517fa9059cbb000000000000000000000000000000000000000000000000000000008152336004820152602481018690527f000000000000000000000000593f39a4ba26a9c8ed2128ac95d109e8e403c48573ffffffffffffffffffffffffffffffffffffffff16925063a9059cbb9150604401610f77565b60005b60ff811682111561177e57600083838360ff1681811061144957611449611cd8565b905060200281019061145b9190611afe565b61146490611bb4565b600054815191925060ff909116106114b45780516040517fa2b48bce00000000000000000000000000000000000000000000000000000000815260ff909116600482015260240160405180910390fd5b600080826000015160ff16815481106114cf576114cf611cd8565b600091825260209091200154604083015173ffffffffffffffffffffffffffffffffffffffff9091169150611505908290611783565b60208201516040517f23b872dd000000000000000000000000000000000000000000000000000000008152336004820152306024820152604481019190915273ffffffffffffffffffffffffffffffffffffffff8216906323b872dd90606401602060405180830381600087803b15801561157f57600080fd5b505af1158015611593573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115b791906119a4565b506040517f138504c400000000000000000000000000000000000000000000000000000000815230600482015260009073ffffffffffffffffffffffffffffffffffffffff83169063138504c490602401602060405180830381600087803b15801561162257600080fd5b505af1158015611636573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061165a91906119cd565b60208401516040517f67dfd4c900000000000000000000000000000000000000000000000000000000815291925073ffffffffffffffffffffffffffffffffffffffff8416916367dfd4c9916116b69160040190815260200190565b600060405180830381600087803b1580156116d057600080fd5b505af11580156116e4573d6000803e3d6000fd5b50506040517f7e62eab80000000000000000000000000000000000000000000000000000000081526004810184905273ffffffffffffffffffffffffffffffffffffffff85169250637e62eab89150602401600060405180830381600087803b15801561175057600080fd5b505af1158015611764573d6000803e3d6000fd5b50505050505050808061177690611c91565b915050611427565b505050565b805160e014156118755760008273ffffffffffffffffffffffffffffffffffffffff1663d505accf60e01b836040516020016117c0929190611ab6565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0818403018152908290526117f891611af2565b6000604051808303816000865af19150503d8060008114611835576040519150601f19603f3d011682016040523d82523d6000602084013e61183a565b606091505b505090508061177e576040517fb78cb0dd00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5050565b60008083601f84011261188b57600080fd5b50813567ffffffffffffffff8111156118a357600080fd5b6020830191508360208260051b85010111156118be57600080fd5b9250929050565b600080602083850312156118d857600080fd5b823567ffffffffffffffff8111156118ef57600080fd5b6118fb85828601611879565b90969095509350505050565b60008060006040848603121561191c57600080fd5b833567ffffffffffffffff81111561193357600080fd5b61193f86828701611879565b909790965060209590950135949350505050565b6000806000806060858703121561196957600080fd5b843567ffffffffffffffff81111561198057600080fd5b61198c87828801611879565b90989097506020870135966040013595509350505050565b6000602082840312156119b657600080fd5b815180151581146119c657600080fd5b9392505050565b6000602082840312156119df57600080fd5b5051919050565b6000602082840312156119f857600080fd5b5035919050565b600080600060408486031215611a1457600080fd5b83359250602084013567ffffffffffffffff80821115611a3357600080fd5b818601915086601f830112611a4757600080fd5b813581811115611a5657600080fd5b876020828501011115611a6857600080fd5b6020830194508093505050509250925092565b6000815160005b81811015611a9c5760208185018101518683015201611a82565b81811115611aab576000828601525b509290920192915050565b7fffffffff00000000000000000000000000000000000000000000000000000000831681526000611aea6004830184611a7b565b949350505050565b60006119c68284611a7b565b600082357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa1833603018112611b3257600080fd5b9190910192915050565b6040516060810167ffffffffffffffff81118282101715611b5f57611b5f611d07565b60405290565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff81118282101715611bac57611bac611d07565b604052919050565b600060608236031215611bc657600080fd5b611bce611b3c565b823560ff81168114611bdf57600080fd5b815260208381013581830152604084013567ffffffffffffffff80821115611c0657600080fd5b9085019036601f830112611c1957600080fd5b813581811115611c2b57611c2b611d07565b611c5b847fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f84011601611b65565b91508082523684828501011115611c7157600080fd5b808484018584013760009082019093019290925250604082015292915050565b600060ff821660ff811415611ccf577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60010192915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fdfea264697066735822122027cf5a36cdcfda97706bdb5206fa949c45ec0ec0aad427d608c29279d9c100e364736f6c63430008060033
Verified Source Code Full Match
Compiler: v0.8.6+commit.11564f7e
EVM: berlin
Optimization: Yes (100000 runs)
IERC20.sol 82 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.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);
}
draft-IERC20Permit.sol 60 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-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);
}
PSPStakingMigratorV1.sol 152 lines
pragma solidity 0.8.6;
import "openzeppelin-solidity/contracts/token/ERC20/IERC20.sol";
import "openzeppelin-solidity/contracts/token/ERC20/extensions/draft-IERC20Permit.sol";
import "./utils/Utils.sol";
error IndexOutOfRange(uint8 index);
interface I_sPSP is IERC20 {
function leave(uint256 _stakedAmount) external;
function withdraw(int256 id) external;
function userVsNextID(address owner) external returns (int256);
}
interface I_stkPSPBpt is IERC20 {
function redeem(address to, uint256 amount) external;
function cooldown() external;
}
interface I_sePSP is IERC20 {
function deposit(uint256 amount) external;
}
interface I_sePSP2 is I_sePSP {
function depositPSPAndEth(
uint256 pspAmount,
uint256 minBptOut,
bytes memory pspPermit
) external payable;
function depositPSPAndWeth(
uint256 pspAmount,
uint256 wethAmount,
uint256 minBptOut,
bytes memory pspPermit
) external;
}
contract PSPStakingMigratorV1 {
IERC20 public immutable PSP;
IERC20 public immutable WETH;
I_sePSP public immutable sePSP;
I_sePSP2 public immutable sePSP2;
I_stkPSPBpt public immutable stkPSPBpt;
IERC20 public immutable BPT;
I_sPSP[] public SPSPs;
struct RequestSPSP {
uint8 index;
uint256 amount;
bytes permitData;
}
constructor(
IERC20 _PSP,
IERC20 _WETH,
IERC20 _bpt,
I_sePSP _sePSP,
I_sePSP2 _sePSP2,
I_stkPSPBpt _stkPSPBpt,
I_sPSP[] memory _SPSPs
) {
PSP = _PSP;
WETH = _WETH;
BPT = _bpt;
sePSP = _sePSP;
sePSP2 = _sePSP2;
stkPSPBpt = _stkPSPBpt;
SPSPs = _SPSPs;
}
function depositSPSPsForSePSP(RequestSPSP[] calldata reqs) external {
_unstakeSPSPsAndGetPSP(reqs);
uint256 pspBalance = PSP.balanceOf(address(this));
PSP.approve(address(sePSP), pspBalance);
sePSP.deposit(pspBalance);
sePSP.transfer(msg.sender, pspBalance); // 1:1 between sePSP and PSP
}
function depositStkPSPBptForSePSP2(uint256 bptAmount, bytes calldata stkPSPBptPermit) external {
Utils.permit(stkPSPBpt, stkPSPBptPermit);
stkPSPBpt.transferFrom(msg.sender, address(this), bptAmount);
stkPSPBpt.cooldown();
stkPSPBpt.redeem(address(this), bptAmount);
BPT.approve(address(sePSP2), bptAmount);
sePSP2.deposit(bptAmount);
sePSP2.transfer(msg.sender, bptAmount); // 1:1 between stkPSPBpt, BPT and sePSP2
}
function depositSPSPsAndETHForSePSP2(RequestSPSP[] calldata reqs, uint256 minBptOut) external payable {
_unstakeSPSPsAndGetPSP(reqs);
uint256 pspAmount = PSP.balanceOf(address(this));
PSP.approve(address(sePSP2), pspAmount);
sePSP2.depositPSPAndEth{ value: msg.value }(pspAmount, minBptOut, "");
uint256 sePSP2Balance = sePSP2.balanceOf(address(this));
sePSP2.transfer(msg.sender, sePSP2Balance);
}
function depositSPSPsAndWETHForSePSP2(
RequestSPSP[] calldata reqs,
uint256 wethAmount,
uint256 minBptOut
) external {
_unstakeSPSPsAndGetPSP(reqs);
WETH.transferFrom(msg.sender, address(this), wethAmount);
uint256 pspAmount = PSP.balanceOf(address(this));
PSP.approve(address(sePSP2), pspAmount);
WETH.approve(address(sePSP2), wethAmount);
sePSP2.depositPSPAndWeth(pspAmount, wethAmount, minBptOut, "");
uint256 sePSP2Balance = sePSP2.balanceOf(address(this));
sePSP2.transfer(msg.sender, sePSP2Balance);
}
function _unstakeSPSPsAndGetPSP(RequestSPSP[] calldata reqs) internal {
for (uint8 i; i < reqs.length; i++) {
RequestSPSP memory req = reqs[i];
if (req.index >= SPSPs.length) {
revert IndexOutOfRange(req.index);
}
I_sPSP sPSP = SPSPs[req.index];
Utils.permit(sPSP, req.permitData);
sPSP.transferFrom(msg.sender, address(this), req.amount);
int256 id = sPSP.userVsNextID(address(this));
sPSP.leave(req.amount);
sPSP.withdraw(id);
}
}
}
Utils.sol 27 lines
pragma solidity 0.8.6;
import "openzeppelin-solidity/contracts/token/ERC20/IERC20.sol";
import "openzeppelin-solidity/contracts/token/ERC20/extensions/draft-IERC20Permit.sol";
error PermitFailed();
error TransferEthFailed();
library Utils {
function permit(IERC20 token, bytes memory permit) internal {
if (permit.length == 32 * 7) {
(bool success, ) = address(token).call(abi.encodePacked(IERC20Permit.permit.selector, permit));
if (!success) {
revert PermitFailed();
}
}
}
function transferETH(address payable destination, uint256 amount) internal {
if (amount > 0) {
(bool result, ) = destination.call{ value: amount }("");
if (!result) {
revert TransferEthFailed();
}
}
}
}
Read Contract
BPT 0x4f064086 → address
PSP 0xf821902d → address
SPSPs 0x1b44a220 → address
WETH 0xad5c4648 → address
sePSP 0x1cef99b0 → address
sePSP2 0x1a73dbb5 → address
stkPSPBpt 0x4441532d → address
Write Contract 4 functions
These functions modify contract state and require a wallet transaction to execute.
depositSPSPsAndETHForSePSP2 0x17d6a63e
tuple[] reqs
uint256 minBptOut
depositSPSPsAndWETHForSePSP2 0xbda8c12f
tuple[] reqs
uint256 wethAmount
uint256 minBptOut
depositSPSPsForSePSP 0x94cf7000
tuple[] reqs
depositStkPSPBptForSePSP2 0xc4cb344d
uint256 bptAmount
bytes stkPSPBptPermit
Recent Transactions
No transactions found for this address