Address Contract Partially Verified
Address
0x511DF2a79e33560bC23f070C3098373F6Ac27e20
Balance
0 ETH
Nonce
1
Code Size
4029 bytes
Creator
0xE9547CF7...D29B at tx 0x6aa740c5...61a7ae
Indexed Transactions
0
Contract Bytecode
4029 bytes
0x608060405234801561001057600080fd5b50600436106100b45760003560e01c806394b918de1161007157806394b918de14610153578063b209f4d614610166578063b77ae67d14610179578063ca4b208b146101a7578063e78cfd3e146101ba578063f851a440146101e157600080fd5b80630e18b681146100b957806326782247146100c357806347bce7f5146100f35780634dd18bf51461011a5780635d36d1821461012d5780636fd00e5514610140575b600080fd5b6100c16101f4565b005b6001546100d6906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b6100d67f00000000000000000000000092cfbec26c206c90aee3b7c66a9ae673754fab7e81565b6100c1610128366004610e9b565b6102fd565b6100c161013b366004610eb8565b61035f565b6100c161014e366004610eb8565b61045d565b6100c1610161366004610ee4565b610523565b6100c1610174366004610eb8565b610943565b610199610187366004610e9b565b60046020526000908152604090205481565b6040519081526020016100ea565b6002546100d6906001600160a01b031681565b6100d67f0000000000000000000000001b6e9c73bee68102d9dd4a2627f97bff4183ab0a81565b6000546100d6906001600160a01b031681565b6001546001600160a01b031633146102475760405162461bcd60e51b815260206004820152601160248201527027b7363c903832b73234b733a0b236b4b760791b60448201526064015b60405180910390fd5b60008054600180546001600160a01b038082166001600160a01b031980861682179096559490911690915560408051919092168082526020820184905292917ff9ffabca9c8276e99321725bcb43fb076a6c66a54b7f21c4e8146d8519b417dc910160405180910390a1600154604080516001600160a01b03808516825290921660208301527fca4f2f25d0898edd99413412fb94012f9e54ec8142f9b093e7720646a95b16a991015b60405180910390a15050565b6103056109c7565b600180546001600160a01b038381166001600160a01b031983168117909355604080519190921680825260208201939093527fca4f2f25d0898edd99413412fb94012f9e54ec8142f9b093e7720646a95b16a991016102f1565b6103676109c7565b6040516370a0823160e01b815230600482015281907f0000000000000000000000001b6e9c73bee68102d9dd4a2627f97bff4183ab0a6001600160a01b0316906370a0823190602401602060405180830381865afa1580156103cd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103f19190610efd565b10156104245760405162461bcd60e51b81526020600482015260026024820152614e4560f01b604482015260640161023e565b6104586001600160a01b037f0000000000000000000000001b6e9c73bee68102d9dd4a2627f97bff4183ab0a168383610a1a565b505050565b6104656109c7565b6001600160a01b038216600090815260046020526040902054808211156104b75760405162461bcd60e51b8152602060048201526006602482015265115e18d9595960d21b604482015260640161023e565b6104c18282610f2c565b6001600160a01b038416600081815260046020908152604091829020849055815192835282018490528101919091527f5b3c1b833e8dec71e8a6577bb8d8796e41d451f271a35c8abba0eb2c20f79e3b906060015b60405180910390a1505050565b61052b610c20565b6002600355336000908152600460205260409020548111156105785760405162461bcd60e51b8152602060048201526006602482015265115e18d9595960d21b604482015260640161023e565b6040516370a0823160e01b81523060048201526000907f0000000000000000000000001b6e9c73bee68102d9dd4a2627f97bff4183ab0a6001600160a01b0316906370a0823190602401602060405180830381865afa1580156105df573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106039190610efd565b90508181101561063a5760405162461bcd60e51b81526020600482015260026024820152614e4560f01b604482015260640161023e565b33600090815260046020526040902054610655908390610f2c565b3360009081526004602081905260408083209390935591516370a0823160e01b81523092810192909252906001600160a01b037f00000000000000000000000092cfbec26c206c90aee3b7c66a9ae673754fab7e16906370a0823190602401602060405180830381865afa1580156106d1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106f59190610efd565b905061072c6001600160a01b037f00000000000000000000000092cfbec26c206c90aee3b7c66a9ae673754fab7e16333086610c72565b506040516370a0823160e01b81523060048201526000907f00000000000000000000000092cfbec26c206c90aee3b7c66a9ae673754fab7e6001600160a01b0316906370a0823190602401602060405180830381865afa158015610794573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107b89190610efd565b9050836107c58383610f2c565b146107fb5760405162461bcd60e51b815260040161023e90602080825260049082015263434b503160e01b604082015260600190565b61082f6001600160a01b037f0000000000000000000000001b6e9c73bee68102d9dd4a2627f97bff4183ab0a163386610a1a565b506040516370a0823160e01b81523060048201526000907f0000000000000000000000001b6e9c73bee68102d9dd4a2627f97bff4183ab0a6001600160a01b0316906370a0823190602401602060405180830381865afa158015610897573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108bb9190610efd565b9050846108c88286610f2c565b146108fe5760405162461bcd60e51b815260040161023e9060208082526004908201526321a5a81960e11b604082015260600190565b60408051338152602081018790527fcdee897399ab5e465acb1bd3ed5e32c695f196321764546c59720fa6c9ce4c69910160405180910390a150506001600355505050565b61094b6109c7565b6001600160a01b03821660009081526004602052604090205461096e8282610f45565b6001600160a01b038416600081815260046020908152604091829020849055815192835282018490528101919091527f8b05844824acf2db2f068e4006ef99b307ca4fe1a896d06e884700f1a9da3a6d90606001610516565b6000546001600160a01b03163314610a185760405162461bcd60e51b815260206004820152601460248201527331b0b63632b91036bab9ba1031329030b236b4b760611b604482015260640161023e565b565b60008115610c19576040516370a0823160e01b81526001600160a01b03848116600483015260009182918716906370a0823190602401602060405180830381865afa158015610a6d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a919190610efd565b604080516001600160a01b038881166024830152604480830189905283518084039091018152606490920183526020820180516001600160e01b031663a9059cbb60e01b179052915192935090881691610aeb9190610f58565b6000604051808303816000865af19150503d8060008114610b28576040519150601f19603f3d011682016040523d82523d6000602084013e610b2d565b606091505b50508092505081610b655760405162461bcd60e51b81526020600482015260026024820152612a2360f11b604482015260640161023e565b6040516370a0823160e01b81526001600160a01b038681166004830152600091908816906370a0823190602401602060405180830381865afa158015610baf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bd39190610efd565b9050818111610c095760405162461bcd60e51b81526020600482015260026024820152612a2360f11b604482015260640161023e565b610c138282610f2c565b93505050505b9392505050565b600260035403610a185760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161023e565b60008115610e7b576040516370a0823160e01b81526001600160a01b03848116600483015260009182918816906370a0823190602401602060405180830381865afa158015610cc5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ce99190610efd565b604080516001600160a01b0389811660248301528881166044830152606480830189905283518084039091018152608490920183526020820180516001600160e01b03166323b872dd60e01b179052915192935090891691610d4b9190610f58565b6000604051808303816000865af19150503d8060008114610d88576040519150601f19603f3d011682016040523d82523d6000602084013e610d8d565b606091505b50508092505081610dc65760405162461bcd60e51b81526020600482015260036024820152622a232360e91b604482015260640161023e565b6040516370a0823160e01b81526001600160a01b038681166004830152600091908916906370a0823190602401602060405180830381865afa158015610e10573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e349190610efd565b9050818111610e6b5760405162461bcd60e51b81526020600482015260036024820152622a232360e91b604482015260640161023e565b610e758282610f2c565b93505050505b949350505050565b6001600160a01b0381168114610e9857600080fd5b50565b600060208284031215610ead57600080fd5b8135610c1981610e83565b60008060408385031215610ecb57600080fd5b8235610ed681610e83565b946020939093013593505050565b600060208284031215610ef657600080fd5b5035919050565b600060208284031215610f0f57600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b81810381811115610f3f57610f3f610f16565b92915050565b80820180821115610f3f57610f3f610f16565b6000825160005b81811015610f795760208186018101518583015201610f5f565b50600092019182525091905056fea2646970667358221220d70ac71d06fdbd1b0818156db8261be7a283e42ab57770af22bfad97a7f319f364736f6c63430008110033
Verified Source Code Partial Match
Compiler: v0.8.17+commit.8df45f5f
EVM: london
Optimization: Yes (200 runs)
OLEV2LockerSwap.sol 69 lines
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.17;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "./common/Adminable.sol";
import "./common/ReentrancyGuard.sol";
import "./libraries/TransferHelper.sol";
contract OLEV2LockerSwap is Adminable, ReentrancyGuard {
using TransferHelper for IERC20;
IERC20 public immutable oleV1;
IERC20 public immutable oleV2;
mapping(address => uint256) public swapLimits;
event Swapped (address account, uint256 amount);
event Increased (address account, uint256 beforeLimit, uint256 afterLimit);
event Reduced (address account, uint256 beforeLimit, uint256 afterLimit);
constructor (address payable _admin, IERC20 _oleV1, IERC20 _oleV2, address[] memory _accounts, uint256[] memory _swapLimits){
require(_admin != address(0), "_admin address cannot be 0");
admin = _admin;
oleV1 = _oleV1;
oleV2 = _oleV2;
uint256 investorsLength = _accounts.length;
require(investorsLength == _swapLimits.length, "Array length must be same");
for (uint256 i = 0; i < investorsLength; i++) {
swapLimits[_accounts[i]] = _swapLimits[i];
}
}
function swap(uint256 _amount) external nonReentrant(){
require(_amount <= swapLimits[msg.sender], "Exceed");
uint256 oleV2BalanceBefore = oleV2.balanceOf(address(this));
require(oleV2BalanceBefore >= _amount, 'NE');
swapLimits[msg.sender] = swapLimits[msg.sender] - _amount;
uint256 oleV1BalanceBefore = oleV1.balanceOf(address(this));
oleV1.safeTransferFrom(msg.sender, address(this), _amount);
uint256 oleV1BalanceAfter = oleV1.balanceOf(address(this));
require(oleV1BalanceAfter - oleV1BalanceBefore == _amount, "CKP1");
oleV2.safeTransfer(msg.sender, _amount);
uint256 oleV2BalanceAfter = oleV2.balanceOf(address(this));
require(oleV2BalanceBefore - oleV2BalanceAfter == _amount, "CKP2");
emit Swapped(msg.sender, _amount);
}
function recycle(address _account, uint256 _amount) external onlyAdmin {
require(oleV2.balanceOf(address(this)) >= _amount, "NE");
oleV2.safeTransfer(_account, _amount);
}
function increaseSwapLimit(address _account, uint256 _increaseAmount) external onlyAdmin {
uint _before = swapLimits[_account];
swapLimits[_account] = _before + _increaseAmount;
emit Increased(_account, _before, swapLimits[_account]);
}
function reduceSwapLimit(address _account, uint256 _reduceAmount) external onlyAdmin {
uint _before = swapLimits[_account];
require(_reduceAmount <= _before, "Exceed");
swapLimits[_account] = _before - _reduceAmount;
emit Reduced(_account, _before, swapLimits[_account]);
}
}
Adminable.sol 52 lines
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.17;
abstract contract Adminable {
address payable public admin;
address payable public pendingAdmin;
address payable public developer;
event NewPendingAdmin(address oldPendingAdmin, address newPendingAdmin);
event NewAdmin(address oldAdmin, address newAdmin);
constructor() {
developer = payable(msg.sender);
}
modifier onlyAdmin() {
checkAdmin();
_;
}
modifier onlyAdminOrDeveloper() {
require(msg.sender == admin || msg.sender == developer, "Only admin or dev");
_;
}
function setPendingAdmin(address payable newPendingAdmin) external virtual onlyAdmin {
// Save current value, if any, for inclusion in log
address oldPendingAdmin = pendingAdmin;
// Store pendingAdmin with value newPendingAdmin
pendingAdmin = newPendingAdmin;
// Emit NewPendingAdmin(oldPendingAdmin, newPendingAdmin)
emit NewPendingAdmin(oldPendingAdmin, newPendingAdmin);
}
function acceptAdmin() external virtual {
require(msg.sender == pendingAdmin, "Only pendingAdmin");
// Save current values for inclusion in log
address oldAdmin = admin;
address oldPendingAdmin = pendingAdmin;
// Store admin with value pendingAdmin
admin = pendingAdmin;
// Clear the pending value
pendingAdmin = payable(0);
emit NewAdmin(oldAdmin, admin);
emit NewPendingAdmin(oldPendingAdmin, pendingAdmin);
}
function checkAdmin() private view {
require(msg.sender == admin, "caller must be admin");
}
}
ReentrancyGuard.sol 27 lines
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.17;
contract ReentrancyGuard {
uint256 private constant _NOT_ENTERED = 1;
uint256 private constant _ENTERED = 2;
uint256 private _status;
constructor() {
_status = _NOT_ENTERED;
}
modifier nonReentrant() {
check();
_status = _ENTERED;
_;
_status = _NOT_ENTERED;
}
function check() private view {
require(_status != _ENTERED, "ReentrancyGuard: reentrant call");
}
}
TransferHelper.sol 61 lines
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.17;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
/**
* @title TransferHelper
* @dev Wrappers around ERC20 operations that returns the value received by recipent and the actual allowance of approval.
* To use this library you can add a `using TransferHelper for IERC20;` statement to your contract,
* which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
*/
library TransferHelper {
function safeTransfer(
IERC20 _token,
address _to,
uint256 _amount
) internal returns (uint256 amountReceived) {
if (_amount > 0) {
bool success;
uint256 balanceBefore = _token.balanceOf(_to);
(success, ) = address(_token).call(abi.encodeWithSelector(_token.transfer.selector, _to, _amount));
require(success, "TF");
uint256 balanceAfter = _token.balanceOf(_to);
require(balanceAfter > balanceBefore, "TF");
amountReceived = balanceAfter - balanceBefore;
}
}
function safeTransferFrom(
IERC20 _token,
address _from,
address _to,
uint256 _amount
) internal returns (uint256 amountReceived) {
if (_amount > 0) {
bool success;
uint256 balanceBefore = _token.balanceOf(_to);
(success, ) = address(_token).call(abi.encodeWithSelector(_token.transferFrom.selector, _from, _to, _amount));
require(success, "TFF");
uint256 balanceAfter = _token.balanceOf(_to);
require(balanceAfter > balanceBefore, "TFF");
amountReceived = balanceAfter - balanceBefore;
}
}
function safeApprove(
IERC20 _token,
address _spender,
uint256 _amount
) internal returns (uint256) {
bool success;
if (_token.allowance(address(this), _spender) != 0) {
(success, ) = address(_token).call(abi.encodeWithSelector(_token.approve.selector, _spender, 0));
require(success, "AF");
}
(success, ) = address(_token).call(abi.encodeWithSelector(_token.approve.selector, _spender, _amount));
require(success, "AF");
return _token.allowance(address(this), _spender);
}
}
IERC20.sol 78 lines
// 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);
}
Read Contract
admin 0xf851a440 → address
developer 0xca4b208b → address
oleV1 0x47bce7f5 → address
oleV2 0xe78cfd3e → address
pendingAdmin 0x26782247 → address
swapLimits 0xb77ae67d → uint256
Write Contract 6 functions
These functions modify contract state and require a wallet transaction to execute.
acceptAdmin 0x0e18b681
No parameters
increaseSwapLimit 0xb209f4d6
address _account
uint256 _increaseAmount
recycle 0x5d36d182
address _account
uint256 _amount
reduceSwapLimit 0x6fd00e55
address _account
uint256 _reduceAmount
setPendingAdmin 0x4dd18bf5
address newPendingAdmin
swap 0x94b918de
uint256 _amount
Recent Transactions
No transactions found for this address