Latest 25 from a total of 164,618 transactions
| Transaction Hash |
|
Block
|
From
|
To
|
|||||
|---|---|---|---|---|---|---|---|---|---|
| Withdraw | 29813973 | 9 days ago | IN | 0 ETH | 0.00000011 | ||||
| Withdraw | 29698582 | 12 days ago | IN | 0 ETH | 0.00000152 | ||||
| Withdraw | 29094435 | 26 days ago | IN | 0 ETH | 0.00000008 | ||||
| Withdraw | 29094429 | 26 days ago | IN | 0 ETH | 0.00000008 | ||||
| Withdraw Protoco... | 29094423 | 26 days ago | IN | 0 ETH | 0.00000012 | ||||
| Join | 28590771 | 37 days ago | IN | 0.005 ETH | 0.00000197 | ||||
| Withdraw | 28579774 | 38 days ago | IN | 0 ETH | 0.00000004 | ||||
| Join | 27301984 | 67 days ago | IN | 0.005 ETH | 0 | ||||
| Withdraw | 26366003 | 89 days ago | IN | 0 ETH | 0 | ||||
| Withdraw | 26122077 | 94 days ago | IN | 0 ETH | 0 | ||||
| Withdraw | 25703107 | 104 days ago | IN | 0 ETH | 0 | ||||
| Withdraw | 25693426 | 104 days ago | IN | 0 ETH | 0 | ||||
| Withdraw | 25342111 | 113 days ago | IN | 0 ETH | 0.00000115 | ||||
| Withdraw | 25312757 | 113 days ago | IN | 0 ETH | 0 | ||||
| Withdraw | 25227314 | 115 days ago | IN | 0 ETH | 0 | ||||
| Withdraw | 25222435 | 115 days ago | IN | 0 ETH | 0 | ||||
| Withdraw | 24828491 | 124 days ago | IN | 0 ETH | 0 | ||||
| Withdraw | 24693703 | 128 days ago | IN | 0 ETH | 0 | ||||
| Withdraw | 24462899 | 133 days ago | IN | 0 ETH | 0.00000002 | ||||
| Withdraw | 24397635 | 134 days ago | IN | 0 ETH | 0.00000004 | ||||
| Withdraw | 24307183 | 136 days ago | IN | 0 ETH | 0 | ||||
| Withdraw | 23711552 | 150 days ago | IN | 0 ETH | 0.00000001 | ||||
| Withdraw | 23695829 | 151 days ago | IN | 0 ETH | 0 | ||||
| Withdraw | 23623952 | 152 days ago | IN | 0 ETH | 0 | ||||
| Withdraw | 23621998 | 152 days ago | IN | 0 ETH | 0 |
Latest 25 internal transactions (View All)
Advanced mode:
| Parent Transaction Hash | Block | From | To | |||
|---|---|---|---|---|---|---|
| 28590771 | 37 days ago | 0.00375 ETH | ||||
| 27301984 | 67 days ago | 0.00425 ETH | ||||
| 17583220 | 292 days ago | 0.00375 ETH | ||||
| 15637395 | 337 days ago | 0.0045 ETH | ||||
| 14445746 | 365 days ago | 0.00375 ETH | ||||
| 14409619 | 366 days ago | 0.00425 ETH | ||||
| 14229589 | 370 days ago | 0.00375 ETH | ||||
| 13938991 | 376 days ago | 0.00425 ETH | ||||
| 13649954 | 383 days ago | 0.00425 ETH | ||||
| 13439390 | 388 days ago | 0.00425 ETH | ||||
| 13251806 | 392 days ago | 0.00425 ETH | ||||
| 13030538 | 398 days ago | 0.00375 ETH | ||||
| 12775416 | 403 days ago | 0.00425 ETH | ||||
| 12690986 | 405 days ago | 0.00425 ETH | ||||
| 12671647 | 406 days ago | 0.00375 ETH | ||||
| 12524259 | 409 days ago | 0.0045 ETH | ||||
| 12203159 | 417 days ago | 0.00375 ETH | ||||
| 12050141 | 420 days ago | 0.0045 ETH | ||||
| 11830869 | 425 days ago | 0.00375 ETH | ||||
| 11786149 | 426 days ago | 0.00425 ETH | ||||
| 11785894 | 426 days ago | 0.00425 ETH | ||||
| 11785595 | 426 days ago | 0.00425 ETH | ||||
| 11784342 | 426 days ago | 0.00425 ETH | ||||
| 11781666 | 426 days ago | 0.00425 ETH | ||||
| 11771275 | 427 days ago | 0.0045 ETH |
Cross-Chain Transactions
Loading...
Loading
Contract Name:
LinkUp
Compiler Version
v0.8.21+commit.d9974bed
Optimization Enabled:
Yes with 200 runs
Other Settings:
paris EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.21;
import {ISOLE} from "./common/ISOLE.sol";
import {OPZap} from "./OPZap.sol";
import {IERC20} from "@openzeppelin-5/contracts/token/ERC20/IERC20.sol";
import {Erc20Utils} from "./common/Erc20Utils.sol";
import {BlastAdapter} from "./BlastAdapter.sol";
/**
* @title LinkUp
* @dev This contract implemented a multi-tier referral system where the first tier (direct) inviter receives a portion of the joining fee, and the second tier (inviter of the inviter) receives a smaller portion.
*/
contract LinkUp is BlastAdapter {
using Erc20Utils for IERC20;
ISOLE public immutable SOLE; // sOLE Token, immutable
IERC20 public immutable OLE; // Address of the OLE token
OPZap public zap;
uint256 public minSoleBalance = 100 * 10 ** 18; // Example: 100 sOLE (adjust as needed)
address public signerAddress;
uint256 public joinFee = 0.0015 ether;
mapping(address => address) public inviterOf;
mapping(address => uint256) public balance;
uint256 public protocolFee;
event Joined(address indexed user, address indexed inviter, uint256 directInviterFee, uint256 secondTierInviterFee, uint256 protocolFee);
event Withdrawn(address indexed user, uint256 amount);
event WithdrawnProtocolFee(address to, uint256 amount);
event FeeChanged(uint256 newFee);
event SignerChanged(address indexed newSigner);
event MinSoleBalanceChanged(uint256 newSoleBalance);
error IncorrectFee();
error AlreadyJoined();
error InvalidInviter();
error InvalidSignature();
error NoBalanceToWithdraw();
error InvalidNewSignerAddress();
error InvalidSignatureLength();
constructor(address signer, address _sole, IERC20 _ole, OPZap _zap) {
signerAddress = signer;
SOLE = ISOLE(_sole);
OLE = _ole;
zap = _zap;
}
function join(address inviter, bytes memory signature, uint256 minBoughtOle) external payable {
if (msg.value != joinFee) revert IncorrectFee();
if (inviterOf[msg.sender] != address(0)) revert AlreadyJoined();
if (inviter == address(0) || inviter == msg.sender) revert InvalidInviter();
if (!verifySig(signerAddress, inviter, signature)) revert InvalidSignature();
// Link the inviter to the new user
inviterOf[msg.sender] = inviter;
// Initialize fee amounts
uint256 directInviterFeePercent = 0;
uint256 secondTierInviterFeePercent = 0;
uint256 protocolFeePercent = 100;
// Check sOLE balances of inviters
bool directInviterOwnsSOLE = SOLE.balanceOf(inviter) >= minSoleBalance;
bool secondTierInviterOwnsSOLE = false;
address secondTierInviter = inviterOf[inviter];
if (secondTierInviter != address(0)) {
secondTierInviterOwnsSOLE = SOLE.balanceOf(secondTierInviter) >= minSoleBalance;
}
// Calculate fee distribution percent
if (directInviterOwnsSOLE && secondTierInviterOwnsSOLE) {
directInviterFeePercent = 70;
secondTierInviterFeePercent = 20;
protocolFeePercent = 10;
} else if (directInviterOwnsSOLE) {
directInviterFeePercent = 75;
secondTierInviterFeePercent = 10;
protocolFeePercent = 15;
} else if (secondTierInviterOwnsSOLE) {
directInviterFeePercent = 50;
secondTierInviterFeePercent = 35;
protocolFeePercent = 15;
} else {
directInviterFeePercent = 60;
secondTierInviterFeePercent = 15;
protocolFeePercent = 25;
}
if (secondTierInviter == address(0)) {
protocolFeePercent += secondTierInviterFeePercent; // Add to protocol fee if no second-tier inviter
secondTierInviterFeePercent = 0;
}
// Increase protocol fee
uint256 _protocolFee = (joinFee * protocolFeePercent) / 100;
protocolFee += _protocolFee;
// Buy ole
uint256 boughtOle = zap.swapETHForOLE{value: joinFee - _protocolFee}(minBoughtOle);
// Distribute fees
uint256 directInviterFee = (boughtOle * directInviterFeePercent) / (directInviterFeePercent + secondTierInviterFeePercent);
uint256 secondTierInviterFee = boughtOle - directInviterFee;
balance[inviter] += directInviterFee;
if (secondTierInviter != address(0)) {
balance[secondTierInviter] += secondTierInviterFee;
}
// Emit event for successful join
emit Joined(msg.sender, inviter, directInviterFee, secondTierInviterFee, _protocolFee);
}
function withdraw() external {
uint256 amount = balance[msg.sender];
if (amount == 0) revert NoBalanceToWithdraw();
balance[msg.sender] = 0;
OLE.transferOut(msg.sender, amount);
emit Withdrawn(msg.sender, amount);
}
function withdrawProtocolFee(address to) external onlyOwner {
uint256 amount = protocolFee;
protocolFee = 0;
payable(to).transfer(amount);
emit WithdrawnProtocolFee(to, amount);
}
function getInvitersOf(address user) external view returns (address, address) {
address directInviter = inviterOf[user];
address secondTierInviter = address(0);
if (directInviter != address(0)) {
secondTierInviter = inviterOf[directInviter];
}
return (directInviter, secondTierInviter);
}
function verifySig(address signingAddr, address signedAddr, bytes memory signature) internal pure returns (bool) {
bytes32 messageHash = keccak256(abi.encodePacked(signedAddr));
bytes32 ethSignedHash = keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", messageHash));
return recoverSigner(ethSignedHash, signature) == signingAddr;
}
function recoverSigner(bytes32 ethSignedHash, bytes memory signature) internal pure returns (address) {
(bytes32 r, bytes32 s, uint8 v) = splitSignature(signature);
return ecrecover(ethSignedHash, v, r, s);
}
function splitSignature(bytes memory sig) internal pure returns (bytes32 r, bytes32 s, uint8 v) {
if (sig.length != 65) revert InvalidSignatureLength();
assembly {
r := mload(add(sig, 32))
s := mload(add(sig, 64))
v := byte(0, mload(add(sig, 96)))
}
}
function setJoinFee(uint256 newFee) external onlyOwner {
joinFee = newFee;
emit FeeChanged(newFee);
}
function changeSigner(address newSigner) external onlyOwner {
if (newSigner == address(0)) revert InvalidNewSignerAddress();
signerAddress = newSigner;
emit SignerChanged(newSigner);
}
function setMinSoleBalance(uint256 newMinSoleBalance) external onlyOwner {
minSoleBalance = newMinSoleBalance;
emit MinSoleBalanceChanged(newMinSoleBalance);
}
function setZap(OPZap newOpZap) external onlyOwner {
zap = newOpZap;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol)
pragma solidity ^0.8.20;
import {Context} from "../utils/Context.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* The initial owner is set to the address provided by the deployer. This can
* later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
/**
* @dev The caller account is not authorized to perform an operation.
*/
error OwnableUnauthorizedAccount(address account);
/**
* @dev The owner is not a valid owner account. (eg. `address(0)`)
*/
error OwnableInvalidOwner(address owner);
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the address provided by the deployer as the initial owner.
*/
constructor(address initialOwner) {
if (initialOwner == address(0)) {
revert OwnableInvalidOwner(address(0));
}
_transferOwnership(initialOwner);
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
_checkOwner();
_;
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if the sender is not the owner.
*/
function _checkOwner() internal view virtual {
if (owner() != _msgSender()) {
revert OwnableUnauthorizedAccount(_msgSender());
}
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby disabling any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
if (newOwner == address(0)) {
revert OwnableInvalidOwner(address(0));
}
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Internal function without access restriction.
*/
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Permit.sol)
pragma solidity ^0.8.20;
/**
* @dev Interface of the 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.
*
* ==== Security Considerations
*
* There are two important considerations concerning the use of `permit`. The first is that a valid permit signature
* expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be
* considered as an intention to spend the allowance in any specific way. The second is that because permits have
* built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should
* take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be
* generally recommended is:
*
* ```solidity
* function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public {
* try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {}
* doThing(..., value);
* }
*
* function doThing(..., uint256 value) public {
* token.safeTransferFrom(msg.sender, address(this), value);
* ...
* }
* ```
*
* Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of
* `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also
* {SafeERC20-safeTransferFrom}).
*
* Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so
* contracts should have entry points that don't rely on permit.
*/
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].
*
* CAUTION: See Security Considerations above.
*/
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 v5.0.0) (token/ERC20/IERC20.sol)
pragma solidity ^0.8.20;
/**
* @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 value of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the value of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves a `value` amount of 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 value) 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 a `value` amount of tokens 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 value) external returns (bool);
/**
* @dev Moves a `value` amount of tokens from `from` to `to` using the
* allowance mechanism. `value` 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 value) external returns (bool);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/utils/SafeERC20.sol)
pragma solidity ^0.8.20;
import {IERC20} from "../IERC20.sol";
import {IERC20Permit} from "../extensions/IERC20Permit.sol";
import {Address} from "../../../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 An operation with an ERC20 token failed.
*/
error SafeERC20FailedOperation(address token);
/**
* @dev Indicates a failed `decreaseAllowance` request.
*/
error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease);
/**
* @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.encodeCall(token.transfer, (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.encodeCall(token.transferFrom, (from, to, 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);
forceApprove(token, spender, oldAllowance + value);
}
/**
* @dev Decrease the calling contract's allowance toward `spender` by `requestedDecrease`. If `token` returns no
* value, non-reverting calls are assumed to be successful.
*/
function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal {
unchecked {
uint256 currentAllowance = token.allowance(address(this), spender);
if (currentAllowance < requestedDecrease) {
revert SafeERC20FailedDecreaseAllowance(spender, currentAllowance, requestedDecrease);
}
forceApprove(token, spender, currentAllowance - requestedDecrease);
}
}
/**
* @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.encodeCall(token.approve, (spender, value));
if (!_callOptionalReturnBool(token, approvalCall)) {
_callOptionalReturn(token, abi.encodeCall(token.approve, (spender, 0)));
_callOptionalReturn(token, approvalCall);
}
}
/**
* @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);
if (returndata.length != 0 && !abi.decode(returndata, (bool))) {
revert SafeERC20FailedOperation(address(token));
}
}
/**
* @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(token).code.length > 0;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/Address.sol)
pragma solidity ^0.8.20;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev The ETH balance of the account is not enough to perform the operation.
*/
error AddressInsufficientBalance(address account);
/**
* @dev There's no code at `target` (it is not a contract).
*/
error AddressEmptyCode(address target);
/**
* @dev A call to an address target failed. The target may have reverted.
*/
error FailedInnerCall();
/**
* @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.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
if (address(this).balance < amount) {
revert AddressInsufficientBalance(address(this));
}
(bool success, ) = recipient.call{value: amount}("");
if (!success) {
revert FailedInnerCall();
}
}
/**
* @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 or custom error, it is bubbled
* up by this function (like regular Solidity function calls). However, if
* the call reverted with no returned reason, this function reverts with a
* {FailedInnerCall} error.
*
* 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.
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0);
}
/**
* @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`.
*/
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
if (address(this).balance < value) {
revert AddressInsufficientBalance(address(this));
}
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResultFromTarget(target, success, returndata);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResultFromTarget(target, success, returndata);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResultFromTarget(target, success, returndata);
}
/**
* @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target
* was not a contract or bubbling up the revert reason (falling back to {FailedInnerCall}) in case of an
* unsuccessful call.
*/
function verifyCallResultFromTarget(
address target,
bool success,
bytes memory returndata
) internal view returns (bytes memory) {
if (!success) {
_revert(returndata);
} else {
// only check if target is a contract if the call was successful and the return data is empty
// otherwise we already know that it was a contract
if (returndata.length == 0 && target.code.length == 0) {
revert AddressEmptyCode(target);
}
return returndata;
}
}
/**
* @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the
* revert reason or with a default {FailedInnerCall} error.
*/
function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) {
if (!success) {
_revert(returndata);
} else {
return returndata;
}
}
/**
* @dev Reverts with returndata if present. Otherwise reverts with {FailedInnerCall}.
*/
function _revert(bytes memory returndata) 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 FailedInnerCall();
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)
pragma solidity ^0.8.20;
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
function _contextSuffixLength() internal view virtual returns (uint256) {
return 0;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/math/Math.sol)
pragma solidity ^0.8.20;
/**
* @dev Standard math utilities missing in the Solidity language.
*/
library Math {
/**
* @dev Muldiv operation overflow.
*/
error MathOverflowedMulDiv();
enum Rounding {
Floor, // Toward negative infinity
Ceil, // Toward positive infinity
Trunc, // Toward zero
Expand // Away from zero
}
/**
* @dev Returns the addition of two unsigned integers, with an overflow flag.
*/
function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
uint256 c = a + b;
if (c < a) return (false, 0);
return (true, c);
}
}
/**
* @dev Returns the subtraction of two unsigned integers, with an overflow flag.
*/
function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b > a) return (false, 0);
return (true, a - b);
}
}
/**
* @dev Returns the multiplication of two unsigned integers, with an overflow flag.
*/
function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) return (true, 0);
uint256 c = a * b;
if (c / a != b) return (false, 0);
return (true, c);
}
}
/**
* @dev Returns the division of two unsigned integers, with a division by zero flag.
*/
function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a / b);
}
}
/**
* @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
*/
function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a % b);
}
}
/**
* @dev Returns the largest of two numbers.
*/
function max(uint256 a, uint256 b) internal pure returns (uint256) {
return a > b ? a : b;
}
/**
* @dev Returns the smallest of two numbers.
*/
function min(uint256 a, uint256 b) internal pure returns (uint256) {
return a < b ? a : b;
}
/**
* @dev Returns the average of two numbers. The result is rounded towards
* zero.
*/
function average(uint256 a, uint256 b) internal pure returns (uint256) {
// (a + b) / 2 can overflow.
return (a & b) + (a ^ b) / 2;
}
/**
* @dev Returns the ceiling of the division of two numbers.
*
* This differs from standard division with `/` in that it rounds towards infinity instead
* of rounding towards zero.
*/
function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
if (b == 0) {
// Guarantee the same behavior as in a regular Solidity division.
return a / b;
}
// (a + b - 1) / b can overflow on addition, so we distribute.
return a == 0 ? 0 : (a - 1) / b + 1;
}
/**
* @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or
* denominator == 0.
* @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) with further edits by
* Uniswap Labs also under MIT license.
*/
function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {
unchecked {
// 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use
// use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256
// variables such that product = prod1 * 2^256 + prod0.
uint256 prod0 = x * y; // Least significant 256 bits of the product
uint256 prod1; // Most significant 256 bits of the product
assembly {
let mm := mulmod(x, y, not(0))
prod1 := sub(sub(mm, prod0), lt(mm, prod0))
}
// Handle non-overflow cases, 256 by 256 division.
if (prod1 == 0) {
// Solidity will revert if denominator == 0, unlike the div opcode on its own.
// The surrounding unchecked block does not change this fact.
// See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.
return prod0 / denominator;
}
// Make sure the result is less than 2^256. Also prevents denominator == 0.
if (denominator <= prod1) {
revert MathOverflowedMulDiv();
}
///////////////////////////////////////////////
// 512 by 256 division.
///////////////////////////////////////////////
// Make division exact by subtracting the remainder from [prod1 prod0].
uint256 remainder;
assembly {
// Compute remainder using mulmod.
remainder := mulmod(x, y, denominator)
// Subtract 256 bit number from 512 bit number.
prod1 := sub(prod1, gt(remainder, prod0))
prod0 := sub(prod0, remainder)
}
// Factor powers of two out of denominator and compute largest power of two divisor of denominator.
// Always >= 1. See https://cs.stackexchange.com/q/138556/92363.
uint256 twos = denominator & (0 - denominator);
assembly {
// Divide denominator by twos.
denominator := div(denominator, twos)
// Divide [prod1 prod0] by twos.
prod0 := div(prod0, twos)
// Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.
twos := add(div(sub(0, twos), twos), 1)
}
// Shift in bits from prod1 into prod0.
prod0 |= prod1 * twos;
// Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such
// that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for
// four bits. That is, denominator * inv = 1 mod 2^4.
uint256 inverse = (3 * denominator) ^ 2;
// Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also
// works in modular arithmetic, doubling the correct bits in each step.
inverse *= 2 - denominator * inverse; // inverse mod 2^8
inverse *= 2 - denominator * inverse; // inverse mod 2^16
inverse *= 2 - denominator * inverse; // inverse mod 2^32
inverse *= 2 - denominator * inverse; // inverse mod 2^64
inverse *= 2 - denominator * inverse; // inverse mod 2^128
inverse *= 2 - denominator * inverse; // inverse mod 2^256
// Because the division is now exact we can divide by multiplying with the modular inverse of denominator.
// This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is
// less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1
// is no longer required.
result = prod0 * inverse;
return result;
}
}
/**
* @notice Calculates x * y / denominator with full precision, following the selected rounding direction.
*/
function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {
uint256 result = mulDiv(x, y, denominator);
if (unsignedRoundsUp(rounding) && mulmod(x, y, denominator) > 0) {
result += 1;
}
return result;
}
/**
* @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded
* towards zero.
*
* Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11).
*/
function sqrt(uint256 a) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
// For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.
//
// We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have
// `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.
//
// This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`
// → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`
// → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`
//
// Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.
uint256 result = 1 << (log2(a) >> 1);
// At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,
// since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at
// every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision
// into the expected uint128 result.
unchecked {
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
return min(result, a / result);
}
}
/**
* @notice Calculates sqrt(a), following the selected rounding direction.
*/
function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = sqrt(a);
return result + (unsignedRoundsUp(rounding) && result * result < a ? 1 : 0);
}
}
/**
* @dev Return the log in base 2 of a positive value rounded towards zero.
* Returns 0 if given 0.
*/
function log2(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >> 128 > 0) {
value >>= 128;
result += 128;
}
if (value >> 64 > 0) {
value >>= 64;
result += 64;
}
if (value >> 32 > 0) {
value >>= 32;
result += 32;
}
if (value >> 16 > 0) {
value >>= 16;
result += 16;
}
if (value >> 8 > 0) {
value >>= 8;
result += 8;
}
if (value >> 4 > 0) {
value >>= 4;
result += 4;
}
if (value >> 2 > 0) {
value >>= 2;
result += 2;
}
if (value >> 1 > 0) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 2, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log2(value);
return result + (unsignedRoundsUp(rounding) && 1 << result < value ? 1 : 0);
}
}
/**
* @dev Return the log in base 10 of a positive value rounded towards zero.
* Returns 0 if given 0.
*/
function log10(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >= 10 ** 64) {
value /= 10 ** 64;
result += 64;
}
if (value >= 10 ** 32) {
value /= 10 ** 32;
result += 32;
}
if (value >= 10 ** 16) {
value /= 10 ** 16;
result += 16;
}
if (value >= 10 ** 8) {
value /= 10 ** 8;
result += 8;
}
if (value >= 10 ** 4) {
value /= 10 ** 4;
result += 4;
}
if (value >= 10 ** 2) {
value /= 10 ** 2;
result += 2;
}
if (value >= 10 ** 1) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 10, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log10(value);
return result + (unsignedRoundsUp(rounding) && 10 ** result < value ? 1 : 0);
}
}
/**
* @dev Return the log in base 256 of a positive value rounded towards zero.
* Returns 0 if given 0.
*
* Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.
*/
function log256(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >> 128 > 0) {
value >>= 128;
result += 16;
}
if (value >> 64 > 0) {
value >>= 64;
result += 8;
}
if (value >> 32 > 0) {
value >>= 32;
result += 4;
}
if (value >> 16 > 0) {
value >>= 16;
result += 2;
}
if (value >> 8 > 0) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 256, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log256(value);
return result + (unsignedRoundsUp(rounding) && 1 << (result << 3) < value ? 1 : 0);
}
}
/**
* @dev Returns whether a provided rounding mode is considered rounding up for unsigned integers.
*/
function unsignedRoundsUp(Rounding rounding) internal pure returns (bool) {
return uint8(rounding) % 2 == 1;
}
}// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.21;
interface IBlast {
enum YieldMode {
AUTOMATIC,
DISABLED,
CLAIMABLE
}
enum GasMode {
VOID,
CLAIMABLE
}
// configure
function configureContract(address contractAddress, YieldMode _yield, GasMode gasMode, address governor) external;
function configure(YieldMode _yield, GasMode gasMode, address governor) external;
// base configuration options
function configureClaimableYield() external;
function configureClaimableYieldOnBehalf(address contractAddress) external;
function configureAutomaticYield() external;
function configureAutomaticYieldOnBehalf(address contractAddress) external;
function configureVoidYield() external;
function configureVoidYieldOnBehalf(address contractAddress) external;
function configureClaimableGas() external;
function configureClaimableGasOnBehalf(address contractAddress) external;
function configureVoidGas() external;
function configureVoidGasOnBehalf(address contractAddress) external;
function configureGovernor(address _governor) external;
function configureGovernorOnBehalf(address _newGovernor, address contractAddress) external;
// claim yield
function claimYield(address contractAddress, address recipientOfYield, uint256 amount) external returns (uint256);
function claimAllYield(address contractAddress, address recipientOfYield) external returns (uint256);
// claim gas
function claimAllGas(address contractAddress, address recipientOfGas) external returns (uint256);
function claimGasAtMinClaimRate(address contractAddress, address recipientOfGas, uint256 minClaimRateBips) external returns (uint256);
function claimMaxGas(address contractAddress, address recipientOfGas) external returns (uint256);
function claimGas(address contractAddress, address recipientOfGas, uint256 gasToClaim, uint256 gasSecondsToConsume) external returns (uint256);
// read functions
function readClaimableYield(address contractAddress) external view returns (uint256);
function readYieldConfiguration(address contractAddress) external view returns (uint8);
function readGasParams(address contractAddress) external view returns (uint256 etherSeconds, uint256 etherBalance, uint256 lastUpdated, GasMode);
}// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.21;
interface IBlastPoints {
function configurePointsOperator(address operator) external;
}// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.0;
import {Ownable} from "@openzeppelin-5/contracts/access/Ownable.sol";
import {IBlast} from "./blast/IBlast.sol";
import {IBlastPoints} from "./blast/IBlastPoints.sol";
contract BlastAdapter is Ownable {
constructor() Ownable(_msgSender()) {}
function enableClaimable(address gov) public onlyOwner {
IBlast(0x4300000000000000000000000000000000000002).configure(IBlast.YieldMode.CLAIMABLE, IBlast.GasMode.CLAIMABLE, gov);
IBlastPoints(0x2536FE9ab3F511540F2f9e2eC2A805005C3Dd800).configurePointsOperator(gov);
}
}// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.21;
import {SafeERC20, IERC20} from "@openzeppelin-5/contracts/token/ERC20/utils/SafeERC20.sol";
import {IWETH} from "../common/IWETH.sol";
library Erc20Utils {
error ETHTransferFailed();
using SafeERC20 for IERC20;
function balanceOfThis(IERC20 token) internal view returns (uint256) {
return token.balanceOf(address(this));
}
function safeApprove(IERC20 token, address spender, uint256 value) internal {
token.forceApprove(spender, value);
}
function safeTransferFrom(IERC20 token, address from, address to, uint256 amount) internal returns (uint256) {
uint256 balance = balanceOfThis(token);
token.safeTransferFrom(from, to, amount);
return balanceOfThis(token) - balance;
}
function safeTransferIn(IERC20 token, address from, uint256 amount) internal returns (uint256) {
uint256 balance = balanceOfThis(token);
token.safeTransferFrom(from, address(this), amount);
return balanceOfThis(token) - balance;
}
function transferOut(IERC20 token, address to, uint256 amount) internal {
token.safeTransfer(to, amount);
}
function uniTransferOut(IERC20 token, address to, uint256 amount, address weth) internal {
if (address(token) == weth) {
IWETH(weth).withdraw(amount);
(bool success, ) = to.call{value: amount}("");
if (!success) revert ETHTransferFailed();
} else {
transferOut(token, to, amount);
}
}
}// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.21;
interface ISOLE {
function create_lock_for(address to, uint256 _value, uint256 _unlock_time) external;
function increase_amount_for(address to, uint256 _value) external;
function balanceOf(address addr) external view returns (uint256);
function increase_unlock_time(uint256 _unlock_time) external;
function withdraw() external;
function locked(address addr) external view returns (uint256 amount, uint256 lockTime);
}// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.21;
import {IERC20} from "@openzeppelin-5/contracts/token/ERC20/IERC20.sol";
interface IUniV2ClassPair is IERC20 {
function mint(address to) external returns (uint liquidity);
function token0() external view returns (address);
function token1() external view returns (address);
function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast);
function sync() external;
function swap(uint256 amount0Out, uint256 amount1Out, address to, bytes calldata data) external;
}// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.21;
interface IWETH {
function deposit() external payable;
function withdraw(uint256) external;
}// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.21;
import {Math} from "@openzeppelin-5/contracts/utils/math/Math.sol";
import {IERC20} from "@openzeppelin-5/contracts/token/ERC20/utils/SafeERC20.sol";
import {ISpaceShare} from "./share/ISpaceShare.sol";
import {IUniV2ClassPair} from "./common/IUniV2ClassPair.sol";
import {Erc20Utils} from "./common/Erc20Utils.sol";
import {ISOLE} from "./common/ISOLE.sol";
import {IWETH} from "./common/IWETH.sol";
import {BlastAdapter} from "./BlastAdapter.sol";
/**
* @title OPZap
* @dev This contract is designed caters to users looking to interact with liquidity pools, swap tokens, and buy the space's shares by ETH.
*/
contract OPZap is BlastAdapter {
error InsufficientLpReturn(); // Error thrown when the LP amount received is less than expected
error InsufficientOleReturn(); // Error thrown when the OLE amount received is less than expected
using Erc20Utils for IERC20;
using Erc20Utils for IUniV2ClassPair;
IERC20 public immutable OLE; // Address of the OLE token
IWETH public immutable WETH; // Native token of the blockchain (e.g., ETH on Ethereum)
IUniV2ClassPair public oleEthLp; // Address of the token pair for liquidity : OLE/ETH
address public immutable SOLE; // Address of the OpenLeverage SOLE token
ISpaceShare public immutable SPACE; // Address of the OpenLeverage Space share contract
uint256 public immutable DEX_FEES; // 0.3% dex fees (e.g., 20 means 0.2%)
constructor(IERC20 _ole, IWETH _weth, IUniV2ClassPair _pair, uint256 _dexFee, address _sole, ISpaceShare _spaceShare) {
OLE = _ole;
WETH = _weth;
oleEthLp = _pair;
DEX_FEES = _dexFee;
SOLE = _sole;
SPACE = _spaceShare;
}
function swapETHForOLE(uint256 minBoughtOle) external payable returns (uint256 boughtOle) {
WETH.deposit{value: msg.value}();
boughtOle = _swapETHForOLE(msg.value, _msgSender());
if (boughtOle < minBoughtOle) revert InsufficientOleReturn();
return boughtOle;
}
function createXoleByETH(uint256 minLpReturn, uint256 unlockTime) external payable {
WETH.deposit{value: msg.value}();
uint256 lpReturn = _addLpByETH(msg.value);
if (lpReturn < minLpReturn) revert InsufficientLpReturn();
oleEthLp.safeApprove(SOLE, lpReturn);
ISOLE(SOLE).create_lock_for(msg.sender, lpReturn, unlockTime);
}
function increaseXoleByETH(uint256 minLpReturn) external payable {
WETH.deposit{value: msg.value}();
uint256 lpReturn = _addLpByETH(msg.value);
if (lpReturn < minLpReturn) revert InsufficientLpReturn();
oleEthLp.safeApprove(SOLE, lpReturn);
ISOLE(SOLE).increase_amount_for(msg.sender, lpReturn);
}
function buySharesByETH(uint256 spaceId, uint256 shares, uint256 timestamp, bytes memory signature, uint256 minBoughtOle) external payable {
WETH.deposit{value: msg.value}();
_swapETHForOLE(msg.value, address(this));
uint256 boughtOle = OLE.balanceOfThis();
if (boughtOle < minBoughtOle) revert InsufficientOleReturn();
OLE.safeApprove(address(SPACE), boughtOle);
SPACE.buySharesTo(spaceId, shares, boughtOle, timestamp, signature, msg.sender);
// refund ole
uint256 oleBalance = OLE.balanceOfThis();
if (oleBalance > 0) {
OLE.transferOut(msg.sender, oleBalance);
}
}
function _swapETHForOLE(uint256 ethAmount, address to) internal returns (uint256 boughtOleAmount) {
(uint256 reserve0, uint256 reserve1, ) = oleEthLp.getReserves();
IERC20(address(WETH)).transferOut(address(oleEthLp), ethAmount);
if (oleIsToken0()) {
boughtOleAmount = getAmountOut(ethAmount, reserve1, reserve0);
oleEthLp.swap(boughtOleAmount, 0, to, "");
} else {
boughtOleAmount = getAmountOut(ethAmount, reserve0, reserve1);
oleEthLp.swap(0, boughtOleAmount, to, "");
}
}
function _addLpByETH(uint256 ethAmount) internal returns (uint256 lpReturn) {
(uint256 reserve0, uint256 reserve1, ) = oleEthLp.getReserves();
uint256 ethToSell;
if (oleIsToken0()) {
ethToSell = _getAccurateETHToSell(ethAmount, reserve1, reserve0);
} else {
ethToSell = _getAccurateETHToSell(ethAmount, reserve0, reserve1);
}
_swapETHForOLE(ethToSell, address(this));
return _addLp(ethAmount - ethToSell, OLE.balanceOfThis());
}
function _addLp(uint256 ethAmount, uint256 oleAmount) internal returns (uint256 lpReturn) {
(uint256 reserve0, uint256 reserve1, ) = oleEthLp.getReserves();
uint256 oleReserve = oleIsToken0() ? reserve0 : reserve1;
uint256 ethReserve = oleIsToken0() ? reserve1 : reserve0;
uint256 ethOut = ethAmount;
uint256 oleOut = oleAmount;
uint256 ethOptimal = _quote(oleAmount, oleReserve, ethReserve);
if (ethOptimal <= ethAmount) {
ethOut = ethOptimal;
} else {
oleOut = _quote(ethAmount, ethReserve, oleReserve);
}
IERC20(address(WETH)).transferOut(address(oleEthLp), ethOut);
OLE.transferOut(address(oleEthLp), oleOut);
lpReturn = oleEthLp.mint(address(this));
}
function _getAccurateETHToSell(uint256 amountAIn, uint256 reserveA, uint256 reserveB) internal view returns (uint256) {
uint256 halfTokenAIn = amountAIn / 2;
uint256 nominator = getAmountOut(halfTokenAIn, reserveA, reserveB);
uint256 denominator = _quote(halfTokenAIn, reserveA + halfTokenAIn, reserveB - nominator);
return amountAIn - Math.sqrt((halfTokenAIn * halfTokenAIn * nominator) / denominator);
}
function _quote(uint256 _amountA, uint256 _reserveA, uint256 _reserveB) internal pure returns (uint256 _amountB) {
_amountB = (_amountA * _reserveB) / _reserveA;
}
function getAmountOut(uint256 amountIn, uint256 reserveIn, uint256 reserveOut) private view returns (uint256 amountOut) {
uint256 amountInWithFee = amountIn * (10000 - DEX_FEES);
uint256 numerator = amountInWithFee * reserveOut;
uint256 denominator = reserveIn * 10000 + amountInWithFee;
amountOut = numerator / denominator;
}
function oleIsToken0() private view returns (bool) {
return address(OLE) < address(WETH);
}
function setOleEthLp(IUniV2ClassPair newOleEthLp) external onlyOwner {
oleEthLp = newOleEthLp;
}
}// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.21;
interface ISpaceShare {
event SpaceCreated(uint256 spaceId, address creator);
event Trade(uint256 spaceId, address trader, bool isBuy, uint256 shares, uint256 price, uint256 protocolFee, uint256 holderFee, uint256 supply);
event WithdrawReward(address holder, uint256 spaceId, uint256 reward);
event ProtocolFeeDestinationChanged(address newProtocolFeeDestination);
event FeesChanged(uint256 newProtocolFeePercent, uint256 newHolderFeePercent);
event SignConfChanged(address newIssuerAddress, uint256 newSignValidDuration);
function createSpace() external;
function buyShares(uint256 spaceId, uint256 shares, uint256 maxInAmount, uint256 timestamp, bytes memory signature) external;
function buySharesTo(uint256 spaceId, uint256 shares, uint256 maxInAmount, uint256 timestamp, bytes memory signature, address to) external;
function sellShares(uint256 spaceId, uint256 shares, uint256 minOutAmount) external;
function withdrawRewards(uint256[] memory spaceIds) external;
function exitSpace(uint256 spaceId, uint256 minOutAmount) external;
// owner function
function setProtocolFeeDestination(address _protocolFeeDestination) external;
function setFees(uint16 _protocolFeePercent, uint16 _holderFeePercent) external;
function setSignConf(address _issuerAddress, uint256 _signValidDuration) external;
// view function
function getBuyPrice(uint256 spaceId, uint256 amount) external view returns (uint256);
function getSellPrice(uint256 spaceId, uint256 amount) external view returns (uint256);
function getBuyPriceWithFees(uint256 spaceId, uint256 amount) external view returns (uint256);
function getSellPriceWithFees(uint256 spaceId, uint256 amount) external view returns (uint256);
function getRewards(uint256[] memory spaceIds, address holder) external view returns (uint256 reward);
}{
"evmVersion": "paris",
"optimizer": {
"enabled": true,
"runs": 200
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"libraries": {}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"address","name":"signer","type":"address"},{"internalType":"address","name":"_sole","type":"address"},{"internalType":"contract IERC20","name":"_ole","type":"address"},{"internalType":"contract OPZap","name":"_zap","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"target","type":"address"}],"name":"AddressEmptyCode","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"AddressInsufficientBalance","type":"error"},{"inputs":[],"name":"AlreadyJoined","type":"error"},{"inputs":[],"name":"FailedInnerCall","type":"error"},{"inputs":[],"name":"IncorrectFee","type":"error"},{"inputs":[],"name":"InvalidInviter","type":"error"},{"inputs":[],"name":"InvalidNewSignerAddress","type":"error"},{"inputs":[],"name":"InvalidSignature","type":"error"},{"inputs":[],"name":"InvalidSignatureLength","type":"error"},{"inputs":[],"name":"NoBalanceToWithdraw","type":"error"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"OwnableInvalidOwner","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"OwnableUnauthorizedAccount","type":"error"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"SafeERC20FailedOperation","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"newFee","type":"uint256"}],"name":"FeeChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"address","name":"inviter","type":"address"},{"indexed":false,"internalType":"uint256","name":"directInviterFee","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"secondTierInviterFee","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"protocolFee","type":"uint256"}],"name":"Joined","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"newSoleBalance","type":"uint256"}],"name":"MinSoleBalanceChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"newSigner","type":"address"}],"name":"SignerChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Withdrawn","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"WithdrawnProtocolFee","type":"event"},{"inputs":[],"name":"OLE","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"SOLE","outputs":[{"internalType":"contract ISOLE","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"balance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newSigner","type":"address"}],"name":"changeSigner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"gov","type":"address"}],"name":"enableClaimable","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"getInvitersOf","outputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"inviterOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"inviter","type":"address"},{"internalType":"bytes","name":"signature","type":"bytes"},{"internalType":"uint256","name":"minBoughtOle","type":"uint256"}],"name":"join","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"joinFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"minSoleBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"protocolFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newFee","type":"uint256"}],"name":"setJoinFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newMinSoleBalance","type":"uint256"}],"name":"setMinSoleBalance","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract OPZap","name":"newOpZap","type":"address"}],"name":"setZap","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"signerAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"}],"name":"withdrawProtocolFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"zap","outputs":[{"internalType":"contract OPZap","name":"","type":"address"}],"stateMutability":"view","type":"function"}]Contract Creation Code
60c060405268056bc75e2d631000006002556605543df729c0006004553480156200002957600080fd5b506040516200149c3803806200149c8339810160408190526200004c9162000126565b33806200007357604051631e4fbdf760e01b81526000600482015260240160405180910390fd5b6200007e81620000bd565b50600380546001600160a01b039586166001600160a01b03199182161790915592841660805290831660a052600180549190931691161790556200018e565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6001600160a01b03811681146200012357600080fd5b50565b600080600080608085870312156200013d57600080fd5b84516200014a816200010d565b60208601519094506200015d816200010d565b604086015190935062000170816200010d565b606086015190925062000183816200010d565b939692955090935050565b60805160a0516112d3620001c9600039600081816102b3015261046b01526000818161017e015281816105e701526106a001526112d36000f3fe60806040526004361061012a5760003560e01c80638da5cb5b116100ab578063c8ced3551161006f578063c8ced3551461032b578063ceeb706614610361578063e3d670d714610381578063f2fde38b146103ae578063fbf7c7df146103ce578063feaf90a5146103e457600080fd5b80638da5cb5b1461028357806391df383f146102a1578063aad2b723146102d5578063b0e21e8a146102f5578063be4d0ae71461030b57600080fd5b80636593c2c9116100f25780636593c2c9146101ea578063668fb6dc1461020a5780636691244a1461022a57806367f568281461024e578063715018a61461026e57600080fd5b8063262d61521461012f5780632eea49d91461016c5780633ccfd60b146101a05780634b236f7c146101b75780635b7633d0146101ca575b600080fd5b34801561013b57600080fd5b5060015461014f906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b34801561017857600080fd5b5061014f7f000000000000000000000000000000000000000000000000000000000000000081565b3480156101ac57600080fd5b506101b5610424565b005b6101b56101c536600461105f565b6104d2565b3480156101d657600080fd5b5060035461014f906001600160a01b031681565b3480156101f657600080fd5b506101b561020536600461112c565b610941565b34801561021657600080fd5b506101b561022536600461112c565b61096b565b34801561023657600080fd5b5061024060025481565b604051908152602001610163565b34801561025a57600080fd5b506101b5610269366004611149565b6109fb565b34801561027a57600080fd5b506101b5610a3f565b34801561028f57600080fd5b506000546001600160a01b031661014f565b3480156102ad57600080fd5b5061014f7f000000000000000000000000000000000000000000000000000000000000000081565b3480156102e157600080fd5b506101b56102f036600461112c565b610a53565b34801561030157600080fd5b5061024060075481565b34801561031757600080fd5b506101b561032636600461112c565b610acc565b34801561033757600080fd5b5061014f61034636600461112c565b6005602052600090815260409020546001600160a01b031681565b34801561036d57600080fd5b506101b561037c366004611149565b610ba6565b34801561038d57600080fd5b5061024061039c36600461112c565b60066020526000908152604090205481565b3480156103ba57600080fd5b506101b56103c936600461112c565b610be3565b3480156103da57600080fd5b5061024060045481565b3480156103f057600080fd5b506104046103ff36600461112c565b610c26565b604080516001600160a01b03938416815292909116602083015201610163565b33600090815260066020526040812054908190036104555760405163177b02e160e31b815260040160405180910390fd5b3360008181526006602052604081205561049a907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169083610c73565b60405181815233907f7084f5476618d8e60b11ef0d7d3f06914655adb8793e28ff7f018d4c76d505d59060200160405180910390a250565b60045434146104f45760405163cd3cb2bb60e01b815260040160405180910390fd5b336000908152600560205260409020546001600160a01b03161561052a57604051621d934160e11b815260040160405180910390fd5b6001600160a01b038316158061054857506001600160a01b03831633145b15610566576040516385b87cb760e01b815260040160405180910390fd5b60035461057d906001600160a01b03168484610c8c565b61059a57604051638baa579f60e01b815260040160405180910390fd5b3360009081526005602052604080822080546001600160a01b0319166001600160a01b0387811691821790925560025492516370a0823160e01b81526004810191909152839260649284927f0000000000000000000000000000000000000000000000000000000000000000909116906370a0823190602401602060405180830381865afa158015610630573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106549190611162565b6001600160a01b03808a16600090815260056020526040812054939092101593509091168015610710576002546040516370a0823160e01b81526001600160a01b0383811660048301527f000000000000000000000000000000000000000000000000000000000000000016906370a0823190602401602060405180830381865afa1580156106e7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061070b9190611162565b101591505b82801561071a5750815b15610730576046955060149450600a935061076b565b821561074757604b9550600a9450600f935061076b565b811561075e576032955060239450600f935061076b565b603c9550600f9450601993505b6001600160a01b03811661078a576107838585611191565b9350600094505b600060648560045461079c91906111a4565b6107a691906111bb565b905080600760008282546107ba9190611191565b90915550506001546004546000916001600160a01b0316906387e6b799906107e39085906111dd565b8b6040518363ffffffff1660e01b815260040161080291815260200190565b60206040518083038185885af1158015610820573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906108459190611162565b90506000610853888a611191565b61085d8a846111a4565b61086791906111bb565b9050600061087582846111dd565b6001600160a01b038e166000908152600660205260408120805492935084929091906108a2908490611191565b90915550506001600160a01b038516156108e4576001600160a01b038516600090815260066020526040812080548392906108de908490611191565b90915550505b60408051838152602081018390529081018590526001600160a01b038e169033907fff6b02d4bfd759252877f26a2dcf137d75e02e1d3140d8bb26ea17dafa89f08c9060600160405180910390a350505050505050505050505050565b610949610d36565b600180546001600160a01b0319166001600160a01b0392909216919091179055565b610973610d36565b6007805460009182905560405190916001600160a01b0384169183156108fc0291849190818181858888f193505050501580156109b4573d6000803e3d6000fd5b50604080516001600160a01b0384168152602081018390527f83c65b637de293aee479ad72f844d5293253834df212a6e940913e37150f82e1910160405180910390a15050565b610a03610d36565b60028190556040518181527fa60211d2e967de17aac799b7b27678c7777f131a3990a7b2596a0a88eb96904b906020015b60405180910390a150565b610a47610d36565b610a516000610d63565b565b610a5b610d36565b6001600160a01b038116610a8257604051636b3e763f60e01b815260040160405180910390fd5b600380546001600160a01b0319166001600160a01b0383169081179091556040517f5719a5656c5cfdaafa148ecf366fd3b0a7fae06449ce2a46225977fb7417e29d90600090a250565b610ad4610d36565b60405163c8992e6160e01b81526002604360981b019063c8992e6190610b04906002906001908690600401611206565b600060405180830381600087803b158015610b1e57600080fd5b505af1158015610b32573d6000803e3d6000fd5b50506040516336b91f2b60e01b81526001600160a01b0384166004820152732536fe9ab3f511540f2f9e2ec2a805005c3dd80092506336b91f2b9150602401600060405180830381600087803b158015610b8b57600080fd5b505af1158015610b9f573d6000803e3d6000fd5b5050505050565b610bae610d36565b60048190556040518181527f6bbc57480a46553fa4d156ce702beef5f3ad66303b0ed1a5d4cb44966c6584c390602001610a34565b610beb610d36565b6001600160a01b038116610c1a57604051631e4fbdf760e01b8152600060048201526024015b60405180910390fd5b610c2381610d63565b50565b6001600160a01b038082166000908152600560205260408120549091829116818115610c6957506001600160a01b03808216600090815260056020526040902054165b9094909350915050565b610c876001600160a01b0384168383610db3565b505050565b604080516bffffffffffffffffffffffff19606085901b16602080830191909152825180830360140181526034830184528051908201207f19457468657265756d205369676e6564204d6573736167653a0a333200000000605484015260708084018290528451808503909101815260909093019093528151910120600091906001600160a01b038616610d208286610e05565b6001600160a01b031614925050505b9392505050565b6000546001600160a01b03163314610a515760405163118cdaa760e01b8152336004820152602401610c11565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b179052610c87908490610e85565b600080600080610e1485610ee8565b6040805160008152602081018083528b905260ff8316918101919091526060810184905260808101839052929550909350915060019060a0016020604051602081039080840390855afa158015610e6f573d6000803e3d6000fd5b5050506020604051035193505050505b92915050565b6000610e9a6001600160a01b03841683610f2d565b90508051600014158015610ebf575080806020019051810190610ebd919061124c565b155b15610c8757604051635274afe760e01b81526001600160a01b0384166004820152602401610c11565b60008060008351604114610f0f57604051634be6321b60e01b815260040160405180910390fd5b50505060208101516040820151606090920151909260009190911a90565b6060610d2f8383600084600080856001600160a01b03168486604051610f53919061126e565b60006040518083038185875af1925050503d8060008114610f90576040519150601f19603f3d011682016040523d82523d6000602084013e610f95565b606091505b5091509150610fa5868383610faf565b9695505050505050565b606082610fc457610fbf8261100b565b610d2f565b8151158015610fdb57506001600160a01b0384163b155b1561100457604051639996b31560e01b81526001600160a01b0385166004820152602401610c11565b5080610d2f565b80511561101b5780518082602001fd5b604051630a12f52160e11b815260040160405180910390fd5b6001600160a01b0381168114610c2357600080fd5b634e487b7160e01b600052604160045260246000fd5b60008060006060848603121561107457600080fd5b833561107f81611034565b9250602084013567ffffffffffffffff8082111561109c57600080fd5b818601915086601f8301126110b057600080fd5b8135818111156110c2576110c2611049565b604051601f8201601f19908116603f011681019083821181831017156110ea576110ea611049565b8160405282815289602084870101111561110357600080fd5b826020860160208301376000602084830101528096505050505050604084013590509250925092565b60006020828403121561113e57600080fd5b8135610d2f81611034565b60006020828403121561115b57600080fd5b5035919050565b60006020828403121561117457600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b80820180821115610e7f57610e7f61117b565b8082028115828204841417610e7f57610e7f61117b565b6000826111d857634e487b7160e01b600052601260045260246000fd5b500490565b81810381811115610e7f57610e7f61117b565b634e487b7160e01b600052602160045260246000fd5b606081016003851061121a5761121a6111f0565b8482526002841061122d5761122d6111f0565b60208201939093526001600160a01b0391909116604090910152919050565b60006020828403121561125e57600080fd5b81518015158114610d2f57600080fd5b6000825160005b8181101561128f5760208186018101518583015201611275565b50600092019182525091905056fea264697066735822122070d9c4a59be920745ff2150dad29a2eadd1e38b3899ff07cc1e428cda0455c3c64736f6c63430008150033000000000000000000000000bc2beee86f74fe7e86f58d46d2a6c09019be0c3c000000000000000000000000de600c085ce67f756bdab2ad2e6ef3e79768883400000000000000000000000073c369f61c90f03eb0dd172e95c90208a28dc5bc000000000000000000000000b936dcd9035eca0e958f67bd553443dfbc6153d4
Deployed Bytecode
0x60806040526004361061012a5760003560e01c80638da5cb5b116100ab578063c8ced3551161006f578063c8ced3551461032b578063ceeb706614610361578063e3d670d714610381578063f2fde38b146103ae578063fbf7c7df146103ce578063feaf90a5146103e457600080fd5b80638da5cb5b1461028357806391df383f146102a1578063aad2b723146102d5578063b0e21e8a146102f5578063be4d0ae71461030b57600080fd5b80636593c2c9116100f25780636593c2c9146101ea578063668fb6dc1461020a5780636691244a1461022a57806367f568281461024e578063715018a61461026e57600080fd5b8063262d61521461012f5780632eea49d91461016c5780633ccfd60b146101a05780634b236f7c146101b75780635b7633d0146101ca575b600080fd5b34801561013b57600080fd5b5060015461014f906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b34801561017857600080fd5b5061014f7f000000000000000000000000de600c085ce67f756bdab2ad2e6ef3e79768883481565b3480156101ac57600080fd5b506101b5610424565b005b6101b56101c536600461105f565b6104d2565b3480156101d657600080fd5b5060035461014f906001600160a01b031681565b3480156101f657600080fd5b506101b561020536600461112c565b610941565b34801561021657600080fd5b506101b561022536600461112c565b61096b565b34801561023657600080fd5b5061024060025481565b604051908152602001610163565b34801561025a57600080fd5b506101b5610269366004611149565b6109fb565b34801561027a57600080fd5b506101b5610a3f565b34801561028f57600080fd5b506000546001600160a01b031661014f565b3480156102ad57600080fd5b5061014f7f00000000000000000000000073c369f61c90f03eb0dd172e95c90208a28dc5bc81565b3480156102e157600080fd5b506101b56102f036600461112c565b610a53565b34801561030157600080fd5b5061024060075481565b34801561031757600080fd5b506101b561032636600461112c565b610acc565b34801561033757600080fd5b5061014f61034636600461112c565b6005602052600090815260409020546001600160a01b031681565b34801561036d57600080fd5b506101b561037c366004611149565b610ba6565b34801561038d57600080fd5b5061024061039c36600461112c565b60066020526000908152604090205481565b3480156103ba57600080fd5b506101b56103c936600461112c565b610be3565b3480156103da57600080fd5b5061024060045481565b3480156103f057600080fd5b506104046103ff36600461112c565b610c26565b604080516001600160a01b03938416815292909116602083015201610163565b33600090815260066020526040812054908190036104555760405163177b02e160e31b815260040160405180910390fd5b3360008181526006602052604081205561049a907f00000000000000000000000073c369f61c90f03eb0dd172e95c90208a28dc5bc6001600160a01b03169083610c73565b60405181815233907f7084f5476618d8e60b11ef0d7d3f06914655adb8793e28ff7f018d4c76d505d59060200160405180910390a250565b60045434146104f45760405163cd3cb2bb60e01b815260040160405180910390fd5b336000908152600560205260409020546001600160a01b03161561052a57604051621d934160e11b815260040160405180910390fd5b6001600160a01b038316158061054857506001600160a01b03831633145b15610566576040516385b87cb760e01b815260040160405180910390fd5b60035461057d906001600160a01b03168484610c8c565b61059a57604051638baa579f60e01b815260040160405180910390fd5b3360009081526005602052604080822080546001600160a01b0319166001600160a01b0387811691821790925560025492516370a0823160e01b81526004810191909152839260649284927f000000000000000000000000de600c085ce67f756bdab2ad2e6ef3e797688834909116906370a0823190602401602060405180830381865afa158015610630573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106549190611162565b6001600160a01b03808a16600090815260056020526040812054939092101593509091168015610710576002546040516370a0823160e01b81526001600160a01b0383811660048301527f000000000000000000000000de600c085ce67f756bdab2ad2e6ef3e79768883416906370a0823190602401602060405180830381865afa1580156106e7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061070b9190611162565b101591505b82801561071a5750815b15610730576046955060149450600a935061076b565b821561074757604b9550600a9450600f935061076b565b811561075e576032955060239450600f935061076b565b603c9550600f9450601993505b6001600160a01b03811661078a576107838585611191565b9350600094505b600060648560045461079c91906111a4565b6107a691906111bb565b905080600760008282546107ba9190611191565b90915550506001546004546000916001600160a01b0316906387e6b799906107e39085906111dd565b8b6040518363ffffffff1660e01b815260040161080291815260200190565b60206040518083038185885af1158015610820573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906108459190611162565b90506000610853888a611191565b61085d8a846111a4565b61086791906111bb565b9050600061087582846111dd565b6001600160a01b038e166000908152600660205260408120805492935084929091906108a2908490611191565b90915550506001600160a01b038516156108e4576001600160a01b038516600090815260066020526040812080548392906108de908490611191565b90915550505b60408051838152602081018390529081018590526001600160a01b038e169033907fff6b02d4bfd759252877f26a2dcf137d75e02e1d3140d8bb26ea17dafa89f08c9060600160405180910390a350505050505050505050505050565b610949610d36565b600180546001600160a01b0319166001600160a01b0392909216919091179055565b610973610d36565b6007805460009182905560405190916001600160a01b0384169183156108fc0291849190818181858888f193505050501580156109b4573d6000803e3d6000fd5b50604080516001600160a01b0384168152602081018390527f83c65b637de293aee479ad72f844d5293253834df212a6e940913e37150f82e1910160405180910390a15050565b610a03610d36565b60028190556040518181527fa60211d2e967de17aac799b7b27678c7777f131a3990a7b2596a0a88eb96904b906020015b60405180910390a150565b610a47610d36565b610a516000610d63565b565b610a5b610d36565b6001600160a01b038116610a8257604051636b3e763f60e01b815260040160405180910390fd5b600380546001600160a01b0319166001600160a01b0383169081179091556040517f5719a5656c5cfdaafa148ecf366fd3b0a7fae06449ce2a46225977fb7417e29d90600090a250565b610ad4610d36565b60405163c8992e6160e01b81526002604360981b019063c8992e6190610b04906002906001908690600401611206565b600060405180830381600087803b158015610b1e57600080fd5b505af1158015610b32573d6000803e3d6000fd5b50506040516336b91f2b60e01b81526001600160a01b0384166004820152732536fe9ab3f511540f2f9e2ec2a805005c3dd80092506336b91f2b9150602401600060405180830381600087803b158015610b8b57600080fd5b505af1158015610b9f573d6000803e3d6000fd5b5050505050565b610bae610d36565b60048190556040518181527f6bbc57480a46553fa4d156ce702beef5f3ad66303b0ed1a5d4cb44966c6584c390602001610a34565b610beb610d36565b6001600160a01b038116610c1a57604051631e4fbdf760e01b8152600060048201526024015b60405180910390fd5b610c2381610d63565b50565b6001600160a01b038082166000908152600560205260408120549091829116818115610c6957506001600160a01b03808216600090815260056020526040902054165b9094909350915050565b610c876001600160a01b0384168383610db3565b505050565b604080516bffffffffffffffffffffffff19606085901b16602080830191909152825180830360140181526034830184528051908201207f19457468657265756d205369676e6564204d6573736167653a0a333200000000605484015260708084018290528451808503909101815260909093019093528151910120600091906001600160a01b038616610d208286610e05565b6001600160a01b031614925050505b9392505050565b6000546001600160a01b03163314610a515760405163118cdaa760e01b8152336004820152602401610c11565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b179052610c87908490610e85565b600080600080610e1485610ee8565b6040805160008152602081018083528b905260ff8316918101919091526060810184905260808101839052929550909350915060019060a0016020604051602081039080840390855afa158015610e6f573d6000803e3d6000fd5b5050506020604051035193505050505b92915050565b6000610e9a6001600160a01b03841683610f2d565b90508051600014158015610ebf575080806020019051810190610ebd919061124c565b155b15610c8757604051635274afe760e01b81526001600160a01b0384166004820152602401610c11565b60008060008351604114610f0f57604051634be6321b60e01b815260040160405180910390fd5b50505060208101516040820151606090920151909260009190911a90565b6060610d2f8383600084600080856001600160a01b03168486604051610f53919061126e565b60006040518083038185875af1925050503d8060008114610f90576040519150601f19603f3d011682016040523d82523d6000602084013e610f95565b606091505b5091509150610fa5868383610faf565b9695505050505050565b606082610fc457610fbf8261100b565b610d2f565b8151158015610fdb57506001600160a01b0384163b155b1561100457604051639996b31560e01b81526001600160a01b0385166004820152602401610c11565b5080610d2f565b80511561101b5780518082602001fd5b604051630a12f52160e11b815260040160405180910390fd5b6001600160a01b0381168114610c2357600080fd5b634e487b7160e01b600052604160045260246000fd5b60008060006060848603121561107457600080fd5b833561107f81611034565b9250602084013567ffffffffffffffff8082111561109c57600080fd5b818601915086601f8301126110b057600080fd5b8135818111156110c2576110c2611049565b604051601f8201601f19908116603f011681019083821181831017156110ea576110ea611049565b8160405282815289602084870101111561110357600080fd5b826020860160208301376000602084830101528096505050505050604084013590509250925092565b60006020828403121561113e57600080fd5b8135610d2f81611034565b60006020828403121561115b57600080fd5b5035919050565b60006020828403121561117457600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b80820180821115610e7f57610e7f61117b565b8082028115828204841417610e7f57610e7f61117b565b6000826111d857634e487b7160e01b600052601260045260246000fd5b500490565b81810381811115610e7f57610e7f61117b565b634e487b7160e01b600052602160045260246000fd5b606081016003851061121a5761121a6111f0565b8482526002841061122d5761122d6111f0565b60208201939093526001600160a01b0391909116604090910152919050565b60006020828403121561125e57600080fd5b81518015158114610d2f57600080fd5b6000825160005b8181101561128f5760208186018101518583015201611275565b50600092019182525091905056fea264697066735822122070d9c4a59be920745ff2150dad29a2eadd1e38b3899ff07cc1e428cda0455c3c64736f6c63430008150033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000bc2beee86f74fe7e86f58d46d2a6c09019be0c3c000000000000000000000000de600c085ce67f756bdab2ad2e6ef3e79768883400000000000000000000000073c369f61c90f03eb0dd172e95c90208a28dc5bc000000000000000000000000b936dcd9035eca0e958f67bd553443dfbc6153d4
-----Decoded View---------------
Arg [0] : signer (address): 0xbC2BEEe86F74fe7e86f58d46D2A6C09019Be0C3c
Arg [1] : _sole (address): 0xde600C085CE67F756Bdab2aD2E6EF3E797688834
Arg [2] : _ole (address): 0x73c369F61c90f03eb0Dd172e95c90208A28dC5bc
Arg [3] : _zap (address): 0xb936dCd9035eCa0E958F67Bd553443Dfbc6153d4
-----Encoded View---------------
4 Constructor Arguments found :
Arg [0] : 000000000000000000000000bc2beee86f74fe7e86f58d46d2a6c09019be0c3c
Arg [1] : 000000000000000000000000de600c085ce67f756bdab2ad2e6ef3e797688834
Arg [2] : 00000000000000000000000073c369f61c90f03eb0dd172e95c90208a28dc5bc
Arg [3] : 000000000000000000000000b936dcd9035eca0e958f67bd553443dfbc6153d4
Loading...
Loading
Loading...
Loading
Loading...
Loading
Net Worth in USD
$6,082.98
Net Worth in ETH
2.056935
Token Allocations
OLE
79.54%
ETH
20.39%
BNB
0.07%
Multichain Portfolio | 35 Chains
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.