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 |
|---|---|---|---|---|
0 | // Throws if argument account is blacklisted _account The address to check/ | modifier notBlacklisted(address _account) {
require(blacklisted[_account] == false);
_;
}
| modifier notBlacklisted(address _account) {
require(blacklisted[_account] == false);
_;
}
| 4,420 |
5 | // pets warehouse init | pets["dog"].Type = "dog";
pets["dog"].Point = 40;
pets["dog"].Repertory = 10;
pets["cat"].Type = "cat";
pets["cat"].Point = 20;
pets["cat"].Repertory = 20;
pets["monkey"].Type = "monkey";
pets["monkey"].Point = 100;
| pets["dog"].Type = "dog";
pets["dog"].Point = 40;
pets["dog"].Repertory = 10;
pets["cat"].Type = "cat";
pets["cat"].Point = 20;
pets["cat"].Repertory = 20;
pets["monkey"].Type = "monkey";
pets["monkey"].Point = 100;
| 53,295 |
41 | // crowdsale parameters | bool public isFinalized; // switched to true in operational state
uint256 public constant FUNDING_START_TIMESTAMP = 1511919480; // 11/29/2017 @ 1:38am UTC
uint256 public constant FUNDING_END_TIMESTAMP = FUNDING_START_TIMESTAMP + (60 * 60 * 24 * 90); // 90 days
uint256 public constant ARCD_FUND = 92 * (10**8) * 10**decimals; // 9.2B for Arcade City
uint256 public constant TOKEN_EXCHANGE_RATE = 200000; // 200,000 ARCD tokens per 1 ETH
uint256 public constant TOKEN_CREATION_CAP = 10 * (10**9) * 10**decimals; // 10B total
uint256 public constant MIN_BUY_TOKENS = 20000 * 10**decimals; // 0.1 ETH
uint256 public constant GAS_PRICE_LIMIT = 60 * 10**9; // Gas limit 60 gwei
| bool public isFinalized; // switched to true in operational state
uint256 public constant FUNDING_START_TIMESTAMP = 1511919480; // 11/29/2017 @ 1:38am UTC
uint256 public constant FUNDING_END_TIMESTAMP = FUNDING_START_TIMESTAMP + (60 * 60 * 24 * 90); // 90 days
uint256 public constant ARCD_FUND = 92 * (10**8) * 10**decimals; // 9.2B for Arcade City
uint256 public constant TOKEN_EXCHANGE_RATE = 200000; // 200,000 ARCD tokens per 1 ETH
uint256 public constant TOKEN_CREATION_CAP = 10 * (10**9) * 10**decimals; // 10B total
uint256 public constant MIN_BUY_TOKENS = 20000 * 10**decimals; // 0.1 ETH
uint256 public constant GAS_PRICE_LIMIT = 60 * 10**9; // Gas limit 60 gwei
| 11,422 |
10 | // Function to run a query.Run a query in order to be able to check if a condition to mint a badge is met._caller The Ethereum address which has requested for the query result._badgeConditionGroupID The ID of the condition group to mint the badge._indexer The service indexing the data (possible values: "thegraph, "covalent")._protocol The set/subgraph on the indexer to use (possible values: "uniswap", "compound" ,"aave" ,"ethereum")._query The query to be run. return _requestID The ID of the query./ | function runQuery(address _caller, bytes32 _badgeConditionGroupID, string memory _indexer, string memory _protocol, string memory _query) onlyOwner() public returns (bytes32 _requestID) {
//TODO : remove
//_queryResult = "51";
// Asking for the query to be run
_queryNonce.increment();
_requestID = keccak256(abi.encodePacked(block.timestamp, _caller, _queryNonce.current()));
// Storing the pending query
Request storage pendingQuery = _requests[_requestID];
pendingQuery.caller = _caller;
pendingQuery.isPending = true;
pendingQuery.badgeConditionGroupID = _badgeConditionGroupID;
pendingQuery.indexer = _indexer;
pendingQuery.protocol = _protocol;
pendingQuery.query = _query;
return _requestID;
}
| function runQuery(address _caller, bytes32 _badgeConditionGroupID, string memory _indexer, string memory _protocol, string memory _query) onlyOwner() public returns (bytes32 _requestID) {
//TODO : remove
//_queryResult = "51";
// Asking for the query to be run
_queryNonce.increment();
_requestID = keccak256(abi.encodePacked(block.timestamp, _caller, _queryNonce.current()));
// Storing the pending query
Request storage pendingQuery = _requests[_requestID];
pendingQuery.caller = _caller;
pendingQuery.isPending = true;
pendingQuery.badgeConditionGroupID = _badgeConditionGroupID;
pendingQuery.indexer = _indexer;
pendingQuery.protocol = _protocol;
pendingQuery.query = _query;
return _requestID;
}
| 54,372 |
85 | // isHuman() onlyOwner() | public
payable
| public
payable
| 39,771 |
201 | // isWhitelisted- Public helper to check if an address is whitelisted | function isWhitelisted (address addr) public view returns (bool) {
return _whiteListedMembers[addr] == MemberClaimStatus.Listed;
}
| function isWhitelisted (address addr) public view returns (bool) {
return _whiteListedMembers[addr] == MemberClaimStatus.Listed;
}
| 50,240 |
3 | // Initializes the contract owner | constructor () public {
owner = msg.sender;
emit OwnershipTransferred(owner, address(0));
}
| constructor () public {
owner = msg.sender;
emit OwnershipTransferred(owner, address(0));
}
| 8,024 |
28 | // at beginning of LE, only V1 depositors and team token holders may contribute | require(
taxCreditsOf(msg.sender) >= 1e6 ether || balanceOf(msg.sender) > 0,
'ERR: must contribute V1 tokens'
);
| require(
taxCreditsOf(msg.sender) >= 1e6 ether || balanceOf(msg.sender) > 0,
'ERR: must contribute V1 tokens'
);
| 56,531 |
16 | // Function to set the pause in order to block or restore all transfers. Allowed only for pauser | * Emits a { PauseModeChange } event
*
* @param newPauseMode The new pause mode
*/
function setPause(bool newPauseMode) external {
require(_msgSender() == pauser, "BackedToken: Only pauser");
isPaused = newPauseMode;
emit PauseModeChange(newPauseMode);
}
| * Emits a { PauseModeChange } event
*
* @param newPauseMode The new pause mode
*/
function setPause(bool newPauseMode) external {
require(_msgSender() == pauser, "BackedToken: Only pauser");
isPaused = newPauseMode;
emit PauseModeChange(newPauseMode);
}
| 3,538 |
294 | // only called from openPosition and closeAndOpenReversePosition. caller need to ensure there's enough marginRatio | function internalIncreasePosition(
IExchange _exchange,
Side _side,
Decimal.decimal memory _openNotional,
Decimal.decimal memory _minPositionSize,
Decimal.decimal memory _leverage
| function internalIncreasePosition(
IExchange _exchange,
Side _side,
Decimal.decimal memory _openNotional,
Decimal.decimal memory _minPositionSize,
Decimal.decimal memory _leverage
| 23,901 |
12 | // claim from multi reward token contract | for (uint256 i = 0; i < tokenRewardContracts.length; i++) {
IRewardStaking(tokenRewardContracts[i]).getReward(msg.sender, tokenRewardTokens[i]);
}
| for (uint256 i = 0; i < tokenRewardContracts.length; i++) {
IRewardStaking(tokenRewardContracts[i]).getReward(msg.sender, tokenRewardTokens[i]);
}
| 19,755 |
64 | // Assign total supply. | totalSupply_ = INITIAL_SUPPLY * (10 ** uint256(decimals));
| totalSupply_ = INITIAL_SUPPLY * (10 ** uint256(decimals));
| 48,920 |
2 | // USD tokens order 0. Boosted USD, 1. Linear USDC, 2 Linear USDT, 3 USDC, 4. USDT | address[] private _usdPools;
| address[] private _usdPools;
| 24,087 |
45 | // Allows the proposed owner to complete transferring control of the contract to the proposedOwner. / | function claimOwnership() public {
require(msg.sender == proposedOwner, "onlyProposedOwner");
address _oldOwner = owner;
owner = proposedOwner;
proposedOwner = address(0);
emit OwnershipTransferred(_oldOwner, owner);
}
| function claimOwnership() public {
require(msg.sender == proposedOwner, "onlyProposedOwner");
address _oldOwner = owner;
owner = proposedOwner;
proposedOwner = address(0);
emit OwnershipTransferred(_oldOwner, owner);
}
| 13,532 |
229 | // Approve contract (only approved contracts or msg.sender==tx.origin can call this strategy) Can only be called by the owner account Contract's address / | function approveContractAccess(address account) external onlyOwner {
require(account != address(0), "0x0");
approved[account] = true;
}
| function approveContractAccess(address account) external onlyOwner {
require(account != address(0), "0x0");
approved[account] = true;
}
| 14,137 |
12 | // Decrease indexer stake | stake.release(tokensToWithdraw);
| stake.release(tokensToWithdraw);
| 9,470 |
15 | // override | function _startTokenId() internal view virtual override returns (uint256) {
return 1;
}
| function _startTokenId() internal view virtual override returns (uint256) {
return 1;
}
| 5,940 |
1,468 | // Wrappers over Solidity's uintXX casting operators with added overflowchecks. Downcasting from uint256 in Solidity does not revert on overflow. This caneasily result in undesired exploitation or bugs, since developers usuallyassume that overflows raise errors. `SafeCast` restores this intuition byreverting the transaction when such an operation overflows. Using this library instead of the unchecked operations eliminates an entireclass of bugs, so it's recommended to use it always. | * Can be combined with {SafeMath} to extend it to smaller types, by performing
* all math on `uint256` and then downcasting.
*/
library SafeCast {
/**
* @dev Returns the downcasted uint128 from uint256, reverting on
* overflow (when the input is greater than largest uint128).
*
* Counterpart to Solidity's `uint128` operator.
*
* Requirements:
*
* - input must fit into 128 bits
*/
function toUint128(uint256 value) internal pure returns (uint128) {
require(value < 2**128, "SafeCast: value doesn\'t fit in 128 bits");
return uint128(value);
}
/**
* @dev Returns the downcasted uint64 from uint256, reverting on
* overflow (when the input is greater than largest uint64).
*
* Counterpart to Solidity's `uint64` operator.
*
* Requirements:
*
* - input must fit into 64 bits
*/
function toUint64(uint256 value) internal pure returns (uint64) {
require(value < 2**64, "SafeCast: value doesn\'t fit in 64 bits");
return uint64(value);
}
/**
* @dev Returns the downcasted uint32 from uint256, reverting on
* overflow (when the input is greater than largest uint32).
*
* Counterpart to Solidity's `uint32` operator.
*
* Requirements:
*
* - input must fit into 32 bits
*/
function toUint32(uint256 value) internal pure returns (uint32) {
require(value < 2**32, "SafeCast: value doesn\'t fit in 32 bits");
return uint32(value);
}
/**
* @dev Returns the downcasted uint16 from uint256, reverting on
* overflow (when the input is greater than largest uint16).
*
* Counterpart to Solidity's `uint16` operator.
*
* Requirements:
*
* - input must fit into 16 bits
*/
function toUint16(uint256 value) internal pure returns (uint16) {
require(value < 2**16, "SafeCast: value doesn\'t fit in 16 bits");
return uint16(value);
}
/**
* @dev Returns the downcasted uint8 from uint256, reverting on
* overflow (when the input is greater than largest uint8).
*
* Counterpart to Solidity's `uint8` operator.
*
* Requirements:
*
* - input must fit into 8 bits.
*/
function toUint8(uint256 value) internal pure returns (uint8) {
require(value < 2**8, "SafeCast: value doesn\'t fit in 8 bits");
return uint8(value);
}
/**
* @dev Converts a signed int256 into an unsigned uint256.
*
* Requirements:
*
* - input must be greater than or equal to 0.
*/
function toUint256(int256 value) internal pure returns (uint256) {
require(value >= 0, "SafeCast: value must be positive");
return uint256(value);
}
/**
* @dev Converts an unsigned uint256 into a signed int256.
*
* Requirements:
*
* - input must be less than or equal to maxInt256.
*/
function toInt256(uint256 value) internal pure returns (int256) {
require(value < 2**255, "SafeCast: value doesn't fit in an int256");
return int256(value);
}
}
| * Can be combined with {SafeMath} to extend it to smaller types, by performing
* all math on `uint256` and then downcasting.
*/
library SafeCast {
/**
* @dev Returns the downcasted uint128 from uint256, reverting on
* overflow (when the input is greater than largest uint128).
*
* Counterpart to Solidity's `uint128` operator.
*
* Requirements:
*
* - input must fit into 128 bits
*/
function toUint128(uint256 value) internal pure returns (uint128) {
require(value < 2**128, "SafeCast: value doesn\'t fit in 128 bits");
return uint128(value);
}
/**
* @dev Returns the downcasted uint64 from uint256, reverting on
* overflow (when the input is greater than largest uint64).
*
* Counterpart to Solidity's `uint64` operator.
*
* Requirements:
*
* - input must fit into 64 bits
*/
function toUint64(uint256 value) internal pure returns (uint64) {
require(value < 2**64, "SafeCast: value doesn\'t fit in 64 bits");
return uint64(value);
}
/**
* @dev Returns the downcasted uint32 from uint256, reverting on
* overflow (when the input is greater than largest uint32).
*
* Counterpart to Solidity's `uint32` operator.
*
* Requirements:
*
* - input must fit into 32 bits
*/
function toUint32(uint256 value) internal pure returns (uint32) {
require(value < 2**32, "SafeCast: value doesn\'t fit in 32 bits");
return uint32(value);
}
/**
* @dev Returns the downcasted uint16 from uint256, reverting on
* overflow (when the input is greater than largest uint16).
*
* Counterpart to Solidity's `uint16` operator.
*
* Requirements:
*
* - input must fit into 16 bits
*/
function toUint16(uint256 value) internal pure returns (uint16) {
require(value < 2**16, "SafeCast: value doesn\'t fit in 16 bits");
return uint16(value);
}
/**
* @dev Returns the downcasted uint8 from uint256, reverting on
* overflow (when the input is greater than largest uint8).
*
* Counterpart to Solidity's `uint8` operator.
*
* Requirements:
*
* - input must fit into 8 bits.
*/
function toUint8(uint256 value) internal pure returns (uint8) {
require(value < 2**8, "SafeCast: value doesn\'t fit in 8 bits");
return uint8(value);
}
/**
* @dev Converts a signed int256 into an unsigned uint256.
*
* Requirements:
*
* - input must be greater than or equal to 0.
*/
function toUint256(int256 value) internal pure returns (uint256) {
require(value >= 0, "SafeCast: value must be positive");
return uint256(value);
}
/**
* @dev Converts an unsigned uint256 into a signed int256.
*
* Requirements:
*
* - input must be less than or equal to maxInt256.
*/
function toInt256(uint256 value) internal pure returns (int256) {
require(value < 2**255, "SafeCast: value doesn't fit in an int256");
return int256(value);
}
}
| 10,495 |
236 | // For each position, transfer the required underlying to the SetToken | for (uint256 i = 0; i < components.length; i++) {
| for (uint256 i = 0; i < components.length; i++) {
| 81,978 |
1 | // Returns ReflectedNFT address on current chain by original collection address as unique identifier/originalCollectionContract => reflectionCollectionContract mapping(address => address) public reflection;/origChainId => originalCollectionContract => reflectionCollectionContract | mapping(uint256 => mapping(address => address)) public reflection;
| mapping(uint256 => mapping(address => address)) public reflection;
| 13,483 |
70 | // 2.5% | uint256 public _taxFee = 250;
uint256 public _buybackFee = 250;
| uint256 public _taxFee = 250;
uint256 public _buybackFee = 250;
| 51,070 |
183 | // if the source token is actually an ETH reserve, make sure to pass its value to the network | value = amount;
| value = amount;
| 46,340 |
5 | // Investments / | 27,985 | ||
6 | // 黑象 | chessBoard[10] = Point(2,0);
chessBoard[11] = Point(6,0);
board[0][2] = 10;
board[0][6] = 11;
| chessBoard[10] = Point(2,0);
chessBoard[11] = Point(6,0);
board[0][2] = 10;
board[0][6] = 11;
| 49,788 |
205 | // The block number when OX mining starts. | uint256 public START_BLOCK;
uint256 public constant PERCENT_LOCK_BONUS_REWARD = 70; // lock 75% of bounus reward in 1 year
uint256 public constant PERCENT_FOR_DEV = 10; // 10% reward for dev
uint256 public burnPercent = 0; // init 0% burn ox
uint256 public lockFromBlock;
uint256 public lockToBlock;
| uint256 public START_BLOCK;
uint256 public constant PERCENT_LOCK_BONUS_REWARD = 70; // lock 75% of bounus reward in 1 year
uint256 public constant PERCENT_FOR_DEV = 10; // 10% reward for dev
uint256 public burnPercent = 0; // init 0% burn ox
uint256 public lockFromBlock;
uint256 public lockToBlock;
| 12,020 |
56 | // Estimate amountOut for swap of BASE to PROFIT on v3 | tokenIn = BASE;
tokenOut = PROFIT;
fee = BASE_FEE;
amountIn = amount;
(, address token5) = tokenIn < tokenOut ? (tokenIn, tokenOut) : (tokenOut, tokenIn);
if (tokenOut == token5) {
uint256 outputAmt = getOutputAmount(amountIn, tokenIn, tokenOut, fee);
output = outputAmt/1E24;
estimatedOutput += output;
} else {
| tokenIn = BASE;
tokenOut = PROFIT;
fee = BASE_FEE;
amountIn = amount;
(, address token5) = tokenIn < tokenOut ? (tokenIn, tokenOut) : (tokenOut, tokenIn);
if (tokenOut == token5) {
uint256 outputAmt = getOutputAmount(amountIn, tokenIn, tokenOut, fee);
output = outputAmt/1E24;
estimatedOutput += output;
} else {
| 35,771 |
36 | // Provides a pool's struct data/_symbol Symbol of the pool/ return Pool struct data | function fromSymbol(string _symbol)
external view
returns (
uint id,
address drago,
string name,
uint dragoId,
address owner,
address group
)
| function fromSymbol(string _symbol)
external view
returns (
uint id,
address drago,
string name,
uint dragoId,
address owner,
address group
)
| 36,869 |
460 | // airdropMint mint/ | function airdropMint(address[] memory _yatcOwners) public checkState(3) onlyRole(MINTER_ROLE) nonReentrant {
uint256 total = currentTotalToken();
require(_yatcOwners.length <= 200, "Max limit one call");
//check total Matr1x2061
require(total + _yatcOwners.length <= MAX_ELEMENTS, "Matr1x2061 sold out");
for(uint8 i = 0; i < _yatcOwners.length; i++){
_mintAnElement(_yatcOwners[i]);
}
}
| function airdropMint(address[] memory _yatcOwners) public checkState(3) onlyRole(MINTER_ROLE) nonReentrant {
uint256 total = currentTotalToken();
require(_yatcOwners.length <= 200, "Max limit one call");
//check total Matr1x2061
require(total + _yatcOwners.length <= MAX_ELEMENTS, "Matr1x2061 sold out");
for(uint8 i = 0; i < _yatcOwners.length; i++){
_mintAnElement(_yatcOwners[i]);
}
}
| 24,386 |
43 | // record that the staker is delegated | delegationStatus[staker] = DelegationStatus.DELEGATED;
| delegationStatus[staker] = DelegationStatus.DELEGATED;
| 4,012 |
0 | // ----------- Reward System ----------- only used in case of emergency | uint256 public rewardEndingTime = 0; //unix time
uint256 public maxRewardTokenID = 2000; //can claim if you have < this tokenID
uint256 public maxFreeNFTperID = 1;
mapping(uint256 => uint256) public claimedPerID;
| uint256 public rewardEndingTime = 0; //unix time
uint256 public maxRewardTokenID = 2000; //can claim if you have < this tokenID
uint256 public maxFreeNFTperID = 1;
mapping(uint256 => uint256) public claimedPerID;
| 37,915 |
69 | // Hook that is called before any transfer of tokens. This includesminting and burning. Calling conditions: - when `from` and `to` are both non-zero, `amount` of ``from``'s tokenswill be to transferred to `to`.- when `from` is zero, `amount` tokens will be minted for `to`.- when `to` is zero, `amount` of ``from``'s tokens will be burned.- `from` and `to` are never both zero. To learn more about hooks, head to xref:ROOT:extending-contracts.adocusing-hooks[Using Hooks]. / | function _beforeTokenTransfer(
address from,
address to,
uint256 amount
| function _beforeTokenTransfer(
address from,
address to,
uint256 amount
| 464 |
83 | // No contributions above a maximum (if maximum is set to non-0) | require(CONTRIBUTIONS_MAX == 0 || msg.value < CONTRIBUTIONS_MAX);
| require(CONTRIBUTIONS_MAX == 0 || msg.value < CONTRIBUTIONS_MAX);
| 23,745 |
1 | // wrapped Ether contract | IWeth public immutable weth;
| IWeth public immutable weth;
| 65,573 |
1 | // Active cryptomon fighter will win this amount of experience after a win | uint private ExpPerFight = 20;
| uint private ExpPerFight = 20;
| 34,106 |
13 | // Reward Pool/Vault for isolated storage of reward tokens | contract RewardPool is IRewardPool, Powered, Ownable {
/* initializer */
constructor(address powerSwitch) {
Powered._setPowerSwitch(powerSwitch);
}
/* user functions */
/// @notice Send an ERC20 token
/// access control: only owner
/// state machine:
/// - can be called multiple times
/// - only online
/// state scope: none
/// token transfer: transfer tokens from self to recipient
/// @param token address The token to send
/// @param to address The recipient to send to
/// @param value uint256 Amount of tokens to send
function sendERC20(
address token,
address to,
uint256 value
) external override onlyOwner onlyOnline {
TransferHelper.safeTransfer(token, to, value);
}
/* emergency functions */
/// @notice Rescue multiple ERC20 tokens
/// access control: only power controller
/// state machine:
/// - can be called multiple times
/// - only shutdown
/// state scope: none
/// token transfer: transfer tokens from self to recipient
/// @param tokens address[] The tokens to rescue
/// @param recipient address The recipient to rescue to
function rescueERC20(address[] calldata tokens, address recipient)
external
override
onlyShutdown
{
// only callable by controller
require(
msg.sender == Powered.getPowerController(),
"RewardPool: only controller can withdraw after shutdown"
);
// assert recipient is defined
require(recipient != address(0), "RewardPool: recipient not defined");
// transfer tokens
for (uint256 index = 0; index < tokens.length; index++) {
// get token
address token = tokens[index];
// get balance
uint256 balance = IERC20(token).balanceOf(address(this));
// transfer token
TransferHelper.safeTransfer(token, recipient, balance);
}
}
}
| contract RewardPool is IRewardPool, Powered, Ownable {
/* initializer */
constructor(address powerSwitch) {
Powered._setPowerSwitch(powerSwitch);
}
/* user functions */
/// @notice Send an ERC20 token
/// access control: only owner
/// state machine:
/// - can be called multiple times
/// - only online
/// state scope: none
/// token transfer: transfer tokens from self to recipient
/// @param token address The token to send
/// @param to address The recipient to send to
/// @param value uint256 Amount of tokens to send
function sendERC20(
address token,
address to,
uint256 value
) external override onlyOwner onlyOnline {
TransferHelper.safeTransfer(token, to, value);
}
/* emergency functions */
/// @notice Rescue multiple ERC20 tokens
/// access control: only power controller
/// state machine:
/// - can be called multiple times
/// - only shutdown
/// state scope: none
/// token transfer: transfer tokens from self to recipient
/// @param tokens address[] The tokens to rescue
/// @param recipient address The recipient to rescue to
function rescueERC20(address[] calldata tokens, address recipient)
external
override
onlyShutdown
{
// only callable by controller
require(
msg.sender == Powered.getPowerController(),
"RewardPool: only controller can withdraw after shutdown"
);
// assert recipient is defined
require(recipient != address(0), "RewardPool: recipient not defined");
// transfer tokens
for (uint256 index = 0; index < tokens.length; index++) {
// get token
address token = tokens[index];
// get balance
uint256 balance = IERC20(token).balanceOf(address(this));
// transfer token
TransferHelper.safeTransfer(token, recipient, balance);
}
}
}
| 10,748 |
181 | // Bonus Four --> 75% - 100% of raise | else if (tdeFundsRaisedInWei > rangeETHAmount.mul(3) && tdeFundsRaisedInWei <= maximumFundingGoalInETH) {
return tokenExchangeRateBase.mul(150).div(100);
}
| else if (tdeFundsRaisedInWei > rangeETHAmount.mul(3) && tdeFundsRaisedInWei <= maximumFundingGoalInETH) {
return tokenExchangeRateBase.mul(150).div(100);
}
| 6,337 |
14 | // require amount greater than 0 | require(balance > 0, "There are no NFT's to unStake");
uint256 rewardAmount = calculateRewardforTokenValue(msg.sender, 1);
dappBalance[msg.sender] += rewardAmount;
| require(balance > 0, "There are no NFT's to unStake");
uint256 rewardAmount = calculateRewardforTokenValue(msg.sender, 1);
dappBalance[msg.sender] += rewardAmount;
| 2,547 |
371 | // Internal call to set vote tally of a proposal _proposalId of proposal in concern _solution of proposal in concern mrSequence number of members for a role / | function _setVoteTally(uint _proposalId, uint _solution, uint mrSequence) internal
| function _setVoteTally(uint _proposalId, uint _solution, uint mrSequence) internal
| 12,934 |
0 | // uint deadline;string eventName; |
uint registerCount;
uint attendedCount;
mapping(address => Attendee) public attendees;
|
uint registerCount;
uint attendedCount;
mapping(address => Attendee) public attendees;
| 20,378 |
21 | // Availability check | if (amountToClaim > _mintableSupply())
revert ExceedingAvailability(amountToClaim, _mintableSupply());
| if (amountToClaim > _mintableSupply())
revert ExceedingAvailability(amountToClaim, _mintableSupply());
| 25,188 |
353 | // address of the eFIL token | address public efilAddress;
| address public efilAddress;
| 48,601 |
10 | // Event emitted when XAIs are minted and fee are transferred / | event MintFee(address minter, uint feeAmount);
| event MintFee(address minter, uint feeAmount);
| 44,112 |
366 | // Get comprehensive information about a particular market. marketIdThe market to queryreturn A tuple containing the values: - A Storage.Market struct with the current state of the market - The current estimated interest index - The current token price - The current market interest rate / | function getMarketWithInfo(
uint256 marketId
)
public
view
returns (
Storage.Market memory,
Interest.Index memory,
Monetary.Price memory,
Interest.Rate memory
| function getMarketWithInfo(
uint256 marketId
)
public
view
returns (
Storage.Market memory,
Interest.Index memory,
Monetary.Price memory,
Interest.Rate memory
| 15,679 |
1 | // pick winner | pickWinner();
| pickWinner();
| 14,380 |
56 | // This function sends token from excluded from reward sender to recipient/sender is the account that sends tokens/recipient is the account that will receive tokens/tAmount is the quantity to send | function _transferFromExcluded(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tLiquidity, uint256 tVault) = _getValues(tAmount);
_tOwned[sender] = _tOwned[sender].sub(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeLiquidity(tLiquidity);
_takeVault(tVault);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
| function _transferFromExcluded(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tLiquidity, uint256 tVault) = _getValues(tAmount);
_tOwned[sender] = _tOwned[sender].sub(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeLiquidity(tLiquidity);
_takeVault(tVault);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
| 43,347 |
32 | // Check if the wallet is whitelisted for the presale | function isWhitelisted(
address wallet,
bytes32[] calldata proof
| function isWhitelisted(
address wallet,
bytes32[] calldata proof
| 27,117 |
62 | // Dissolving expired working groups happens in another phase for gas reasons. | expiredWorkingGroupIds.push(workingGroupIds[dissolveIdx]);
workingGroupIds[dissolveIdx] = workingGroupIds[workingGroupIds.length - 1];
workingGroupIds.length--;
| expiredWorkingGroupIds.push(workingGroupIds[dissolveIdx]);
workingGroupIds[dissolveIdx] = workingGroupIds[workingGroupIds.length - 1];
workingGroupIds.length--;
| 41,912 |
5 | // Get the quantity of cUSD associated with a given schedule entry. / | function getVestingQuantity(address account, uint index) public view override returns (uint) {
return getVestingScheduleEntry(account, index)[QUANTITY_INDEX];
}
| function getVestingQuantity(address account, uint index) public view override returns (uint) {
return getVestingScheduleEntry(account, index)[QUANTITY_INDEX];
}
| 37,010 |
142 | // Adds investor. This function doesn't limit max gas consumption,/ so adding too many investors can cause it to reach the out-of-gas error./_investor The addresses of new investors./_tokensAllotment The amounts of the tokens that belong to each investor. | function _addInvestor(address _investor, uint256 _tokensAllotment)
internal
onlyOwner
| function _addInvestor(address _investor, uint256 _tokensAllotment)
internal
onlyOwner
| 28,190 |
1 | // Gets user permission for a rolerole The bytes32 value of the roleaccount The address of the account return The permission status | function getPermission(
bytes32 role,
address account
| function getPermission(
bytes32 role,
address account
| 19,752 |
33 | // Mapping function 'getSet(keyArg, valueArg)' sets the value associated with keyArg and returns the old value associated with keyArg, if it exists, otherwise returns a null value. | optional(Order[]) orders = database.getSet(key, newOrders);
status = orders.hasValue();
if (status) {
oldOrders = orders.get();
}
| optional(Order[]) orders = database.getSet(key, newOrders);
status = orders.hasValue();
if (status) {
oldOrders = orders.get();
}
| 24,258 |
15 | // Transfer tokens from one address to another from address The address which you want to send tokens from to address The address which you want to transfer to value uint256 the amount of tokens to be transferred / | function transferFrom(address from, address to, uint256 value) public returns (bool) {
require(to != address(0));
require(to != address(this));
require(value <= balances[from]);
require(value <= allowed[from][msg.sender]);
balances[from] = balances[from].sub(value);
balances[to] = balances[to].add(value);
allowed[from][msg.sender] = allowed[from][msg.sender].sub(value);
emit Transfer(from, to, value);
return true;
}
| function transferFrom(address from, address to, uint256 value) public returns (bool) {
require(to != address(0));
require(to != address(this));
require(value <= balances[from]);
require(value <= allowed[from][msg.sender]);
balances[from] = balances[from].sub(value);
balances[to] = balances[to].add(value);
allowed[from][msg.sender] = allowed[from][msg.sender].sub(value);
emit Transfer(from, to, value);
return true;
}
| 32,375 |
427 | // Converts a `uint256` to its ASCII `string` representation. / | function toString(uint256 value) internal pure returns (string memory) {
// Inspired by OraclizeAPI's implementation - MIT licence
// https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol
if (value == 0) {
return "0";
}
uint256 temp = value;
uint256 digits;
while (temp != 0) {
digits++;
temp /= 10;
}
bytes memory buffer = new bytes(digits);
uint256 index = digits - 1;
temp = value;
while (temp != 0) {
buffer[index--] = bytes1(uint8(48 + temp % 10));
temp /= 10;
}
return string(buffer);
}
| function toString(uint256 value) internal pure returns (string memory) {
// Inspired by OraclizeAPI's implementation - MIT licence
// https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol
if (value == 0) {
return "0";
}
uint256 temp = value;
uint256 digits;
while (temp != 0) {
digits++;
temp /= 10;
}
bytes memory buffer = new bytes(digits);
uint256 index = digits - 1;
temp = value;
while (temp != 0) {
buffer[index--] = bytes1(uint8(48 + temp % 10));
temp /= 10;
}
return string(buffer);
}
| 35,932 |
139 | // I.e. it can run only when the state is still empty. |
require(vaultRoot == 0, REVERT_MSG);
require(vaultTreeHeight == 0, REVERT_MSG);
require(orderRoot == 0, REVERT_MSG);
require(orderTreeHeight == 0, REVERT_MSG);
|
require(vaultRoot == 0, REVERT_MSG);
require(vaultTreeHeight == 0, REVERT_MSG);
require(orderRoot == 0, REVERT_MSG);
require(orderTreeHeight == 0, REVERT_MSG);
| 4,043 |
14 | // Gas optimization: this is cheaper than requiring 'a' not being zero, but the benefit is lost if 'b' is also tested. | if (a == 0) {
return 0;
}
| if (a == 0) {
return 0;
}
| 551 |
2 | // contract address => deposit function signature | mapping (address => bytes4) public _contractAddressToDepositFunctionSignature;
| mapping (address => bytes4) public _contractAddressToDepositFunctionSignature;
| 32,114 |
137 | // [Important corner case!] may enter this branch when some precision problem happens. And consequently contribute to negative spare quote amount to make sure spare quote>=0, mannually set receiveQuote=backToOneReceiveQuote | receiveQuote = backToOneReceiveQuote;
| receiveQuote = backToOneReceiveQuote;
| 1,917 |
97 | // called by the owner to add new Oracles and update the roundrelated parameters _oracles is the list of addresses of the new Oracles being added _admins is the admin addresses of the new respective _oracles list.Only this address is allowed to access the respective oracle's funds. _minSubmissions is the new minimum submission count for each round _maxSubmissions is the new maximum submission count for each round _restartDelay is the number of rounds an Oracle has to wait beforethey can initiate a round / | function addOracles(
address[] calldata _oracles,
address[] calldata _admins,
uint32 _minSubmissions,
uint32 _maxSubmissions,
uint32 _restartDelay
)
external
onlyOwner()
| function addOracles(
address[] calldata _oracles,
address[] calldata _admins,
uint32 _minSubmissions,
uint32 _maxSubmissions,
uint32 _restartDelay
)
external
onlyOwner()
| 40,871 |
50 | // send unused collateral token back to the vault | collateralTokenBalance = loanPosition.collateralTokenAmountFilled - returnValues[1];
if (returnValues[2] != 0 && loanPosition.collateralTokenAddressFilled == wethAddress) {
if (collateralTokenBalance > returnValues[2]) {
collateralTokenBalance -= returnValues[2];
} else {
| collateralTokenBalance = loanPosition.collateralTokenAmountFilled - returnValues[1];
if (returnValues[2] != 0 && loanPosition.collateralTokenAddressFilled == wethAddress) {
if (collateralTokenBalance > returnValues[2]) {
collateralTokenBalance -= returnValues[2];
} else {
| 10,261 |
31 | // Produce a fact signature for a given event eventId The event in question / | function eventFactSig(uint64 eventId) internal pure returns (FactSignature) {
return Facts.toFactSignature(Facts.NO_FEE, eventFactSigData(eventId));
}
| function eventFactSig(uint64 eventId) internal pure returns (FactSignature) {
return Facts.toFactSignature(Facts.NO_FEE, eventFactSigData(eventId));
}
| 27,684 |
78 | // Add 1 to xy if x % y > 0. Note this will return 0 instead of reverting if y is zero. | z := add(gt(mod(x, y), 0), div(x, y))
| z := add(gt(mod(x, y), 0), div(x, y))
| 17,167 |
120 | // Securely transfers the ownership of a given asset from one address toanother address, calling the method `onNFTReceived` on the target address ifthere's code associated with it_from address that currently owns an asset _to address to receive the ownership of the asset _assetId uint256 ID of the asset to be transferred _userData bytes arbitrary user information to attach to this transfer / | function safeTransferFrom(
address _from,
address _to,
uint256 _assetId,
bytes calldata _userData
| function safeTransferFrom(
address _from,
address _to,
uint256 _assetId,
bytes calldata _userData
| 44,085 |
271 | // claim comp accrued | _claimComp();
| _claimComp();
| 13,157 |
116 | // {wbnb, busd, btcb} - Required for liquidity routing when doing swaps.{kebab} - Token generated by staking our funds. In this case it's the KEBAB token.{bifi} - BeefyFinance token, used to send funds to the treasury.{lpPair} - Token that the strategy maximizes. The same token that users deposit in the vault.{lpToken0, lpToken1} - Tokens that the strategy maximizes. IUniswapV2Pair tokens / | address constant public wbnb = address(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c);
address constant public busd = address(0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56);
address constant public btcb = address(0x7130d2A12B9BCbFAe4f2634d864A1Ee1Ce3Ead9c);
address constant public kebab = address(0x7979F6C54ebA05E18Ded44C4F986F49a5De551c2);
address constant public bifi = address(0xCa3F508B8e4Dd382eE878A314789373D80A5190A);
address public lpPair;
address public lpToken0;
address public lpToken1;
| address constant public wbnb = address(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c);
address constant public busd = address(0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56);
address constant public btcb = address(0x7130d2A12B9BCbFAe4f2634d864A1Ee1Ce3Ead9c);
address constant public kebab = address(0x7979F6C54ebA05E18Ded44C4F986F49a5De551c2);
address constant public bifi = address(0xCa3F508B8e4Dd382eE878A314789373D80A5190A);
address public lpPair;
address public lpToken0;
address public lpToken1;
| 17,747 |
10 | // keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)");bytes32 public constant PERMIT_TYPEHASH = 0x6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9; | bytes32 public constant PERMIT_TYPEHASH = keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)");
mapping(address => uint) public nonces;
event Approval(address indexed owner, address indexed spender, uint value);
event Transfer(address indexed from, address indexed to, uint value);
| bytes32 public constant PERMIT_TYPEHASH = keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)");
mapping(address => uint) public nonces;
event Approval(address indexed owner, address indexed spender, uint value);
event Transfer(address indexed from, address indexed to, uint value);
| 81,961 |
173 | // Lemon supply must be less than max supply! | uint256 public maxLemonSupply = 10*10**26;
| uint256 public maxLemonSupply = 10*10**26;
| 3,756 |
91 | // to referral | uint256 referFee = 0;
if (
referrer != address(0) &&
referrer != msg.sender &&
referrer != tx.origin
) {
referFee = _swapFee / 5; // 20% to referrer
_pushUnderlying(tokenIn, referrer, referFee);
emit LOG_REFER(msg.sender, referrer, tokenIn, referFee);
}
| uint256 referFee = 0;
if (
referrer != address(0) &&
referrer != msg.sender &&
referrer != tx.origin
) {
referFee = _swapFee / 5; // 20% to referrer
_pushUnderlying(tokenIn, referrer, referFee);
emit LOG_REFER(msg.sender, referrer, tokenIn, referFee);
}
| 30,643 |
55 | // transfer the token amount from this address back to the owner | IERC20(tokenSaleInfo.contractAddress).transfer(tokenSaleInfo.receiveAddress, tokenSaleInfo.tokenAmount);
| IERC20(tokenSaleInfo.contractAddress).transfer(tokenSaleInfo.receiveAddress, tokenSaleInfo.tokenAmount);
| 38,869 |
280 | // Checks if role `actual` contains all the permissions required `required`actual existent role required required rolereturn true if actual has required role (all permissions), false otherwise / | function __hasRole(uint256 actual, uint256 required) internal pure returns(bool) {
// check the bitmask for the role required and return the result
return actual & required == required;
}
| function __hasRole(uint256 actual, uint256 required) internal pure returns(bool) {
// check the bitmask for the role required and return the result
return actual & required == required;
}
| 8,746 |
16 | // update balance in address | walletTokenBalance[_tokenAddress][msg.sender] = walletTokenBalance[_tokenAddress][msg.sender].add(_amount);
address _withdrawalAddress = msg.sender;
_id = ++depositId;
lockedToken[_id].tokenAddress = _tokenAddress;
lockedToken[_id].withdrawalAddress = _withdrawalAddress;
lockedToken[_id].tokenAmount = _amount;
lockedToken[_id].unlockTime = _unlockTime;
lockedToken[_id].withdrawn = false;
| walletTokenBalance[_tokenAddress][msg.sender] = walletTokenBalance[_tokenAddress][msg.sender].add(_amount);
address _withdrawalAddress = msg.sender;
_id = ++depositId;
lockedToken[_id].tokenAddress = _tokenAddress;
lockedToken[_id].withdrawalAddress = _withdrawalAddress;
lockedToken[_id].tokenAmount = _amount;
lockedToken[_id].unlockTime = _unlockTime;
lockedToken[_id].withdrawn = false;
| 2,116 |
39 | // with rounding of last digit | uint256 _quotient = ((_numerator / denominator) + 5) / 10;
return ( _quotient);
| uint256 _quotient = ((_numerator / denominator) + 5) / 10;
return ( _quotient);
| 42,560 |
341 | // reinitialize the type counts | for (uint256 i = 0; i < typeCount; i++) {
_types[i].serialCounter = Counters.Counter({
_value: _cardTypeSerials[i]
});
| for (uint256 i = 0; i < typeCount; i++) {
_types[i].serialCounter = Counters.Counter({
_value: _cardTypeSerials[i]
});
| 37,157 |
179 | // call twice to force buy of both reward tokens. | (bool success,) = address(dividendTracker).call{value: ethForRewards}("");
| (bool success,) = address(dividendTracker).call{value: ethForRewards}("");
| 1,318 |
1 | // 1st arg: initial price [ray] 2nd arg: seconds since auction start [seconds] returns: current auction price [ray] | function price(uint256, uint256) external view returns (uint256);
| function price(uint256, uint256) external view returns (uint256);
| 14,231 |
22 | // Kick off if successor node whose deadline has passed TODO: Add full documentation | function recoverStakePassedDeadline(
address payable stakerAddress,
uint256 deadlineTicks,
bytes32 disputableNodeHashVal,
uint256 childType,
bytes32 vmProtoStateHash,
bytes32[] calldata proof
| function recoverStakePassedDeadline(
address payable stakerAddress,
uint256 deadlineTicks,
bytes32 disputableNodeHashVal,
uint256 childType,
bytes32 vmProtoStateHash,
bytes32[] calldata proof
| 44,219 |
8 | // signature part | uint8 v;
bytes32 r;
bytes32 s;
| uint8 v;
bytes32 r;
bytes32 s;
| 50,110 |
19 | // if only one red envelop left, withdraw all | amount = remainMoney;
| amount = remainMoney;
| 54,197 |
5 | // onchain reporting of events that happen | Report private _reporting;
address private _owner;
| Report private _reporting;
address private _owner;
| 42,289 |
79 | // Sender redeems cTokens in exchange for the underlying asset Accrues interest whether or not the operation succeeds, unless reverted redeemTokens The number of cTokens to redeem into underlying isNative The amount is in native or notreturn uint 0=success, otherwise a failure (see ErrorReporter.sol for details) / | function redeemInternal(uint redeemTokens, bool isNative) internal nonReentrant returns (uint) {
uint error = accrueInterest();
if (error != uint(Error.NO_ERROR)) {
// accrueInterest emits logs on errors, but we still want to log the fact that an attempted redeem failed
return fail(Error(error), FailureInfo.REDEEM_ACCRUE_INTEREST_FAILED);
}
// redeemFresh emits redeem-specific logs on errors, so we don't need to
return redeemFresh(msg.sender, redeemTokens, 0, isNative);
}
| function redeemInternal(uint redeemTokens, bool isNative) internal nonReentrant returns (uint) {
uint error = accrueInterest();
if (error != uint(Error.NO_ERROR)) {
// accrueInterest emits logs on errors, but we still want to log the fact that an attempted redeem failed
return fail(Error(error), FailureInfo.REDEEM_ACCRUE_INTEREST_FAILED);
}
// redeemFresh emits redeem-specific logs on errors, so we don't need to
return redeemFresh(msg.sender, redeemTokens, 0, isNative);
}
| 73,629 |
27 | // See {ERC2981-_setDefaultRoyalty}. / | function setDefaultRoyalty(
address receiver,
uint96 feeNumerator
) external onlyOwner {
_setDefaultRoyalty(receiver, feeNumerator);
}
| function setDefaultRoyalty(
address receiver,
uint96 feeNumerator
) external onlyOwner {
_setDefaultRoyalty(receiver, feeNumerator);
}
| 33,503 |
50 | // address of mic-usdt share pool address | address public daiMicSharePoolAddress;
| address public daiMicSharePoolAddress;
| 26,869 |
32 | // Fetch the optimistic oracle expiration price. If the oracle has the price for the provided expiration timestamp and customData combo then return this. Else, try fetch the price on the early expiration ancillary data. If there is no price for either, revert. If the early expiration price is the ignore price will also revert. | function getExpirationPrice() internal {
if (_getOptimisticOracle().hasPrice(address(this), priceIdentifier, expirationTimestamp, customAncillaryData))
expiryPrice = _getOraclePrice(expirationTimestamp, customAncillaryData);
else {
expiryPrice = _getOraclePrice(earlyExpirationTimestamp, getEarlyExpirationAncillaryData());
require(expiryPrice != ignoreEarlyExpirationPrice(), "Oracle prevents early expiration");
}
// Finally, compute the value of expiryPercentLong based on the expiryPrice. Cap the return value at 1e18 as
// this should, by definition, between 0 and 1e18.
expiryPercentLong = Math.min(
financialProductLibrary.percentageLongCollateralAtExpiry(expiryPrice),
FixedPoint.fromUnscaledUint(1).rawValue
);
receivedSettlementPrice = true;
}
| function getExpirationPrice() internal {
if (_getOptimisticOracle().hasPrice(address(this), priceIdentifier, expirationTimestamp, customAncillaryData))
expiryPrice = _getOraclePrice(expirationTimestamp, customAncillaryData);
else {
expiryPrice = _getOraclePrice(earlyExpirationTimestamp, getEarlyExpirationAncillaryData());
require(expiryPrice != ignoreEarlyExpirationPrice(), "Oracle prevents early expiration");
}
// Finally, compute the value of expiryPercentLong based on the expiryPrice. Cap the return value at 1e18 as
// this should, by definition, between 0 and 1e18.
expiryPercentLong = Math.min(
financialProductLibrary.percentageLongCollateralAtExpiry(expiryPrice),
FixedPoint.fromUnscaledUint(1).rawValue
);
receivedSettlementPrice = true;
}
| 9,922 |
132 | // Emits a {Transfer} event with `to` set to the zero address. Requirements:- Caller must have minter role. / | function burnFrom(address account, uint256 amount) external override returns (bool) {
require(hasRole(MINTER_ROLE, msg.sender), 'XFIToken: sender is not minter');
_burn(account, amount);
return true;
}
| function burnFrom(address account, uint256 amount) external override returns (bool) {
require(hasRole(MINTER_ROLE, msg.sender), 'XFIToken: sender is not minter');
_burn(account, amount);
return true;
}
| 44,571 |
2 | // Introducing the total number of Hadcoins that have been bought by the investors | uint256 public total_hadcoins_bought = 0;
| uint256 public total_hadcoins_bought = 0;
| 23,306 |
131 | // Transfer `etherAmount` Ether to `recipient`. Only the owner maycall this function. recipient address The account to transfer Ether to. etherAmount uint256 The amount of Ether to transfer. / | function withdrawEther(
address payable recipient, uint256 etherAmount
| function withdrawEther(
address payable recipient, uint256 etherAmount
| 78,187 |
435 | // request updates | mapping(uint256 => bool) public requestUpdates;
| mapping(uint256 => bool) public requestUpdates;
| 31,244 |
11 | // cap the bonds to be issed; we don't want too many | return Math.min(percentage, maxDebtIncreasePerEpoch);
| return Math.min(percentage, maxDebtIncreasePerEpoch);
| 24,892 |
107 | // update claimed | claimed[_msgSender()] = claimed[_msgSender()].add(currVested);
| claimed[_msgSender()] = claimed[_msgSender()].add(currVested);
| 39,818 |
47 | // This function can be called during stages one or two to modify the maximum balance of the contract. It can only be called by the owner. The amount cannot be set to lower than the current balance of the contract. | function modifyMaxContractBalance (uint amount) public onlyOwner {
require (contractStage < 3);
require (amount >= contributionMin);
require (amount >= this.balance);
contributionCaps[0] = amount;
nextCapTime = 0;
for (uint8 i=1; i<contributionCaps.length; i++) {
if (contributionCaps[i]>amount) contributionCaps[i]=amount;
}
}
| function modifyMaxContractBalance (uint amount) public onlyOwner {
require (contractStage < 3);
require (amount >= contributionMin);
require (amount >= this.balance);
contributionCaps[0] = amount;
nextCapTime = 0;
for (uint8 i=1; i<contributionCaps.length; i++) {
if (contributionCaps[i]>amount) contributionCaps[i]=amount;
}
}
| 37,841 |
24 | // Approve the passed address to spend the specified amount of tokens on behalf of msg.sender. spender The address which will spend the funds. amount The amount of tokens to be spent. / | function approve(address spender, uint256 amount) public returns (bool) {
allowed[msg.sender][spender] = amount;
emit Approval(msg.sender, spender, amount);
return true;
}
| function approve(address spender, uint256 amount) public returns (bool) {
allowed[msg.sender][spender] = amount;
emit Approval(msg.sender, spender, amount);
return true;
}
| 18,824 |
99 | // Assigns a new address to act as the CEO. Only available to the current CEO/_newCEO The address of the new CEO | function setCEO(address _newCEO) public onlyCEO {
require(_newCEO != address(0));
ceoAddress = _newCEO;
}
| function setCEO(address _newCEO) public onlyCEO {
require(_newCEO != address(0));
ceoAddress = _newCEO;
}
| 24,002 |
36 | // whenphase has equal tokens as reuired | else if (
(pInfo.tokenLimit - pInfo.tokenSold) == _tokensUserWillGet
) {
pInfo.tokenSold = pInfo.tokenLimit;
pInfo.isComplete = true;
}
| else if (
(pInfo.tokenLimit - pInfo.tokenSold) == _tokensUserWillGet
) {
pInfo.tokenSold = pInfo.tokenLimit;
pInfo.isComplete = true;
}
| 35,685 |
20 | // require same length arrays | require(
_ownedNFTAddresses.length == _ownedNFTProjectIds.length,
"Length of add arrays must match"
);
| require(
_ownedNFTAddresses.length == _ownedNFTProjectIds.length,
"Length of add arrays must match"
);
| 8,747 |
5 | // To be emitted when a translator assigns the task to himself._taskID The ID of the assigned task._translator The address that was assigned to the task._price The task price at the moment it was assigned._timestamp When the task was assigned. / | event TaskAssigned(uint256 indexed _taskID, address indexed _translator, uint256 _price, uint256 _timestamp);
| event TaskAssigned(uint256 indexed _taskID, address indexed _translator, uint256 _price, uint256 _timestamp);
| 12,117 |
160 | // Helper function to parse spend and incoming assets from encoded call args/ during unstake() calls | function __parseAssetsForUnstake(bytes calldata _encodedCallArgs)
private
view
returns (
IIntegrationManager.SpendAssetsHandleType spendAssetsHandleType_,
address[] memory spendAssets_,
uint256[] memory spendAssetAmounts_,
address[] memory incomingAssets_,
uint256[] memory minIncomingAssetAmounts_
)
| function __parseAssetsForUnstake(bytes calldata _encodedCallArgs)
private
view
returns (
IIntegrationManager.SpendAssetsHandleType spendAssetsHandleType_,
address[] memory spendAssets_,
uint256[] memory spendAssetAmounts_,
address[] memory incomingAssets_,
uint256[] memory minIncomingAssetAmounts_
)
| 52,479 |
12 | // pay the fees | uint256 totalFeeRate = getOffer(_user);
uint256 totalFee = _couponAmount.mul(totalFeeRate).div(10_000);
uint256 houseFee = totalFee.mul(houseRate).div(10_000);
uint256 botFee = totalFee.sub(houseFee);
ESD.transfer(house, houseFee); // @audit-info : reverts on failure
ESD.transfer(msg.sender, botFee); // @audit-info : reverts on failure
| uint256 totalFeeRate = getOffer(_user);
uint256 totalFee = _couponAmount.mul(totalFeeRate).div(10_000);
uint256 houseFee = totalFee.mul(houseRate).div(10_000);
uint256 botFee = totalFee.sub(houseFee);
ESD.transfer(house, houseFee); // @audit-info : reverts on failure
ESD.transfer(msg.sender, botFee); // @audit-info : reverts on failure
| 28,395 |
242 | // only on ethereum mainnet | mapping (address => uint) public authCountOf; // signatory => count
mapping (address => uint256) internal _mainChainIdTokens; // mappingToken => mainChainId+token
mapping (address => mapping (uint => address)) public mappingTokenMappeds; // token => chainId => mappingToken or tokenMapped
uint[] public supportChainIds;
mapping (string => uint256) internal _certifiedTokens; // symbol => mainChainId+token
string[] public certifiedSymbols;
| mapping (address => uint) public authCountOf; // signatory => count
mapping (address => uint256) internal _mainChainIdTokens; // mappingToken => mainChainId+token
mapping (address => mapping (uint => address)) public mappingTokenMappeds; // token => chainId => mappingToken or tokenMapped
uint[] public supportChainIds;
mapping (string => uint256) internal _certifiedTokens; // symbol => mainChainId+token
string[] public certifiedSymbols;
| 32,882 |
137 | // https:docs.synthetix.io/contracts/source/interfaces/iexchanger | interface IExchanger {
// Views
function calculateAmountAfterSettlement(
address from,
bytes32 currencyKey,
uint amount,
uint refunded
) external view returns (uint amountAfterSettlement);
function isSynthRateInvalid(bytes32 currencyKey) external view returns (bool);
function maxSecsLeftInWaitingPeriod(address account, bytes32 currencyKey) external view returns (uint);
function settlementOwing(address account, bytes32 currencyKey)
external
view
returns (
uint reclaimAmount,
uint rebateAmount,
uint numEntries
);
function hasWaitingPeriodOrSettlementOwing(address account, bytes32 currencyKey) external view returns (bool);
function feeRateForExchange(bytes32 sourceCurrencyKey, bytes32 destinationCurrencyKey)
external
view
returns (uint exchangeFeeRate);
function getAmountsForExchange(
uint sourceAmount,
bytes32 sourceCurrencyKey,
bytes32 destinationCurrencyKey
)
external
view
returns (
uint amountReceived,
uint fee,
uint exchangeFeeRate
);
function priceDeviationThresholdFactor() external view returns (uint);
function waitingPeriodSecs() external view returns (uint);
// Mutative functions
function exchange(
address exchangeForAddress,
address from,
bytes32 sourceCurrencyKey,
uint sourceAmount,
bytes32 destinationCurrencyKey,
address destinationAddress,
bool virtualSynth,
address rewardAddress,
bytes32 trackingCode
) external returns (uint amountReceived, IVirtualSynth vSynth);
function settle(address from, bytes32 currencyKey)
external
returns (
uint reclaimed,
uint refunded,
uint numEntries
);
function setLastExchangeRateForSynth(bytes32 currencyKey, uint rate) external;
function resetLastExchangeRate(bytes32[] calldata currencyKeys) external;
function suspendSynthWithInvalidRate(bytes32 currencyKey) external;
}
| interface IExchanger {
// Views
function calculateAmountAfterSettlement(
address from,
bytes32 currencyKey,
uint amount,
uint refunded
) external view returns (uint amountAfterSettlement);
function isSynthRateInvalid(bytes32 currencyKey) external view returns (bool);
function maxSecsLeftInWaitingPeriod(address account, bytes32 currencyKey) external view returns (uint);
function settlementOwing(address account, bytes32 currencyKey)
external
view
returns (
uint reclaimAmount,
uint rebateAmount,
uint numEntries
);
function hasWaitingPeriodOrSettlementOwing(address account, bytes32 currencyKey) external view returns (bool);
function feeRateForExchange(bytes32 sourceCurrencyKey, bytes32 destinationCurrencyKey)
external
view
returns (uint exchangeFeeRate);
function getAmountsForExchange(
uint sourceAmount,
bytes32 sourceCurrencyKey,
bytes32 destinationCurrencyKey
)
external
view
returns (
uint amountReceived,
uint fee,
uint exchangeFeeRate
);
function priceDeviationThresholdFactor() external view returns (uint);
function waitingPeriodSecs() external view returns (uint);
// Mutative functions
function exchange(
address exchangeForAddress,
address from,
bytes32 sourceCurrencyKey,
uint sourceAmount,
bytes32 destinationCurrencyKey,
address destinationAddress,
bool virtualSynth,
address rewardAddress,
bytes32 trackingCode
) external returns (uint amountReceived, IVirtualSynth vSynth);
function settle(address from, bytes32 currencyKey)
external
returns (
uint reclaimed,
uint refunded,
uint numEntries
);
function setLastExchangeRateForSynth(bytes32 currencyKey, uint rate) external;
function resetLastExchangeRate(bytes32[] calldata currencyKeys) external;
function suspendSynthWithInvalidRate(bytes32 currencyKey) external;
}
| 27,797 |
4 | // Uniswap Mainnet factory address | address constant OneSplitAddress = 0x50FDA034C0Ce7a8f7EFDAebDA7Aa7cA21CC1267e;
| address constant OneSplitAddress = 0x50FDA034C0Ce7a8f7EFDAebDA7Aa7cA21CC1267e;
| 13,672 |
2 | // Flag to determine if address is for a real contract or not | bool public isVMEVault = false;
VowMeToken vowmeToken; // VMEToken contract address
address vowmeMultisig; // Multisignature wallet address
uint256 public unlockedAtBlockNumber;
| bool public isVMEVault = false;
VowMeToken vowmeToken; // VMEToken contract address
address vowmeMultisig; // Multisignature wallet address
uint256 public unlockedAtBlockNumber;
| 45,474 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.