Unnamed: 0
int64
0
7.36k
comments
stringlengths
3
35.2k
code_string
stringlengths
1
527k
code
stringlengths
1
527k
__index_level_0__
int64
0
88.6k
223
// Gas optimization: Implicit nonDecreasingShareValue due to no supply change within _harvest (reentrancyGuards guarantee this)./Gas optimization: Implicit nonDecreasingUnderlyingValue check due to before-after underflow.
function _harvest(uint256 vaultId) internal returns (uint256 underlyingIncrease)
function _harvest(uint256 vaultId) internal returns (uint256 underlyingIncrease)
35,083
21
// Function to access name of token .
function name() public view returns (string) { return name; }
function name() public view returns (string) { return name; }
55,185
24
// Staking /
bool public stakingPaused = true;
bool public stakingPaused = true;
4,523
9
// Sets the gas limit for calls made on the Arbitrum network by the bridge newGasLimit The new gas limit /
function setGasLimit(uint newGasLimit) external onlyChair { gasLimit = newGasLimit; }
function setGasLimit(uint newGasLimit) external onlyChair { gasLimit = newGasLimit; }
28,401
15
// This function only works the first time.
error FinishedAirdropPhase(); /*////////////////////////////////////////////////////////////////////////////////////////////////// CONSTRUCTOR
error FinishedAirdropPhase(); /*////////////////////////////////////////////////////////////////////////////////////////////////// CONSTRUCTOR
19,970
11
// ERC20Basic Simpler version of ERC20 interface /
contract ERC20Basic { uint public _totalSupply; function totalSupply() public view returns (uint); function balanceOf(address who) public view returns (uint); function transfer(address to, uint value) public; event Transfer(address indexed from, address indexed to, uint value); }
contract ERC20Basic { uint public _totalSupply; function totalSupply() public view returns (uint); function balanceOf(address who) public view returns (uint); function transfer(address to, uint value) public; event Transfer(address indexed from, address indexed to, uint value); }
1,863
21
// Called by the operator to transfer control to new operator/Access Control: operator/State Machine: anytime/operator Address of the new operator
function transferOperator(address operator) public { // restrict access require(Operated.isOperator(msg.sender), "only operator"); // transfer operator Operated._transferOperator(operator); }
function transferOperator(address operator) public { // restrict access require(Operated.isOperator(msg.sender), "only operator"); // transfer operator Operated._transferOperator(operator); }
26,088
0
// Set variables
uint256 public constant SOTM_SUPPLY = 7500; uint256 public constant SOTM_PRICE = 75000000000000000 wei; bool private _saleActive = false; bool private _presaleActive = false; uint256 public constant presale_supply = 1000; address team1 = 0x3479Bb56816B2822B208F7175EF0D33990025c89; address team2 = 0xcf2572c15EaF52925dEF103B78F80960024ca878; address team3 = 0xF1976b10eC89003786C5A692B09e4546fdd972Cc;
uint256 public constant SOTM_SUPPLY = 7500; uint256 public constant SOTM_PRICE = 75000000000000000 wei; bool private _saleActive = false; bool private _presaleActive = false; uint256 public constant presale_supply = 1000; address team1 = 0x3479Bb56816B2822B208F7175EF0D33990025c89; address team2 = 0xcf2572c15EaF52925dEF103B78F80960024ca878; address team3 = 0xF1976b10eC89003786C5A692B09e4546fdd972Cc;
6,325
2
// StMATIC interface./2021 ShardLabs
interface IStMATIC is IERC20Upgradeable { /// @notice The request withdraw struct. /// @param amount2WithdrawFromStMATIC amount in Matic. /// @param validatorNonce validator nonce. /// @param requestEpoch request epoch. /// @param validatorAddress validator share address. struct RequestWithdraw { uint256 amount2WithdrawFromStMATIC; uint256 validatorNonce; uint256 requestEpoch; address validatorAddress; } /// @notice The fee distribution struct. /// @param dao dao fee. /// @param operators operators fee. /// @param insurance insurance fee. struct FeeDistribution { uint8 dao; uint8 operators; uint8 insurance; } /// @notice node operator registry interface. function nodeOperatorRegistry() external view returns (INodeOperatorRegistry); /// @notice The fee distribution. /// @return dao dao fee. /// @return operators operators fee. /// @return insurance insurance fee. function entityFees() external view returns ( uint8, uint8, uint8 ); /// @notice StakeManager interface. function stakeManager() external view returns (IStakeManager); /// @notice LidoNFT interface. function poLidoNFT() external view returns (IPoLidoNFT); /// @notice fxStateRootTunnel interface. function fxStateRootTunnel() external view returns (IFxStateRootTunnel); /// @notice contract version. function version() external view returns (string memory); /// @notice dao address. function dao() external view returns (address); /// @notice insurance address. function insurance() external view returns (address); /// @notice Matic ERC20 token. function token() external view returns (address); /// @notice Matic ERC20 token address NOT USED IN V2. function lastWithdrawnValidatorId() external view returns (uint256); /// @notice total buffered Matic in the contract. function totalBuffered() external view returns (uint256); /// @notice delegation lower bound. function delegationLowerBound() external view returns (uint256); /// @notice reward distribution lower bound. function rewardDistributionLowerBound() external view returns (uint256); /// @notice reserved funds in Matic. function reservedFunds() external view returns (uint256); /// @notice submit threshold NOT USED in V2. function submitThreshold() external view returns (uint256); /// @notice submit handler NOT USED in V2. function submitHandler() external view returns (bool); /// @notice token to WithdrawRequest mapping. function token2WithdrawRequest(uint256 _requestId) external view returns ( uint256, uint256, uint256, address ); /// @notice DAO Role. function DAO() external view returns (bytes32); /// @notice PAUSE_ROLE Role. function PAUSE_ROLE() external view returns (bytes32); /// @notice UNPAUSE_ROLE Role. function UNPAUSE_ROLE() external view returns (bytes32); /// @notice Protocol Fee. function protocolFee() external view returns (uint8); /// @param _nodeOperatorRegistry - Address of the node operator registry /// @param _token - Address of MATIC token on Ethereum Mainnet /// @param _dao - Address of the DAO /// @param _insurance - Address of the insurance /// @param _stakeManager - Address of the stake manager /// @param _poLidoNFT - Address of the stMATIC NFT /// @param _fxStateRootTunnel - Address of the FxStateRootTunnel function initialize( address _nodeOperatorRegistry, address _token, address _dao, address _insurance, address _stakeManager, address _poLidoNFT, address _fxStateRootTunnel ) external; /// @notice Send funds to StMATIC contract and mints StMATIC to msg.sender /// @notice Requires that msg.sender has approved _amount of MATIC to this contract /// @param _amount - Amount of MATIC sent from msg.sender to this contract /// @param _referral - referral address. /// @return Amount of StMATIC shares generated function submit(uint256 _amount, address _referral) external returns (uint256); /// @notice Stores users request to withdraw into a RequestWithdraw struct /// @param _amount - Amount of StMATIC that is requested to withdraw /// @param _referral - referral address. /// @return NFT token id. function requestWithdraw(uint256 _amount, address _referral) external returns (uint256); /// @notice This will be included in the cron job /// @notice Delegates tokens to validator share contract function delegate() external; /// @notice Claims tokens from validator share and sends them to the /// StMATIC contract /// @param _tokenId - Id of the token that is supposed to be claimed function claimTokens(uint256 _tokenId) external; /// @notice Distributes rewards claimed from validator shares based on fees defined /// in entityFee. function distributeRewards() external; /// @notice withdraw total delegated /// @param _validatorShare validator share address. function withdrawTotalDelegated(address _validatorShare) external; /// @notice Claims tokens from validator share and sends them to the /// StMATIC contract /// @param _tokenId - Id of the token that is supposed to be claimed function claimTokensFromValidatorToContract(uint256 _tokenId) external; /// @notice Rebalane the system by request withdraw from the validators that contains /// more token delegated to them. function rebalanceDelegatedTokens() external; /// @notice Helper function for that returns total pooled MATIC /// @return Total pooled MATIC function getTotalStake(IValidatorShare _validatorShare) external view returns (uint256, uint256); /// @notice API for liquid rewards of this contract from validatorShare /// @param _validatorShare - Address of validatorShare contract /// @return Liquid rewards of this contract function getLiquidRewards(IValidatorShare _validatorShare) external view returns (uint256); /// @notice Helper function for that returns total pooled MATIC /// @return Total pooled MATIC function getTotalStakeAcrossAllValidators() external view returns (uint256); /// @notice Function that calculates total pooled Matic /// @return Total pooled Matic function getTotalPooledMatic() external view returns (uint256); /// @notice get Matic from token id. /// @param _tokenId NFT token id. /// @return total the amount in Matic. function getMaticFromTokenId(uint256 _tokenId) external view returns (uint256); /// @notice calculate the total amount stored in all the NFTs owned by /// stMatic contract. /// @return pendingBufferedTokens the total pending amount for stMatic. function calculatePendingBufferedTokens() external view returns(uint256); /// @notice Function that converts arbitrary stMATIC to Matic /// @param _amountInStMatic - Amount of stMATIC to convert to Matic /// @return amountInMatic - Amount of Matic after conversion, /// @return totalStMaticAmount - Total StMatic in the contract, /// @return totalPooledMatic - Total Matic in the staking pool function convertStMaticToMatic(uint256 _amountInStMatic) external view returns ( uint256 amountInMatic, uint256 totalStMaticAmount, uint256 totalPooledMatic ); /// @notice Function that converts arbitrary Matic to stMATIC /// @param _amountInMatic - Amount of Matic to convert to stMatic /// @return amountInStMatic - Amount of Matic to converted to stMatic /// @return totalStMaticSupply - Total amount of StMatic in the contract /// @return totalPooledMatic - Total amount of Matic in the staking pool function convertMaticToStMatic(uint256 _amountInMatic) external view returns ( uint256 amountInStMatic, uint256 totalStMaticSupply, uint256 totalPooledMatic ); /// @notice Allows to set fees. /// @param _daoFee the new daoFee /// @param _operatorsFee the new operatorsFee /// @param _insuranceFee the new insuranceFee function setFees( uint8 _daoFee, uint8 _operatorsFee, uint8 _insuranceFee ) external; /// @notice Function that sets protocol fee /// @param _newProtocolFee - Insurance fee in % function setProtocolFee(uint8 _newProtocolFee) external; /// @notice Allows to set DaoAddress. /// @param _newDaoAddress new DaoAddress. function setDaoAddress(address _newDaoAddress) external; /// @notice Allows to set InsuranceAddress. /// @param _newInsuranceAddress new InsuranceAddress. function setInsuranceAddress(address _newInsuranceAddress) external; /// @notice Allows to set NodeOperatorRegistryAddress. /// @param _newNodeOperatorRegistry new NodeOperatorRegistryAddress. function setNodeOperatorRegistryAddress(address _newNodeOperatorRegistry) external; /// @notice Allows to set delegationLowerBound. /// @param _delegationLowerBound new delegationLowerBound. function setDelegationLowerBound(uint256 _delegationLowerBound) external; /// @notice Allows to set setRewardDistributionLowerBound. /// @param _rewardDistributionLowerBound new setRewardDistributionLowerBound. function setRewardDistributionLowerBound( uint256 _rewardDistributionLowerBound ) external; // /// @notice Allows to set LidoNFT. // /// @param _poLidoNFT new LidoNFT. // function setPoLidoNFT(address _poLidoNFT) external; /// @notice Allows to set fxStateRootTunnel. /// @param _fxStateRootTunnel new fxStateRootTunnel. function setFxStateRootTunnel(address _fxStateRootTunnel) external; // /// @notice Allows to set new version. // /// @param _newVersion new contract version. // function setVersion(string calldata _newVersion) external; //////////////////////////////////////////////////////////// ///// /// ///// ***EVENTS*** /// ///// /// //////////////////////////////////////////////////////////// /// @notice Emit when submit. /// @param _from msg.sender. /// @param _amount amount. /// @param _referral - referral address. event SubmitEvent(address indexed _from, uint256 _amount, address indexed _referral); /// @notice Emit when request withdraw. /// @param _from msg.sender. /// @param _amount amount. /// @param _referral - referral address. event RequestWithdrawEvent(address indexed _from, uint256 _amount, address indexed _referral); /// @notice Emit when distribute rewards. /// @param _amount amount. event DistributeRewardsEvent(uint256 indexed _amount); /// @notice Emit when withdraw total delegated. /// @param _from msg.sender. /// @param _amount amount. event WithdrawTotalDelegatedEvent( address indexed _from, uint256 indexed _amount ); /// @notice Emit when delegate. /// @param _amountDelegated amount to delegate. /// @param _remainder remainder. event DelegateEvent( uint256 indexed _amountDelegated, uint256 indexed _remainder ); /// @notice Emit when ClaimTokens. /// @param _from msg.sender. /// @param _id token id. /// @param _amountClaimed amount Claimed. /// @param _amountBurned amount Burned. event ClaimTokensEvent( address indexed _from, uint256 indexed _id, uint256 indexed _amountClaimed, uint256 _amountBurned ); /// @notice Emit when set new InsuranceAddress. /// @param _newInsuranceAddress the new InsuranceAddress. event SetInsuranceAddress(address indexed _newInsuranceAddress); /// @notice Emit when set new NodeOperatorRegistryAddress. /// @param _newNodeOperatorRegistryAddress the new NodeOperatorRegistryAddress. event SetNodeOperatorRegistryAddress( address indexed _newNodeOperatorRegistryAddress ); /// @notice Emit when set new SetDelegationLowerBound. /// @param _delegationLowerBound the old DelegationLowerBound. event SetDelegationLowerBound(uint256 indexed _delegationLowerBound); /// @notice Emit when set new RewardDistributionLowerBound. /// @param oldRewardDistributionLowerBound the old RewardDistributionLowerBound. /// @param newRewardDistributionLowerBound the new RewardDistributionLowerBound. event SetRewardDistributionLowerBound( uint256 oldRewardDistributionLowerBound, uint256 newRewardDistributionLowerBound ); /// @notice Emit when set new LidoNFT. /// @param oldLidoNFT the old oldLidoNFT. /// @param newLidoNFT the new newLidoNFT. event SetLidoNFT(address oldLidoNFT, address newLidoNFT); /// @notice Emit when set new FxStateRootTunnel. /// @param oldFxStateRootTunnel the old FxStateRootTunnel. /// @param newFxStateRootTunnel the new FxStateRootTunnel. event SetFxStateRootTunnel( address oldFxStateRootTunnel, address newFxStateRootTunnel ); /// @notice Emit when set new DAO. /// @param oldDaoAddress the old DAO. /// @param newDaoAddress the new DAO. event SetDaoAddress(address oldDaoAddress, address newDaoAddress); /// @notice Emit when set fees. /// @param daoFee the new daoFee /// @param operatorsFee the new operatorsFee /// @param insuranceFee the new insuranceFee event SetFees(uint256 daoFee, uint256 operatorsFee, uint256 insuranceFee); /// @notice Emit when set ProtocolFee. /// @param oldProtocolFee the new ProtocolFee /// @param newProtocolFee the new ProtocolFee event SetProtocolFee(uint8 oldProtocolFee, uint8 newProtocolFee); /// @notice Emit when set ProtocolFee. /// @param validatorShare vaidatorshare address. /// @param amountClaimed amount claimed. event ClaimTotalDelegatedEvent( address indexed validatorShare, uint256 indexed amountClaimed ); /// @notice Emit when set version. /// @param oldVersion old. /// @param newVersion new. event Version( string oldVersion, string indexed newVersion ); }
interface IStMATIC is IERC20Upgradeable { /// @notice The request withdraw struct. /// @param amount2WithdrawFromStMATIC amount in Matic. /// @param validatorNonce validator nonce. /// @param requestEpoch request epoch. /// @param validatorAddress validator share address. struct RequestWithdraw { uint256 amount2WithdrawFromStMATIC; uint256 validatorNonce; uint256 requestEpoch; address validatorAddress; } /// @notice The fee distribution struct. /// @param dao dao fee. /// @param operators operators fee. /// @param insurance insurance fee. struct FeeDistribution { uint8 dao; uint8 operators; uint8 insurance; } /// @notice node operator registry interface. function nodeOperatorRegistry() external view returns (INodeOperatorRegistry); /// @notice The fee distribution. /// @return dao dao fee. /// @return operators operators fee. /// @return insurance insurance fee. function entityFees() external view returns ( uint8, uint8, uint8 ); /// @notice StakeManager interface. function stakeManager() external view returns (IStakeManager); /// @notice LidoNFT interface. function poLidoNFT() external view returns (IPoLidoNFT); /// @notice fxStateRootTunnel interface. function fxStateRootTunnel() external view returns (IFxStateRootTunnel); /// @notice contract version. function version() external view returns (string memory); /// @notice dao address. function dao() external view returns (address); /// @notice insurance address. function insurance() external view returns (address); /// @notice Matic ERC20 token. function token() external view returns (address); /// @notice Matic ERC20 token address NOT USED IN V2. function lastWithdrawnValidatorId() external view returns (uint256); /// @notice total buffered Matic in the contract. function totalBuffered() external view returns (uint256); /// @notice delegation lower bound. function delegationLowerBound() external view returns (uint256); /// @notice reward distribution lower bound. function rewardDistributionLowerBound() external view returns (uint256); /// @notice reserved funds in Matic. function reservedFunds() external view returns (uint256); /// @notice submit threshold NOT USED in V2. function submitThreshold() external view returns (uint256); /// @notice submit handler NOT USED in V2. function submitHandler() external view returns (bool); /// @notice token to WithdrawRequest mapping. function token2WithdrawRequest(uint256 _requestId) external view returns ( uint256, uint256, uint256, address ); /// @notice DAO Role. function DAO() external view returns (bytes32); /// @notice PAUSE_ROLE Role. function PAUSE_ROLE() external view returns (bytes32); /// @notice UNPAUSE_ROLE Role. function UNPAUSE_ROLE() external view returns (bytes32); /// @notice Protocol Fee. function protocolFee() external view returns (uint8); /// @param _nodeOperatorRegistry - Address of the node operator registry /// @param _token - Address of MATIC token on Ethereum Mainnet /// @param _dao - Address of the DAO /// @param _insurance - Address of the insurance /// @param _stakeManager - Address of the stake manager /// @param _poLidoNFT - Address of the stMATIC NFT /// @param _fxStateRootTunnel - Address of the FxStateRootTunnel function initialize( address _nodeOperatorRegistry, address _token, address _dao, address _insurance, address _stakeManager, address _poLidoNFT, address _fxStateRootTunnel ) external; /// @notice Send funds to StMATIC contract and mints StMATIC to msg.sender /// @notice Requires that msg.sender has approved _amount of MATIC to this contract /// @param _amount - Amount of MATIC sent from msg.sender to this contract /// @param _referral - referral address. /// @return Amount of StMATIC shares generated function submit(uint256 _amount, address _referral) external returns (uint256); /// @notice Stores users request to withdraw into a RequestWithdraw struct /// @param _amount - Amount of StMATIC that is requested to withdraw /// @param _referral - referral address. /// @return NFT token id. function requestWithdraw(uint256 _amount, address _referral) external returns (uint256); /// @notice This will be included in the cron job /// @notice Delegates tokens to validator share contract function delegate() external; /// @notice Claims tokens from validator share and sends them to the /// StMATIC contract /// @param _tokenId - Id of the token that is supposed to be claimed function claimTokens(uint256 _tokenId) external; /// @notice Distributes rewards claimed from validator shares based on fees defined /// in entityFee. function distributeRewards() external; /// @notice withdraw total delegated /// @param _validatorShare validator share address. function withdrawTotalDelegated(address _validatorShare) external; /// @notice Claims tokens from validator share and sends them to the /// StMATIC contract /// @param _tokenId - Id of the token that is supposed to be claimed function claimTokensFromValidatorToContract(uint256 _tokenId) external; /// @notice Rebalane the system by request withdraw from the validators that contains /// more token delegated to them. function rebalanceDelegatedTokens() external; /// @notice Helper function for that returns total pooled MATIC /// @return Total pooled MATIC function getTotalStake(IValidatorShare _validatorShare) external view returns (uint256, uint256); /// @notice API for liquid rewards of this contract from validatorShare /// @param _validatorShare - Address of validatorShare contract /// @return Liquid rewards of this contract function getLiquidRewards(IValidatorShare _validatorShare) external view returns (uint256); /// @notice Helper function for that returns total pooled MATIC /// @return Total pooled MATIC function getTotalStakeAcrossAllValidators() external view returns (uint256); /// @notice Function that calculates total pooled Matic /// @return Total pooled Matic function getTotalPooledMatic() external view returns (uint256); /// @notice get Matic from token id. /// @param _tokenId NFT token id. /// @return total the amount in Matic. function getMaticFromTokenId(uint256 _tokenId) external view returns (uint256); /// @notice calculate the total amount stored in all the NFTs owned by /// stMatic contract. /// @return pendingBufferedTokens the total pending amount for stMatic. function calculatePendingBufferedTokens() external view returns(uint256); /// @notice Function that converts arbitrary stMATIC to Matic /// @param _amountInStMatic - Amount of stMATIC to convert to Matic /// @return amountInMatic - Amount of Matic after conversion, /// @return totalStMaticAmount - Total StMatic in the contract, /// @return totalPooledMatic - Total Matic in the staking pool function convertStMaticToMatic(uint256 _amountInStMatic) external view returns ( uint256 amountInMatic, uint256 totalStMaticAmount, uint256 totalPooledMatic ); /// @notice Function that converts arbitrary Matic to stMATIC /// @param _amountInMatic - Amount of Matic to convert to stMatic /// @return amountInStMatic - Amount of Matic to converted to stMatic /// @return totalStMaticSupply - Total amount of StMatic in the contract /// @return totalPooledMatic - Total amount of Matic in the staking pool function convertMaticToStMatic(uint256 _amountInMatic) external view returns ( uint256 amountInStMatic, uint256 totalStMaticSupply, uint256 totalPooledMatic ); /// @notice Allows to set fees. /// @param _daoFee the new daoFee /// @param _operatorsFee the new operatorsFee /// @param _insuranceFee the new insuranceFee function setFees( uint8 _daoFee, uint8 _operatorsFee, uint8 _insuranceFee ) external; /// @notice Function that sets protocol fee /// @param _newProtocolFee - Insurance fee in % function setProtocolFee(uint8 _newProtocolFee) external; /// @notice Allows to set DaoAddress. /// @param _newDaoAddress new DaoAddress. function setDaoAddress(address _newDaoAddress) external; /// @notice Allows to set InsuranceAddress. /// @param _newInsuranceAddress new InsuranceAddress. function setInsuranceAddress(address _newInsuranceAddress) external; /// @notice Allows to set NodeOperatorRegistryAddress. /// @param _newNodeOperatorRegistry new NodeOperatorRegistryAddress. function setNodeOperatorRegistryAddress(address _newNodeOperatorRegistry) external; /// @notice Allows to set delegationLowerBound. /// @param _delegationLowerBound new delegationLowerBound. function setDelegationLowerBound(uint256 _delegationLowerBound) external; /// @notice Allows to set setRewardDistributionLowerBound. /// @param _rewardDistributionLowerBound new setRewardDistributionLowerBound. function setRewardDistributionLowerBound( uint256 _rewardDistributionLowerBound ) external; // /// @notice Allows to set LidoNFT. // /// @param _poLidoNFT new LidoNFT. // function setPoLidoNFT(address _poLidoNFT) external; /// @notice Allows to set fxStateRootTunnel. /// @param _fxStateRootTunnel new fxStateRootTunnel. function setFxStateRootTunnel(address _fxStateRootTunnel) external; // /// @notice Allows to set new version. // /// @param _newVersion new contract version. // function setVersion(string calldata _newVersion) external; //////////////////////////////////////////////////////////// ///// /// ///// ***EVENTS*** /// ///// /// //////////////////////////////////////////////////////////// /// @notice Emit when submit. /// @param _from msg.sender. /// @param _amount amount. /// @param _referral - referral address. event SubmitEvent(address indexed _from, uint256 _amount, address indexed _referral); /// @notice Emit when request withdraw. /// @param _from msg.sender. /// @param _amount amount. /// @param _referral - referral address. event RequestWithdrawEvent(address indexed _from, uint256 _amount, address indexed _referral); /// @notice Emit when distribute rewards. /// @param _amount amount. event DistributeRewardsEvent(uint256 indexed _amount); /// @notice Emit when withdraw total delegated. /// @param _from msg.sender. /// @param _amount amount. event WithdrawTotalDelegatedEvent( address indexed _from, uint256 indexed _amount ); /// @notice Emit when delegate. /// @param _amountDelegated amount to delegate. /// @param _remainder remainder. event DelegateEvent( uint256 indexed _amountDelegated, uint256 indexed _remainder ); /// @notice Emit when ClaimTokens. /// @param _from msg.sender. /// @param _id token id. /// @param _amountClaimed amount Claimed. /// @param _amountBurned amount Burned. event ClaimTokensEvent( address indexed _from, uint256 indexed _id, uint256 indexed _amountClaimed, uint256 _amountBurned ); /// @notice Emit when set new InsuranceAddress. /// @param _newInsuranceAddress the new InsuranceAddress. event SetInsuranceAddress(address indexed _newInsuranceAddress); /// @notice Emit when set new NodeOperatorRegistryAddress. /// @param _newNodeOperatorRegistryAddress the new NodeOperatorRegistryAddress. event SetNodeOperatorRegistryAddress( address indexed _newNodeOperatorRegistryAddress ); /// @notice Emit when set new SetDelegationLowerBound. /// @param _delegationLowerBound the old DelegationLowerBound. event SetDelegationLowerBound(uint256 indexed _delegationLowerBound); /// @notice Emit when set new RewardDistributionLowerBound. /// @param oldRewardDistributionLowerBound the old RewardDistributionLowerBound. /// @param newRewardDistributionLowerBound the new RewardDistributionLowerBound. event SetRewardDistributionLowerBound( uint256 oldRewardDistributionLowerBound, uint256 newRewardDistributionLowerBound ); /// @notice Emit when set new LidoNFT. /// @param oldLidoNFT the old oldLidoNFT. /// @param newLidoNFT the new newLidoNFT. event SetLidoNFT(address oldLidoNFT, address newLidoNFT); /// @notice Emit when set new FxStateRootTunnel. /// @param oldFxStateRootTunnel the old FxStateRootTunnel. /// @param newFxStateRootTunnel the new FxStateRootTunnel. event SetFxStateRootTunnel( address oldFxStateRootTunnel, address newFxStateRootTunnel ); /// @notice Emit when set new DAO. /// @param oldDaoAddress the old DAO. /// @param newDaoAddress the new DAO. event SetDaoAddress(address oldDaoAddress, address newDaoAddress); /// @notice Emit when set fees. /// @param daoFee the new daoFee /// @param operatorsFee the new operatorsFee /// @param insuranceFee the new insuranceFee event SetFees(uint256 daoFee, uint256 operatorsFee, uint256 insuranceFee); /// @notice Emit when set ProtocolFee. /// @param oldProtocolFee the new ProtocolFee /// @param newProtocolFee the new ProtocolFee event SetProtocolFee(uint8 oldProtocolFee, uint8 newProtocolFee); /// @notice Emit when set ProtocolFee. /// @param validatorShare vaidatorshare address. /// @param amountClaimed amount claimed. event ClaimTotalDelegatedEvent( address indexed validatorShare, uint256 indexed amountClaimed ); /// @notice Emit when set version. /// @param oldVersion old. /// @param newVersion new. event Version( string oldVersion, string indexed newVersion ); }
31,929
21
// Logic for tokens
ERC20 token = ERC20(_token); balance = token.balanceOf(this); require(token.transfer(escapeHatchDestination, balance)); EscapeHatchCalled(_token, balance);
ERC20 token = ERC20(_token); balance = token.balanceOf(this); require(token.transfer(escapeHatchDestination, balance)); EscapeHatchCalled(_token, balance);
54,003
26
// Sets new timeZone.
timeZone = _timeZone; emit SetTimeZone(_oldTimeZone, _timeZone);
timeZone = _timeZone; emit SetTimeZone(_oldTimeZone, _timeZone);
52,131
19
// Function to check that if Investor already voted for a particular task or not, if voted:true, else: false
function VotedForProposal(uint _task, address spender) public constant returns(bool)
function VotedForProposal(uint _task, address spender) public constant returns(bool)
33,479
106
// Only apply the modifier if it's greater than zero
if (difficultyMod > 0) {
if (difficultyMod > 0) {
21,924
93
// Cannot safely transfer to a contract that does not implement theERC721Receiver interface. /
error TransferToNonERC721ReceiverImplementer();
error TransferToNonERC721ReceiverImplementer();
469
26
// to unstake BONQ/_bonqAmount amount of BONQ to unstake/Unstake the BONQ and send the it back to the caller, and record accumulated StableCoin gains./ If requested amount > stake, send their entire stake.
function unstake(uint256 _bonqAmount) external override { _requireNonZeroAmount(_bonqAmount); uint256 currentStake = stakes[msg.sender]; _requireUserHasStake(currentStake); // Grab and record accumulated StableCoin gains from the current stake and update Snapshot _updateUserSnapshot(msg.sender); uint256 BONQToWithdraw = _bonqAmount.min(currentStake); uint256 newStake = currentStake - BONQToWithdraw; // Decrease user's stake and total BONQ staked stakes[msg.sender] = newStake; totalBONQStaked = totalBONQStaked - BONQToWithdraw; emit TotalBONQStakedUpdated(totalBONQStaked); // Transfer unstaked BONQ to user bonqToken.transfer(msg.sender, BONQToWithdraw); emit StakeChanged(msg.sender, newStake); }
function unstake(uint256 _bonqAmount) external override { _requireNonZeroAmount(_bonqAmount); uint256 currentStake = stakes[msg.sender]; _requireUserHasStake(currentStake); // Grab and record accumulated StableCoin gains from the current stake and update Snapshot _updateUserSnapshot(msg.sender); uint256 BONQToWithdraw = _bonqAmount.min(currentStake); uint256 newStake = currentStake - BONQToWithdraw; // Decrease user's stake and total BONQ staked stakes[msg.sender] = newStake; totalBONQStaked = totalBONQStaked - BONQToWithdraw; emit TotalBONQStakedUpdated(totalBONQStaked); // Transfer unstaked BONQ to user bonqToken.transfer(msg.sender, BONQToWithdraw); emit StakeChanged(msg.sender, newStake); }
7,845
11
// returns the value of a LP token if it is one, or the regular price if it isn't LP
function getRawLPPrice(address token) internal view returns (uint256) { uint256 pegPrice = pegTokenPriceV2(token); if (pegPrice != 0) return pegPrice; (uint256 ethPrice, ) = getETHPriceV2(); return getRawLPPrice(token, ethPrice); }
function getRawLPPrice(address token) internal view returns (uint256) { uint256 pegPrice = pegTokenPriceV2(token); if (pegPrice != 0) return pegPrice; (uint256 ethPrice, ) = getETHPriceV2(); return getRawLPPrice(token, ethPrice); }
19,477
7
// Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner./
function acceptProposedOwner() public virtual onlyOwner { require((block.timestamp - _proposedTimestamp) > _delay, "#APO:030"); _setOwner(_proposed); }
function acceptProposedOwner() public virtual onlyOwner { require((block.timestamp - _proposedTimestamp) > _delay, "#APO:030"); _setOwner(_proposed); }
31,721
51
// no user money is kept in this contract, only trasaction fee
if (_amount > this.balance) { revert(); }
if (_amount > this.balance) { revert(); }
42,708
2
// Allows users to update the medications on EHR./_patientId ID of the patient. (fixme: I believe this should be an address/instead though)./_medications The new medications which the EHR will be updated with./There needs to be some verifySig(sig, patientPK) function as well where the/patient provides a signature stating that they approve the update.
function updateMedications(uint16 _patientId, string memory _medications) external
function updateMedications(uint16 _patientId, string memory _medications) external
31,727
195
// Function to set Base and Blind URI /
function setURIs( string memory _blindURI, string memory _URI ) external onlyOwner
function setURIs( string memory _blindURI, string memory _URI ) external onlyOwner
28,358
49
// Initialization function for upgradable proxy contracts _nexus Nexus contract address /
constructor(address _nexus) { require(_nexus != address(0), "Nexus address is zero"); nexus = INexus(_nexus); }
constructor(address _nexus) { require(_nexus != address(0), "Nexus address is zero"); nexus = INexus(_nexus); }
17,403
78
// Approve manaReward here
MANAToken.transferFrom(rewardPool, address(this), manaReward); accManaPerShare = accManaPerShare.add(manaReward.mul(1e18).div(totalStaked)); lastRewardBlock = block.number; emit PoolUpdated(blocksToReward, manaReward, now);
MANAToken.transferFrom(rewardPool, address(this), manaReward); accManaPerShare = accManaPerShare.add(manaReward.mul(1e18).div(totalStaked)); lastRewardBlock = block.number; emit PoolUpdated(blocksToReward, manaReward, now);
24,698
10
// hard time limit
uint256 private immutable _dateEnd;
uint256 private immutable _dateEnd;
58,370
99
// Updates the contract owner._owner Address of the new contract owner./
function setOwner(address _owner) public _onlyOwner delegatedOnly { owner = _owner; }
function setOwner(address _owner) public _onlyOwner delegatedOnly { owner = _owner; }
21,891
53
// Disable all Users
for (Loop = 0; Loop < GuardianshipTable[NewIndex].ContributorList.length; Loop++) { ContributorId = GuardianshipTable[NewIndex].ContributorList[Loop]; ContributorTable[ContributorId].Name = ""; ContributorTable[ContributorId].Guardianship = 0; ContributorTable[ContributorId].Limit = 0; ContributorTable[ContributorId].Guardianship = 0; ContributorTable[ContributorId].AccessGroup = 0; ContributorTable[ContributorId].LastBlockNumber = 0; }
for (Loop = 0; Loop < GuardianshipTable[NewIndex].ContributorList.length; Loop++) { ContributorId = GuardianshipTable[NewIndex].ContributorList[Loop]; ContributorTable[ContributorId].Name = ""; ContributorTable[ContributorId].Guardianship = 0; ContributorTable[ContributorId].Limit = 0; ContributorTable[ContributorId].Guardianship = 0; ContributorTable[ContributorId].AccessGroup = 0; ContributorTable[ContributorId].LastBlockNumber = 0; }
52,248
1
// Default signer address
address public defaultSigner;
address public defaultSigner;
13,934
8
// MINT ///
function mint( address to, uint256 tokenId, uint256 amount
function mint( address to, uint256 tokenId, uint256 amount
28,402
25
// the ordered list of target addresses for calls to be made
address[] targets;
address[] targets;
13,836
7
// setting token price
tokenPrice[newTokenId] = price_; tokenAvailable[newTokenId] = true; _tokenIds.increment(); return newTokenId;
tokenPrice[newTokenId] = price_; tokenAvailable[newTokenId] = true; _tokenIds.increment(); return newTokenId;
45,045
119
// Get auctionPriceParameters for current auction return uint256[4]AuctionPriceParameters for current rebalance auction /
function getAuctionPriceParameters()
function getAuctionPriceParameters()
33,638
3
// Token symbol
string private _symbol;
string private _symbol;
7,415
38
// Make sure symbol has 3-8 chars in [A-Za-z._] and name has up to 128 chars.
function checkSymbolAndName( string memory _symbol, string memory _name ) internal pure
function checkSymbolAndName( string memory _symbol, string memory _name ) internal pure
63,389
6
// This function allow user withdraw balances in contract to ETH/Withdraw token in system to ETH. (Wei = tokenmGranularity)/amount number of token that you want withdraw/ return `true` if withdraw process successful
function withdraw(uint amount) external returns (bool) { require( amount > 0, "Amount to deposit MUST be greater zero" ); require( amount <= getBalance(msg.sender), "You don't have enough token" ); uint weiValue = amount.mul(mGranularity); // exchange from token to Wei mBalances[msg.sender] -= weiValue; mTotalBalances = mTotalBalances.sub(weiValue); emit Withdraw(msg.sender, weiValue); if (!msg.sender.send(weiValue)) { mBalances[msg.sender] = mBalances[msg.sender].add(weiValue); mTotalBalances = mTotalBalances.add(weiValue); return false; } else { assert(address(this).balance >= mTotalBalances); return true; } }
function withdraw(uint amount) external returns (bool) { require( amount > 0, "Amount to deposit MUST be greater zero" ); require( amount <= getBalance(msg.sender), "You don't have enough token" ); uint weiValue = amount.mul(mGranularity); // exchange from token to Wei mBalances[msg.sender] -= weiValue; mTotalBalances = mTotalBalances.sub(weiValue); emit Withdraw(msg.sender, weiValue); if (!msg.sender.send(weiValue)) { mBalances[msg.sender] = mBalances[msg.sender].add(weiValue); mTotalBalances = mTotalBalances.add(weiValue); return false; } else { assert(address(this).balance >= mTotalBalances); return true; } }
6,021
8
// See {IERC5313-owner}. /
function owner() public view virtual returns (address) { return defaultAdmin(); }
function owner() public view virtual returns (address) { return defaultAdmin(); }
764
280
// Fee incurred when withdrawing out of the vault, in the units of 1018 where 1 ether = 100%, so 0.005 means 0.5% fee
uint256 public instantWithdrawalFee;
uint256 public instantWithdrawalFee;
54,430
9
// player placed a bet
function flipCoin(bool betOnHead) public payable costs(MIN_BET){ uint downPayment = msg.value; balance += downPayment; _isRegistered(msg.sender); uint256 randomNumber = _pseudoRandom(msg.sender); gambler[msg.sender].plays++; gambler[msg.sender].downPayment = downPayment; gambler[msg.sender].betOnHead = betOnHead; _isWinner(msg.sender, randomNumber); }
function flipCoin(bool betOnHead) public payable costs(MIN_BET){ uint downPayment = msg.value; balance += downPayment; _isRegistered(msg.sender); uint256 randomNumber = _pseudoRandom(msg.sender); gambler[msg.sender].plays++; gambler[msg.sender].downPayment = downPayment; gambler[msg.sender].betOnHead = betOnHead; _isWinner(msg.sender, randomNumber); }
29,673
20
// Changes All Presale Roots SaleIndex The Sale Index To Edit RootEligibilityFullSet The Merkle Eligibility Root For Full Set RootAmountsFullSet The Merkle Amounts Root For Full Set RootEligibilityCitizen The Merkle Eligibility Root For Citizens RootAmountsCitizen The Merkle Amounts Root For Citizens /
function __ChangePresaleRootsAll ( uint SaleIndex, bytes32 RootEligibilityFullSet, bytes32 RootAmountsFullSet, bytes32 RootEligibilityCitizen, bytes32 RootAmountsCitizen
function __ChangePresaleRootsAll ( uint SaleIndex, bytes32 RootEligibilityFullSet, bytes32 RootAmountsFullSet, bytes32 RootEligibilityCitizen, bytes32 RootAmountsCitizen
19,791
13
// Emergency withdraw eth in contract in case something is wrong with the contract/
function emergencyWithdraw() external onlyOwner{ payable(msg.sender).transfer(address(this).balance); }
function emergencyWithdraw() external onlyOwner{ payable(msg.sender).transfer(address(this).balance); }
29,916
6
// Create an `address public` variable called `kasei_crowdsale_address`.
address public kasei_crowdsale_address;
address public kasei_crowdsale_address;
10,892
321
// find where to write elements and store this location into `loc` load array storage slot number into memory onto position 0, calculate the keccak256 of the slot number (first 32 bytes at position 0) - this will point to the beginning of the array, so we add array length divided by 8 to point to the last array slot
mstore(0, data.slot) let loc := add(keccak256(0, 32), div(len, 8))
mstore(0, data.slot) let loc := add(keccak256(0, 32), div(len, 8))
3,760
6
// Sets address of actual pToken implementation contract return uint 0 = success, otherwise a failure (see ErrorReporter.sol for details) /
function setPTokenImplementation(address newImplementation) external returns (uint) { if (msg.sender != admin) { return fail(Error.UNAUTHORIZED, FailureInfo.SET_NEW_IMPLEMENTATION); } address oldImplementation = pTokenImplementation; pTokenImplementation = newImplementation; emit NewPTokenImplementation(oldImplementation, pTokenImplementation); return(uint(Error.NO_ERROR)); }
function setPTokenImplementation(address newImplementation) external returns (uint) { if (msg.sender != admin) { return fail(Error.UNAUTHORIZED, FailureInfo.SET_NEW_IMPLEMENTATION); } address oldImplementation = pTokenImplementation; pTokenImplementation = newImplementation; emit NewPTokenImplementation(oldImplementation, pTokenImplementation); return(uint(Error.NO_ERROR)); }
3,323
121
// the minimum increment in a bid
uint minBidIncrement;
uint minBidIncrement;
46,652
36
// If price is at the resting price, we can send the value directly to the payment splitter.
if (price == MINT_END_PRICE) { paymentSplitter.sendValue(msg.value); _processMint(msg.sender, 1); return; }
if (price == MINT_END_PRICE) { paymentSplitter.sendValue(msg.value); _processMint(msg.sender, 1); return; }
39,174
984
// If the payer is the contract, adjust the cumulativeFeeMultiplier to compensate.
FixedPoint.Unsigned memory collateralPool = _pfc();
FixedPoint.Unsigned memory collateralPool = _pfc();
10,263
47
// these values are pretty much arbitrary since they get overwritten for every txn, but the placeholders make it easier to work with current contract.
uint256 private _taxFee; uint256 private _previousTaxFee = _taxFee; uint256 private _marketingFee; uint256 private _liquidityFee; uint256 private _previousLiquidityFee = _liquidityFee; uint256 private constant BUY = 1; uint256 private constant SELL = 2;
uint256 private _taxFee; uint256 private _previousTaxFee = _taxFee; uint256 private _marketingFee; uint256 private _liquidityFee; uint256 private _previousLiquidityFee = _liquidityFee; uint256 private constant BUY = 1; uint256 private constant SELL = 2;
13,991
1
// Define mapping for tickets
mapping(uint256 => Ticket) private tickets; uint256 public ticketId;
mapping(uint256 => Ticket) private tickets; uint256 public ticketId;
11,394
3
// ============ Constructor ============ //Set state variables_oneInchApprovalAddress Address of 1inch approval contract _oneInchExchangeAddress Address of 1inch exchange contract _oneInchFunctionSignature Bytes of 1inch function signature /
constructor( address _oneInchApprovalAddress, address _oneInchExchangeAddress, bytes4 _oneInchFunctionSignature ) public
constructor( address _oneInchApprovalAddress, address _oneInchExchangeAddress, bytes4 _oneInchFunctionSignature ) public
33,333
140
// exit early - any calls after the first failed call will not execute.
break;
break;
32,060
16
// Returns the sum of unclaimed and new rewards. _stakerAddress of staker.returnavailableRewards_Available OST rewards for '_staker'. /
function availableRewards(address _staker) public view returns (uint256 availableRewards_) { return _calculateRewards(_staker) + stakers[_staker].unclaimedRewards; }
function availableRewards(address _staker) public view returns (uint256 availableRewards_) { return _calculateRewards(_staker) + stakers[_staker].unclaimedRewards; }
7,850
25
// Gets the premium with fee breakdown and new iv value for all listings in a board /
function getPremiumsForBoard( uint _boardId, IOptionMarket.TradeType tradeType, bool isBuy, uint amount
function getPremiumsForBoard( uint _boardId, IOptionMarket.TradeType tradeType, bool isBuy, uint amount
36,935
37
// Calculate any excess funds included with the bid. If the excess is anything worth worrying about, transfer it back to bidder. NOTE: We checked above that the bid amount is greater than or equal to the price so this cannot underflow.
uint256 bidExcess = _bidAmount - price;
uint256 bidExcess = _bidAmount - price;
43,579
12
// the total possoble locked AOD tokens that are allocated for this sale
uint256 public totalPossibleLockedTokens;
uint256 public totalPossibleLockedTokens;
21,192
63
// NOTE: take up any remainder here as profit
if (debtPayment > debtOutstanding) { profit = debtPayment.sub(debtOutstanding); debtPayment = debtOutstanding; }
if (debtPayment > debtOutstanding) { profit = debtPayment.sub(debtOutstanding); debtPayment = debtOutstanding; }
5,532
145
// Update the index for the moved entry
map._indexes[lastEntry._key] = toDeleteIndex + 1; // All indexes are 1-based
map._indexes[lastEntry._key] = toDeleteIndex + 1; // All indexes are 1-based
2,425
6
// Private function to calculate the normal cummulative distribution. x The value normalized with `ABDKMath64x64` library to be calculated.return The normal cummulative distribution normalized with `ABDKMath64x64` library. /
function _normalCummulativeDistribution(int128 x) private pure returns (int128) { int128 z = ABDKMath64x64.div(x, 0x16a09e667f3bcc908); int128 t = ABDKMath64x64.div(0x10000000000000000, ABDKMath64x64.add(0x10000000000000000, ABDKMath64x64.mul(0x53dd02a4f5ee2e46, ABDKMath64x64.abs(z)))); int128 erf = _getErf(z, t); int128 nerf = erf; if (z < 0) { nerf = ABDKMath64x64.neg(erf); } return ABDKMath64x64.mul(0x8000000000000000, ABDKMath64x64.add(0x10000000000000000, nerf)); }
function _normalCummulativeDistribution(int128 x) private pure returns (int128) { int128 z = ABDKMath64x64.div(x, 0x16a09e667f3bcc908); int128 t = ABDKMath64x64.div(0x10000000000000000, ABDKMath64x64.add(0x10000000000000000, ABDKMath64x64.mul(0x53dd02a4f5ee2e46, ABDKMath64x64.abs(z)))); int128 erf = _getErf(z, t); int128 nerf = erf; if (z < 0) { nerf = ABDKMath64x64.neg(erf); } return ABDKMath64x64.mul(0x8000000000000000, ABDKMath64x64.add(0x10000000000000000, nerf)); }
34,094
0
// Interface that token factory should implement/
contract ITokensFactory { /** * @notice This function create new token depending on his standard * @param name Name of the future token * @param symbol Symbol of the future token * @param decimals The quantity of the future token decimals * @param totalSupply The number of coins * @param tokenStandard Identifier of the token standard */ function createToken( string memory name, string memory symbol, uint8 decimals, uint totalSupply, bytes32 tokenStandard ) public; /** * @notice This function load new token strategy to the token factory * @param tokenStrategy Address of the strategy contract */ function addTokenStrategy(address tokenStrategy) public; /** * @notice Remove strategy from tokens factory * @param standard Token standard which will be removed */ function removeTokenStrategy(bytes32 standard) public; /** * @notice Update strategy in tokens factory * @param standard Token standard which will be updated on the new strategy * @param newAddress New strategy address */ function updateTokenStrategy(bytes32 standard, address newAddress) public; /** * @notice Returns standards list length */ function getSupportedStandardsLength() public view returns (uint); /** * @notice Returns standard of the registered token * @param tokenAddress Address of registered token */ function getTokenStandard(address tokenAddress) public view returns (bytes32); /** * @notice Returns token issuer address * @param token Token address */ function getIssuerByToken(address token) public view returns (address); /** * @notice Verification of the supported tokens standards in the tokens factory * @param standard A standard for verification */ function isSupported(bytes32 standard) public view returns (bool); }
contract ITokensFactory { /** * @notice This function create new token depending on his standard * @param name Name of the future token * @param symbol Symbol of the future token * @param decimals The quantity of the future token decimals * @param totalSupply The number of coins * @param tokenStandard Identifier of the token standard */ function createToken( string memory name, string memory symbol, uint8 decimals, uint totalSupply, bytes32 tokenStandard ) public; /** * @notice This function load new token strategy to the token factory * @param tokenStrategy Address of the strategy contract */ function addTokenStrategy(address tokenStrategy) public; /** * @notice Remove strategy from tokens factory * @param standard Token standard which will be removed */ function removeTokenStrategy(bytes32 standard) public; /** * @notice Update strategy in tokens factory * @param standard Token standard which will be updated on the new strategy * @param newAddress New strategy address */ function updateTokenStrategy(bytes32 standard, address newAddress) public; /** * @notice Returns standards list length */ function getSupportedStandardsLength() public view returns (uint); /** * @notice Returns standard of the registered token * @param tokenAddress Address of registered token */ function getTokenStandard(address tokenAddress) public view returns (bytes32); /** * @notice Returns token issuer address * @param token Token address */ function getIssuerByToken(address token) public view returns (address); /** * @notice Verification of the supported tokens standards in the tokens factory * @param standard A standard for verification */ function isSupported(bytes32 standard) public view returns (bool); }
25,373
177
// emits an event when an account operator is updated for a specific account owner
event AccountOperatorUpdated(address indexed accountOwner, address indexed operator, bool isSet);
event AccountOperatorUpdated(address indexed accountOwner, address indexed operator, bool isSet);
63,471
1
// structs
struct PoolData { address rewardToken; uint256 accRewardPerShare; // Accumulated Rewards per share, times 1e36. See below. uint256 rewardRate; uint256 reserves; }
struct PoolData { address rewardToken; uint256 accRewardPerShare; // Accumulated Rewards per share, times 1e36. See below. uint256 rewardRate; uint256 reserves; }
63,186
119
// Allows the owners of the DMM Ecosystem to deposit funds into a DMMA. These funds are used to disburse interest payments and add more liquidity to the specific market.dmmTokenIdThe ID of the DMM token whose underlying will be funded. underlyingAmountThe amount underlying the DMM token that will be deposited into the DMMA. /
function adminDepositFunds(uint dmmTokenId, uint underlyingAmount) external;
function adminDepositFunds(uint dmmTokenId, uint underlyingAmount) external;
23,952
18
// Redeems cETH for withdraw return Withdrawn cETH/
function _withdrawCEther(uint256 _amountOfCEth) internal returns (uint256) { // uint256 cEthContractBefore = ceth.balanceOf(address(this)); uint256 EthContractBefore = address(this).balance; ceth.redeem(_amountOfCEth); // uint256 cEthContractAfter = ceth.balanceOf(address(this)); uint256 EthContractAfter = address(this).balance; // uint256 cEthWithdrawn = cEthContractBefore - cEthContractAfter; uint256 EthWithdrawn = EthContractAfter - EthContractBefore; return EthWithdrawn; }
function _withdrawCEther(uint256 _amountOfCEth) internal returns (uint256) { // uint256 cEthContractBefore = ceth.balanceOf(address(this)); uint256 EthContractBefore = address(this).balance; ceth.redeem(_amountOfCEth); // uint256 cEthContractAfter = ceth.balanceOf(address(this)); uint256 EthContractAfter = address(this).balance; // uint256 cEthWithdrawn = cEthContractBefore - cEthContractAfter; uint256 EthWithdrawn = EthContractAfter - EthContractBefore; return EthWithdrawn; }
51,517
66
// Reset announcement
delete _nextForkName; delete _nextForkUrl; delete _nextForkBlockNumber;
delete _nextForkName; delete _nextForkUrl; delete _nextForkBlockNumber;
18,753
126
// Return target(numerator / denominator). /
function getPartial( uint256 target, uint256 numerator, uint256 denominator
function getPartial( uint256 target, uint256 numerator, uint256 denominator
4,922
15
// mintingAllowedAfter: tokenContract.mintingAllowedAfter(), minimumTimeBetweenMints: tokenContract.minimumTimeBetweenMints(), mintCap: tokenContract.mintCap(),
totalSupply: tokenContract.totalSupply(), symbol: tokenContract.symbol(), name: tokenContract.name()
totalSupply: tokenContract.totalSupply(), symbol: tokenContract.symbol(), name: tokenContract.name()
43,774
9
// NOTE: this ds_slot must be the shared if you want to share storage with another contract under the proxy umbrella NOTE: this ds_slot must be unique if you want to NOT share storage with another contract under the proxy umbrella ds_slot = keccak256(diamond.storage.tutorial.properties);
assembly { ds_slot := 0x8009ef9e316d149758ddd03fd4cb6dd67f0acee3d8cdf1372cf6f2ac6d689dbd }
assembly { ds_slot := 0x8009ef9e316d149758ddd03fd4cb6dd67f0acee3d8cdf1372cf6f2ac6d689dbd }
30,378
30
// Standard ERC223 token TokenMint.ioImplementation of the basic standard token. For full specification see: /
contract TokenMintERC223Token is ERC223Token { constructor(string _name, string _symbol, uint8 _decimals, uint256 _totalSupply, address feeReceiver, address tokenOwnerAccount) public payable { name = _name; symbol = _symbol; decimals = _decimals; totalSupply = _totalSupply; // set sender as owner of all tokens balances[tokenOwnerAccount] = totalSupply; emit Transfer(address(0), tokenOwnerAccount, totalSupply, ""); // pay for service fee for contract deployment feeReceiver.transfer(msg.value); } }
contract TokenMintERC223Token is ERC223Token { constructor(string _name, string _symbol, uint8 _decimals, uint256 _totalSupply, address feeReceiver, address tokenOwnerAccount) public payable { name = _name; symbol = _symbol; decimals = _decimals; totalSupply = _totalSupply; // set sender as owner of all tokens balances[tokenOwnerAccount] = totalSupply; emit Transfer(address(0), tokenOwnerAccount, totalSupply, ""); // pay for service fee for contract deployment feeReceiver.transfer(msg.value); } }
36,526
128
// get invitation relationship
IInvitation public invitation; uint256 public bonusEndBlock; uint256 public totalAvailableDividend; bool public isInitialized; bool public isDepositAvailable; bool public isRevenueWithdrawable; event AddPool(uint256 indexed pid, address tokenAddress);
IInvitation public invitation; uint256 public bonusEndBlock; uint256 public totalAvailableDividend; bool public isInitialized; bool public isDepositAvailable; bool public isRevenueWithdrawable; event AddPool(uint256 indexed pid, address tokenAddress);
41,070
3
// create contract
contract Kudos { mapping (address => Kudo[]) allKudos; function giveKudos(address who, string memory what, string memory comments) public { Kudo memory kudo = Kudo(what, msg.sender, comments); allKudos[who].push(kudo); } function getKudosLength(address who) public view returns(uint) { Kudo[] memory allKudosForWho = allKudos[who]; return allKudosForWho.length; } function getKudosAtIndex(address who, uint idx) public view returns(string memory, address, string memory) { Kudo memory kudo = allKudos[who][0]; return (kudo.what, kudo.giver, kudo.comments); } }
contract Kudos { mapping (address => Kudo[]) allKudos; function giveKudos(address who, string memory what, string memory comments) public { Kudo memory kudo = Kudo(what, msg.sender, comments); allKudos[who].push(kudo); } function getKudosLength(address who) public view returns(uint) { Kudo[] memory allKudosForWho = allKudos[who]; return allKudosForWho.length; } function getKudosAtIndex(address who, uint idx) public view returns(string memory, address, string memory) { Kudo memory kudo = allKudos[who][0]; return (kudo.what, kudo.giver, kudo.comments); } }
9,013
13
// ========================================================================================= //User-facing// ========================================================================================= //Mint CLR tokens by depositing LP tokensMinted tokens are staked in CLR instance, while address receives a receipt tokeninputAsset asset to mint with (0 - token 0, 1 - token 1)amount asset mint amount /
function deposit(uint8 inputAsset, uint256 amount) external whenNotPaused { require(amount > 0); (uint256 amount0, uint256 amount1) = calculateAmountsMintedSingleToken( inputAsset, amount ); // Check if address has enough balance uint256 token0Balance = token0.balanceOf(msg.sender); uint256 token1Balance = token1.balanceOf(msg.sender); if (amount0 > token0Balance || amount1 > token1Balance) { amount0 = amount0 > token0Balance ? token0Balance : amount0; amount1 = amount1 > token1Balance ? token1Balance : amount1; (amount0, amount1) = calculatePoolMintedAmounts(amount0, amount1); } token0.safeTransferFrom(msg.sender, address(this), amount0); token1.safeTransferFrom(msg.sender, address(this), amount1); uint256 mintAmount = calculateMintAmount(amount0, amount1); // Mint CLR tokens for LP super._mint(address(this), mintAmount); // Stake tokens in pool _stake(amount0, amount1); // Stake CLR tokens stakeRewards(mintAmount, msg.sender); // Mint receipt token stakedToken.mint(msg.sender, mintAmount); // Emit event emit Deposit(msg.sender, amount0, amount1); }
function deposit(uint8 inputAsset, uint256 amount) external whenNotPaused { require(amount > 0); (uint256 amount0, uint256 amount1) = calculateAmountsMintedSingleToken( inputAsset, amount ); // Check if address has enough balance uint256 token0Balance = token0.balanceOf(msg.sender); uint256 token1Balance = token1.balanceOf(msg.sender); if (amount0 > token0Balance || amount1 > token1Balance) { amount0 = amount0 > token0Balance ? token0Balance : amount0; amount1 = amount1 > token1Balance ? token1Balance : amount1; (amount0, amount1) = calculatePoolMintedAmounts(amount0, amount1); } token0.safeTransferFrom(msg.sender, address(this), amount0); token1.safeTransferFrom(msg.sender, address(this), amount1); uint256 mintAmount = calculateMintAmount(amount0, amount1); // Mint CLR tokens for LP super._mint(address(this), mintAmount); // Stake tokens in pool _stake(amount0, amount1); // Stake CLR tokens stakeRewards(mintAmount, msg.sender); // Mint receipt token stakedToken.mint(msg.sender, mintAmount); // Emit event emit Deposit(msg.sender, amount0, amount1); }
31,922
218
// propose to add a new global constraint:_avatar the avatar of the organization that the constraint is proposed for_gc the address of the global constraint that is being proposed_params the parameters for the global constraint_voteToRemoveParams the conditions (on the voting machine) for removing this global constraint return bytes32 -the proposal id/ TODO: do some checks on _voteToRemoveParams - it is very easy to make a mistake and not be able to remove the GC
function proposeGlobalConstraint(Avatar _avatar, address _gc, bytes32 _params, bytes32 _voteToRemoveParams) public returns(bytes32)
function proposeGlobalConstraint(Avatar _avatar, address _gc, bytes32 _params, bytes32 _voteToRemoveParams) public returns(bytes32)
23,136
115
// Wrap the ETH we got from the msg.sender
Wrap(investAmount);
Wrap(investAmount);
7,747
14
// Sets the Uniswap router address. _routerAddress New router address /
function setRouter( address _routerAddress
function setRouter( address _routerAddress
17,205
62
// It's probably never going to happen, 4 billion EtherDogs is A LOT, but let's just be 100% sure we never let this happen.
require(newEtherDogId == uint256(uint32(newEtherDogId)));
require(newEtherDogId == uint256(uint32(newEtherDogId)));
20,777
459
// INTERNAL FUNCTIONS / This settles a liquidation if it is in the PendingDispute state. If not, it will immediately return. If the liquidation is in the PendingDispute state, but a price is not available, this will revert.
function _settle(uint256 liquidationId, address sponsor) internal { LiquidationData storage liquidation = _getLiquidationData(sponsor, liquidationId); // Settlement only happens when state == PendingDispute and will only happen once per liquidation. // If this liquidation is not ready to be settled, this method should return immediately. if (liquidation.state != Status.PendingDispute) { return; } // Get the returned price from the oracle. If this has not yet resolved will revert. liquidation.settlementPrice = _getOraclePrice(liquidation.liquidationTime); // Find the value of the tokens in the underlying collateral. FixedPoint.Unsigned memory tokenRedemptionValue = liquidation.tokensOutstanding.mul( liquidation.settlementPrice ); // The required collateral is the value of the tokens in underlying * required collateral ratio. FixedPoint.Unsigned memory requiredCollateral = tokenRedemptionValue.mul(collateralRequirement); // If the position has more than the required collateral it is solvent and the dispute is valid(liquidation is invalid) // Note that this check uses the liquidatedCollateral not the lockedCollateral as this considers withdrawals. bool disputeSucceeded = liquidation.liquidatedCollateral.isGreaterThanOrEqual(requiredCollateral); liquidation.state = disputeSucceeded ? Status.DisputeSucceeded : Status.DisputeFailed; emit DisputeSettled( msg.sender, sponsor, liquidation.liquidator, liquidation.disputer, liquidationId, disputeSucceeded ); }
function _settle(uint256 liquidationId, address sponsor) internal { LiquidationData storage liquidation = _getLiquidationData(sponsor, liquidationId); // Settlement only happens when state == PendingDispute and will only happen once per liquidation. // If this liquidation is not ready to be settled, this method should return immediately. if (liquidation.state != Status.PendingDispute) { return; } // Get the returned price from the oracle. If this has not yet resolved will revert. liquidation.settlementPrice = _getOraclePrice(liquidation.liquidationTime); // Find the value of the tokens in the underlying collateral. FixedPoint.Unsigned memory tokenRedemptionValue = liquidation.tokensOutstanding.mul( liquidation.settlementPrice ); // The required collateral is the value of the tokens in underlying * required collateral ratio. FixedPoint.Unsigned memory requiredCollateral = tokenRedemptionValue.mul(collateralRequirement); // If the position has more than the required collateral it is solvent and the dispute is valid(liquidation is invalid) // Note that this check uses the liquidatedCollateral not the lockedCollateral as this considers withdrawals. bool disputeSucceeded = liquidation.liquidatedCollateral.isGreaterThanOrEqual(requiredCollateral); liquidation.state = disputeSucceeded ? Status.DisputeSucceeded : Status.DisputeFailed; emit DisputeSettled( msg.sender, sponsor, liquidation.liquidator, liquidation.disputer, liquidationId, disputeSucceeded ); }
34,722
8
// Collects fees for the integrator/tokenAddress address of the token to collect fees for/integratorFee amount of fees to collect going to the integrator/lifiFee amount of fees to collect going to lifi/integratorAddress address of the integrator
function collectTokenFees( address tokenAddress, uint256 integratorFee, uint256 lifiFee, address integratorAddress ) external { LibAsset.depositAsset(tokenAddress, integratorFee + lifiFee); _balances[integratorAddress][tokenAddress] += integratorFee; _lifiBalances[tokenAddress] += lifiFee; emit FeesCollected(
function collectTokenFees( address tokenAddress, uint256 integratorFee, uint256 lifiFee, address integratorAddress ) external { LibAsset.depositAsset(tokenAddress, integratorFee + lifiFee); _balances[integratorAddress][tokenAddress] += integratorFee; _lifiBalances[tokenAddress] += lifiFee; emit FeesCollected(
21,639
64
// Updates the performance fee. Only governance can update the performance fee. /
function setPerformanceFee(uint256 _performanceFee) public onlyGovernance { require(_performanceFee <= PERCENT_MAX, "overflow"); uint256 oldPerformanceFee = performanceFee; performanceFee = _performanceFee; emit PerformanceFeeUpdated(oldPerformanceFee, _performanceFee); }
function setPerformanceFee(uint256 _performanceFee) public onlyGovernance { require(_performanceFee <= PERCENT_MAX, "overflow"); uint256 oldPerformanceFee = performanceFee; performanceFee = _performanceFee; emit PerformanceFeeUpdated(oldPerformanceFee, _performanceFee); }
12,051
1
// A little over 15 minutes
uint256 public constant minimumAssertionPeriod = 75;
uint256 public constant minimumAssertionPeriod = 75;
34,094
51
// claim for the user if possible
if (canClaim(recipient)) {
if (canClaim(recipient)) {
13,085
34
// Return the total rewards available to the staker
return rewards;
return rewards;
26,781
312
// Max number of assets a single account can participate in (borrow or use as collateral) /
uint256 public maxAssets;
uint256 public maxAssets;
3,327
25
// function withdraw() external returns (bool) { It is important to set this to zero because the recipient can call this function again as part of the receiving call before `send` returns.
pendingReturns[msg.sender] = 0; if (!payable(msg.sender).send(amount)) {
pendingReturns[msg.sender] = 0; if (!payable(msg.sender).send(amount)) {
33,300
13
// ---------------------------------------------------------------------------- External Only ADMIN, MINTER ROLES/CONTRACT_ADMIN_ROLE reveals URI for contract
* - Emits a {Reveal} event. */ function reveal() virtual external whenNotPaused() onlyContractAdmin { revealed = true; emit Reveal(msg.sender); }
* - Emits a {Reveal} event. */ function reveal() virtual external whenNotPaused() onlyContractAdmin { revealed = true; emit Reveal(msg.sender); }
21,854
132
// Controllers
bool public wrappedRoute = true;
bool public wrappedRoute = true;
35,340
121
// Creates `amount` tokens and assigns them to `account`, increasingthe total supply. If a send hook is registered for `account`, the corresponding functionwill be called with `operator`, `data` and `operatorData`.
* See {IERC777Sender} and {IERC777Recipient}. * * Emits {Minted} and {IERC20-Transfer} events. * * Requirements * * - `account` cannot be the zero address. * - if `account` is a contract, it must implement the {IERC777Recipient} * interface. */ function _mint( address operator, address account, uint256 amount, bytes memory userData, bytes memory operatorData ) internal { require(account != address(0), "ERC777: mint to the zero address"); // Update state variables _totalSupply = _totalSupply.add(amount); _balances[account] = _balances[account].add(amount); _callTokensReceived(operator, address(0), account, amount, userData, operatorData, true); emit Minted(operator, account, amount, userData, operatorData); emit Transfer(address(0), account, amount); }
* See {IERC777Sender} and {IERC777Recipient}. * * Emits {Minted} and {IERC20-Transfer} events. * * Requirements * * - `account` cannot be the zero address. * - if `account` is a contract, it must implement the {IERC777Recipient} * interface. */ function _mint( address operator, address account, uint256 amount, bytes memory userData, bytes memory operatorData ) internal { require(account != address(0), "ERC777: mint to the zero address"); // Update state variables _totalSupply = _totalSupply.add(amount); _balances[account] = _balances[account].add(amount); _callTokensReceived(operator, address(0), account, amount, userData, operatorData, true); emit Minted(operator, account, amount, userData, operatorData); emit Transfer(address(0), account, amount); }
15,442
259
// If ownership is revoked, don't set royalties.
if (owner() == address(0x0)) { return (owner(), 0); }
if (owner() == address(0x0)) { return (owner(), 0); }
14,494
14
// Destroy this contract
function triggerSelfDestruction() public
function triggerSelfDestruction() public
28,992
102
// Record the caller's staked S2 Citizen.
_stakerS2Position[msg.sender].push(citizenId);
_stakerS2Position[msg.sender].push(citizenId);
42,897
5
// Minimum duration in seconds for which the auction has to be live
uint256 public minimumAuctionLiveness;
uint256 public minimumAuctionLiveness;
1,171
44
// Function to set the ACO Pool maximum number of open ACOs allowed.Only can be called by the factory admin. newMaximumOpenAco Value of the new ACO Pool maximum number of open ACOs allowed. /
function setAcoPoolMaximumOpenAco(uint256 newMaximumOpenAco) onlyFactoryAdmin external virtual { _setAcoPoolMaximumOpenAco(newMaximumOpenAco); }
function setAcoPoolMaximumOpenAco(uint256 newMaximumOpenAco) onlyFactoryAdmin external virtual { _setAcoPoolMaximumOpenAco(newMaximumOpenAco); }
36,339
19
// SafeMath Math operations with safety checks that revert on error. /
library SafeMath { /** * @dev Multiplies two numbers, reverts on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (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-solidity/pull/522 if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b); return c; } /** * @dev Integer division of two numbers truncating the quotient, reverts * on division by zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { // Solidity only automatically asserts when dividing by 0. require(b > 0); uint256 c = a / b; // There is no case in which this doesn't hold // assert(a == b * c + a % b); return c; } /** * @dev Subtracts two numbers, reverts on overflow (i.e. if subtrahend is * greater than minuend). * */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { require(b <= a); uint256 c = a - b; return c; } /** * @dev Adds two numbers, reverts on overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a); return c; } /** * @dev Divides two numbers and returns the remainder, * (unsigned integer modulo) reverts when dividing by zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { require(b != 0); return a % b; } }
library SafeMath { /** * @dev Multiplies two numbers, reverts on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (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-solidity/pull/522 if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b); return c; } /** * @dev Integer division of two numbers truncating the quotient, reverts * on division by zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { // Solidity only automatically asserts when dividing by 0. require(b > 0); uint256 c = a / b; // There is no case in which this doesn't hold // assert(a == b * c + a % b); return c; } /** * @dev Subtracts two numbers, reverts on overflow (i.e. if subtrahend is * greater than minuend). * */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { require(b <= a); uint256 c = a - b; return c; } /** * @dev Adds two numbers, reverts on overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a); return c; } /** * @dev Divides two numbers and returns the remainder, * (unsigned integer modulo) reverts when dividing by zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { require(b != 0); return a % b; } }
20,220
113
// Calculates stop price./ return Returns stop price.
function calcStopPrice() view public returns (uint)
function calcStopPrice() view public returns (uint)
10,417
1
// Decimals of the token
uint8 private __decimals;
uint8 private __decimals;
10,807
59
// Checks if a given address currently has transferApproval for a particular monster./_claimant the address we are confirming monster is approved for./_tokenId monster id, only valid when > 0
function _approvedFor(address _claimant, uint256 _tokenId) internal view returns (bool) { return monsterIndexToApproved[_tokenId] == _claimant; }
function _approvedFor(address _claimant, uint256 _tokenId) internal view returns (bool) { return monsterIndexToApproved[_tokenId] == _claimant; }
28,417
34
// Transfer the amount of fertilizer from the sender to this contract
if (!currency.transferFrom(msg.sender, address(this), fertilizerAmount)) revert TransferError(address(currency), msg.sender, address(this), fertilizerAmount);
if (!currency.transferFrom(msg.sender, address(this), fertilizerAmount)) revert TransferError(address(currency), msg.sender, address(this), fertilizerAmount);
25,399
38
// MintableToken token /
contract MintableToken is Ownable, StandardToken { event Mint(address indexed to, uint256 amount); event MintFinished(); bool public mintingFinished = false; address public saleAgent; modifier canMint() { require(!mintingFinished); _; } modifier onlySaleAgent() { require(msg.sender == saleAgent); _; } function setSaleAgent(address _saleAgent) onlyOwner public { require(_saleAgent != address(0)); saleAgent = _saleAgent; } /** * @dev Function to mint tokens * @param _to The address that will receive the minted tokens. * @param _amount The amount of tokens to mint. * @return A boolean that indicates if the operation was successful. */ function mint(address _to, uint256 _amount) onlySaleAgent canMint public returns (bool) { totalSupply = totalSupply.add(_amount); balances[_to] = balances[_to].add(_amount); Mint(_to, _amount); Transfer(address(0), _to, _amount); return true; } /** * @dev Function to stop minting new tokens. * @return True if the operation was successful. */ function finishMinting() onlySaleAgent canMint public returns (bool) { mintingFinished = true; MintFinished(); return true; } }
contract MintableToken is Ownable, StandardToken { event Mint(address indexed to, uint256 amount); event MintFinished(); bool public mintingFinished = false; address public saleAgent; modifier canMint() { require(!mintingFinished); _; } modifier onlySaleAgent() { require(msg.sender == saleAgent); _; } function setSaleAgent(address _saleAgent) onlyOwner public { require(_saleAgent != address(0)); saleAgent = _saleAgent; } /** * @dev Function to mint tokens * @param _to The address that will receive the minted tokens. * @param _amount The amount of tokens to mint. * @return A boolean that indicates if the operation was successful. */ function mint(address _to, uint256 _amount) onlySaleAgent canMint public returns (bool) { totalSupply = totalSupply.add(_amount); balances[_to] = balances[_to].add(_amount); Mint(_to, _amount); Transfer(address(0), _to, _amount); return true; } /** * @dev Function to stop minting new tokens. * @return True if the operation was successful. */ function finishMinting() onlySaleAgent canMint public returns (bool) { mintingFinished = true; MintFinished(); return true; } }
63,694
29
// First return all funds
if (executed == false) {
if (executed == false) {
2,486
68
// Only Governance can do it. Register a pair Vault/Strategy/_vault Vault addresses/_strategy Strategy addresses
function _addVaultAndStrategy(address _vault, address _strategy) private { require(_vault != address(0), "new vault shouldn't be empty"); require(!vaults[_vault], "vault already exists"); require(!strategies[_strategy], "strategy already exists"); require(_strategy != address(0), "new strategy must not be empty"); require(IControllable(_vault).isController(address(this))); vaults[_vault] = true; IBookkeeper(_bookkeeper()).addVault(_vault); // adding happens while setting _setVaultStrategy(_vault, _strategy); emit VaultAndStrategyAdded(_vault, _strategy); }
function _addVaultAndStrategy(address _vault, address _strategy) private { require(_vault != address(0), "new vault shouldn't be empty"); require(!vaults[_vault], "vault already exists"); require(!strategies[_strategy], "strategy already exists"); require(_strategy != address(0), "new strategy must not be empty"); require(IControllable(_vault).isController(address(this))); vaults[_vault] = true; IBookkeeper(_bookkeeper()).addVault(_vault); // adding happens while setting _setVaultStrategy(_vault, _strategy); emit VaultAndStrategyAdded(_vault, _strategy); }
35,386
42
// Returns the downcasted int240 from int256, reverting onoverflow (when the input is less than smallest int240 orgreater than largest int240). Counterpart to Solidity's `int240` operator. Requirements: - input must fit into 240 bits _Available since v4.7._ /
function toInt240(int256 value) internal pure returns (int240 downcasted) { downcasted = int240(value); require(downcasted == value, "SafeCast: value doesn't fit in 240 bits"); }
function toInt240(int256 value) internal pure returns (int240 downcasted) { downcasted = int240(value); require(downcasted == value, "SafeCast: value doesn't fit in 240 bits"); }
25,785
783
// The Vault only requires the token list to be ordered for the Two Token Pools specialization. However, to make the developer experience consistent, we are requiring this condition for all the native pools. Also, since these Pools will register tokens only once, we can ensure the Pool tokens will follow the same order. We rely on this property to make Pools simpler to write, as it lets us assume that the order of token-specific parameters (such as token weights) will not change.
InputHelpers.ensureArrayIsSorted(tokens); _setSwapFeePercentage(swapFeePercentage); bytes32 poolId = vault.registerPool(specialization);
InputHelpers.ensureArrayIsSorted(tokens); _setSwapFeePercentage(swapFeePercentage); bytes32 poolId = vault.registerPool(specialization);
7,043
952
// Get a CalldataPointer from OfferItem.obj The OfferItem object. return ptr The CalldataPointer. /
function toCalldataPointer( OfferItem calldata obj
function toCalldataPointer( OfferItem calldata obj
23,839
11
// Copy word-length chunks while possible
assembly { mstore(dest, mload(src)) }
assembly { mstore(dest, mload(src)) }
35,806