Overview
ETH Balance
0 ETH
Eth Value
$0.00Latest 1 from a total of 1 transactions
| Transaction Hash |
Method
|
Block
|
From
|
|
To
|
||||
|---|---|---|---|---|---|---|---|---|---|
| Set Fee Bps Defa... | 14133123 | 1518 days ago | IN | 0 ETH | 0.00502958 |
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Loading...
Loading
Cross-Chain Transactions
Loading...
Loading
Contract Name:
ProtocolFeeTracker
Compiler Version
v0.6.12+commit.27d51765
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: GPL-3.0
/*
This file is part of the Enzyme Protocol.
(c) Enzyme Council <council@enzyme.finance>
For the full license information, please view the LICENSE
file that was distributed with this source code.
*/
pragma solidity 0.6.12;
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "../../utils/FundDeployerOwnerMixin.sol";
import "./IProtocolFeeTracker.sol";
/// @title ProtocolFeeTracker Contract
/// @author Enzyme Council <security@enzyme.finance>
/// @notice The contract responsible for tracking owed protocol fees
contract ProtocolFeeTracker is IProtocolFeeTracker, FundDeployerOwnerMixin {
using SafeMath for uint256;
event InitializedForVault(address vaultProxy);
event FeeBpsDefaultSet(uint256 nextFeeBpsDefault);
event FeeBpsOverrideSetForVault(address indexed vaultProxy, uint256 nextFeeBpsOverride);
event FeePaidForVault(address indexed vaultProxy, uint256 sharesAmount, uint256 secondsPaid);
event LastPaidSetForVault(
address indexed vaultProxy,
uint256 prevTimestamp,
uint256 nextTimestamp
);
uint256 private constant MAX_BPS = 10000;
uint256 private constant SECONDS_IN_YEAR = 31557600; // 60*60*24*365.25
uint256 private feeBpsDefault;
mapping(address => uint256) private vaultProxyToFeeBpsOverride;
mapping(address => uint256) private vaultProxyToLastPaid;
constructor(address _fundDeployer) public FundDeployerOwnerMixin(_fundDeployer) {
// Validate constants
require(
SECONDS_IN_YEAR == (60 * 60 * 24 * 36525) / 100,
"constructor: Incorrect SECONDS_IN_YEAR"
);
}
// EXTERNAL FUNCTIONS
/// @notice Initializes protocol fee tracking for a given VaultProxy
/// @param _vaultProxy The VaultProxy
/// @dev Does not validate whether _vaultProxy is already initialized,
/// as FundDeployer will only do this once
function initializeForVault(address _vaultProxy) external override {
require(msg.sender == getFundDeployer(), "Only the FundDeployer can call this function");
__setLastPaidForVault(_vaultProxy, block.timestamp);
emit InitializedForVault(_vaultProxy);
}
/// @notice Marks the protocol fee as paid for the sender, and gets the amount of shares that
/// should be minted for payment
/// @return sharesDue_ The amount of shares to be minted for payment
/// @dev This trusts the VaultProxy to mint the correct sharesDue_.
/// There is no need to validate that the VaultProxy is still on this release.
function payFee() external override returns (uint256 sharesDue_) {
address vaultProxy = msg.sender;
// VaultProxy is validated during initialization
uint256 lastPaid = getLastPaidForVault(vaultProxy);
if (lastPaid >= block.timestamp) {
return 0;
}
// Not strictly necessary as we trust the FundDeployer to have already initialized the
// VaultProxy, but inexpensive
require(lastPaid > 0, "payFee: VaultProxy not initialized");
uint256 secondsDue = block.timestamp.sub(lastPaid);
sharesDue_ = __calcSharesDueForVault(vaultProxy, secondsDue);
// Even if sharesDue_ is 0, we update the lastPaid timestamp and emit the event
__setLastPaidForVault(vaultProxy, block.timestamp);
emit FeePaidForVault(vaultProxy, sharesDue_, secondsDue);
return sharesDue_;
}
// PUBLIC FUNCTIONS
/// @notice Gets the protocol fee rate (in bps) for a given VaultProxy
/// @param _vaultProxy The VaultProxy
/// @return feeBps_ The protocol fee (in bps)
function getFeeBpsForVault(address _vaultProxy) public view returns (uint256 feeBps_) {
feeBps_ = getFeeBpsOverrideForVault(_vaultProxy);
if (feeBps_ == 0) {
feeBps_ = getFeeBpsDefault();
}
return feeBps_;
}
// PRIVATE FUNCTIONS
/// @dev Helper to calculate the protocol fee shares due for a given VaultProxy
function __calcSharesDueForVault(address _vaultProxy, uint256 _secondsDue)
private
view
returns (uint256 sharesDue_)
{
uint256 sharesSupply = ERC20(_vaultProxy).totalSupply();
uint256 rawSharesDue = sharesSupply
.mul(getFeeBpsForVault(_vaultProxy))
.mul(_secondsDue)
.div(SECONDS_IN_YEAR)
.div(MAX_BPS);
uint256 supplyNetRawSharesDue = sharesSupply.sub(rawSharesDue);
if (supplyNetRawSharesDue == 0) {
return 0;
}
return rawSharesDue.mul(sharesSupply).div(supplyNetRawSharesDue);
}
/// @dev Helper to set the lastPaid timestamp for a given VaultProxy
function __setLastPaidForVault(address _vaultProxy, uint256 _nextTimestamp) private {
vaultProxyToLastPaid[_vaultProxy] = _nextTimestamp;
}
////////////////
// ADMIN ONLY //
////////////////
/// @notice Sets the default protocol fee rate (in bps)
/// @param _nextFeeBpsDefault The default protocol fee rate (in bps) to set
function setFeeBpsDefault(uint256 _nextFeeBpsDefault) external onlyFundDeployerOwner {
require(_nextFeeBpsDefault < MAX_BPS, "setDefaultFeeBps: Exceeds max");
feeBpsDefault = _nextFeeBpsDefault;
emit FeeBpsDefaultSet(_nextFeeBpsDefault);
}
/// @notice Sets a specified protocol fee rate (in bps) for a particular VaultProxy
/// @param _vaultProxy The VaultProxy
/// @param _nextFeeBpsOverride The protocol fee rate (in bps) to set
function setFeeBpsOverrideForVault(address _vaultProxy, uint256 _nextFeeBpsOverride)
external
onlyFundDeployerOwner
{
require(_nextFeeBpsOverride < MAX_BPS, "setFeeBpsOverrideForVault: Exceeds max");
vaultProxyToFeeBpsOverride[_vaultProxy] = _nextFeeBpsOverride;
emit FeeBpsOverrideSetForVault(_vaultProxy, _nextFeeBpsOverride);
}
/// @notice Sets the lastPaid timestamp for a specified VaultProxy
/// @param _vaultProxy The VaultProxy
/// @param _nextTimestamp The lastPaid timestamp to set
function setLastPaidForVault(address _vaultProxy, uint256 _nextTimestamp)
external
onlyFundDeployerOwner
{
uint256 prevTimestamp = getLastPaidForVault(_vaultProxy);
require(prevTimestamp > 0, "setLastPaidForVault: _vaultProxy not initialized");
require(
_nextTimestamp > prevTimestamp || _nextTimestamp > block.timestamp,
"setLastPaidForVault: Can only increase or set a future timestamp"
);
__setLastPaidForVault(_vaultProxy, _nextTimestamp);
emit LastPaidSetForVault(_vaultProxy, prevTimestamp, _nextTimestamp);
}
///////////////////
// STATE GETTERS //
///////////////////
/// @notice Gets the `feeBpsDefault` variable value
/// @return feeBpsDefault_ The `feeBpsDefault` variable value
function getFeeBpsDefault() public view returns (uint256 feeBpsDefault_) {
return feeBpsDefault;
}
/// @notice Gets the feeBpsOverride value for the given VaultProxy
/// @param _vaultProxy The VaultProxy
/// @return feeBpsOverride_ The feeBpsOverride value
function getFeeBpsOverrideForVault(address _vaultProxy)
public
view
returns (uint256 feeBpsOverride_)
{
return vaultProxyToFeeBpsOverride[_vaultProxy];
}
/// @notice Gets the lastPaid value for the given VaultProxy
/// @param _vaultProxy The VaultProxy
/// @return lastPaid_ The lastPaid value
function getLastPaidForVault(address _vaultProxy) public view returns (uint256 lastPaid_) {
return vaultProxyToLastPaid[_vaultProxy];
}
}// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high level programming languages.
* `SafeMath` restores this intuition by reverting the transaction when an
* operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*/
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
uint256 c = a + b;
if (c < a) return (false, 0);
return (true, c);
}
/**
* @dev Returns the substraction of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
if (b > a) return (false, 0);
return (true, a - b);
}
/**
* @dev Returns the multiplication of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
// 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.
*
* _Available since v3.4._
*/
function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
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.
*
* _Available since v3.4._
*/
function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
if (b == 0) return (false, 0);
return (true, a % b);
}
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a, "SafeMath: subtraction overflow");
return a - b;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
*
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) return 0;
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
/**
* @dev Returns the integer division of two unsigned integers, reverting on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
require(b > 0, "SafeMath: division by zero");
return a / b;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* reverting when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
require(b > 0, "SafeMath: modulo by zero");
return a % b;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {trySub}.
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
return a - b;
}
/**
* @dev Returns the integer division of two unsigned integers, reverting with custom message on
* division by zero. The result is rounded towards zero.
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {tryDiv}.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
return a / b;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* reverting with custom message when dividing by zero.
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {tryMod}.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
return a % b;
}
}// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
import "../../utils/Context.sol";
import "./IERC20.sol";
import "../../math/SafeMath.sol";
/**
* @dev Implementation of the {IERC20} interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using {_mint}.
* For a generic mechanism see {ERC20PresetMinterPauser}.
*
* TIP: For a detailed writeup see our guide
* https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How
* to implement supply mechanisms].
*
* We have followed general OpenZeppelin guidelines: functions revert instead
* of returning `false` on failure. This behavior is nonetheless conventional
* and does not conflict with the expectations of ERC20 applications.
*
* Additionally, an {Approval} event is emitted on calls to {transferFrom}.
* This allows applications to reconstruct the allowance for all accounts just
* by listening to said events. Other implementations of the EIP may not emit
* these events, as it isn't required by the specification.
*
* Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
* functions have been added to mitigate the well-known issues around setting
* allowances. See {IERC20-approve}.
*/
contract ERC20 is Context, IERC20 {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
uint8 private _decimals;
/**
* @dev Sets the values for {name} and {symbol}, initializes {decimals} with
* a default value of 18.
*
* To select a different value for {decimals}, use {_setupDecimals}.
*
* All three of these values are immutable: they can only be set once during
* construction.
*/
constructor (string memory name_, string memory symbol_) public {
_name = name_;
_symbol = symbol_;
_decimals = 18;
}
/**
* @dev Returns the name of the token.
*/
function name() public view virtual returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view virtual returns (string memory) {
return _symbol;
}
/**
* @dev Returns the number of decimals used to get its user representation.
* For example, if `decimals` equals `2`, a balance of `505` tokens should
* be displayed to a user as `5,05` (`505 / 10 ** 2`).
*
* Tokens usually opt for a value of 18, imitating the relationship between
* Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} is
* called.
*
* NOTE: This information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* {IERC20-balanceOf} and {IERC20-transfer}.
*/
function decimals() public view virtual returns (uint8) {
return _decimals;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public view virtual override returns (uint256) {
return _totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account) public view virtual override returns (uint256) {
return _balances[account];
}
/**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - `recipient` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
/**
* @dev See {IERC20-allowance}.
*/
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
/**
* @dev See {IERC20-approve}.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
/**
* @dev See {IERC20-transferFrom}.
*
* Emits an {Approval} event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of {ERC20}.
*
* Requirements:
*
* - `sender` and `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
* - the caller must have allowance for ``sender``'s tokens of at least
* `amount`.
*/
function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
/**
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
return true;
}
/**
* @dev Atomically decreases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `spender` must have allowance for the caller of at least
* `subtractedValue`.
*/
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero"));
return true;
}
/**
* @dev Moves tokens `amount` from `sender` to `recipient`.
*
* This is internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* Requirements:
*
* - `sender` cannot be the zero address.
* - `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
*/
function _transfer(address sender, address recipient, uint256 amount) internal virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(sender, recipient, amount);
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
/** @dev Creates `amount` tokens and assigns them to `account`, increasing
* the total supply.
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* Requirements:
*
* - `to` cannot be the zero address.
*/
function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
}
/**
* @dev Destroys `amount` tokens from `account`, reducing the
* total supply.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* Requirements:
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
_balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
/**
* @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.
*
* This internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
function _approve(address owner, address spender, uint256 amount) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
/**
* @dev Sets {decimals} to a value other than the default one of 18.
*
* WARNING: This function should only be called from the constructor. Most
* applications that interact with token contracts will not expect
* {decimals} to ever change, and may work incorrectly if it does.
*/
function _setupDecimals(uint8 decimals_) internal virtual {
_decimals = decimals_;
}
/**
* @dev Hook that is called before any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* will be to transferred to `to`.
* - when `from` is zero, `amount` tokens will be minted for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens will be burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { }
}// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @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 `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, 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 `sender` to `recipient` 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 sender, address recipient, uint256 amount) external returns (bool);
/**
* @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);
}// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <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 GSN 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 payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}// SPDX-License-Identifier: GPL-3.0
/*
This file is part of the Enzyme Protocol.
(c) Enzyme Council <council@enzyme.finance>
For the full license information, please view the LICENSE
file that was distributed with this source code.
*/
pragma solidity 0.6.12;
/// @title IFundDeployer Interface
/// @author Enzyme Council <security@enzyme.finance>
interface IFundDeployer {
function getOwner() external view returns (address);
function hasReconfigurationRequest(address) external view returns (bool);
function isAllowedBuySharesOnBehalfCaller(address) external view returns (bool);
function isAllowedVaultCall(
address,
bytes4,
bytes32
) external view returns (bool);
}// SPDX-License-Identifier: GPL-3.0
/*
This file is part of the Enzyme Protocol.
(c) Enzyme Council <council@enzyme.finance>
For the full license information, please view the LICENSE
file that was distributed with this source code.
*/
pragma solidity 0.6.12;
/// @title IProtocolFeeTracker Interface
/// @author Enzyme Council <security@enzyme.finance>
interface IProtocolFeeTracker {
function initializeForVault(address) external;
function payFee() external returns (uint256);
}// SPDX-License-Identifier: GPL-3.0
/*
This file is part of the Enzyme Protocol.
(c) Enzyme Council <council@enzyme.finance>
For the full license information, please view the LICENSE
file that was distributed with this source code.
*/
pragma solidity 0.6.12;
import "../core/fund-deployer/IFundDeployer.sol";
/// @title FundDeployerOwnerMixin Contract
/// @author Enzyme Council <security@enzyme.finance>
/// @notice A mixin contract that defers ownership to the owner of FundDeployer
abstract contract FundDeployerOwnerMixin {
address internal immutable FUND_DEPLOYER;
modifier onlyFundDeployerOwner() {
require(
msg.sender == getOwner(),
"onlyFundDeployerOwner: Only the FundDeployer owner can call this function"
);
_;
}
constructor(address _fundDeployer) public {
FUND_DEPLOYER = _fundDeployer;
}
/// @notice Gets the owner of this contract
/// @return owner_ The owner
/// @dev Ownership is deferred to the owner of the FundDeployer contract
function getOwner() public view returns (address owner_) {
return IFundDeployer(FUND_DEPLOYER).getOwner();
}
///////////////////
// STATE GETTERS //
///////////////////
/// @notice Gets the `FUND_DEPLOYER` variable
/// @return fundDeployer_ The `FUND_DEPLOYER` variable value
function getFundDeployer() public view returns (address fundDeployer_) {
return FUND_DEPLOYER;
}
}{
"evmVersion": "istanbul",
"libraries": {},
"metadata": {
"bytecodeHash": "ipfs",
"useLiteralContent": true
},
"optimizer": {
"details": {
"constantOptimizer": true,
"cse": true,
"deduplicate": true,
"jumpdestRemover": true,
"orderLiterals": true,
"peephole": true,
"yul": false
},
"runs": 200
},
"remappings": [],
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"address","name":"_fundDeployer","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"nextFeeBpsDefault","type":"uint256"}],"name":"FeeBpsDefaultSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"vaultProxy","type":"address"},{"indexed":false,"internalType":"uint256","name":"nextFeeBpsOverride","type":"uint256"}],"name":"FeeBpsOverrideSetForVault","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"vaultProxy","type":"address"},{"indexed":false,"internalType":"uint256","name":"sharesAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"secondsPaid","type":"uint256"}],"name":"FeePaidForVault","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"vaultProxy","type":"address"}],"name":"InitializedForVault","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"vaultProxy","type":"address"},{"indexed":false,"internalType":"uint256","name":"prevTimestamp","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"nextTimestamp","type":"uint256"}],"name":"LastPaidSetForVault","type":"event"},{"inputs":[],"name":"getFeeBpsDefault","outputs":[{"internalType":"uint256","name":"feeBpsDefault_","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_vaultProxy","type":"address"}],"name":"getFeeBpsForVault","outputs":[{"internalType":"uint256","name":"feeBps_","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_vaultProxy","type":"address"}],"name":"getFeeBpsOverrideForVault","outputs":[{"internalType":"uint256","name":"feeBpsOverride_","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getFundDeployer","outputs":[{"internalType":"address","name":"fundDeployer_","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_vaultProxy","type":"address"}],"name":"getLastPaidForVault","outputs":[{"internalType":"uint256","name":"lastPaid_","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getOwner","outputs":[{"internalType":"address","name":"owner_","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_vaultProxy","type":"address"}],"name":"initializeForVault","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"payFee","outputs":[{"internalType":"uint256","name":"sharesDue_","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_nextFeeBpsDefault","type":"uint256"}],"name":"setFeeBpsDefault","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_vaultProxy","type":"address"},{"internalType":"uint256","name":"_nextFeeBpsOverride","type":"uint256"}],"name":"setFeeBpsOverrideForVault","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_vaultProxy","type":"address"},{"internalType":"uint256","name":"_nextTimestamp","type":"uint256"}],"name":"setLastPaidForVault","outputs":[],"stateMutability":"nonpayable","type":"function"}]Contract Creation Code
60a060405234801561001057600080fd5b50604051610b9d380380610b9d8339818101604052602081101561003357600080fd5b5051606081901b6001600160601b0319166080526001600160a01b0316610b3161006c6000398061055052806105da5250610b316000f3fe608060405234801561001057600080fd5b50600436106100a95760003560e01c806397c0ac871161007157806397c0ac871461015d5780639f17818814610165578063b69f36521461018b578063bcdba20a146101b1578063f033ac56146101b9578063f8fc2961146101e5576100a9565b80630a48e041146100ae578063137e8d9b146100d657806329610252146100f35780637c73c6991461010d578063893d20e814610139575b600080fd5b6100d4600480360360208110156100c457600080fd5b50356001600160a01b031661020b565b005b6100d4600480360360208110156100ec57600080fd5b50356102ab565b6100fb610393565b60408051918252519081900360200190f35b6100d46004803603604081101561012357600080fd5b506001600160a01b038135169060200135610461565b61014161054c565b604080516001600160a01b039092168252519081900360200190f35b6101416105d8565b6100fb6004803603602081101561017b57600080fd5b50356001600160a01b03166105fc565b6100fb600480360360208110156101a157600080fd5b50356001600160a01b031661061b565b6100fb610636565b6100d4600480360360408110156101cf57600080fd5b506001600160a01b03813516906020013561063c565b6100fb600480360360208110156101fb57600080fd5b50356001600160a01b0316610779565b6102136105d8565b6001600160a01b0316336001600160a01b0316146102625760405162461bcd60e51b815260040180806020018281038252602c815260200180610a90602c913960400191505060405180910390fd5b61026c8142610799565b604080516001600160a01b038316815290517fd3ba69979a943b00f5eea9e34dba3f3104dcf0c16890e7d8c693a0d52de074589181900360200190a150565b6102b361054c565b6001600160a01b0316336001600160a01b0316146103025760405162461bcd60e51b81526004018080602001828103825260498152602001806109ae6049913960600191505060405180910390fd5b6127108110610358576040805162461bcd60e51b815260206004820152601d60248201527f73657444656661756c744665654270733a2045786365656473206d6178000000604482015290519081900360640190fd5b60008190556040805182815290517f39c6a3e3a79878fee4b8deeec6702a2c4971f2bdcb4bb41aa2b6cf58c9905e5d9181900360200190a150565b600033816103a08261061b565b90504281106103b45760009250505061045e565b600081116103f35760405162461bcd60e51b81526004018080602001828103825260228152602001806109f76022913960400191505060405180910390fd5b60006103ff42836107b5565b905061040b8382610812565b93506104178342610799565b604080518581526020810183905281516001600160a01b038616927f1e6728e7f6ab409f42c28a298d4691e94f5426e54658999f76770bff70e56eaf928290030190a25050505b90565b61046961054c565b6001600160a01b0316336001600160a01b0316146104b85760405162461bcd60e51b81526004018080602001828103825260498152602001806109ae6049913960600191505060405180910390fd5b61271081106104f85760405162461bcd60e51b8152600401808060200182810382526026815260200180610a196026913960400191505060405180910390fd5b6001600160a01b038216600081815260016020908152604091829020849055815184815291517fb1a79d5ffbf14d3dbd6507eb9ea97f172baa93ff87773c8a9613841bcf3632759281900390910190a25050565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663893d20e86040518163ffffffff1660e01b815260040160206040518083038186803b1580156105a757600080fd5b505afa1580156105bb573d6000803e3d6000fd5b505050506040513d60208110156105d157600080fd5b5051905090565b7f000000000000000000000000000000000000000000000000000000000000000090565b6001600160a01b0381166000908152600160205260409020545b919050565b6001600160a01b031660009081526002602052604090205490565b60005490565b61064461054c565b6001600160a01b0316336001600160a01b0316146106935760405162461bcd60e51b81526004018080602001828103825260498152602001806109ae6049913960600191505060405180910390fd5b600061069e8361061b565b9050600081116106df5760405162461bcd60e51b8152600401808060200182810382526030815260200180610a3f6030913960400191505060405180910390fd5b808211806106ec57504282115b6107275760405162461bcd60e51b8152600401808060200182810382526040815260200180610abc6040913960400191505060405180910390fd5b6107318383610799565b604080518281526020810184905281516001600160a01b038616927fbcfa0c3d77a6e27e439a116566a0dd57d1f2c68d510dc877c6ac541b5275a9cf928290030190a2505050565b6000610784826105fc565b90508061061657610793610636565b92915050565b6001600160a01b03909116600090815260026020526040902055565b60008282111561080c576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b50900390565b600080836001600160a01b03166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b15801561084e57600080fd5b505afa158015610862573d6000803e3d6000fd5b505050506040513d602081101561087857600080fd5b5051905060006108ad6127106108a76301e187e081886108a161089a8c610779565b89906108e6565b906108e6565b90610946565b905060006108bb83836107b5565b9050806108ce5760009350505050610793565b6108dc816108a784866108e6565b9695505050505050565b6000826108f557506000610793565b8282028284828161090257fe5b041461093f5760405162461bcd60e51b8152600401808060200182810382526021815260200180610a6f6021913960400191505060405180910390fd5b9392505050565b600080821161099c576040805162461bcd60e51b815260206004820152601a60248201527f536166654d6174683a206469766973696f6e206279207a65726f000000000000604482015290519081900360640190fd5b8183816109a557fe5b04939250505056fe6f6e6c7946756e644465706c6f7965724f776e65723a204f6e6c79207468652046756e644465706c6f796572206f776e65722063616e2063616c6c20746869732066756e6374696f6e7061794665653a205661756c7450726f7879206e6f7420696e697469616c697a65647365744665654270734f76657272696465466f725661756c743a2045786365656473206d61787365744c61737450616964466f725661756c743a205f7661756c7450726f7879206e6f7420696e697469616c697a6564536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f774f6e6c79207468652046756e644465706c6f7965722063616e2063616c6c20746869732066756e6374696f6e7365744c61737450616964466f725661756c743a2043616e206f6e6c7920696e637265617365206f72207365742061206675747572652074696d657374616d70a2646970667358221220c5af249d575c378a2525025eb403f4be6880c2e9823eb289d190726b0650cb5664736f6c634300060c00330000000000000000000000004f1c53f096533c04d8157efb6bca3eb22ddc6360
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106100a95760003560e01c806397c0ac871161007157806397c0ac871461015d5780639f17818814610165578063b69f36521461018b578063bcdba20a146101b1578063f033ac56146101b9578063f8fc2961146101e5576100a9565b80630a48e041146100ae578063137e8d9b146100d657806329610252146100f35780637c73c6991461010d578063893d20e814610139575b600080fd5b6100d4600480360360208110156100c457600080fd5b50356001600160a01b031661020b565b005b6100d4600480360360208110156100ec57600080fd5b50356102ab565b6100fb610393565b60408051918252519081900360200190f35b6100d46004803603604081101561012357600080fd5b506001600160a01b038135169060200135610461565b61014161054c565b604080516001600160a01b039092168252519081900360200190f35b6101416105d8565b6100fb6004803603602081101561017b57600080fd5b50356001600160a01b03166105fc565b6100fb600480360360208110156101a157600080fd5b50356001600160a01b031661061b565b6100fb610636565b6100d4600480360360408110156101cf57600080fd5b506001600160a01b03813516906020013561063c565b6100fb600480360360208110156101fb57600080fd5b50356001600160a01b0316610779565b6102136105d8565b6001600160a01b0316336001600160a01b0316146102625760405162461bcd60e51b815260040180806020018281038252602c815260200180610a90602c913960400191505060405180910390fd5b61026c8142610799565b604080516001600160a01b038316815290517fd3ba69979a943b00f5eea9e34dba3f3104dcf0c16890e7d8c693a0d52de074589181900360200190a150565b6102b361054c565b6001600160a01b0316336001600160a01b0316146103025760405162461bcd60e51b81526004018080602001828103825260498152602001806109ae6049913960600191505060405180910390fd5b6127108110610358576040805162461bcd60e51b815260206004820152601d60248201527f73657444656661756c744665654270733a2045786365656473206d6178000000604482015290519081900360640190fd5b60008190556040805182815290517f39c6a3e3a79878fee4b8deeec6702a2c4971f2bdcb4bb41aa2b6cf58c9905e5d9181900360200190a150565b600033816103a08261061b565b90504281106103b45760009250505061045e565b600081116103f35760405162461bcd60e51b81526004018080602001828103825260228152602001806109f76022913960400191505060405180910390fd5b60006103ff42836107b5565b905061040b8382610812565b93506104178342610799565b604080518581526020810183905281516001600160a01b038616927f1e6728e7f6ab409f42c28a298d4691e94f5426e54658999f76770bff70e56eaf928290030190a25050505b90565b61046961054c565b6001600160a01b0316336001600160a01b0316146104b85760405162461bcd60e51b81526004018080602001828103825260498152602001806109ae6049913960600191505060405180910390fd5b61271081106104f85760405162461bcd60e51b8152600401808060200182810382526026815260200180610a196026913960400191505060405180910390fd5b6001600160a01b038216600081815260016020908152604091829020849055815184815291517fb1a79d5ffbf14d3dbd6507eb9ea97f172baa93ff87773c8a9613841bcf3632759281900390910190a25050565b60007f0000000000000000000000004f1c53f096533c04d8157efb6bca3eb22ddc63606001600160a01b031663893d20e86040518163ffffffff1660e01b815260040160206040518083038186803b1580156105a757600080fd5b505afa1580156105bb573d6000803e3d6000fd5b505050506040513d60208110156105d157600080fd5b5051905090565b7f0000000000000000000000004f1c53f096533c04d8157efb6bca3eb22ddc636090565b6001600160a01b0381166000908152600160205260409020545b919050565b6001600160a01b031660009081526002602052604090205490565b60005490565b61064461054c565b6001600160a01b0316336001600160a01b0316146106935760405162461bcd60e51b81526004018080602001828103825260498152602001806109ae6049913960600191505060405180910390fd5b600061069e8361061b565b9050600081116106df5760405162461bcd60e51b8152600401808060200182810382526030815260200180610a3f6030913960400191505060405180910390fd5b808211806106ec57504282115b6107275760405162461bcd60e51b8152600401808060200182810382526040815260200180610abc6040913960400191505060405180910390fd5b6107318383610799565b604080518281526020810184905281516001600160a01b038616927fbcfa0c3d77a6e27e439a116566a0dd57d1f2c68d510dc877c6ac541b5275a9cf928290030190a2505050565b6000610784826105fc565b90508061061657610793610636565b92915050565b6001600160a01b03909116600090815260026020526040902055565b60008282111561080c576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b50900390565b600080836001600160a01b03166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b15801561084e57600080fd5b505afa158015610862573d6000803e3d6000fd5b505050506040513d602081101561087857600080fd5b5051905060006108ad6127106108a76301e187e081886108a161089a8c610779565b89906108e6565b906108e6565b90610946565b905060006108bb83836107b5565b9050806108ce5760009350505050610793565b6108dc816108a784866108e6565b9695505050505050565b6000826108f557506000610793565b8282028284828161090257fe5b041461093f5760405162461bcd60e51b8152600401808060200182810382526021815260200180610a6f6021913960400191505060405180910390fd5b9392505050565b600080821161099c576040805162461bcd60e51b815260206004820152601a60248201527f536166654d6174683a206469766973696f6e206279207a65726f000000000000604482015290519081900360640190fd5b8183816109a557fe5b04939250505056fe6f6e6c7946756e644465706c6f7965724f776e65723a204f6e6c79207468652046756e644465706c6f796572206f776e65722063616e2063616c6c20746869732066756e6374696f6e7061794665653a205661756c7450726f7879206e6f7420696e697469616c697a65647365744665654270734f76657272696465466f725661756c743a2045786365656473206d61787365744c61737450616964466f725661756c743a205f7661756c7450726f7879206e6f7420696e697469616c697a6564536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f774f6e6c79207468652046756e644465706c6f7965722063616e2063616c6c20746869732066756e6374696f6e7365744c61737450616964466f725661756c743a2043616e206f6e6c7920696e637265617365206f72207365742061206675747572652074696d657374616d70a2646970667358221220c5af249d575c378a2525025eb403f4be6880c2e9823eb289d190726b0650cb5664736f6c634300060c0033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
0000000000000000000000004f1c53f096533c04d8157efb6bca3eb22ddc6360
-----Decoded View---------------
Arg [0] : _fundDeployer (address): 0x4f1C53F096533C04d8157EFB6Bca3eb22ddC6360
-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 0000000000000000000000004f1c53f096533c04d8157efb6bca3eb22ddc6360
Loading...
Loading
Loading...
Loading
Net Worth in USD
$0.00
Net Worth in ETH
0
Multichain Portfolio | 33 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|
Loading...
Loading
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.