More Info
Private Name Tags
ContractCreator
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Latest 1 internal transaction
Parent Transaction Hash | Block | From | To | |||
---|---|---|---|---|---|---|
6708384 | 307 days ago | Contract Creation | 0 ETH |
Loading...
Loading
Similar Match Source Code This contract matches the deployed Bytecode of the Source Code for Contract 0x2E97a660...051fb4e12 The constructor portion of the code might be different and could alter the actual behaviour of the contract
Contract Name:
PairFees
Compiler Version
v0.8.23+commit.f704f362
Optimization Enabled:
Yes with 200 runs
Other Settings:
shanghai EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; // Pair Fees contract is used as a 1:1 pair relationship to split out fees, this ensures that the curve does not need to be modified for LP shares contract PairFees { address internal immutable pair; // The pair it is bonded to address internal immutable token0; // token0 of pair, saved localy and statically for gas optimization address internal immutable token1; // Token1 of pair, saved localy and statically for gas optimization uint256 private _reserve0; uint256 private _reserve1; constructor(address _token0, address _token1) { pair = msg.sender; token0 = _token0; token1 = _token1; } function _safeTransfer(address token, address to, uint256 value) internal { if (value != 0) { require(token.code.length != 0); (bool success, bytes memory data) = token.call(abi.encodeWithSelector(IERC20.transfer.selector, to, value)); require(success && (data.length == 0 || abi.decode(data, (bool)))); } } // Allow the pair to transfer fees to users function claimFeesFor(address recipient, uint256 amount0, uint256 amount1) external { require(msg.sender == pair); if (amount0 != 0) { uint256 reserve0 = _reserve0; if (reserve0 >= amount0) { unchecked { _reserve0 = reserve0 - amount0; _safeTransfer(token0, recipient, amount0); } } } if (amount1 != 0) { uint256 reserve1 = _reserve1; if (reserve1 >= amount1) { unchecked { _reserve1 = reserve1 - amount1; _safeTransfer(token1, recipient, amount1); } } } } function notifyFeeAmounts(uint256 amount0, uint256 amount1) external { require(msg.sender == pair); if (amount0 != 0) _reserve0 = _reserve0 + amount0; if (amount1 != 0) _reserve1 = _reserve1 + amount1; } }
// 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); }
{ "optimizer": { "enabled": true, "runs": 200 }, "evmVersion": "shanghai", "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":"_token0","type":"address"},{"internalType":"address","name":"_token1","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount0","type":"uint256"},{"internalType":"uint256","name":"amount1","type":"uint256"}],"name":"claimFeesFor","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount0","type":"uint256"},{"internalType":"uint256","name":"amount1","type":"uint256"}],"name":"notifyFeeAmounts","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Deployed Bytecode
0x608060405234801561000f575f80fd5b5060043610610034575f3560e01c80630ab6d72514610038578063533cf5ce1461004d575b5f80fd5b61004b610046366004610270565b610060565b005b61004b61005b366004610290565b6100c6565b336001600160a01b037f00000000000000000000000044b9d1b49bc6cfaeb9e478a32095d3190a0d79091614610094575f80fd5b81156100aa57815f546100a791906102cd565b5f555b80156100c257806001546100be91906102cd565b6001555b5050565b336001600160a01b037f00000000000000000000000044b9d1b49bc6cfaeb9e478a32095d3190a0d790916146100fa575f80fd5b811561013b575f54828110610139578281035f556101397f00000000000000000000000006efdbff2a14a7c8e15944d1f4a48f9f95f663a48585610183565b505b801561017e5760015481811061017c5781810360015561017c7f00000000000000000000000053000000000000000000000000000000000000048584610183565b505b505050565b801561017e57826001600160a01b03163b5f0361019e575f80fd5b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663a9059cbb60e01b17905291515f928392908716916101f991906102f2565b5f604051808303815f865af19150503d805f8114610232576040519150601f19603f3d011682016040523d82523d5f602084013e610237565b606091505b5091509150818015610261575080511580610261575080806020019051810190610261919061031e565b610269575f80fd5b5050505050565b5f8060408385031215610281575f80fd5b50508035926020909101359150565b5f805f606084860312156102a2575f80fd5b83356001600160a01b03811681146102b8575f80fd5b95602085013595506040909401359392505050565b808201808211156102ec57634e487b7160e01b5f52601160045260245ffd5b92915050565b5f82515f5b8181101561031157602081860181015185830152016102f7565b505f920191825250919050565b5f6020828403121561032e575f80fd5b8151801515811461033d575f80fd5b939250505056fea2646970667358221220ce8b8ed52dd73d28ba2b6bd2eb3ed2f5b22688aca8bf613cf7712664c0833a2764736f6c63430008170033
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.