Overview
S Balance
0 S
S Value
-More Info
Private Name Tags
ContractCreator
Latest 1 from a total of 1 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Register Option ... | 1791673 | 13 days ago | IN | 0 S | 0.00007399 |
Loading...
Loading
Contract Source Code Verified (Exact Match)
Contract Name:
ClammFeeStrategyV2
Compiler Version
v0.8.26+commit.8a97fa7a
Optimization Enabled:
Yes with 200 runs
Other Settings:
shanghai EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.13; // Interfaces import {IClammFeeStrategyV2} from "./IClammFeeStrategyV2.sol"; // Contracts import {Ownable} from "openzeppelin-contracts/contracts/access/Ownable.sol"; contract ClammFeeStrategyV2 is IClammFeeStrategyV2, Ownable { /// @dev Option Market address => bool (is registered or not) mapping(address => bool) public registeredOptionMarkets; /// @dev Option Market address => Fee Percentage (fee percentage on premium) mapping(address => uint256) public feePercentages; /// @dev The precision in which fee percent is set (fee percent should always be divided by 1e6 to get the correct vaue) uint256 public constant FEE_PERCENT_PRECISION = 1e4; constructor() Ownable(msg.sender) {} /// @notice Registers an option market with the fee strategy /// @dev Can only be called by owner. /// @param _optionMarket Address of the option market /// @param _feePercentage Fee percentage function registerOptionMarket(address _optionMarket, uint256 _feePercentage) external onlyOwner { registeredOptionMarkets[_optionMarket] = true; updateFees(_optionMarket, _feePercentage); emit OptionMarketRegistered(_optionMarket); } /// @notice Updates the fee struct of an option market /// @dev Can only be called by owner. /// @param _optionMarket Address of the option market /// @param _feePercentage Fee percentage function updateFees(address _optionMarket, uint256 _feePercentage) public onlyOwner { require(_feePercentage < FEE_PERCENT_PRECISION * 100, "Fee percentage cannot be 100% or more"); feePercentages[_optionMarket] = _feePercentage; emit FeeUpdate(_optionMarket, _feePercentage); } /// @inheritdoc IClammFeeStrategyV2 function onFeeReqReceive(address _optionMarket, uint256, uint256 _premium) external view returns (uint256 fee) { uint256 feePercentage = feePercentages[_optionMarket]; if (!registeredOptionMarkets[_optionMarket]) { revert OptionMarketNotRegistered(_optionMarket); } fee = (feePercentage * _premium) / (FEE_PERCENT_PRECISION * 100); } error OptionMarketNotRegistered(address optionMarket); event OptionMarketRegistered(address optionMarket); event FeeUpdate(address optionMarket, uint256 feePercentages); }
// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.13; interface IClammFeeStrategyV2 { /// @notice Computes the fee for an option purchase on CLAMM /// @param _optionMarket Address of the option market /// @param _amount Notional Amount /// @param _premium Total premium being charged for the option purchase /// @return fee the computed fee function onFeeReqReceive(address _optionMarket, uint256 _amount, uint256 _premium) external view returns (uint256 fee); }
// 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.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; } }
{ "remappings": [ "@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/", "ds-test/=lib/openzeppelin-contracts/lib/forge-std/lib/ds-test/src/", "erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/", "forge-std/=lib/forge-std/src/", "openzeppelin-contracts/=lib/openzeppelin-contracts/", "v3-core/=lib/v3-core/contracts/", "v3-periphery/=lib/v3-periphery/contracts/", "@uniswap/v3-core/=lib/v3-core/", "@uniswap/v3-periphery/=lib/v3-periphery/", "@openzeppelin/=lib/openzeppelin-contracts/" ], "optimizer": { "enabled": true, "runs": 200 }, "metadata": { "useLiteralContent": false, "bytecodeHash": "ipfs", "appendCBOR": true }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "evmVersion": "shanghai", "viaIR": false, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"optionMarket","type":"address"}],"name":"OptionMarketNotRegistered","type":"error"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"OwnableInvalidOwner","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"OwnableUnauthorizedAccount","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"optionMarket","type":"address"},{"indexed":false,"internalType":"uint256","name":"feePercentages","type":"uint256"}],"name":"FeeUpdate","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"optionMarket","type":"address"}],"name":"OptionMarketRegistered","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"},{"inputs":[],"name":"FEE_PERCENT_PRECISION","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"feePercentages","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_optionMarket","type":"address"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"_premium","type":"uint256"}],"name":"onFeeReqReceive","outputs":[{"internalType":"uint256","name":"fee","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_optionMarket","type":"address"},{"internalType":"uint256","name":"_feePercentage","type":"uint256"}],"name":"registerOptionMarket","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"registeredOptionMarkets","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_optionMarket","type":"address"},{"internalType":"uint256","name":"_feePercentage","type":"uint256"}],"name":"updateFees","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
6080604052348015600e575f80fd5b503380603357604051631e4fbdf760e01b81525f600482015260240160405180910390fd5b603a81603f565b50608e565b5f80546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6105038061009b5f395ff3fe608060405234801561000f575f80fd5b5060043610610090575f3560e01c8063766990951161006357806376699095146101155780638da5cb5b1461012857806395958ab514610142578063a7fa088b14610155578063f2fde38b1461015e575f80fd5b80630b964988146100945780634328ea43146100c657806356c2d309146100f8578063715018a61461010d575b5f80fd5b6100b36100a236600461040d565b60026020525f908152604090205481565b6040519081526020015b60405180910390f35b6100e86100d436600461040d565b60016020525f908152604090205460ff1681565b60405190151581526020016100bd565b61010b61010636600461042d565b610171565b005b61010b6101e9565b6100b3610123366004610455565b6101fc565b5f546040516001600160a01b0390911681526020016100bd565b61010b61015036600461042d565b610279565b6100b361271081565b61010b61016c36600461040d565b61033a565b610179610377565b6001600160a01b0382165f908152600160208190526040909120805460ff191690911790556101a88282610279565b6040516001600160a01b03831681527f969cf6acb76f10dc15d6ac6a3d7e9ef65e8680dcfe5f4fb9b73624067dc49543906020015b60405180910390a15050565b6101f1610377565b6101fa5f6103a3565b565b6001600160a01b0383165f90815260026020908152604080832054600190925282205460ff1661024f5760405163010e87b960e51b81526001600160a01b03861660048201526024015b60405180910390fd5b61025c6127106064610485565b6102668483610485565b61027091906104ae565b95945050505050565b610281610377565b61028e6127106064610485565b81106102ea5760405162461bcd60e51b815260206004820152602560248201527f4665652070657263656e746167652063616e6e6f742062652031303025206f72604482015264206d6f726560d81b6064820152608401610246565b6001600160a01b0382165f81815260026020908152604091829020849055815192835282018390527fa12973bd1c09e4ec46288dc2a7ccb9b337e197c7ffad7a179ecae62a90830afd91016101dd565b610342610377565b6001600160a01b03811661036b57604051631e4fbdf760e01b81525f6004820152602401610246565b610374816103a3565b50565b5f546001600160a01b031633146101fa5760405163118cdaa760e01b8152336004820152602401610246565b5f80546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b80356001600160a01b0381168114610408575f80fd5b919050565b5f6020828403121561041d575f80fd5b610426826103f2565b9392505050565b5f806040838503121561043e575f80fd5b610447836103f2565b946020939093013593505050565b5f805f60608486031215610467575f80fd5b610470846103f2565b95602085013595506040909401359392505050565b80820281158282048414176104a857634e487b7160e01b5f52601160045260245ffd5b92915050565b5f826104c857634e487b7160e01b5f52601260045260245ffd5b50049056fea26469706673582212209da4a88990734ccc74b0305ac1c62f08954cdd6c356d0bff7da2921748d8693264736f6c634300081a0033
Deployed Bytecode
0x608060405234801561000f575f80fd5b5060043610610090575f3560e01c8063766990951161006357806376699095146101155780638da5cb5b1461012857806395958ab514610142578063a7fa088b14610155578063f2fde38b1461015e575f80fd5b80630b964988146100945780634328ea43146100c657806356c2d309146100f8578063715018a61461010d575b5f80fd5b6100b36100a236600461040d565b60026020525f908152604090205481565b6040519081526020015b60405180910390f35b6100e86100d436600461040d565b60016020525f908152604090205460ff1681565b60405190151581526020016100bd565b61010b61010636600461042d565b610171565b005b61010b6101e9565b6100b3610123366004610455565b6101fc565b5f546040516001600160a01b0390911681526020016100bd565b61010b61015036600461042d565b610279565b6100b361271081565b61010b61016c36600461040d565b61033a565b610179610377565b6001600160a01b0382165f908152600160208190526040909120805460ff191690911790556101a88282610279565b6040516001600160a01b03831681527f969cf6acb76f10dc15d6ac6a3d7e9ef65e8680dcfe5f4fb9b73624067dc49543906020015b60405180910390a15050565b6101f1610377565b6101fa5f6103a3565b565b6001600160a01b0383165f90815260026020908152604080832054600190925282205460ff1661024f5760405163010e87b960e51b81526001600160a01b03861660048201526024015b60405180910390fd5b61025c6127106064610485565b6102668483610485565b61027091906104ae565b95945050505050565b610281610377565b61028e6127106064610485565b81106102ea5760405162461bcd60e51b815260206004820152602560248201527f4665652070657263656e746167652063616e6e6f742062652031303025206f72604482015264206d6f726560d81b6064820152608401610246565b6001600160a01b0382165f81815260026020908152604091829020849055815192835282018390527fa12973bd1c09e4ec46288dc2a7ccb9b337e197c7ffad7a179ecae62a90830afd91016101dd565b610342610377565b6001600160a01b03811661036b57604051631e4fbdf760e01b81525f6004820152602401610246565b610374816103a3565b50565b5f546001600160a01b031633146101fa5760405163118cdaa760e01b8152336004820152602401610246565b5f80546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b80356001600160a01b0381168114610408575f80fd5b919050565b5f6020828403121561041d575f80fd5b610426826103f2565b9392505050565b5f806040838503121561043e575f80fd5b610447836103f2565b946020939093013593505050565b5f805f60608486031215610467575f80fd5b610470846103f2565b95602085013595506040909401359392505050565b80820281158282048414176104a857634e487b7160e01b5f52601160045260245ffd5b92915050565b5f826104c857634e487b7160e01b5f52601260045260245ffd5b50049056fea26469706673582212209da4a88990734ccc74b0305ac1c62f08954cdd6c356d0bff7da2921748d8693264736f6c634300081a0033
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
[ 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.