Source Code
Overview
ETH Balance
0 ETH
ETH Value
$0.00View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Cross-Chain Transactions
Loading...
Loading
Contract Source Code Verified (Exact Match)
Contract Name:
FeeHook
Compiler Version
v0.8.26+commit.8a97fa7a
Optimization Enabled:
Yes with 1 runs
Other Settings:
cancun EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT
pragma solidity 0.8.26;
import {IFeeHook} from "src/interfaces/utils/integrations/IFeeHook.sol";
import {IMetaCore} from "src/interfaces/core/IMetaCore.sol";
/**
* @title FeeHook
* @author Spinnaker Labs
* @notice Simple settable fee for PSM
*/
contract FeeHook is IFeeHook {
struct Fee {
bool exists;
uint16 entryFeeInBp;
uint16 exitFeeInBp;
}
IMetaCore metaCore;
mapping(address actor => Fee) public customFee;
constructor(address _metaCore) {
metaCore = IMetaCore(_metaCore);
}
function calcFee(address caller, address stable, uint256 amount, Action action) external view returns (uint256 feeInBP) {
Fee memory fee = customFee[caller];
if (action == Action.DEPOSIT || action == Action.MINT) {
return fee.exists ? fee.entryFeeInBp : 20; // 0.2%
}
return fee.exists ? fee.exitFeeInBp : 35; // 0.35%
}
function setCustomFee(address actor, Fee calldata fee) external {
require(msg.sender == metaCore.owner(), "Not owner");
customFee[actor] = fee;
}
}// SPDX-License-Identifier: MIT
pragma solidity 0.8.26;
interface IFeeHook {
enum Action {
DEPOSIT,
MINT,
WITHDRAW,
REDEEM
}
function calcFee(address caller, address token, uint amount, Action action) external view returns (uint feeInBP);
}// SPDX-License-Identifier: MIT
pragma solidity 0.8.26;
interface IMetaCore {
// ---------------------------------
// Structures
// ---------------------------------
struct FeeInfo {
bool existsForDebtToken;
uint16 debtTokenFee;
}
struct RebalancerFeeInfo {
bool exists;
uint16 entryFee;
uint16 exitFee;
}
// ---------------------------------
// Public constants
// ---------------------------------
function OWNERSHIP_TRANSFER_DELAY() external view returns (uint256);
function DEFAULT_FLASH_LOAN_FEE() external view returns (uint16);
// ---------------------------------
// Public state variables
// ---------------------------------
function debtToken() external view returns (address);
function lspEntryFee() external view returns (uint16);
function lspExitFee() external view returns (uint16);
function interestProtocolShare() external view returns (uint16);
/// @dev Default interest receiver for all PositionManagers, unless overriden in the respective PM
function defaultInterestReceiver() external view returns (address);
function feeReceiver() external view returns (address);
function priceFeed() external view returns (address);
function owner() external view returns (address);
function pendingOwner() external view returns (address);
function ownershipTransferDeadline() external view returns (uint256);
function guardian() external view returns (address);
function paused() external view returns (bool);
function lspBootstrapPeriod() external view returns (uint64);
// ---------------------------------
// External functions
// ---------------------------------
function setFeeReceiver(address _feeReceiver) external;
function setPriceFeed(address _priceFeed) external;
function setGuardian(address _guardian) external;
/**
* @notice Global pause/unpause
* Pausing halts new deposits/borrowing across the protocol
*/
function setPaused(bool _paused) external;
/**
* @notice Extend or change the LSP bootstrap period,
* after which certain protocol mechanics change
*/
function setLspBootstrapPeriod(uint64 _bootstrapPeriod) external;
/**
* @notice Set a custom flash-loan fee for a given periphery contract
* @param _periphery Target contract that will get this custom fee
* @param _debtTokenFee Fee in basis points (bp)
* @param _existsForDebtToken Whether this custom fee is used when the caller = `debtToken`
*/
function setPeripheryFlashLoanFee(address _periphery, uint16 _debtTokenFee, bool _existsForDebtToken) external;
/**
* @notice Begin the ownership transfer process
* @param newOwner The address proposed to be the new owner
*/
function commitTransferOwnership(address newOwner) external;
/**
* @notice Finish the ownership transfer, after the mandatory delay
*/
function acceptTransferOwnership() external;
/**
* @notice Revoke a pending ownership transfer
*/
function revokeTransferOwnership() external;
/**
* @notice Look up a custom flash-loan fee for a specific periphery contract
* @param peripheryContract The contract that might have a custom fee
* @return The flash-loan fee in basis points
*/
function getPeripheryFlashLoanFee(address peripheryContract) external view returns (uint16);
/**
* @notice Set / override entry & exit fees for a special rebalancer contract
*/
function setRebalancerFee(address _rebalancer, uint16 _entryFee, uint16 _exitFee) external;
/**
* @notice Set the LSP entry fee globally
* @param _fee Fee in basis points
*/
function setEntryFee(uint16 _fee) external;
/**
* @notice Set the LSP exit fee globally
* @param _fee Fee in basis points
*/
function setExitFee(uint16 _fee) external;
/**
* @notice Set the interest protocol share globally to all PositionManagers
* @param _interestProtocolShare Share in basis points
*/
function setInterestProtocolShare(uint16 _interestProtocolShare) external;
/**
* @notice Look up the LSP entry fee for a rebalancer
* @param rebalancer Possibly has a special fee
* @return The entry fee in basis points
*/
function getLspEntryFee(address rebalancer) external view returns (uint16);
/**
* @notice Look up the LSP exit fee for a rebalancer
* @param rebalancer Possibly has a special fee
* @return The exit fee in basis points
*/
function getLspExitFee(address rebalancer) external view returns (uint16);
// ---------------------------------
// Events
// ---------------------------------
event NewOwnerCommitted(address indexed owner, address indexed pendingOwner, uint256 deadline);
event NewOwnerAccepted(address indexed oldOwner, address indexed newOwner);
event NewOwnerRevoked(address indexed owner, address indexed revokedOwner);
event FeeReceiverSet(address indexed feeReceiver);
event PriceFeedSet(address indexed priceFeed);
event GuardianSet(address indexed guardian);
event PeripheryFlashLoanFee(address indexed periphery, uint16 debtTokenFee);
event LSPBootstrapPeriodSet(uint64 bootstrapPeriod);
event RebalancerFees(address indexed rebalancer, uint16 entryFee, uint16 exitFee);
event EntryFeeSet(uint16 fee);
event ExitFeeSet(uint16 fee);
event InterestProtocolShareSet(uint16 interestProtocolShare);
event DefaultInterestReceiverSet(address indexed defaultInterestReceiver);
event Paused();
event Unpaused();
}{
"remappings": [
"@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/",
"@openzeppelin-upgradeable/contracts/=lib/openzeppelin-contracts-upgradeable/contracts/",
"solady/=lib/solady/src/",
"@solmate/=lib/solmate/src/",
"@chimera/=lib/chimera/src/",
"forge-std/=lib/forge-std/src/",
"@uniswap/v3-core/=lib/v3-core/",
"@uniswap/v3-periphery/=lib/v3-periphery/",
"@openzeppelin/contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts/",
"chimera/=lib/chimera/src/",
"ds-test/=lib/solmate/lib/ds-test/src/",
"erc4626-tests/=lib/openzeppelin-contracts-upgradeable/lib/erc4626-tests/",
"halmos-cheatcodes/=lib/openzeppelin-contracts-upgradeable/lib/halmos-cheatcodes/src/",
"openzeppelin-contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/",
"openzeppelin-contracts/=lib/openzeppelin-contracts/",
"rewards/=lib/rewards/",
"solmate/=lib/solmate/src/",
"uniswap/=lib/uniswap/",
"v3-core/=lib/v3-core/contracts/",
"v3-periphery/=lib/v3-periphery/contracts/"
],
"optimizer": {
"enabled": true,
"runs": 1
},
"metadata": {
"useLiteralContent": false,
"bytecodeHash": "ipfs",
"appendCBOR": true
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"evmVersion": "cancun",
"viaIR": false
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"address","name":"_metaCore","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"caller","type":"address"},{"internalType":"address","name":"stable","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"enum IFeeHook.Action","name":"action","type":"uint8"}],"name":"calcFee","outputs":[{"internalType":"uint256","name":"feeInBP","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"actor","type":"address"}],"name":"customFee","outputs":[{"internalType":"bool","name":"exists","type":"bool"},{"internalType":"uint16","name":"entryFeeInBp","type":"uint16"},{"internalType":"uint16","name":"exitFeeInBp","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"actor","type":"address"},{"components":[{"internalType":"bool","name":"exists","type":"bool"},{"internalType":"uint16","name":"entryFeeInBp","type":"uint16"},{"internalType":"uint16","name":"exitFeeInBp","type":"uint16"}],"internalType":"struct FeeHook.Fee","name":"fee","type":"tuple"}],"name":"setCustomFee","outputs":[],"stateMutability":"nonpayable","type":"function"}]Contract Creation Code
6080604052348015600e575f80fd5b506040516104c23803806104c2833981016040819052602b91604e565b5f80546001600160a01b0319166001600160a01b03929092169190911790556079565b5f60208284031215605d575f80fd5b81516001600160a01b03811681146072575f80fd5b9392505050565b61043c806100865f395ff3fe608060405234801561000f575f80fd5b506004361061003f575f3560e01c806330d14cdf14610043578063385d2ae2146100585780634d419abc1461007e575b5f80fd5b61005661005136600461029b565b6100d7565b005b61006b6100663660046102d9565b6101c2565b6040519081526020015b60405180910390f35b6100b561008c36600461032c565b60016020525f908152604090205460ff81169061ffff6101008204811691630100000090041683565b60408051931515845261ffff9283166020850152911690820152606001610075565b5f8054906101000a90046001600160a01b03166001600160a01b0316638da5cb5b6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610125573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610149919061034e565b6001600160a01b0316336001600160a01b0316146101995760405162461bcd60e51b81526020600482015260096024820152682737ba1037bbb732b960b91b604482015260640160405180910390fd5b6001600160a01b0382165f90815260016020526040902081906101bc8282610381565b50505050565b6001600160a01b0384165f9081526001602090815260408083208151606081018352905460ff81161515825261ffff6101008204811694830194909452630100000090049092169082015281836003811115610220576102206103f2565b148061023d5750600183600381111561023b5761023b6103f2565b145b1561026157805161024f576014610255565b80602001515b61ffff1691505061027c565b805161026e576023610274565b80604001515b61ffff169150505b949350505050565b6001600160a01b0381168114610298575f80fd5b50565b5f8082840360808112156102ad575f80fd5b83356102b881610284565b92506060601f19820112156102cb575f80fd5b506020830190509250929050565b5f805f80608085870312156102ec575f80fd5b84356102f781610284565b9350602085013561030781610284565b925060408501359150606085013560048110610321575f80fd5b939692955090935050565b5f6020828403121561033c575f80fd5b813561034781610284565b9392505050565b5f6020828403121561035e575f80fd5b815161034781610284565b5f813561ffff8116811461037b575f80fd5b92915050565b8135801515808214610391575f80fd5b8254915060ff811690508060ff19831617835562ffff006103b460208601610369565b60081b16808262ffffff1985161717845564ffff0000006103d760408701610369565b60181b168264ffffffffff1985161782171784555050505050565b634e487b7160e01b5f52602160045260245ffdfea26469706673582212204f700eb084e7adba1900ac4de4b4dcec9683b235674c887ace82419c658cc7a464736f6c634300081a00330000000000000000000000008700af942be2a6e5566306d0ee7bcc5a3a6e0ce8
Deployed Bytecode
0x608060405234801561000f575f80fd5b506004361061003f575f3560e01c806330d14cdf14610043578063385d2ae2146100585780634d419abc1461007e575b5f80fd5b61005661005136600461029b565b6100d7565b005b61006b6100663660046102d9565b6101c2565b6040519081526020015b60405180910390f35b6100b561008c36600461032c565b60016020525f908152604090205460ff81169061ffff6101008204811691630100000090041683565b60408051931515845261ffff9283166020850152911690820152606001610075565b5f8054906101000a90046001600160a01b03166001600160a01b0316638da5cb5b6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610125573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610149919061034e565b6001600160a01b0316336001600160a01b0316146101995760405162461bcd60e51b81526020600482015260096024820152682737ba1037bbb732b960b91b604482015260640160405180910390fd5b6001600160a01b0382165f90815260016020526040902081906101bc8282610381565b50505050565b6001600160a01b0384165f9081526001602090815260408083208151606081018352905460ff81161515825261ffff6101008204811694830194909452630100000090049092169082015281836003811115610220576102206103f2565b148061023d5750600183600381111561023b5761023b6103f2565b145b1561026157805161024f576014610255565b80602001515b61ffff1691505061027c565b805161026e576023610274565b80604001515b61ffff169150505b949350505050565b6001600160a01b0381168114610298575f80fd5b50565b5f8082840360808112156102ad575f80fd5b83356102b881610284565b92506060601f19820112156102cb575f80fd5b506020830190509250929050565b5f805f80608085870312156102ec575f80fd5b84356102f781610284565b9350602085013561030781610284565b925060408501359150606085013560048110610321575f80fd5b939692955090935050565b5f6020828403121561033c575f80fd5b813561034781610284565b9392505050565b5f6020828403121561035e575f80fd5b815161034781610284565b5f813561ffff8116811461037b575f80fd5b92915050565b8135801515808214610391575f80fd5b8254915060ff811690508060ff19831617835562ffff006103b460208601610369565b60081b16808262ffffff1985161717845564ffff0000006103d760408701610369565b60181b168264ffffffffff1985161782171784555050505050565b634e487b7160e01b5f52602160045260245ffdfea26469706673582212204f700eb084e7adba1900ac4de4b4dcec9683b235674c887ace82419c658cc7a464736f6c634300081a0033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
0000000000000000000000008700af942be2a6e5566306d0ee7bcc5a3a6e0ce8
-----Decoded View---------------
Arg [0] : _metaCore (address): 0x8700AF942BE2A6E5566306D0eE7Bcc5a3A6E0ce8
-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 0000000000000000000000008700af942be2a6e5566306d0ee7bcc5a3a6e0ce8
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 34 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|
Loading...
Loading
Loading...
Loading
Loading...
Loading
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.