Source Code
Overview
ETH Balance
0 ETH
Eth Value
$0.00Loading...
Loading
Loading...
Loading
Cross-Chain Transactions
Loading...
Loading
Contract Name:
StakeDaoHarvesterFacet
Compiler Version
v0.7.6+commit.7338295f
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.6;
import "../../concentrator/interfaces/IAladdinCompounder.sol";
import "../../concentrator/stakedao/interfaces/IStakeDAOVault.sol";
import "../libraries/LibConcentratorHarvester.sol";
contract StakeDaoHarvesterFacet {
/// @notice Harvest pending rewards from StakeDAOVault contract.
/// @param _vault The address of StakeDAOVault contract.
function harvestStakeDaoVault(address _vault) external {
LibConcentratorHarvester.enforceHasPermission();
IStakeDAOVault(_vault).harvest(msg.sender);
}
/// @notice Harvest pending rewards from StakeDAOVault and corresponding AladdinCompounder contract.
/// @param _vault The address of StakeDAOVault contract.
/// @param _compounder The address of AladdinCompounder contract.
/// @param _minAssets The minimum amount of underlying assets should be harvested.
function harvestStakeDaoVaultAndCompounder(
address _vault,
address _compounder,
uint256 _minAssets
) external {
LibConcentratorHarvester.enforceHasPermission();
IStakeDAOVault(_vault).harvest(msg.sender);
IAladdinCompounder(_compounder).harvest(msg.sender, _minAssets);
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.7.6;
pragma abicoder v2;
import "../../interfaces/ICurveVoteEscrow.sol";
// solhint-disable const-name-snakecase
// solhint-disable no-inline-assembly
// solhint-disable not-rely-on-time
library LibConcentratorHarvester {
/*************
* Constants *
*************/
/// @dev The storage slot for default diamond storage.
bytes32 private constant DIAMOND_STORAGE_POSITION = keccak256("diamond.standard.diamond.storage");
/// @dev The storage slot for harvester storage.
bytes32 private constant HARVESTER_STORAGE_POSITION = keccak256("diamond.harvester.concentrator.storage");
/// @dev The address of veCTR contract.
address internal constant veCTR = 0xe4C09928d834cd58D233CD77B5af3545484B4968;
/***********
* Structs *
***********/
struct FacetAddressAndSelectorPosition {
address facetAddress;
uint16 selectorPosition;
}
struct DiamondStorage {
// function selector => facet address and selector position in selectors array
mapping(bytes4 => FacetAddressAndSelectorPosition) facetAddressAndSelectorPosition;
bytes4[] selectors;
mapping(bytes4 => bool) supportedInterfaces;
// owner of the contract
address contractOwner;
}
struct HarvesterStorage {
uint128 minLockCTR;
uint128 minLockDuration;
mapping(address => bool) whitelist;
mapping(address => bool) blacklist;
}
/**********************
* Internal Functions *
**********************/
function diamondStorage() private pure returns (DiamondStorage storage ds) {
bytes32 position = DIAMOND_STORAGE_POSITION;
assembly {
ds.slot := position
}
}
function harvesterStorage() internal pure returns (HarvesterStorage storage hs) {
bytes32 position = HARVESTER_STORAGE_POSITION;
assembly {
hs.slot := position
}
}
function updatePermission(uint128 _minLockCTR, uint128 _minLockDuration) internal {
HarvesterStorage storage hs = harvesterStorage();
hs.minLockCTR = _minLockCTR;
hs.minLockDuration = _minLockDuration;
}
function updateWhitelist(address _account, bool _status) internal {
HarvesterStorage storage hs = harvesterStorage();
hs.whitelist[_account] = _status;
}
function updateBlacklist(address _account, bool _status) internal {
HarvesterStorage storage hs = harvesterStorage();
hs.blacklist[_account] = _status;
}
function enforceIsContractOwner() internal view {
require(msg.sender == diamondStorage().contractOwner, "only owner");
}
function enforceHasPermission() internal view {
ICurveVoteEscrow.LockedBalance memory _locked = ICurveVoteEscrow(veCTR).locked(msg.sender);
HarvesterStorage storage hs = harvesterStorage();
// check whether is blacklisted
require(!hs.blacklist[msg.sender], "account blacklisted");
// check whether is whitelisted
if (hs.whitelist[msg.sender] || hs.minLockCTR == 0) return;
// check veCTR locking
require(uint128(_locked.amount) >= hs.minLockCTR, "insufficient lock amount");
require(_locked.end >= hs.minLockDuration + block.timestamp, "insufficient lock duration");
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.7.6;
/// @title IAladdinCompounder
/// @notice The interface for AladdinCompounder like aCRV, aFXS, and is also EIP4646 compatible.
interface IAladdinCompounder {
/// @notice Emitted when someone deposits asset into this contract.
/// @dev See https://eips.ethereum.org/EIPS/eip-4626
/// @param sender The address who sends underlying asset.
/// @param owner The address who will receive the pool shares.
/// @param assets The amount of asset deposited.
/// @param shares The amounf of pool shares received.
event Deposit(address indexed sender, address indexed owner, uint256 assets, uint256 shares);
/// @notice Emitted when someone withdraws asset from this contract.
/// @dev See https://eips.ethereum.org/EIPS/eip-4626
/// @param sender The address who call the function.
/// @param receiver The address who will receive the assets.
/// @param owner The address who owns the assets.
/// @param assets The amount of asset withdrawn.
/// @param shares The amounf of pool shares to withdraw.
event Withdraw(
address indexed sender,
address indexed receiver,
address indexed owner,
uint256 assets,
uint256 shares
);
/// @notice Emitted when someone harvests rewards.
/// @param caller The address who call the function.
/// @param recipient The address of account to recieve the harvest bounty.
/// @param assets The total amount of underlying asset harvested.
/// @param platformFee The amount of harvested assets as platform fee.
/// @param harvestBounty The amount of harvested assets as harvest bounty.
event Harvest(
address indexed caller,
address indexed recipient,
uint256 assets,
uint256 platformFee,
uint256 harvestBounty
);
/// @notice Return the address of underlying assert.
/// @dev See https://eips.ethereum.org/EIPS/eip-4626
function asset() external view returns (address assetTokenAddress);
/// @notice Return the total amount of underlying assert mananged by the contract.
/// @dev See https://eips.ethereum.org/EIPS/eip-4626
function totalAssets() external view returns (uint256 totalManagedAssets);
/// @notice Return the amount of pool shares given the amount of asset.
/// @dev See https://eips.ethereum.org/EIPS/eip-4626
/// @param assets The amount of asset to convert.
function convertToShares(uint256 assets) external view returns (uint256 shares);
/// @notice Return the amount of asset given the amount of pool share.
/// @dev See https://eips.ethereum.org/EIPS/eip-4626
/// @param assets The amount of pool shares to convert.
function convertToAssets(uint256 shares) external view returns (uint256 assets);
/// @notice Return the maximum amount of asset that the user can deposit.
/// @dev See https://eips.ethereum.org/EIPS/eip-4626
/// @param receiver The address of user to receive the pool share.
function maxDeposit(address receiver) external view returns (uint256 maxAssets);
/// @notice Return the amount of pool shares will receive, if perform a deposit.
/// @dev See https://eips.ethereum.org/EIPS/eip-4626
/// @param assets The amount of asset to deposit.
function previewDeposit(uint256 assets) external view returns (uint256 shares);
/// @notice Deposit assets into this contract.
/// @dev See https://eips.ethereum.org/EIPS/eip-4626
/// @param assets The amount of asset to deposit.
/// @param receiver The address of account who will receive the pool share.
/// @return shares The amount of pool shares received.
function deposit(uint256 assets, address receiver) external returns (uint256 shares);
/// @notice Return the maximum amount of pool shares that the user can mint.
/// @dev See https://eips.ethereum.org/EIPS/eip-4626
/// @param receiver The address of user to receive the pool share.
function maxMint(address receiver) external view returns (uint256 maxShares);
/// @notice Return the amount of assets needed, if perform a mint.
/// @dev See https://eips.ethereum.org/EIPS/eip-4626
/// @param shares The amount of pool shares to mint.
function previewMint(uint256 shares) external view returns (uint256 assets);
/// @notice Mint pool shares from this contract.
/// @dev See https://eips.ethereum.org/EIPS/eip-4626
/// @param shares The amount of pool shares to mint.
/// @param receiver The address of account who will receive the pool share.
/// @return assets The amount of assets deposited to the contract.
function mint(uint256 shares, address receiver) external returns (uint256 assets);
/// @notice Return the maximum amount of assets that the user can withdraw.
/// @dev See https://eips.ethereum.org/EIPS/eip-4626
/// @param owner The address of user to withdraw from.
function maxWithdraw(address owner) external view returns (uint256 maxAssets);
/// @notice Return the amount of shares needed, if perform a withdraw.
/// @dev See https://eips.ethereum.org/EIPS/eip-4626
/// @param assets The amount of assets to withdraw.
function previewWithdraw(uint256 assets) external view returns (uint256 shares);
/// @notice Withdraw assets from this contract.
/// @dev See https://eips.ethereum.org/EIPS/eip-4626
/// @param assets The amount of assets to withdraw.
/// @param receiver The address of account who will receive the assets.
/// @param owner The address of user to withdraw from.
/// @return shares The amount of pool shares burned.
function withdraw(
uint256 assets,
address receiver,
address owner
) external returns (uint256 shares);
/// @notice Return the maximum amount of pool shares that the user can redeem.
/// @dev See https://eips.ethereum.org/EIPS/eip-4626
/// @param owner The address of user to redeem from.
function maxRedeem(address owner) external view returns (uint256 maxShares);
/// @notice Return the amount of assets to be received, if perform a redeem.
/// @dev See https://eips.ethereum.org/EIPS/eip-4626
/// @param shares The amount of pool shares to redeem.
function previewRedeem(uint256 shares) external view returns (uint256 assets);
/// @notice Redeem assets from this contract.
/// @dev See https://eips.ethereum.org/EIPS/eip-4626
/// @param shares The amount of pool shares to burn.
/// @param receiver The address of account who will receive the assets.
/// @param owner The address of user to withdraw from.
/// @return assets The amount of assets withdrawn.
function redeem(
uint256 shares,
address receiver,
address owner
) external returns (uint256 assets);
/// @notice Harvest rewards and convert to underlying asset.
/// @param recipient The address of account to recieve the harvest bounty.
/// @param minAssets The minimum amount of underlying asset harvested.
/// @return assets The total amount of underlying asset harvested.
function harvest(address recipient, uint256 minAssets) external returns (uint256 assets);
}// SPDX-License-Identifier: MIT
pragma solidity ^0.7.6;
interface IStakeDAOVault {
/// @notice Emitted when user deposit staking token to the contract.
/// @param _owner The address of the owner of the staking token.
/// @param _recipient The address of the recipient of the staking token.
/// @param _amount The amount of staking token deposited.
event Deposit(address indexed _owner, address indexed _recipient, uint256 _amount);
/// @notice Emitted when user withdraw staking token from the contract.
/// @param _owner The address of the owner of the staking token.
/// @param _recipient The address of the recipient of the staking token.
/// @param _amount The amount of staking token withdrawn.
/// @param _fee The amount of withdraw fee.
event Withdraw(address indexed _owner, address indexed _recipient, uint256 _amount, uint256 _fee);
/// @notice Emitted when user claim pending rewards from the contract.
/// @param _owner The address of the owner of the staking token.
/// @param _recipient The address of the recipient of the pending rewards.
/// @param _amounts The list of pending reward amounts.
event Claim(address indexed _owner, address indexed _recipient, uint256[] _amounts);
/// @notice Emitted when someone harvest pending rewards.
/// @param _caller The address of the caller.
/// @param _rewards The list of harvested rewards.
/// @param _bounties The list of harvest bounty given to caller.
/// @param _platformFees The list of platform fee taken.
/// @param _boostFee The amount SDT for veSDT boost delegation fee.
event Harvest(
address indexed _caller,
uint256[] _rewards,
uint256[] _bounties,
uint256[] _platformFees,
uint256 _boostFee
);
/// @notice Return the amount of staking token staked in the contract.
function totalSupply() external view returns (uint256);
/// @notice Return the amount of staking token staked in the contract for some user.
/// @param _user The address of user to query.
function balanceOf(address _user) external view returns (uint256);
/// @notice Deposit some staking token to the contract.
/// @dev use `_amount=-1` to deposit all tokens.
/// @param _amount The amount of staking token to deposit.
/// @param _recipient The address of recipient who will receive the deposited staking token.
function deposit(uint256 _amount, address _recipient) external;
/// @notice Withdraw some staking token from the contract.
/// @dev use `_amount=-1` to withdraw all tokens.
/// @param _amount The amount of staking token to withdraw.
/// @param _recipient The address of recipient who will receive the withdrawn staking token.
function withdraw(uint256 _amount, address _recipient) external;
/// @notice Claim all pending rewards from some user.
/// @param _user The address of user to claim.
/// @param _recipient The address of recipient who will receive the rewards.
/// @return _amounts The list of amount of rewards claimed.
function claim(address _user, address _recipient) external returns (uint256[] memory _amounts);
/// @notice Harvest pending reward from the contract.
/// @param _recipient The address of recipient who will receive the harvest bounty.
function harvest(address _recipient) external;
/// @notice Update the user information.
/// @param _user The address of user to update.
function checkpoint(address _user) external;
}// SPDX-License-Identifier: MIT
pragma solidity ^0.7.6;
pragma abicoder v2;
// solhint-disable func-name-mixedcase
// solhint-disable var-name-mixedcase
interface ICurveVoteEscrow {
struct LockedBalance {
int128 amount;
uint256 end;
}
/// @notice Deposit `_value` tokens for `msg.sender` and lock until `_unlock_time`
/// @param _value Amount to deposit
/// @param _unlock_time Epoch time when tokens unlock, rounded down to whole weeks
function create_lock(uint256 _value, uint256 _unlock_time) external;
/// @notice Deposit `_value` additional tokens for `msg.sender` without modifying the unlock time
/// @param _value Amount of tokens to deposit and add to the lock
function increase_amount(uint256 _value) external;
/// @notice Extend the unlock time for `msg.sender` to `_unlock_time`
/// @param _unlock_time New epoch time for unlocking
function increase_unlock_time(uint256 _unlock_time) external;
/// @notice Withdraw all tokens for `msg.sender`
/// @dev Only possible if the lock has expired
function withdraw() external;
/// @notice Get timestamp when `_addr`'s lock finishes
/// @param _addr User wallet
/// @return Epoch time of the lock end
function locked__end(address _addr) external view returns (uint256);
function locked(address _addr) external view returns (LockedBalance memory);
}{
"optimizer": {
"enabled": true,
"runs": 200
},
"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":"_vault","type":"address"}],"name":"harvestStakeDaoVault","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_vault","type":"address"},{"internalType":"address","name":"_compounder","type":"address"},{"internalType":"uint256","name":"_minAssets","type":"uint256"}],"name":"harvestStakeDaoVaultAndCompounder","outputs":[],"stateMutability":"nonpayable","type":"function"}]Contract Creation Code
608060405234801561001057600080fd5b506104b9806100206000396000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c8063a486d5321461003b578063b0af875814610073575b600080fd5b6100716004803603606081101561005157600080fd5b506001600160a01b03813581169160208101359091169060400135610099565b005b6100716004803603602081101561008957600080fd5b50356001600160a01b0316610180565b6100a16101e3565b6040805163072e008f60e11b815233600482015290516001600160a01b03851691630e5c011e91602480830192600092919082900301818387803b1580156100e857600080fd5b505af11580156100fc573d6000803e3d6000fd5b50506040805163018ee9b760e01b81523360048201526024810185905290516001600160a01b038616935063018ee9b7925060448083019260209291908290030181600087803b15801561014f57600080fd5b505af1158015610163573d6000803e3d6000fd5b505050506040513d602081101561017957600080fd5b5050505050565b6101886101e3565b6040805163072e008f60e11b815233600482015290516001600160a01b03831691630e5c011e91602480830192600092919082900301818387803b1580156101cf57600080fd5b505af1158015610179573d6000803e3d6000fd5b60405163cbf9fe5f60e01b815260009073e4c09928d834cd58d233cd77b5af3545484b49689063cbf9fe5f9061021d9033906004016103d4565b604080518083038186803b15801561023457600080fd5b505afa158015610248573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061026c919061037d565b90506000610278610359565b33600090815260028201602052604090205490915060ff16156102b65760405162461bcd60e51b81526004016102ad906103e8565b60405180910390fd5b33600090815260018201602052604090205460ff16806102de575080546001600160801b0316155b156102ea575050610357565b805482516001600160801b03918216911610156103195760405162461bcd60e51b81526004016102ad90610415565b805460208301516001600160801b03600160801b90920491909116420111156103545760405162461bcd60e51b81526004016102ad9061044c565b50505b565b7f7b3d7c6d072f5ba80c1b8069e5afa5580d5083ebf8116656029468cd718daac790565b60006040828403121561038e578081fd5b6040516040810181811067ffffffffffffffff821117156103ab57fe5b6040528251600f81900b81146103bf578283fd5b81526020928301519281019290925250919050565b6001600160a01b0391909116815260200190565b6020808252601390820152721858d8dbdd5b9d08189b1858dadb1a5cdd1959606a1b604082015260600190565b60208082526018908201527f696e73756666696369656e74206c6f636b20616d6f756e740000000000000000604082015260600190565b6020808252601a908201527f696e73756666696369656e74206c6f636b206475726174696f6e00000000000060408201526060019056fea264697066735822122026be5a1542e252845deadfc6e6dbcd54b9cad89a5d4a13a0efdcc024dce2b19464736f6c63430007060033
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106100365760003560e01c8063a486d5321461003b578063b0af875814610073575b600080fd5b6100716004803603606081101561005157600080fd5b506001600160a01b03813581169160208101359091169060400135610099565b005b6100716004803603602081101561008957600080fd5b50356001600160a01b0316610180565b6100a16101e3565b6040805163072e008f60e11b815233600482015290516001600160a01b03851691630e5c011e91602480830192600092919082900301818387803b1580156100e857600080fd5b505af11580156100fc573d6000803e3d6000fd5b50506040805163018ee9b760e01b81523360048201526024810185905290516001600160a01b038616935063018ee9b7925060448083019260209291908290030181600087803b15801561014f57600080fd5b505af1158015610163573d6000803e3d6000fd5b505050506040513d602081101561017957600080fd5b5050505050565b6101886101e3565b6040805163072e008f60e11b815233600482015290516001600160a01b03831691630e5c011e91602480830192600092919082900301818387803b1580156101cf57600080fd5b505af1158015610179573d6000803e3d6000fd5b60405163cbf9fe5f60e01b815260009073e4c09928d834cd58d233cd77b5af3545484b49689063cbf9fe5f9061021d9033906004016103d4565b604080518083038186803b15801561023457600080fd5b505afa158015610248573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061026c919061037d565b90506000610278610359565b33600090815260028201602052604090205490915060ff16156102b65760405162461bcd60e51b81526004016102ad906103e8565b60405180910390fd5b33600090815260018201602052604090205460ff16806102de575080546001600160801b0316155b156102ea575050610357565b805482516001600160801b03918216911610156103195760405162461bcd60e51b81526004016102ad90610415565b805460208301516001600160801b03600160801b90920491909116420111156103545760405162461bcd60e51b81526004016102ad9061044c565b50505b565b7f7b3d7c6d072f5ba80c1b8069e5afa5580d5083ebf8116656029468cd718daac790565b60006040828403121561038e578081fd5b6040516040810181811067ffffffffffffffff821117156103ab57fe5b6040528251600f81900b81146103bf578283fd5b81526020928301519281019290925250919050565b6001600160a01b0391909116815260200190565b6020808252601390820152721858d8dbdd5b9d08189b1858dadb1a5cdd1959606a1b604082015260600190565b60208082526018908201527f696e73756666696369656e74206c6f636b20616d6f756e740000000000000000604082015260600190565b6020808252601a908201527f696e73756666696369656e74206c6f636b206475726174696f6e00000000000060408201526060019056fea264697066735822122026be5a1542e252845deadfc6e6dbcd54b9cad89a5d4a13a0efdcc024dce2b19464736f6c63430007060033
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
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.