My Name Tag:
Not Available
[ Download CSV Export ]
Latest 25 internal transaction
[ Download CSV Export ]
Contract Name:
SsovV3FeeStrategy
Compiler Version
v0.8.9+commit.e5eed63a
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (access/Ownable.sol) pragma solidity ^0.8.0; import "../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. * * By default, the owner account will be the one that deploys the contract. 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; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _transferOwnership(_msgSender()); } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(owner() == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing 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 { require(newOwner != address(0), "Ownable: new owner is the zero address"); _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 v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; /** * @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; } }
// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.0; // Contracts import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol"; // Interfaces import {IFeeStrategy} from "../interfaces/IFeeStrategy.sol"; contract SsovV3FeeStrategy is Ownable, IFeeStrategy { struct FeeStructure { /// @dev Purchase Fee in 1e8: x% of the price of the underlying asset * the amount of options being bought uint256 purchaseFeePercentage; /// @dev Settlement Fee in 1e8: x% of the settlement price uint256 settlementFeePercentage; } /// @dev ssov address => FeeStructure mapping(address => FeeStructure) public ssovFeeStructures; /// @notice Emitted on update of a ssov fee structure /// @param ssov address of ssov /// @param feeStructure FeeStructure of the ssov event FeeStructureUpdated(address ssov, FeeStructure feeStructure); /// @notice Update the fee structure of an ssov /// @dev Can only be called by owner /// @param ssov target ssov /// @param feeStructure FeeStructure for the ssov function updateSsovFeeStructure( address ssov, FeeStructure calldata feeStructure ) external onlyOwner { ssovFeeStructures[ssov] = feeStructure; emit FeeStructureUpdated(ssov, feeStructure); } /// @notice Calculate Fees for purchase /// @param price price of underlying in 1e8 precision /// @param strike strike price of the option in 1e8 precision /// @param amount amount of options being bought in 1e18 precision /// @param finalFee in USD in 1e8 precision function calculatePurchaseFees( uint256 price, uint256 strike, uint256 amount ) external view returns (uint256 finalFee) { (uint256 purchaseFeePercentage, ) = getSsovFeeStructure(msg.sender); finalFee = ((purchaseFeePercentage * amount * price) / 1e10) / 1e18; if (price < strike) { uint256 feeMultiplier = (((strike * 100) / (price)) - 100) + 100; finalFee = (feeMultiplier * finalFee) / 100; } } /// @notice Calculate Fees for settlement /// @param pnl PnL of the settlement /// @return finalFee in the precision of pnl function calculateSettlementFees(uint256 pnl) external view returns (uint256 finalFee) { (, uint256 settlementFeePercentage) = getSsovFeeStructure(msg.sender); finalFee = (settlementFeePercentage * pnl) / 1e10; } /// @notice Returns the fee structure of an ssov /// @param ssov target ssov function getSsovFeeStructure(address ssov) public view returns (uint256 purchaseFeePercentage, uint256 settlementFeePercentage) { FeeStructure memory feeStructure = ssovFeeStructures[ssov]; purchaseFeePercentage = feeStructure.purchaseFeePercentage; settlementFeePercentage = feeStructure.settlementFeePercentage; } }
// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.0; interface IFeeStrategy { function calculatePurchaseFees( uint256, uint256, uint256 ) external view returns (uint256); function calculateSettlementFees(uint256) external view returns (uint256); }
{ "evmVersion": "london", "libraries": {}, "metadata": { "bytecodeHash": "ipfs", "useLiteralContent": true }, "optimizer": { "enabled": true, "runs": 200 }, "remappings": [], "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } } }
[{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"ssov","type":"address"},{"components":[{"internalType":"uint256","name":"purchaseFeePercentage","type":"uint256"},{"internalType":"uint256","name":"settlementFeePercentage","type":"uint256"}],"indexed":false,"internalType":"struct SsovV3FeeStrategy.FeeStructure","name":"feeStructure","type":"tuple"}],"name":"FeeStructureUpdated","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":[{"internalType":"uint256","name":"price","type":"uint256"},{"internalType":"uint256","name":"strike","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"calculatePurchaseFees","outputs":[{"internalType":"uint256","name":"finalFee","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"pnl","type":"uint256"}],"name":"calculateSettlementFees","outputs":[{"internalType":"uint256","name":"finalFee","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"ssov","type":"address"}],"name":"getSsovFeeStructure","outputs":[{"internalType":"uint256","name":"purchaseFeePercentage","type":"uint256"},{"internalType":"uint256","name":"settlementFeePercentage","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"ssovFeeStructures","outputs":[{"internalType":"uint256","name":"purchaseFeePercentage","type":"uint256"},{"internalType":"uint256","name":"settlementFeePercentage","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"ssov","type":"address"},{"components":[{"internalType":"uint256","name":"purchaseFeePercentage","type":"uint256"},{"internalType":"uint256","name":"settlementFeePercentage","type":"uint256"}],"internalType":"struct SsovV3FeeStrategy.FeeStructure","name":"feeStructure","type":"tuple"}],"name":"updateSsovFeeStructure","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
608060405234801561001057600080fd5b5061001a3361001f565b61006f565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6105d28061007e6000396000f3fe608060405234801561001057600080fd5b50600436106100885760003560e01c80638da5cb5b1161005b5780638da5cb5b146100fe578063c48ce05b14610119578063e8468ee41461013a578063f2fde38b1461014d57600080fd5b80631d04ad0b1461008d578063439d5409146100ce5780636ee6f129146100e1578063715018a6146100f6575b600080fd5b6100b461009b366004610442565b6001602081905260009182526040909120805491015482565b604080519283526020830191909152015b60405180910390f35b6100b46100dc366004610442565b610160565b6100f46100ef36600461045d565b610193565b005b6100f4610231565b6000546040516001600160a01b0390911681526020016100c5565b61012c61012736600461049c565b610267565b6040519081526020016100c5565b61012c6101483660046104b5565b610298565b6100f461015b366004610442565b61033b565b6001600160a01b031660009081526001602081815260409283902083518085019094528054808552920154920182905291565b6000546001600160a01b031633146101c65760405162461bcd60e51b81526004016101bd906104e1565b60405180910390fd5b6001600160a01b0382166000818152600160208181526040928390208535808255868301359190930181905583519485529084019190915282820152517f1bdfa13a5ea39bcb6e6fec473c574564ea44f5a028138ad811ff41e1542fb5249181900360600190a15050565b6000546001600160a01b0316331461025b5760405162461bcd60e51b81526004016101bd906104e1565b61026560006103d6565b565b60008061027333610160565b91506402540be4009050610287848361052c565b610291919061054b565b9392505050565b6000806102a433610160565b509050670de0b6b3a76400006402540be400866102c1868561052c565b6102cb919061052c565b6102d5919061054b565b6102df919061054b565b9150838510156103335760006064866102f8878361052c565b610302919061054b565b61030c919061056d565b610317906064610584565b90506064610325848361052c565b61032f919061054b565b9250505b509392505050565b6000546001600160a01b031633146103655760405162461bcd60e51b81526004016101bd906104e1565b6001600160a01b0381166103ca5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016101bd565b6103d3816103d6565b50565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b80356001600160a01b038116811461043d57600080fd5b919050565b60006020828403121561045457600080fd5b61029182610426565b600080828403606081121561047157600080fd5b61047a84610426565b92506040601f198201121561048e57600080fd5b506020830190509250929050565b6000602082840312156104ae57600080fd5b5035919050565b6000806000606084860312156104ca57600080fd5b505081359360208301359350604090920135919050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052601160045260246000fd5b600081600019048311821515161561054657610546610516565b500290565b60008261056857634e487b7160e01b600052601260045260246000fd5b500490565b60008282101561057f5761057f610516565b500390565b6000821982111561059757610597610516565b50019056fea2646970667358221220b6bfe2810b0e40bdef3aa00b9cf34d617d0c56afaa5f8edc3ac5c64ecd35a03e64736f6c63430008090033
Age | Block | Fee Address | BC Fee Address | Voting Power | Jailed | Incoming |
---|
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.