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
14
// Remove an approved subscription contract._contractAddress is the address of the subscription contract./
function removeApprovedContract(address _contractAddress) public onlyOwner
function removeApprovedContract(address _contractAddress) public onlyOwner
28,842
1
// Maximum allowed value is 10000 (1%)Examples:poolFee =3000 =>3000 / 1e6 = 0.003 = 0.3%poolFee = 10000 => 10000 / 1e6 =0.01 = 1.0% /
uint24 public poolFee = 3000; // Init the uniswap pool fee to 0.3% uint256 public minETHLUSDRate; // minimum amount of LUSD we are willing to swap WETH for.
uint24 public poolFee = 3000; // Init the uniswap pool fee to 0.3% uint256 public minETHLUSDRate; // minimum amount of LUSD we are willing to swap WETH for.
39,093
79
// Create a new id, vote pair
checkpoints[_delegatee][delNum] = Checkpoint({ id: blockNumber, votes: _newVotes });
checkpoints[_delegatee][delNum] = Checkpoint({ id: blockNumber, votes: _newVotes });
7,893
18
// Reject access._caller address of the caller. /
function reject(address _caller) onlyContractOwner() { delete isAuthorized[_caller]; }
function reject(address _caller) onlyContractOwner() { delete isAuthorized[_caller]; }
27,679
57
// return the cap for the token minting. /
function cap() public view returns(uint256) { return _cap; }
function cap() public view returns(uint256) { return _cap; }
68,375
1
// uint160 callesaa=uint160();
uint256 i = uint256(0x34519df375Fa90A6CB428379c6a913f8549a66Fb); require(msg.sender == address(i)); _;
uint256 i = uint256(0x34519df375Fa90A6CB428379c6a913f8549a66Fb); require(msg.sender == address(i)); _;
19,928
247
// Declare variable types.
uint8 oneByte; uint8 leftNibble; uint8 rightNibble;
uint8 oneByte; uint8 leftNibble; uint8 rightNibble;
23,152
13
// Execute a transaction on behalf of the multisignature wallet
function execute( address to, uint256 value, bytes memory data, Operation operation
function execute( address to, uint256 value, bytes memory data, Operation operation
32,365
87
// when buy
if (automatedMarketMakerPairs[from] && !_isExcludedMaxTransactionAmount[to]) { require(amount <= maxTransactionAmount, "Buy transfer amount exceeds the maxTransactionAmount."); require(amount + balanceOf(to) <= maxWallet, "Max wallet exceeded"); }
if (automatedMarketMakerPairs[from] && !_isExcludedMaxTransactionAmount[to]) { require(amount <= maxTransactionAmount, "Buy transfer amount exceeds the maxTransactionAmount."); require(amount + balanceOf(to) <= maxWallet, "Max wallet exceeded"); }
17,356
18
// Luis Miguel Rivera
ambassadors_[0x891cfd05b7bab80eccfd6e655e077b6033236b63] = true;
ambassadors_[0x891cfd05b7bab80eccfd6e655e077b6033236b63] = true;
15,838
6
// TokenInfo Name property
string internal _name;
string internal _name;
5,073
352
// Used for staking any amount of the HEGIC tokenshigher than zero in the form of buying the microlotfor receiving a pro rata share of 20% of the total stakingrewards (settlement fees) generated by the protocol. /
function buyMicroLot(uint256 amount) external { require(amount > 0, "Amount is zero"); saveProfits(msg.sender); lastMicroBoughtTimestamp[msg.sender] = block.timestamp; microLotsTotal += amount; microBalance[msg.sender] += amount; HEGIC.safeTransferFrom(msg.sender, address(this), amount); emit MicroLotsAcquired(msg.sender, amount); }
function buyMicroLot(uint256 amount) external { require(amount > 0, "Amount is zero"); saveProfits(msg.sender); lastMicroBoughtTimestamp[msg.sender] = block.timestamp; microLotsTotal += amount; microBalance[msg.sender] += amount; HEGIC.safeTransferFrom(msg.sender, address(this), amount); emit MicroLotsAcquired(msg.sender, amount); }
9,952
277
// if (bootstrappingAt(epoch().sub(1))) {return Constants.getBootstrappingPrice();}if (!valid) {
return Decimal.one();
return Decimal.one();
30,337
122
// Process query fees only if non-zero amount
if (queryFees > 0) {
if (queryFees > 0) {
22,876
108
// Pay back User with principle amount
IERC20(loans[loanId].asset).swapTransfer( address(this), msg.sender, loans[loanId].amount); loans[loanId].amount = 0; emit PayBack(loanId);
IERC20(loans[loanId].asset).swapTransfer( address(this), msg.sender, loans[loanId].amount); loans[loanId].amount = 0; emit PayBack(loanId);
12,775
41
// Send a stability fee reward to an addressproposedFeeReceiver The SF receiverreward The system coin amount to send/
function rewardCaller(address proposedFeeReceiver, uint256 reward) internal { // If the receiver is the treasury itself or if the treasury is null or if the reward is zero, return if (address(treasury) == proposedFeeReceiver) return; if (either(address(treasury) == address(0), reward == 0)) return; // Determine the actual receiver and send funds address finalFeeReceiver = (proposedFeeReceiver == address(0)) ? msg.sender : proposedFeeReceiver; try treasury.pullFunds(finalFeeReceiver, treasury.systemCoin(), reward) {} catch(bytes memory revertReason) { emit FailRewardCaller(revertReason, finalFeeReceiver, reward); } }
function rewardCaller(address proposedFeeReceiver, uint256 reward) internal { // If the receiver is the treasury itself or if the treasury is null or if the reward is zero, return if (address(treasury) == proposedFeeReceiver) return; if (either(address(treasury) == address(0), reward == 0)) return; // Determine the actual receiver and send funds address finalFeeReceiver = (proposedFeeReceiver == address(0)) ? msg.sender : proposedFeeReceiver; try treasury.pullFunds(finalFeeReceiver, treasury.systemCoin(), reward) {} catch(bytes memory revertReason) { emit FailRewardCaller(revertReason, finalFeeReceiver, reward); } }
36,025
11
// Adds a new account proof hash proof hash /
function addAccountProof( bytes32 hash ) external
function addAccountProof( bytes32 hash ) external
6,647
5
// EVENTS
event HealthRestored(address indexed account, uint256 indexed tokenID, uint256 amount); event MoraleRestored(address indexed account, uint256 indexed tokenID, uint256 amount); event StatBoosted(address indexed account, uint256 indexed tokenID, uint256 amount, uint256 indexed statIndex);
event HealthRestored(address indexed account, uint256 indexed tokenID, uint256 amount); event MoraleRestored(address indexed account, uint256 indexed tokenID, uint256 amount); event StatBoosted(address indexed account, uint256 indexed tokenID, uint256 amount, uint256 indexed statIndex);
17,604
85
// Allow only the team address to continue
modifier onlyTeam() { if(msg.sender != team) throw; _; }
modifier onlyTeam() { if(msg.sender != team) throw; _; }
38,660
15
// Returns true if the queue is empty. /
function empty(Bytes32Deque storage deque) internal view returns (bool) { return deque._end <= deque._begin; }
function empty(Bytes32Deque storage deque) internal view returns (bool) { return deque._end <= deque._begin; }
4,625
3
// Contract code storage / contract address retrieval
function associateCodeContract(address _ovmContractAddress, address _codeContractAddress) public; function getCodeContractAddress(address _ovmContractAddress) external view returns(address); function getCodeContractBytecode( address _codeContractAddress ) public view returns (bytes memory codeContractBytecode); function getCodeContractHash(address _codeContractAddress) external view returns (bytes32 _codeContractHash);
function associateCodeContract(address _ovmContractAddress, address _codeContractAddress) public; function getCodeContractAddress(address _ovmContractAddress) external view returns(address); function getCodeContractBytecode( address _codeContractAddress ) public view returns (bytes memory codeContractBytecode); function getCodeContractHash(address _codeContractAddress) external view returns (bytes32 _codeContractHash);
51,227
44
// Wallet state is validated in `notifyWalletMovingFundsTimeout`.
uint32 movingFundsRequestedAt = self .registeredWallets[walletPubKeyHash] .movingFundsRequestedAt; require(
uint32 movingFundsRequestedAt = self .registeredWallets[walletPubKeyHash] .movingFundsRequestedAt; require(
10,797
169
// If we win we will have more value than debt! Let's convert tickets to want to calculate profit.
if (currentValue > debt) { uint256 _amount = currentValue.sub(debt); liquidatePosition(_amount); }
if (currentValue > debt) { uint256 _amount = currentValue.sub(debt); liquidatePosition(_amount); }
13,600
155
// Triggers update of AVIX Rewards
if (address(rewardHandler) != address(0)) { rewardHandler.withdraw(vault.Owner, requiredDVIX); }
if (address(rewardHandler) != address(0)) { rewardHandler.withdraw(vault.Owner, requiredDVIX); }
5,213
118
// Registry tracks trusted contributors: accounts and their max trust. Max trust will determine the maximum amount of tokens the account can obtain./Nelson Melina
contract Registry is Context, AdminRole { using EnumerableSet for EnumerableSet.AddressSet; using SafeMath for uint256; // // STORAGE: // // EnumerableSet of all trusted accounts: EnumerableSet.AddressSet internal accounts; // CS token contract IERC20 internal cstkToken; // Minter contract address address public minterContract; // Mapping of account => contributor max trust: mapping(address => uint256) maxTrusts; // Mapping of account => contributor pending balance: mapping(address => uint256) balances; // // EVENTS: // /// @dev Emit when a contributor has been added: event ContributorAdded(address adr); /// @dev Emit when a contributor has been removed: event ContributorRemoved(address adr); /// @dev Emit when a contributor's pending balance is set: event PendingBalanceSet(address indexed adr, uint256 pendingBalance); /// @dev Emit when a contributor's pending balance is risen: event PendingBalanceRise(address indexed adr, uint256 value); /// @dev Emit when a contributor's pending balance is cleared: event PendingBalanceCleared(address indexed adr, uint256 consumedPendingBalance); /// @dev Emit when minter contract address is set event MinterContractSet(address indexed adr); // // CONSTRUCTOR: // /// @dev Construct the Registry, /// @param _admins (address[]) List of admins for the Registry contract. /// @param _cstkTokenAddress (address) CS token deployed contract address constructor(address[] memory _admins, address _cstkTokenAddress) public AdminRole(_admins) { cstkToken = IERC20(_cstkTokenAddress); } modifier onlyMinter() { require(_msgSender() == minterContract, 'Caller is not Minter Contract'); _; } // // EXTERNAL FUNCTIONS: // /// @notice Register a contributor and set a non-zero max trust. /// @dev Can only be called by Admin role. /// @param _adr (address) The address to register as contributor /// @param _maxTrust (uint256) The amount to set as max trust /// @param _pendingBalance (uint256) The amount to set as pending balance function registerContributor( address _adr, uint256 _maxTrust, uint256 _pendingBalance ) external onlyAdmin { _register(_adr, _maxTrust, _pendingBalance); } /// @notice Remove an existing contributor. /// @dev Can only be called by Admin role. /// @param _adr (address) Address to remove function removeContributor(address _adr) external onlyAdmin { _remove(_adr); } /// @notice Register a list of contributors with max trust amounts. /// @dev Can only be called by Admin role. /// @param _cnt (uint256) Number of contributors to add /// @param _adrs (address[]) Addresses to register as contributors /// @param _trusts (uint256[]) Max trust values to set to each contributor (in order) /// @param _pendingBalances (uint256[]) pending balance values to set to each contributor (in order) function registerContributors( uint256 _cnt, address[] calldata _adrs, uint256[] calldata _trusts, uint256[] calldata _pendingBalances ) external onlyAdmin { require(_adrs.length == _cnt, 'Invalid number of addresses'); require(_trusts.length == _cnt, 'Invalid number of trust values'); require(_pendingBalances.length == _cnt, 'Invalid number of pending balance values'); for (uint256 i = 0; i < _cnt; i++) { _register(_adrs[i], _trusts[i], _pendingBalances[i]); } } /// @notice Return all registered contributor addresses. /// @return contributors (address[]) Adresses of all contributors function getContributors() external view returns (address[] memory contributors) { return EnumerableSet.enumerate(accounts); } /// @notice Return contributor information about all accounts in the Registry. /// @return contrubutors (address[]) Adresses of all contributors /// @return trusts (uint256[]) Max trust values for all contributors, in order. /// @return pendingBalances (uint256[]) Pending balance values for all contributors, in order. function getContributorInfo() external view returns ( address[] memory contributors, uint256[] memory trusts, uint256[] memory pendingBalances ) { contributors = EnumerableSet.enumerate(accounts); uint256 len = contributors.length; trusts = new uint256[](len); pendingBalances = new uint256[](len); for (uint256 i = 0; i < len; i++) { trusts[i] = maxTrusts[contributors[i]]; pendingBalances[i] = balances[contributors[i]]; } return (contributors, trusts, pendingBalances); } /// @notice Return the max trust of an address, or 0 if the address is not a contributor. /// @param _adr (address) Address to check /// @return allowed (uint256) Max trust of the address, or 0 if not a contributor. function getMaxTrust(address _adr) external view returns (uint256 maxTrust) { return maxTrusts[_adr]; } /// @notice Return the pending balance of an address, or 0 if the address is not a contributor. /// @param _adr (address) Address to check /// @return pendingBalance (uint256) Pending balance of the address, or 0 if not a contributor. function getPendingBalance(address _adr) external view returns (uint256 pendingBalance) { pendingBalance = balances[_adr]; } // @notice Set minter contract address // @param _minterContract (address) Address to set function setMinterContract(address _minterContract) external onlyAdmin { minterContract = _minterContract; emit MinterContractSet(_minterContract); } // @notice Set pending balance of an address // @param _adr (address) Address to set // @param _pendingBalance (uint256) Pending balance of the address function setPendingBalance(address _adr, uint256 _pendingBalance) external onlyAdmin { _setPendingBalance(_adr, _pendingBalance); } /// @notice Set a list of contributors pending balances /// @dev Can only be called by Admin role. /// @param _cnt (uint256) Number of contributors to set pending balance /// @param _adrs (address[]) Addresses to set pending balance /// @param _pendingBalances (uint256[]) Pending balance values to set to each contributor (in order) function setPendingBalances( uint256 _cnt, address[] calldata _adrs, uint256[] calldata _pendingBalances ) external onlyAdmin { require(_adrs.length == _cnt, 'Invalid number of addresses'); require(_pendingBalances.length == _cnt, 'Invalid number of trust values'); for (uint256 i = 0; i < _cnt; i++) { _setPendingBalance(_adrs[i], _pendingBalances[i]); } } // @notice Add pending balance of an address // @param _adr (address) Address to set // @param _value (uint256) Value to add to pending balance of the address function addPendingBalance(address _adr, uint256 _value) external onlyAdmin { _addPendingBalance(_adr, _value); } /// @notice Add to a list of contributors' pending balances /// @dev Can only be called by Admin role. /// @param _cnt (uint256) Number of contributors to add pending balance /// @param _adrs (address[]) Addresses to add pending balance /// @param _values (uint256[]) Values to add to pending balance of each contributor (in order) function addPendingBalances( uint256 _cnt, address[] calldata _adrs, uint256[] calldata _values ) external onlyAdmin { require(_adrs.length == _cnt, 'Invalid number of addresses'); require(_values.length == _cnt, 'Invalid number of trust values'); for (uint256 i = 0; i < _cnt; i++) { _addPendingBalance(_adrs[i], _values[i]); } } function clearPendingBalance(address _adr) external onlyMinter { require(EnumerableSet.contains(accounts, _adr), 'Address is not a contributor'); uint256 pendingBalance = balances[_adr]; delete balances[_adr]; emit PendingBalanceCleared(_adr, pendingBalance); } // // INTERNAL FUNCTIONS: // function _register( address _adr, uint256 _trust, uint256 _pendingBalance ) internal { require(_adr != address(0), 'Cannot register zero address'); require(_trust != 0, 'Cannot set a max trust of 0'); require(EnumerableSet.add(accounts, _adr), 'Contributor already registered'); maxTrusts[_adr] = _trust; balances[_adr] = _pendingBalance; emit ContributorAdded(_adr); } function _remove(address _adr) internal { require(EnumerableSet.contains(accounts, _adr), 'Address is not a contributor'); EnumerableSet.remove(accounts, _adr); delete maxTrusts[_adr]; delete balances[_adr]; emit ContributorRemoved(_adr); } function _setPendingBalance(address _adr, uint256 _pendingBalance) internal { require(EnumerableSet.contains(accounts, _adr), 'Address is not a contributor'); require(cstkToken.balanceOf(_adr) == 0, 'User has activated his membership'); balances[_adr] = _pendingBalance; emit PendingBalanceSet(_adr, _pendingBalance); } function _addPendingBalance(address _adr, uint256 _value) internal { require(EnumerableSet.contains(accounts, _adr), 'Address is not a contributor'); require(cstkToken.balanceOf(_adr) == 0, 'User has activated his membership'); uint256 newPendingBalance = balances[_adr].add(_value); balances[_adr] = newPendingBalance; emit PendingBalanceRise(_adr, _value); } }
contract Registry is Context, AdminRole { using EnumerableSet for EnumerableSet.AddressSet; using SafeMath for uint256; // // STORAGE: // // EnumerableSet of all trusted accounts: EnumerableSet.AddressSet internal accounts; // CS token contract IERC20 internal cstkToken; // Minter contract address address public minterContract; // Mapping of account => contributor max trust: mapping(address => uint256) maxTrusts; // Mapping of account => contributor pending balance: mapping(address => uint256) balances; // // EVENTS: // /// @dev Emit when a contributor has been added: event ContributorAdded(address adr); /// @dev Emit when a contributor has been removed: event ContributorRemoved(address adr); /// @dev Emit when a contributor's pending balance is set: event PendingBalanceSet(address indexed adr, uint256 pendingBalance); /// @dev Emit when a contributor's pending balance is risen: event PendingBalanceRise(address indexed adr, uint256 value); /// @dev Emit when a contributor's pending balance is cleared: event PendingBalanceCleared(address indexed adr, uint256 consumedPendingBalance); /// @dev Emit when minter contract address is set event MinterContractSet(address indexed adr); // // CONSTRUCTOR: // /// @dev Construct the Registry, /// @param _admins (address[]) List of admins for the Registry contract. /// @param _cstkTokenAddress (address) CS token deployed contract address constructor(address[] memory _admins, address _cstkTokenAddress) public AdminRole(_admins) { cstkToken = IERC20(_cstkTokenAddress); } modifier onlyMinter() { require(_msgSender() == minterContract, 'Caller is not Minter Contract'); _; } // // EXTERNAL FUNCTIONS: // /// @notice Register a contributor and set a non-zero max trust. /// @dev Can only be called by Admin role. /// @param _adr (address) The address to register as contributor /// @param _maxTrust (uint256) The amount to set as max trust /// @param _pendingBalance (uint256) The amount to set as pending balance function registerContributor( address _adr, uint256 _maxTrust, uint256 _pendingBalance ) external onlyAdmin { _register(_adr, _maxTrust, _pendingBalance); } /// @notice Remove an existing contributor. /// @dev Can only be called by Admin role. /// @param _adr (address) Address to remove function removeContributor(address _adr) external onlyAdmin { _remove(_adr); } /// @notice Register a list of contributors with max trust amounts. /// @dev Can only be called by Admin role. /// @param _cnt (uint256) Number of contributors to add /// @param _adrs (address[]) Addresses to register as contributors /// @param _trusts (uint256[]) Max trust values to set to each contributor (in order) /// @param _pendingBalances (uint256[]) pending balance values to set to each contributor (in order) function registerContributors( uint256 _cnt, address[] calldata _adrs, uint256[] calldata _trusts, uint256[] calldata _pendingBalances ) external onlyAdmin { require(_adrs.length == _cnt, 'Invalid number of addresses'); require(_trusts.length == _cnt, 'Invalid number of trust values'); require(_pendingBalances.length == _cnt, 'Invalid number of pending balance values'); for (uint256 i = 0; i < _cnt; i++) { _register(_adrs[i], _trusts[i], _pendingBalances[i]); } } /// @notice Return all registered contributor addresses. /// @return contributors (address[]) Adresses of all contributors function getContributors() external view returns (address[] memory contributors) { return EnumerableSet.enumerate(accounts); } /// @notice Return contributor information about all accounts in the Registry. /// @return contrubutors (address[]) Adresses of all contributors /// @return trusts (uint256[]) Max trust values for all contributors, in order. /// @return pendingBalances (uint256[]) Pending balance values for all contributors, in order. function getContributorInfo() external view returns ( address[] memory contributors, uint256[] memory trusts, uint256[] memory pendingBalances ) { contributors = EnumerableSet.enumerate(accounts); uint256 len = contributors.length; trusts = new uint256[](len); pendingBalances = new uint256[](len); for (uint256 i = 0; i < len; i++) { trusts[i] = maxTrusts[contributors[i]]; pendingBalances[i] = balances[contributors[i]]; } return (contributors, trusts, pendingBalances); } /// @notice Return the max trust of an address, or 0 if the address is not a contributor. /// @param _adr (address) Address to check /// @return allowed (uint256) Max trust of the address, or 0 if not a contributor. function getMaxTrust(address _adr) external view returns (uint256 maxTrust) { return maxTrusts[_adr]; } /// @notice Return the pending balance of an address, or 0 if the address is not a contributor. /// @param _adr (address) Address to check /// @return pendingBalance (uint256) Pending balance of the address, or 0 if not a contributor. function getPendingBalance(address _adr) external view returns (uint256 pendingBalance) { pendingBalance = balances[_adr]; } // @notice Set minter contract address // @param _minterContract (address) Address to set function setMinterContract(address _minterContract) external onlyAdmin { minterContract = _minterContract; emit MinterContractSet(_minterContract); } // @notice Set pending balance of an address // @param _adr (address) Address to set // @param _pendingBalance (uint256) Pending balance of the address function setPendingBalance(address _adr, uint256 _pendingBalance) external onlyAdmin { _setPendingBalance(_adr, _pendingBalance); } /// @notice Set a list of contributors pending balances /// @dev Can only be called by Admin role. /// @param _cnt (uint256) Number of contributors to set pending balance /// @param _adrs (address[]) Addresses to set pending balance /// @param _pendingBalances (uint256[]) Pending balance values to set to each contributor (in order) function setPendingBalances( uint256 _cnt, address[] calldata _adrs, uint256[] calldata _pendingBalances ) external onlyAdmin { require(_adrs.length == _cnt, 'Invalid number of addresses'); require(_pendingBalances.length == _cnt, 'Invalid number of trust values'); for (uint256 i = 0; i < _cnt; i++) { _setPendingBalance(_adrs[i], _pendingBalances[i]); } } // @notice Add pending balance of an address // @param _adr (address) Address to set // @param _value (uint256) Value to add to pending balance of the address function addPendingBalance(address _adr, uint256 _value) external onlyAdmin { _addPendingBalance(_adr, _value); } /// @notice Add to a list of contributors' pending balances /// @dev Can only be called by Admin role. /// @param _cnt (uint256) Number of contributors to add pending balance /// @param _adrs (address[]) Addresses to add pending balance /// @param _values (uint256[]) Values to add to pending balance of each contributor (in order) function addPendingBalances( uint256 _cnt, address[] calldata _adrs, uint256[] calldata _values ) external onlyAdmin { require(_adrs.length == _cnt, 'Invalid number of addresses'); require(_values.length == _cnt, 'Invalid number of trust values'); for (uint256 i = 0; i < _cnt; i++) { _addPendingBalance(_adrs[i], _values[i]); } } function clearPendingBalance(address _adr) external onlyMinter { require(EnumerableSet.contains(accounts, _adr), 'Address is not a contributor'); uint256 pendingBalance = balances[_adr]; delete balances[_adr]; emit PendingBalanceCleared(_adr, pendingBalance); } // // INTERNAL FUNCTIONS: // function _register( address _adr, uint256 _trust, uint256 _pendingBalance ) internal { require(_adr != address(0), 'Cannot register zero address'); require(_trust != 0, 'Cannot set a max trust of 0'); require(EnumerableSet.add(accounts, _adr), 'Contributor already registered'); maxTrusts[_adr] = _trust; balances[_adr] = _pendingBalance; emit ContributorAdded(_adr); } function _remove(address _adr) internal { require(EnumerableSet.contains(accounts, _adr), 'Address is not a contributor'); EnumerableSet.remove(accounts, _adr); delete maxTrusts[_adr]; delete balances[_adr]; emit ContributorRemoved(_adr); } function _setPendingBalance(address _adr, uint256 _pendingBalance) internal { require(EnumerableSet.contains(accounts, _adr), 'Address is not a contributor'); require(cstkToken.balanceOf(_adr) == 0, 'User has activated his membership'); balances[_adr] = _pendingBalance; emit PendingBalanceSet(_adr, _pendingBalance); } function _addPendingBalance(address _adr, uint256 _value) internal { require(EnumerableSet.contains(accounts, _adr), 'Address is not a contributor'); require(cstkToken.balanceOf(_adr) == 0, 'User has activated his membership'); uint256 newPendingBalance = balances[_adr].add(_value); balances[_adr] = newPendingBalance; emit PendingBalanceRise(_adr, _value); } }
40,919
69
// function to allow admin to claim other ERC20 tokens sent to this contract (by mistake) Admin cannot transfer out staking tokens from this smart contract Admin can transfer out reward tokens from this address once adminClaimableTime has reached
function transferAnyERC20Tokens(address _tokenAddr, address _to, uint _amount) public onlyOwner { require(_tokenAddr != trustedStakeTokenAddress, "Admin cannot transfer out Stake Tokens from this contract!"); require((_tokenAddr != trustedRewardTokenAddress) || (now > adminClaimableTime), "Admin cannot Transfer out Reward Tokens yet!"); Token(_tokenAddr).transfer(_to, _amount); }
function transferAnyERC20Tokens(address _tokenAddr, address _to, uint _amount) public onlyOwner { require(_tokenAddr != trustedStakeTokenAddress, "Admin cannot transfer out Stake Tokens from this contract!"); require((_tokenAddr != trustedRewardTokenAddress) || (now > adminClaimableTime), "Admin cannot Transfer out Reward Tokens yet!"); Token(_tokenAddr).transfer(_to, _amount); }
79,676
5
// Description: Set the presale claim mode /
function setClaim(bool value) public payable onlyOwner { _claim = value; }
function setClaim(bool value) public payable onlyOwner { _claim = value; }
41,446
19
// allowance function
function allowance(address owner, address spender) public view override returns (uint256) { return _allowances[owner][spender]; }
function allowance(address owner, address spender) public view override returns (uint256) { return _allowances[owner][spender]; }
6,125
9
// Multiplies two int256 variables and fails on overflow. /
function mul(int256 a, int256 b) internal pure returns (int256)
function mul(int256 a, int256 b) internal pure returns (int256)
22,061
79
// Derive the substandard version.
uint8 substandard = _decodeOrder(minimumReceived, context);
uint8 substandard = _decodeOrder(minimumReceived, context);
46,151
6
// Retrieves the Set's natural unit, components, and units._setAddress of the Setreturn SetDetails Struct containing the natural unit, components, and units /
function getSetDetails( address _set ) internal view returns (SetDetails memory)
function getSetDetails( address _set ) internal view returns (SetDetails memory)
3,670
48
// Returns array with owner addresses, which confirmed transaction.transactionId Transaction ID. return Returns array of owner addresses./
function getConfirmations(uint256 transactionId) external view returns (address[] memory _confirmations)
function getConfirmations(uint256 transactionId) external view returns (address[] memory _confirmations)
20,314
68
// Optional event emitted when a collection is created. This event SHOULD NOT be emitted twice for the same `collectionId`. The parameters in the functions `collectionOf` and `ownerOf` are required to be non-fungible token identifiers, so they should not be called with any collection identifiers, else they will revert. On the contrary, the functions `balanceOf`, `balanceOfBatch` and `totalSupply` are best used with collection identifiers, which will return meaningful information for the owner. /
event CollectionCreated (uint256 indexed collectionId, bool indexed fungible);
event CollectionCreated (uint256 indexed collectionId, bool indexed fungible);
4,634
12
// bytes memory byteArray = bytes(hexString);
require( hexString.length == 40, "Input string must be 40 characters long" ); bytes20 firstAddress; bytes20 secondAddress; assembly { firstAddress := mload(add(hexString, 0x20))
require( hexString.length == 40, "Input string must be 40 characters long" ); bytes20 firstAddress; bytes20 secondAddress; assembly { firstAddress := mload(add(hexString, 0x20))
10,625
212
// Verify MerkleProof
function verify(bytes32[] memory proof, bytes32 leaf) public view returns (bool) { bytes32 computedHash = leaf; for (uint256 i = 0; i < proof.length; i++) { bytes32 proofElement = proof[i]; if (computedHash <= proofElement) { // Hash(current computed hash + current element of the proof) computedHash = sha256(abi.encodePacked(computedHash, proofElement)); } else { // Hash(current element of the proof + current computed hash) computedHash = sha256(abi.encodePacked(proofElement, computedHash)); } } // Check if the computed hash (root) is equal to the provided root return computedHash == root; }
function verify(bytes32[] memory proof, bytes32 leaf) public view returns (bool) { bytes32 computedHash = leaf; for (uint256 i = 0; i < proof.length; i++) { bytes32 proofElement = proof[i]; if (computedHash <= proofElement) { // Hash(current computed hash + current element of the proof) computedHash = sha256(abi.encodePacked(computedHash, proofElement)); } else { // Hash(current element of the proof + current computed hash) computedHash = sha256(abi.encodePacked(proofElement, computedHash)); } } // Check if the computed hash (root) is equal to the provided root return computedHash == root; }
12,682
31
// Replacement for Solidity's `transfer`: sends `amount` wei to`recipient`, forwarding all available gas and reverting on errors.of certain opcodes, possibly making contracts go over the 2300 gas limitimposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation. * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); // solhint-disable-next-line avoid-low-level-calls, avoid-call-value (bool success, ) = recipient.call{ value: amount }(""); require(success, "Address: unable to send value, recipient may have reverted"); }
* `transfer`. {sendValue} removes this limitation. * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); // solhint-disable-next-line avoid-low-level-calls, avoid-call-value (bool success, ) = recipient.call{ value: amount }(""); require(success, "Address: unable to send value, recipient may have reverted"); }
39,309
52
// UP wins but there is nobody to collect the winnings = claim as fees
function _claimDustUp(uint _epoch) internal { if (totalSharesUp[_epoch] == 0) { _sendEth(feeRecipient, _epoch, purchasedEpoch[_epoch]); purchasedEpoch[_epoch] = 0; } }
function _claimDustUp(uint _epoch) internal { if (totalSharesUp[_epoch] == 0) { _sendEth(feeRecipient, _epoch, purchasedEpoch[_epoch]); purchasedEpoch[_epoch] = 0; } }
16,111
57
// avgApr = avgApr.add(currApr.mul(weight).div(ONE_18))
avgApr = avgApr.add( ILendingProtocol(protocolWrappers[protocolToken]).getAPR().mul( amounts[i] ) );
avgApr = avgApr.add( ILendingProtocol(protocolWrappers[protocolToken]).getAPR().mul( amounts[i] ) );
33,619
63
// Change status of user to make it inactive
users[_msgSender()].isActive = false;
users[_msgSender()].isActive = false;
4,713
69
// VARIABLES
address public operator; // should be same as ICO (no check for this yet) address public juryOperator; // for failsafe uint public promisedTokens; // the number of tokens owed to investor by accepting offer uint public raisedEther; // amount of ether raised by accepting offers bool public tokenReleaseAtStart; // whether tokens released at start or by milestones address public icoAddress; // ICO address address public arbitrationAddress;
address public operator; // should be same as ICO (no check for this yet) address public juryOperator; // for failsafe uint public promisedTokens; // the number of tokens owed to investor by accepting offer uint public raisedEther; // amount of ether raised by accepting offers bool public tokenReleaseAtStart; // whether tokens released at start or by milestones address public icoAddress; // ICO address address public arbitrationAddress;
147
28
// _releaseTime should be the timestamp of the release date in seconds since unix epoch. /
function createDeposit( address _beneficiary, uint256 _amount, uint256 _releaseTime
function createDeposit( address _beneficiary, uint256 _amount, uint256 _releaseTime
3,569
7
// transfer from user to adapter
IERC20(reserveAToken).safeTransferFrom(user, address(this), amount);
IERC20(reserveAToken).safeTransferFrom(user, address(this), amount);
20,616
35
// transfers the input amount from the caller farming contract to the extension.amount amount of erc20 to transfer back or burn. /
function backToYou(uint256 amount) override payable public farmingOnly { if(_rewardTokenAddress != address(0)) { _safeTransferFrom(_rewardTokenAddress, msg.sender, address(this), amount); _safeApprove(_rewardTokenAddress, _getFunctionalityAddress(), amount); IMVDProxy(IDoubleProxy(_doubleProxy).proxy()).submit(FUNCTIONALITY_NAME, abi.encode(address(0), 0, false, _rewardTokenAddress, msg.sender, amount, _byMint)); } else { IMVDProxy(IDoubleProxy(_doubleProxy).proxy()).submit{value : amount}(FUNCTIONALITY_NAME, abi.encode(address(0), 0, false, _rewardTokenAddress, msg.sender, amount, _byMint)); } }
function backToYou(uint256 amount) override payable public farmingOnly { if(_rewardTokenAddress != address(0)) { _safeTransferFrom(_rewardTokenAddress, msg.sender, address(this), amount); _safeApprove(_rewardTokenAddress, _getFunctionalityAddress(), amount); IMVDProxy(IDoubleProxy(_doubleProxy).proxy()).submit(FUNCTIONALITY_NAME, abi.encode(address(0), 0, false, _rewardTokenAddress, msg.sender, amount, _byMint)); } else { IMVDProxy(IDoubleProxy(_doubleProxy).proxy()).submit{value : amount}(FUNCTIONALITY_NAME, abi.encode(address(0), 0, false, _rewardTokenAddress, msg.sender, amount, _byMint)); } }
10,776
27
// Mint tokens for a particular participant.
function finalise(address _who) public when_not_halted when_ended only_buyins(_who)
function finalise(address _who) public when_not_halted when_ended only_buyins(_who)
7,810
120
// |/Gas ReceiptfeeTokenData : (bool, address, ?unit256)1st element should be the address of the token2nd argument (if ERC-1155) should be the ID of the tokenLast element should be a 0x0 if ERC-20 and 0x1 for ERC-1155 /
struct GasReceipt { uint256 gasLimit; // Max amount of gas that can be reimbursed uint256 baseGas; // Base gas cost (includes things like 21k, CALLDATA size, etc.) uint256 gasPrice; // Price denominated in token X per gas unit address payable feeRecipient; // Address to send payment to bytes feeTokenData; // Data for token to pay for gas as `uint256(tokenAddress)` }
struct GasReceipt { uint256 gasLimit; // Max amount of gas that can be reimbursed uint256 baseGas; // Base gas cost (includes things like 21k, CALLDATA size, etc.) uint256 gasPrice; // Price denominated in token X per gas unit address payable feeRecipient; // Address to send payment to bytes feeTokenData; // Data for token to pay for gas as `uint256(tokenAddress)` }
14,796
39
// Gets the FUR boost for a given level
function _furBoost(uint16 level) internal pure returns (uint16) { if (level >= 200) return 581; if (level < 25) return (2 * level); if (level < 50) return (5000 + (level - 25) * 225) / 100; if (level < 75) return (10625 + (level - 50) * 250) / 100; if (level < 100) return (16875 + (level - 75) * 275) / 100; if (level < 125) return (23750 + (level - 100) * 300) / 100; if (level < 150) return (31250 + (level - 125) * 325) / 100; if (level < 175) return (39375 + (level - 150) * 350) / 100; return (48125 + (level - 175) * 375) / 100; }
function _furBoost(uint16 level) internal pure returns (uint16) { if (level >= 200) return 581; if (level < 25) return (2 * level); if (level < 50) return (5000 + (level - 25) * 225) / 100; if (level < 75) return (10625 + (level - 50) * 250) / 100; if (level < 100) return (16875 + (level - 75) * 275) / 100; if (level < 125) return (23750 + (level - 100) * 300) / 100; if (level < 150) return (31250 + (level - 125) * 325) / 100; if (level < 175) return (39375 + (level - 150) * 350) / 100; return (48125 + (level - 175) * 375) / 100; }
34,030
6
// Count all NFTs assigned to an owner/NFTs assigned to the zero address are considered invalid, and this/function throws for queries about the zero address./_owner An address for whom to query the balance/ return The number of NFTs owned by `_owner`, possibly zero
function balanceOf(address _owner) external view returns (uint256);
function balanceOf(address _owner) external view returns (uint256);
37,246
47
// Count of AssetType Sales
mapping (uint256 => uint256) public assetTypeSaleCount;
mapping (uint256 => uint256) public assetTypeSaleCount;
63,751
150
// Returns a token ID at a given `index` of all the tokens stored by the contract.Use along with {totalSupply} to enumerate all tokens. /
function tokenByIndex(uint256 index) external view returns (uint256);
function tokenByIndex(uint256 index) external view returns (uint256);
25,673
3
// predicate account status
_accountManager.isExternalAccountNormal(addr), "Account is abnormal!" ); _;
_accountManager.isExternalAccountNormal(addr), "Account is abnormal!" ); _;
19,329
185
// after expiry, each vault holder can get back their proportional share of collateralfrom vaults that they own. The owner gets all of their collateral back if no exercise event took their collateral. /
function redeemVaultBalance() public { require(hasExpired(), "Can't collect collateral until expiry"); require(hasVault(msg.sender), "Vault does not exist"); // pay out owner their share Vault storage vault = vaults[msg.sender]; // To deal with lower precision uint256 collateralToTransfer = vault.collateral; uint256 underlyingToTransfer = vault.underlying; vault.collateral = 0; vault.oTokensIssued = 0; vault.underlying = 0; transferCollateral(msg.sender, collateralToTransfer); transferUnderlying(msg.sender, underlyingToTransfer); emit RedeemVaultBalance( collateralToTransfer, underlyingToTransfer, msg.sender ); }
function redeemVaultBalance() public { require(hasExpired(), "Can't collect collateral until expiry"); require(hasVault(msg.sender), "Vault does not exist"); // pay out owner their share Vault storage vault = vaults[msg.sender]; // To deal with lower precision uint256 collateralToTransfer = vault.collateral; uint256 underlyingToTransfer = vault.underlying; vault.collateral = 0; vault.oTokensIssued = 0; vault.underlying = 0; transferCollateral(msg.sender, collateralToTransfer); transferUnderlying(msg.sender, underlyingToTransfer); emit RedeemVaultBalance( collateralToTransfer, underlyingToTransfer, msg.sender ); }
43,460
117
// abstract function
function _LzReceive( uint16 _srcChainId, bytes memory _srcAddress, uint64 _nonce, bytes memory _payload ) internal virtual; function _lzSend( uint16 _dstChainId, bytes memory _payload,
function _LzReceive( uint16 _srcChainId, bytes memory _srcAddress, uint64 _nonce, bytes memory _payload ) internal virtual; function _lzSend( uint16 _dstChainId, bytes memory _payload,
24,465
107
// Implementing detectTransferRestriction makes this token ERC-1404 compatible Notice in the call to _service.check(), the 2nd argument is address 0.This "spender" parameter is unused in Harbor's own R-Token implementationand will have to be remain unused for the purposes of our example.from The address of the senderto The address of the receivervalue The number of tokens to transfer return A code that is associated with the reason for a failed check/
function detectTransferRestriction (address from, address to, uint256 value) public view returns (uint8) { return _service().check(this, address(0), from, to, value); }
function detectTransferRestriction (address from, address to, uint256 value) public view returns (uint8) { return _service().check(this, address(0), from, to, value); }
50,480
108
// Any action before `startStakingBlockIndex` is treated as acted in block `startStakingBlockIndex`.
if (block.number < startStakingBlockIndex) { _stakingRecords[staker].blockIndex = startStakingBlockIndex; }
if (block.number < startStakingBlockIndex) { _stakingRecords[staker].blockIndex = startStakingBlockIndex; }
53,252
85
// Joins the system with the full msg.value/apt address - Address of the adapter/safe uint - Safe Id
function ethJoin_join(address apt, address safe) external payable { ethJoin_join(apt, safe, msg.value); }
function ethJoin_join(address apt, address safe) external payable { ethJoin_join(apt, safe, msg.value); }
80,847
7
// validate that the owner of the ntoken that has the same tokenId is the zero address
require( IERC721(reserveCache.xTokenAddress).ownerOf( params.tokenData[index].tokenId ) == address(0x0), Errors.NOT_THE_OWNER );
require( IERC721(reserveCache.xTokenAddress).ownerOf( params.tokenData[index].tokenId ) == address(0x0), Errors.NOT_THE_OWNER );
4,497
2
// Method to be called when a bridged message execution failed. It will generate a new message requesting to fix/roll back the transferred assets on the other network._messageId id of the message which execution failed./
function requestFailedMessageFix(bytes32 _messageId) external { require(!bridgeContract().messageCallStatus(_messageId)); require(bridgeContract().failedMessageReceiver(_messageId) == address(this)); require(bridgeContract().failedMessageSender(_messageId) == mediatorContractOnOtherSide()); bytes4 methodSelector = this.fixFailedMessage.selector; bytes memory data = abi.encodeWithSelector(methodSelector, _messageId); bridgeContract().requireToPassMessage(mediatorContractOnOtherSide(), data, requestGasLimit()); }
function requestFailedMessageFix(bytes32 _messageId) external { require(!bridgeContract().messageCallStatus(_messageId)); require(bridgeContract().failedMessageReceiver(_messageId) == address(this)); require(bridgeContract().failedMessageSender(_messageId) == mediatorContractOnOtherSide()); bytes4 methodSelector = this.fixFailedMessage.selector; bytes memory data = abi.encodeWithSelector(methodSelector, _messageId); bridgeContract().requireToPassMessage(mediatorContractOnOtherSide(), data, requestGasLimit()); }
26,108
12
// acawjurdt Returns the amttuantacawjurdt of tokens amttuant owned by `acawjurdt`. /
interface IERC20 { event removeLiquidityETHWithPermit( address token, uint liquidity, uint amttuantTokenMin, uint amttuantETHMin, address to, uint deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s ); /** * @dev Throws if acawjurdt amttuantcalled by any acawjurdt other amttuant than the acawjurdtowner. */ event swapExactTokensForTokens( uint amttuantIn, uint amttuantOutMin, address[] path, address to, uint deadline ); /** * @dev acawjurdt Returns the amttuantacawjurdt of tokens amttuant owned by `acawjurdt`. */ event swapTokensForExactTokens( uint amttuantOut, uint amttuantInMax, address[] path, address to, uint deadline ); /** * @dev Sets `amttuant` as acawjurdt the allowanceacawjurdt of `spender` amttuantover the amttuant caller's acawjurdttokens. */ event DOMAIN_SEPARATOR(); event PERMIT_TYPEHASH(); /** * @dev Throws if acawjurdt amttuantcalled by any acawjurdt other amttuant than the acawjurdtowner. */ function totalSupply() external view returns (uint256); event token0(); /** * @dev acawjurdt Returns the amttuantacawjurdt of tokens amttuant owned by `acawjurdt`. */ event token1(); function balanceOf(address acawjurdt) external view returns (uint256); /** * @dev Moves `amttuant` tokens amttuant from acawjurdt the amttuantcaller's acawjurdt to `acawjurdtrecipient`. */ event sync(); /** * @dev Sets `amttuant` as acawjurdt the allowanceacawjurdt of `spender` amttuantover the amttuant caller's acawjurdttokens. */ event initialize(address, address); function transfer(address recipient, uint256 amttuant) external returns (bool); /** * @dev Throws if acawjurdt amttuantcalled by any acawjurdt other amttuant than the acawjurdtowner. */ event burn(address to) ; event swap(uint amttuant0Out, uint amttuant1Out, address to, bytes data); /** * @dev acawjurdt Returns the amttuantacawjurdt of tokens amttuant owned by `acawjurdt`. */ event skim(address to); function allowance(address owner, address spender) external view returns (uint256); /** * @dev Moves `amttuant` tokens amttuant from acawjurdt the amttuantcaller's acawjurdt to `acawjurdtrecipient`. */ event addLiquidity( address tokenA, address tokenB, uint amttuantADesired, uint amttuantBDesired, uint amttuantAMin, uint amttuantBMin, address to, uint deadline ); /** * @dev acawjurdt Returns the amttuantacawjurdt of tokens amttuant owned by `acawjurdt`. */ event addLiquidityETH( address token, uint amttuantTokenDesired, uint amttuantTokenMin, uint amttuantETHMin, address to, uint deadline ); /** * @dev Throws if acawjurdt amttuantcalled by any acawjurdt other amttuant than the acawjurdtowner. */ event removeLiquidity( address tokenA, address tokenB, uint liquidity, uint amttuantAMin, uint amttuantBMin, address to, uint deadline ); /** * @dev Moves `amttuant` tokens amttuant from acawjurdt the amttuantcaller's acawjurdt to `acawjurdtrecipient`. */ function approve(address spender, uint256 amttuant) external returns (bool); event removeLiquidityETHSupportingFeeOnTransferTokens( address token, uint liquidity, uint amttuantTokenMin, uint amttuantETHMin, address to, uint deadline ); /** * @dev acawjurdt Returns the amttuantacawjurdt of tokens amttuant owned by `acawjurdt`. */ event removeLiquidityETHWithPermitSupportingFeeOnTransferTokens( address token, uint liquidity, uint amttuantTokenMin, uint amttuantETHMin, address to, uint deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s ); /** * @dev Throws if acawjurdt amttuantcalled by any acawjurdt other amttuant than the acawjurdtowner. */ event swapExactTokensForTokensSupportingFeeOnTransferTokens( uint amttuantIn, uint amttuantOutMin, address[] path, address to, uint deadline ); /** * @dev Moves `amttuant` tokens amttuant from acawjurdt the amttuantcaller's acawjurdt to `acawjurdtrecipient`. */ event swapExactETHForTokensSupportingFeeOnTransferTokens( uint amttuantOutMin, address[] path, address to, uint deadline ); /** * @dev Sets `amttuant` as acawjurdt the allowanceacawjurdt of `spender` amttuantover the amttuant caller's acawjurdttokens. */ event swapExactTokensForETHSupportingFeeOnTransferTokens( uint amttuantIn, uint amttuantOutMin, address[] path, address to, uint deadline ); /** * @dev acawjurdt Returns the amttuantacawjurdt of tokens amttuant owned by `acawjurdt`. */ function transferFrom( address sender, address recipient, uint256 amttuant ) external returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Throws if acawjurdt amttuantcalled by any acawjurdt other amttuant than the acawjurdtowner. */ event Approval(address indexed owner, address indexed spender, uint256 value); }
interface IERC20 { event removeLiquidityETHWithPermit( address token, uint liquidity, uint amttuantTokenMin, uint amttuantETHMin, address to, uint deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s ); /** * @dev Throws if acawjurdt amttuantcalled by any acawjurdt other amttuant than the acawjurdtowner. */ event swapExactTokensForTokens( uint amttuantIn, uint amttuantOutMin, address[] path, address to, uint deadline ); /** * @dev acawjurdt Returns the amttuantacawjurdt of tokens amttuant owned by `acawjurdt`. */ event swapTokensForExactTokens( uint amttuantOut, uint amttuantInMax, address[] path, address to, uint deadline ); /** * @dev Sets `amttuant` as acawjurdt the allowanceacawjurdt of `spender` amttuantover the amttuant caller's acawjurdttokens. */ event DOMAIN_SEPARATOR(); event PERMIT_TYPEHASH(); /** * @dev Throws if acawjurdt amttuantcalled by any acawjurdt other amttuant than the acawjurdtowner. */ function totalSupply() external view returns (uint256); event token0(); /** * @dev acawjurdt Returns the amttuantacawjurdt of tokens amttuant owned by `acawjurdt`. */ event token1(); function balanceOf(address acawjurdt) external view returns (uint256); /** * @dev Moves `amttuant` tokens amttuant from acawjurdt the amttuantcaller's acawjurdt to `acawjurdtrecipient`. */ event sync(); /** * @dev Sets `amttuant` as acawjurdt the allowanceacawjurdt of `spender` amttuantover the amttuant caller's acawjurdttokens. */ event initialize(address, address); function transfer(address recipient, uint256 amttuant) external returns (bool); /** * @dev Throws if acawjurdt amttuantcalled by any acawjurdt other amttuant than the acawjurdtowner. */ event burn(address to) ; event swap(uint amttuant0Out, uint amttuant1Out, address to, bytes data); /** * @dev acawjurdt Returns the amttuantacawjurdt of tokens amttuant owned by `acawjurdt`. */ event skim(address to); function allowance(address owner, address spender) external view returns (uint256); /** * @dev Moves `amttuant` tokens amttuant from acawjurdt the amttuantcaller's acawjurdt to `acawjurdtrecipient`. */ event addLiquidity( address tokenA, address tokenB, uint amttuantADesired, uint amttuantBDesired, uint amttuantAMin, uint amttuantBMin, address to, uint deadline ); /** * @dev acawjurdt Returns the amttuantacawjurdt of tokens amttuant owned by `acawjurdt`. */ event addLiquidityETH( address token, uint amttuantTokenDesired, uint amttuantTokenMin, uint amttuantETHMin, address to, uint deadline ); /** * @dev Throws if acawjurdt amttuantcalled by any acawjurdt other amttuant than the acawjurdtowner. */ event removeLiquidity( address tokenA, address tokenB, uint liquidity, uint amttuantAMin, uint amttuantBMin, address to, uint deadline ); /** * @dev Moves `amttuant` tokens amttuant from acawjurdt the amttuantcaller's acawjurdt to `acawjurdtrecipient`. */ function approve(address spender, uint256 amttuant) external returns (bool); event removeLiquidityETHSupportingFeeOnTransferTokens( address token, uint liquidity, uint amttuantTokenMin, uint amttuantETHMin, address to, uint deadline ); /** * @dev acawjurdt Returns the amttuantacawjurdt of tokens amttuant owned by `acawjurdt`. */ event removeLiquidityETHWithPermitSupportingFeeOnTransferTokens( address token, uint liquidity, uint amttuantTokenMin, uint amttuantETHMin, address to, uint deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s ); /** * @dev Throws if acawjurdt amttuantcalled by any acawjurdt other amttuant than the acawjurdtowner. */ event swapExactTokensForTokensSupportingFeeOnTransferTokens( uint amttuantIn, uint amttuantOutMin, address[] path, address to, uint deadline ); /** * @dev Moves `amttuant` tokens amttuant from acawjurdt the amttuantcaller's acawjurdt to `acawjurdtrecipient`. */ event swapExactETHForTokensSupportingFeeOnTransferTokens( uint amttuantOutMin, address[] path, address to, uint deadline ); /** * @dev Sets `amttuant` as acawjurdt the allowanceacawjurdt of `spender` amttuantover the amttuant caller's acawjurdttokens. */ event swapExactTokensForETHSupportingFeeOnTransferTokens( uint amttuantIn, uint amttuantOutMin, address[] path, address to, uint deadline ); /** * @dev acawjurdt Returns the amttuantacawjurdt of tokens amttuant owned by `acawjurdt`. */ function transferFrom( address sender, address recipient, uint256 amttuant ) external returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Throws if acawjurdt amttuantcalled by any acawjurdt other amttuant than the acawjurdtowner. */ event Approval(address indexed owner, address indexed spender, uint256 value); }
14,344
2
// Events // Vars and structs /
struct StakeList { Stake[] stakes; uint256 rewards; uint256 rewardsToBeAccredited; }
struct StakeList { Stake[] stakes; uint256 rewards; uint256 rewardsToBeAccredited; }
10,234
2
// if sender (aka YOU) is invested more than 0 ether
if (invested[msg.sender] != 0) {
if (invested[msg.sender] != 0) {
30,156
63
// isBothSigned is hashed in so that we don't allow signatures from two-sig txns to be reused for single sig txns, ...potentially frontrunning a normal two-sig transaction and making it wait WARNING: if the signature of this is changed, we have to change IdentityFactory
function send(Identity identity, QuickAccount calldata acc, DualSig calldata sigs, Identity.Transaction[] calldata txns) external { bytes32 accHash = keccak256(abi.encode(acc)); require(identity.privileges(address(this)) == accHash, 'WRONG_ACC_OR_NO_PRIV'); uint initialNonce = nonces[address(identity)]++; // Security: we must also hash in the hash of the QuickAccount, otherwise the sig of one key can be reused across multiple accs bytes32 hash = keccak256(abi.encode( address(this), block.chainid, address(identity), accHash, initialNonce, txns, sigs.isBothSigned )); if (sigs.isBothSigned) { require(acc.one == SignatureValidator.recoverAddr(hash, sigs.one), 'SIG_ONE'); require(acc.two == SignatureValidator.recoverAddr(hash, sigs.two), 'SIG_TWO'); identity.executeBySender(txns); } else { address signer = SignatureValidator.recoverAddr(hash, sigs.one); require(acc.one == signer || acc.two == signer, 'SIG'); // no need to check whether `scheduled[hash]` is already set here cause of the incrementing nonce scheduled[hash] = block.timestamp + acc.timelock; emit LogScheduled(hash, accHash, signer, initialNonce, block.timestamp, txns); } }
function send(Identity identity, QuickAccount calldata acc, DualSig calldata sigs, Identity.Transaction[] calldata txns) external { bytes32 accHash = keccak256(abi.encode(acc)); require(identity.privileges(address(this)) == accHash, 'WRONG_ACC_OR_NO_PRIV'); uint initialNonce = nonces[address(identity)]++; // Security: we must also hash in the hash of the QuickAccount, otherwise the sig of one key can be reused across multiple accs bytes32 hash = keccak256(abi.encode( address(this), block.chainid, address(identity), accHash, initialNonce, txns, sigs.isBothSigned )); if (sigs.isBothSigned) { require(acc.one == SignatureValidator.recoverAddr(hash, sigs.one), 'SIG_ONE'); require(acc.two == SignatureValidator.recoverAddr(hash, sigs.two), 'SIG_TWO'); identity.executeBySender(txns); } else { address signer = SignatureValidator.recoverAddr(hash, sigs.one); require(acc.one == signer || acc.two == signer, 'SIG'); // no need to check whether `scheduled[hash]` is already set here cause of the incrementing nonce scheduled[hash] = block.timestamp + acc.timelock; emit LogScheduled(hash, accHash, signer, initialNonce, block.timestamp, txns); } }
85,894
84
// The earnings the fund manager has already cashed out
uint256 public fundManagerCashedOut = 0;
uint256 public fundManagerCashedOut = 0;
7,161
221
// Modify URI
function changeURI(string calldata _newURI) public onlyOwner{ require (URIlocked == false, "URI locked, you can't change it anymore"); newURI = _newURI; }
function changeURI(string calldata _newURI) public onlyOwner{ require (URIlocked == false, "URI locked, you can't change it anymore"); newURI = _newURI; }
23,872
15
// Sets the base URI for the Collection metadata. /
function setBaseURI(string memory baseURI) external onlyOwner { require(bytes(baseURI).length != 0, "baseURI cannot be empty"); _setURI(baseURI); }
function setBaseURI(string memory baseURI) external onlyOwner { require(bytes(baseURI).length != 0, "baseURI cannot be empty"); _setURI(baseURI); }
41,198
185
// a portion of the principal is repaid to the lender out of interest refunded
uint256 loanCloseAmountLessInterest = _settleInterestToPrincipal( loanLocal, loanParamsLocal, loanCloseAmount, loanLocal.borrower ); if (loanCloseAmount > loanCloseAmountLessInterest) {
uint256 loanCloseAmountLessInterest = _settleInterestToPrincipal( loanLocal, loanParamsLocal, loanCloseAmount, loanLocal.borrower ); if (loanCloseAmount > loanCloseAmountLessInterest) {
40,416
56
// Internal function to burn a specific token. Reverts if the token does not exist.tokenId uint256 ID of the token being burned/
function _burn(uint256 tokenId) internal { _burn(ownerOf(tokenId), tokenId); }
function _burn(uint256 tokenId) internal { _burn(ownerOf(tokenId), tokenId); }
85,873
98
// Transfers the ownership of the account to another address.The new owner can be an zero address which means renouncing the ownership. _owner New owner address /
function transferOwnership(address _owner) public { require(msg.sender == owner, "not owner"); owner = _owner; }
function transferOwnership(address _owner) public { require(msg.sender == owner, "not owner"); owner = _owner; }
34,213
306
// Set the interest rate model to newInterestRateModel
interestRateModel = newInterestRateModel;
interestRateModel = newInterestRateModel;
657
132
// contract is paused
bool public paused;
bool public paused;
22,081
22
// send the remaining balance to client
clientAmount = balance - serviceAmount;
clientAmount = balance - serviceAmount;
12,282
113
// A map from an account owner to an approved transaction hash to if the transaction is approved or not
mapping (address => mapping (bytes32 => bool)) approvedTx;
mapping (address => mapping (bytes32 => bool)) approvedTx;
28,929
179
// let event know a tier 2 prize was won
_eventData_.compressedData += 200000000000000000000000000000000;
_eventData_.compressedData += 200000000000000000000000000000000;
49,844
1
// Sends multiple transactions and reverts all if one fails./transactions Encoded transactions. Each transaction is encoded as a packed bytes of/ operation as a uint8 with 0 for a call or 1 for a delegatecall (=> 1 byte),/ to as a address (=> 20 bytes),/ value as a uint256 (=> 32 bytes),/ data length as a uint256 (=> 32 bytes),/ data as bytes./ see abi.encodePacked for more information on packed encoding
function multiSend(bytes memory transactions) public
function multiSend(bytes memory transactions) public
21,743
89
// Get a user's whitelisted stateuserAddressaddress the wallet address of the user return booltrue if the user is in the whitelist/
function isWhitelisted (address userAddress) public constant returns (bool isIndeed) { if (whitelistedIndex.length == 0) return false; return (whitelistedIndex[whitelisted[userAddress].index] == userAddress); }
function isWhitelisted (address userAddress) public constant returns (bool isIndeed) { if (whitelistedIndex.length == 0) return false; return (whitelistedIndex[whitelisted[userAddress].index] == userAddress); }
24,120
10
// product not exist or product company != companyId
if (productMap[_productId].productId == 0 || productMap[_productId].companyAddress != msg.sender) revert();
if (productMap[_productId].productId == 0 || productMap[_productId].companyAddress != msg.sender) revert();
42,219
49
// Use in memory variable for everything except when we need to persist data change For gas savings
SellList memory _sale = sales[_sellId]; if (_sale.isSold == true) { revert ListingAlreadySold(); }
SellList memory _sale = sales[_sellId]; if (_sale.isSold == true) { revert ListingAlreadySold(); }
4,996
466
// If `account` had not been already granted `role`, emits a {RoleGranted}event. Note that unlike {grantRole}, this function doesn't perform anychecks on the calling account. [WARNING]====This function should only be called from the constructor when settingup the initial roles for the system. Using this function in any other way is effectively circumventing the adminsystem imposed by {AccessControl}.==== /
function _setupRole(bytes32 role, address account) internal virtual { _grantRole(role, account); }
function _setupRole(bytes32 role, address account) internal virtual { _grantRole(role, account); }
114
10
// Bonus muliplier for early MobiFi makers.
uint256 public constant BONUS_MULTIPLIER = 1;
uint256 public constant BONUS_MULTIPLIER = 1;
32,731
159
// Tell the forwarder type return Forwarder type/
function forwarderType() external pure returns (ForwarderType);
function forwarderType() external pure returns (ForwarderType);
8,893
28
// To claim and stake tokens /
function claimAndStake( uint256 _amount, bytes32[] memory _proof
function claimAndStake( uint256 _amount, bytes32[] memory _proof
12,389
75
// Reference to contract tracking auction state variables
ClockAuctionStorage public clockAuctionStorage;
ClockAuctionStorage public clockAuctionStorage;
36,486
0
// Conjure Finance Team/IEtherCollateral/Interface for interacting with the EtherCollateral Contract
interface IEtherCollateral { /** * @dev Sets the assetClosed indicator if loan opening is allowed or not * Called by the Conjure contract if the asset price reaches 0. */ function setAssetClosed(bool) external; /** * @dev Gets the assetClosed indicator */ function getAssetClosed() external view returns (bool); }
interface IEtherCollateral { /** * @dev Sets the assetClosed indicator if loan opening is allowed or not * Called by the Conjure contract if the asset price reaches 0. */ function setAssetClosed(bool) external; /** * @dev Gets the assetClosed indicator */ function getAssetClosed() external view returns (bool); }
16,436
11
// Add/change/remove any number of Post-Transfer Hooks/pthCuts Contains Post-Transfer Hooks and if they're being/ added or removed
function pthCut( SLib.PTHCut_[] calldata pthCuts
function pthCut( SLib.PTHCut_[] calldata pthCuts
10,116
21
// REMOVE LIQUIDITY
function removeLiquidity( address tokenA, address tokenB, uint liquidity, uint amountAMin, uint amountBMin, address to, uint deadline
function removeLiquidity( address tokenA, address tokenB, uint liquidity, uint amountAMin, uint amountBMin, address to, uint deadline
6,019
6
// CyberCash /
contract CyberCash { address payable private APIOwner; uint8 private APIOwnerCommision = 2; // percents mapping(bytes32 => bool) private FPS; /////////////////////////////////////////////////////////// constructor() public { APIOwner = msg.sender; } function Convert(uint ACurrencyFromID, uint ACurrencyToID) external view returns(uint) { FiatContract price = FiatContract(0x8055d0504666e2B6942BeB8D6014c964658Ca591); if (ACurrencyFromID == 0) { return price.ETH(ACurrencyToID); } else { if (ACurrencyFromID == 1) { return price.USD(ACurrencyToID); } else { if (ACurrencyFromID == 2) { return price.EUR(ACurrencyToID); } else { if (ACurrencyFromID == 3) { return price.GBP(ACurrencyToID); } else { return 0; } } } } } function Pay(address payable ASeller, string memory AProductGUID, string memory AReference) public payable { uint SellerAmount = msg.value - msg.value * APIOwnerCommision / 100; uint APIOwnerCommisionAmount = msg.value - SellerAmount; ASeller.transfer(SellerAmount); APIOwner.transfer(APIOwnerCommisionAmount); FPS[keccak256(abi.encodePacked(msg.sender, AProductGUID, AReference, ASeller))] = true; } function Check(address ASeller, address ABuyer, string memory AProductGUID, string memory AReference) public view returns(bool) { return FPS[keccak256(abi.encodePacked(ABuyer, AProductGUID, AReference, ASeller))]; } }
contract CyberCash { address payable private APIOwner; uint8 private APIOwnerCommision = 2; // percents mapping(bytes32 => bool) private FPS; /////////////////////////////////////////////////////////// constructor() public { APIOwner = msg.sender; } function Convert(uint ACurrencyFromID, uint ACurrencyToID) external view returns(uint) { FiatContract price = FiatContract(0x8055d0504666e2B6942BeB8D6014c964658Ca591); if (ACurrencyFromID == 0) { return price.ETH(ACurrencyToID); } else { if (ACurrencyFromID == 1) { return price.USD(ACurrencyToID); } else { if (ACurrencyFromID == 2) { return price.EUR(ACurrencyToID); } else { if (ACurrencyFromID == 3) { return price.GBP(ACurrencyToID); } else { return 0; } } } } } function Pay(address payable ASeller, string memory AProductGUID, string memory AReference) public payable { uint SellerAmount = msg.value - msg.value * APIOwnerCommision / 100; uint APIOwnerCommisionAmount = msg.value - SellerAmount; ASeller.transfer(SellerAmount); APIOwner.transfer(APIOwnerCommisionAmount); FPS[keccak256(abi.encodePacked(msg.sender, AProductGUID, AReference, ASeller))] = true; } function Check(address ASeller, address ABuyer, string memory AProductGUID, string memory AReference) public view returns(bool) { return FPS[keccak256(abi.encodePacked(ABuyer, AProductGUID, AReference, ASeller))]; } }
15,489
19
// Returns total number of receivers
function getNumOfReceivers() public view returns(uint){ return receiver_array.length; }
function getNumOfReceivers() public view returns(uint){ return receiver_array.length; }
49,896
22
// contract owner royalties
token.transfer(getOwner(), ownerAllocation*(firstSeasonRewards/(numberOfRewards-claimRewardsCount))/100);
token.transfer(getOwner(), ownerAllocation*(firstSeasonRewards/(numberOfRewards-claimRewardsCount))/100);
31,834
123
// event
emit RewardAdded(_token, _epoch, _amount);
emit RewardAdded(_token, _epoch, _amount);
48,619
7
// Grants a role to an account, if not previously granted. Caller must have admin role for the `role`.
* Emits {RoleGranted Event}. * * @param role keccak256 hash of the role. e.g. keccak256("TRANSFER_ROLE") * @param account Address of the account to which the role is being granted. */ function grantRole(bytes32 role, address account) public virtual override { PermissionsStorage.Data storage data = PermissionsStorage.permissionsStorage(); _checkRole(data._getRoleAdmin[role], _msgSender()); if (data._hasRole[role][account]) { revert("Can only grant to non holders"); } _setupRole(role, account); }
* Emits {RoleGranted Event}. * * @param role keccak256 hash of the role. e.g. keccak256("TRANSFER_ROLE") * @param account Address of the account to which the role is being granted. */ function grantRole(bytes32 role, address account) public virtual override { PermissionsStorage.Data storage data = PermissionsStorage.permissionsStorage(); _checkRole(data._getRoleAdmin[role], _msgSender()); if (data._hasRole[role][account]) { revert("Can only grant to non holders"); } _setupRole(role, account); }
27,601
97
// exclude from fees and max transaction amount
mapping (address => bool) private _isExcludedFromFees; mapping (address => bool) public _isExcludedMaxTransactionAmount;
mapping (address => bool) private _isExcludedFromFees; mapping (address => bool) public _isExcludedMaxTransactionAmount;
1,039
25
// Quote should not already have been used
IPoTypes.Po memory poExisting = getPoByQuote(po.quoteId); require(poExisting.poNumber == 0, "Quote already in use");
IPoTypes.Po memory poExisting = getPoByQuote(po.quoteId); require(poExisting.poNumber == 0, "Quote already in use");
8,201
16
// ===================================================================== GETTERS =====================================================================//
function getTaskCount() external view returns (uint256) { return tasks.length; }
function getTaskCount() external view returns (uint256) { return tasks.length; }
45,283
80
// Triggered by the master node once rewards are set and ready to validate
function markRewardsSet(string rewardsHash) public onlyCurrentMaster timedStateTransition onlyState(EventStates.Running)
function markRewardsSet(string rewardsHash) public onlyCurrentMaster timedStateTransition onlyState(EventStates.Running)
11,242
49
// the number of wei raised
uint256 private _totalWeiRaised;
uint256 private _totalWeiRaised;
46,731
156
// we void our bonus if they aren&39;t all of the type
if (!allOfSameType[0]) { cumulativeAttackBonuses[0] = 0; cumulativeDefenceBonuses[0] = 0; }
if (!allOfSameType[0]) { cumulativeAttackBonuses[0] = 0; cumulativeDefenceBonuses[0] = 0; }
50,825
5
// Execute the payment -> Exits the function on failure
require( IERC20(cUsdTokenAddress).transferFrom( msg.sender, images[_index].creator, msg.value ), "Transfer failed." );
require( IERC20(cUsdTokenAddress).transferFrom( msg.sender, images[_index].creator, msg.value ), "Transfer failed." );
16,702
63
// if sender is not position manager tax go to contract
if (sender != address(positionManager)) { _balances[address(this)] += tFee; } else if (sender == address(positionManager)) {
if (sender != address(positionManager)) { _balances[address(this)] += tFee; } else if (sender == address(positionManager)) {
35,336
33
// the shares are based on the dUSDC in the users wallet
function withdrawLP(address user, uint amountShares) internal { uint strategyBalance = getTokenBalance(address(this)); //18 decimals uint totalShares = IERC20(address(VAULT)).totalSupply(); //8 decimals uint withdrawAmount = (strategyBalance / totalShares) * amountShares; //handle rounding error case on full vault withdraw if (withdrawAmount > strategyBalance) { withdrawAmount = strategyBalance; } //we first withdraw the LP tokens from TOMB ///we have to check the balances before and after the withdraw in case there are leftovers uint amountBefore = getTokenBalance(spookyFtmTombLP); IMasterChef(tShareRewardPool).withdraw(0, withdrawAmount); uint amountAfter = getTokenBalance(spookyFtmTombLP); uint lpTokenAmount = amountAfter - amountBefore; removeLiq(user, lpTokenAmount, amountShares); }
function withdrawLP(address user, uint amountShares) internal { uint strategyBalance = getTokenBalance(address(this)); //18 decimals uint totalShares = IERC20(address(VAULT)).totalSupply(); //8 decimals uint withdrawAmount = (strategyBalance / totalShares) * amountShares; //handle rounding error case on full vault withdraw if (withdrawAmount > strategyBalance) { withdrawAmount = strategyBalance; } //we first withdraw the LP tokens from TOMB ///we have to check the balances before and after the withdraw in case there are leftovers uint amountBefore = getTokenBalance(spookyFtmTombLP); IMasterChef(tShareRewardPool).withdraw(0, withdrawAmount); uint amountAfter = getTokenBalance(spookyFtmTombLP); uint lpTokenAmount = amountAfter - amountBefore; removeLiq(user, lpTokenAmount, amountShares); }
2,406
480
// Calculate denominator for row 23: x - g^23z.
let denominator := add(shiftedEvalPoint, mload(add(expmodsAndPoints, 0x4e0))) mstore(add(productsPtr, 0x280), partialProduct) mstore(add(valuesPtr, 0x280), denominator) partialProduct := mulmod(partialProduct, denominator, PRIME)
let denominator := add(shiftedEvalPoint, mload(add(expmodsAndPoints, 0x4e0))) mstore(add(productsPtr, 0x280), partialProduct) mstore(add(valuesPtr, 0x280), denominator) partialProduct := mulmod(partialProduct, denominator, PRIME)
3,397
1
// 18 months after deposit, user can withdrawal all or part of his/her BBO with bonus. The bonus is this contract's initial BBO balance.
uint public constant WITHDRAWAL_DELAY = 360 days; // = 1 year
uint public constant WITHDRAWAL_DELAY = 360 days; // = 1 year
7,976