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 |
|---|---|---|---|---|
1 | // manager only functions: pause, finalizeContract | modifier mManagerOnly(){
require(msg.sender == manager);
_;
}
| modifier mManagerOnly(){
require(msg.sender == manager);
_;
}
| 42,899 |
102 | // Someone puts tokens as collateral via a spell caller. | event PutCollateral(uint positionId, address caller, address token, uint id, uint amount);
| event PutCollateral(uint positionId, address caller, address token, uint id, uint amount);
| 40,236 |
212 | // 3. Clear position debt and return funds to liquidator and position owner. | if (prize > 0) {
if (token == config.getWrappedNativeAddr()) {
SafeToken.safeTransfer(token, config.getWNativeRelayer(), prize);
WNativeRelayer(uint160(config.getWNativeRelayer())).withdraw(prize);
msg.sender.transfer(prize);
} else {
| if (prize > 0) {
if (token == config.getWrappedNativeAddr()) {
SafeToken.safeTransfer(token, config.getWNativeRelayer(), prize);
WNativeRelayer(uint160(config.getWNativeRelayer())).withdraw(prize);
msg.sender.transfer(prize);
} else {
| 12,968 |
18 | // Helper function to extract a useful revert message from a failed call. If the returned data is malformed or not correctly abi encoded then this call can fail itself. | function _getRevertMsg(bytes memory _returnData) internal pure returns (string memory) {
// If the _res length is less than 68, then the transaction failed silently (without a revert message)
if (_returnData.length < 68) return "Transaction reverted silently";
assembly {
// Slic... | function _getRevertMsg(bytes memory _returnData) internal pure returns (string memory) {
// If the _res length is less than 68, then the transaction failed silently (without a revert message)
if (_returnData.length < 68) return "Transaction reverted silently";
assembly {
// Slic... | 23,991 |
2 | // Any funds sent here are for dividend payment to all power coin holders. | function () public payable {
}
| function () public payable {
}
| 5,026 |
64 | // Mapping from token id to position in the allTokens array | mapping(uint256 => uint256) internal allTokensIndex;
| mapping(uint256 => uint256) internal allTokensIndex;
| 7,026 |
71 | // Queues a proposal of state succeededproposalId The id of the proposal to queue/ | function queue(uint proposalId) external {
require(state(proposalId) == ProposalState.Succeeded, "GovernorBravo::queue: proposal can only be queued if it is succeeded");
Proposal storage proposal = proposals[proposalId];
uint eta = add256(block.timestamp, timelock.delay());
for (uint... | function queue(uint proposalId) external {
require(state(proposalId) == ProposalState.Succeeded, "GovernorBravo::queue: proposal can only be queued if it is succeeded");
Proposal storage proposal = proposals[proposalId];
uint eta = add256(block.timestamp, timelock.delay());
for (uint... | 60,823 |
213 | // Pauses Public API since the specified block number blockNumber block number since which public interaction will be paused (for all block.number >= blockNumber). Delegate only If `blocknumber < block.number`, then contract will be paused immediately = from `block.number`. / | function pausePublicApiSince(uint256 blockNumber)
external
override
canPause(blockNumber)
| function pausePublicApiSince(uint256 blockNumber)
external
override
canPause(blockNumber)
| 72,364 |
31 | // Set the current level cap. / | function setCurrentLevelCap(uint256 _newCap) external onlyOwner {
require(_newCap > plugTotalAmount());
currentLevelCap = _newCap;
}
| function setCurrentLevelCap(uint256 _newCap) external onlyOwner {
require(_newCap > plugTotalAmount());
currentLevelCap = _newCap;
}
| 4,779 |
8 | // Info of each user that stakes LP tokens. | mapping (address => UserInfo) public userInfo;
| mapping (address => UserInfo) public userInfo;
| 267 |
6 | // A contributor can pledge ETH for the project amount the amount of ETH to ensure it's correct / | function pledge(uint256 amount) public payable {
require(amount == msg.value,
"Amount mismatch");
require(block.timestamp < deadline, // solhint-disable-line not-rely-on-time
"Funding period ended");
pledgeOf[msg.sender] += amount;
emit PledgeCreated(msg.sender, amount);
}
| function pledge(uint256 amount) public payable {
require(amount == msg.value,
"Amount mismatch");
require(block.timestamp < deadline, // solhint-disable-line not-rely-on-time
"Funding period ended");
pledgeOf[msg.sender] += amount;
emit PledgeCreated(msg.sender, amount);
}
| 51,148 |
28 | // Safe hog transfer function, just in case if rounding error causes pool to not have enough HOGs. | function safeHogTransfer(address _to, uint256 _amount) internal {
uint256 hogBal = hog.balanceOf(address(this));
if (_amount > hogBal) {
hog.safeTransfer(_to, hogBal);
} else {
hog.safeTransfer(_to, _amount);
}
}
| function safeHogTransfer(address _to, uint256 _amount) internal {
uint256 hogBal = hog.balanceOf(address(this));
if (_amount > hogBal) {
hog.safeTransfer(_to, hogBal);
} else {
hog.safeTransfer(_to, _amount);
}
}
| 4,779 |
44 | // 2. Pool 1 private | function _POOL1_harvest(address a) private{
User storage u = users[a];
uint pending = _POOL1_pendingReward(u);
POOL1_update();
if(pending > 0){
if(u.POOL1_referral == address(0)){
POOLS_safeTokenTransfer(a, pending);
//token.burn(... | function _POOL1_harvest(address a) private{
User storage u = users[a];
uint pending = _POOL1_pendingReward(u);
POOL1_update();
if(pending > 0){
if(u.POOL1_referral == address(0)){
POOLS_safeTokenTransfer(a, pending);
//token.burn(... | 7,512 |
3 | // The address of the underlying token. | IERC20 public underlyingToken;
| IERC20 public underlyingToken;
| 32,412 |
5 | // 1. Check time past condition | uint timePassed = block.timestamp - lastAccrueTime;
if (timePassed == 0) return;
lastAccrueTime = block.timestamp;
| uint timePassed = block.timestamp - lastAccrueTime;
if (timePassed == 0) return;
lastAccrueTime = block.timestamp;
| 31,058 |
16 | // Add to presale | function addTopresale(address[] memory newPresale, uint256 mintId) public onlyOwner {
for (uint256 i = 0; i < newPresale.length; i++) {
presale[mintId][newPresale[i]] = 1;
presaleCount = presaleCount + 1;
}
}
| function addTopresale(address[] memory newPresale, uint256 mintId) public onlyOwner {
for (uint256 i = 0; i < newPresale.length; i++) {
presale[mintId][newPresale[i]] = 1;
presaleCount = presaleCount + 1;
}
}
| 9,972 |
137 | // = keccak256("ApproveWithAuthorization(address owner,address spender,uint256 value,uint256 validAfter,uint256 validBefore,bytes32 nonce)") | bytes32 public constant INCREASE_ALLOWANCE_WITH_AUTHORIZATION_TYPEHASH =
0x424222bb050a1f7f14017232a5671f2680a2d3420f504bd565cf03035c53198a;
| bytes32 public constant INCREASE_ALLOWANCE_WITH_AUTHORIZATION_TYPEHASH =
0x424222bb050a1f7f14017232a5671f2680a2d3420f504bd565cf03035c53198a;
| 1,894 |
2 | // new APIs | function getExpectedRateAfterFee(
IERC20Ext src,
IERC20Ext dest,
uint256 srcQty,
uint256 platformFeeBps,
bytes calldata hint
| function getExpectedRateAfterFee(
IERC20Ext src,
IERC20Ext dest,
uint256 srcQty,
uint256 platformFeeBps,
bytes calldata hint
| 19,104 |
99 | // swap token0 to toToken | if (token0 == _toToken) {
tokensBought = tokensBought.add(_amountA);
} else {
| if (token0 == _toToken) {
tokensBought = tokensBought.add(_amountA);
} else {
| 30,496 |
62 | // Constructs a condition ID from an oracle, a question ID, and the outcome slot count for the question./oracle The account assigned to report the result for the prepared condition./questionId An identifier for the question to be answered by the oracle./outcomeSlotCount The number of outcome slots which should be used ... | function getConditionId(address oracle, bytes32 questionId, uint outcomeSlotCount) internal pure returns (bytes32) {
return keccak256(abi.encodePacked(oracle, questionId, outcomeSlotCount));
}
| function getConditionId(address oracle, bytes32 questionId, uint outcomeSlotCount) internal pure returns (bytes32) {
return keccak256(abi.encodePacked(oracle, questionId, outcomeSlotCount));
}
| 9,180 |
132 | // Get the depositTotalCredit and borrowTotalCredituserAddr The address of the user return depositTotalCredit The amount that users can borrow (i.e. depositborrowLimit) return borrowTotalCredit The sum of borrow amount for all handlers/ | function getUserTotalIntraCreditAsset(address payable userAddr) external view override returns (uint256, uint256)
| function getUserTotalIntraCreditAsset(address payable userAddr) external view override returns (uint256, uint256)
| 9,985 |
219 | // redeposit received tokens for underlying | uint256 daiBalance = target == dai ? IERC20(target).balanceOf(address(this)) : 0;
uint256 usdcBalance = target == usdc ? IERC20(target).balanceOf(address(this)) : 0;
uint256 usdtBalance = target == usdt ? IERC20(target).balanceOf(address(this)) : 0;
if (da... | uint256 daiBalance = target == dai ? IERC20(target).balanceOf(address(this)) : 0;
uint256 usdcBalance = target == usdc ? IERC20(target).balanceOf(address(this)) : 0;
uint256 usdtBalance = target == usdt ? IERC20(target).balanceOf(address(this)) : 0;
if (da... | 55,919 |
50 | // pre-sales | startTimes[0] = 1525910400; //MAY 10, 2018 00:00 AM GMT
endTimes[0] = 0; //NO END TIME INITIALLY
hardCaps[0] = 7500 ether;
minEtherContribution[0] = 0.3 ether;
bonusPercentages[0] = 20;
| startTimes[0] = 1525910400; //MAY 10, 2018 00:00 AM GMT
endTimes[0] = 0; //NO END TIME INITIALLY
hardCaps[0] = 7500 ether;
minEtherContribution[0] = 0.3 ether;
bonusPercentages[0] = 20;
| 58,494 |
1 | // Emitted when funds are paid to this contract. | event ETHReceived(
address payee,
uint256 value
);
| event ETHReceived(
address payee,
uint256 value
);
| 50,195 |
279 | // Can make O(1) by storing index pointer in proposals mapping. Requires inProgressProposals to be 1-indexed, since all proposals that are not present will have pointer set to 0. / | function _removeFromInProgressProposals(uint256 _proposalId) internal {
uint256 index = 0;
for (uint256 i = 0; i < inProgressProposals.length; i++) {
if (inProgressProposals[i] == _proposalId) {
index = i;
break;
}
}
// Swap pr... | function _removeFromInProgressProposals(uint256 _proposalId) internal {
uint256 index = 0;
for (uint256 i = 0; i < inProgressProposals.length; i++) {
if (inProgressProposals[i] == _proposalId) {
index = i;
break;
}
}
// Swap pr... | 25,932 |
40 | // work out if linear | bool currentlyLinear = false;
if (multLinear == 1 || (multLinear == 2 && !thresholdReached)) currentlyLinear = true;
| bool currentlyLinear = false;
if (multLinear == 1 || (multLinear == 2 && !thresholdReached)) currentlyLinear = true;
| 32,220 |
13 | // send refund back to sender | if (!msg.sender.send(amount_to_refund)) throw;
| if (!msg.sender.send(amount_to_refund)) throw;
| 41,569 |
117 | // ----- totalSupply = totalSupply.sub(reducedVolumeInDecimal); |
uint256 baseAmount = totalSupply;
uint256 finalAmount = baseAmount - reducedVolumeInDecimal;
assert(finalAmount <= baseAmount);
totalSupply = finalAmount;
|
uint256 baseAmount = totalSupply;
uint256 finalAmount = baseAmount - reducedVolumeInDecimal;
assert(finalAmount <= baseAmount);
totalSupply = finalAmount;
| 48,330 |
34 | // Transfers the ownership of a given token ID to another addressUsage of this method is discouraged, use `safeTransferFrom` whenever possibleRequires the msg sender to be the owner, approved, or operator_from current owner of the token_to address to receive the ownership of the given token ID_tokenId uint256 ID of the... | function transferFrom(address _from, address _to, uint256 _tokenId) public canTransfer(_tokenId) {
require(_from != address(0));
require(_to != address(0));
clearApproval(_from, _tokenId);
removeTokenFrom(_from, _tokenId);
addTokenTo(_to, _tokenId);
emit Transfer(_f... | function transferFrom(address _from, address _to, uint256 _tokenId) public canTransfer(_tokenId) {
require(_from != address(0));
require(_to != address(0));
clearApproval(_from, _tokenId);
removeTokenFrom(_from, _tokenId);
addTokenTo(_to, _tokenId);
emit Transfer(_f... | 46,486 |
173 | // Modifiers ------------------------------------------------------------------------ | modifier onlyPresale() {
require(isPresaleActive, "PRESALE_NOT_ACTIVE");
_;
}
| modifier onlyPresale() {
require(isPresaleActive, "PRESALE_NOT_ACTIVE");
_;
}
| 14,860 |
11 | // Delete token origin extension tracking | delete _tokensExtension[tokenId];
| delete _tokensExtension[tokenId];
| 38,651 |
2 | // CA_CAC: caller is a contract | require(tx.origin == msgSender, "CA_CAC");
_requireUsdcIsPegged();
| require(tx.origin == msgSender, "CA_CAC");
_requireUsdcIsPegged();
| 9,447 |
1 | // Allows the current owner to set the pendingOwner address. newOwner The address to transfer ownership to. / | function transferOwnership(address newOwner) onlyOwner public {
pendingOwner = newOwner;
}
| function transferOwnership(address newOwner) onlyOwner public {
pendingOwner = newOwner;
}
| 16,332 |
7 | // _name = " PAID Ignition Cr.Platform ";_symbol = "iPAID"; | _name = "PAID Ignition Cr.Platform ";
_symbol = "iPAID ";
_decimals = 18;
_totalSupply = 200000000000000000000000;
_balances[creator()] = _totalSupply;
emit Transfer(address(0), creator(), _totalSupply);
| _name = "PAID Ignition Cr.Platform ";
_symbol = "iPAID ";
_decimals = 18;
_totalSupply = 200000000000000000000000;
_balances[creator()] = _totalSupply;
emit Transfer(address(0), creator(), _totalSupply);
| 8,737 |
52 | // Returns the confirmation status of a transaction./transactionId Transaction ID./ return Confirmation status. | function isConfirmed(uint transactionId)
public
constant
returns (bool)
| function isConfirmed(uint transactionId)
public
constant
returns (bool)
| 24,272 |
11 | // the function that the vault will call when the new round is starting / | function rolloverPosition() external override {
onlyVault();
// this function can only be called when it's `Committed`
_rollOverNextOTokenAndActivate();
rolloverTime = block.timestamp;
}
| function rolloverPosition() external override {
onlyVault();
// this function can only be called when it's `Committed`
_rollOverNextOTokenAndActivate();
rolloverTime = block.timestamp;
}
| 44,532 |
9 | // If _endblock is changed, and if we have another range after the updated one, we need to update rewardPerBlock to distribute on the next new range or we could run out of tokens | if (_endBlock != _previousEndBlock && rewardInfo.length - 1 > _rewardIndex) {
RewardInfo storage nextRewardInfo = rewardInfo[_rewardIndex + 1];
uint256 _nextRewardInfoEndBlock = nextRewardInfo.endBlock;
uint256 _initialBlockRange = _nextRewardInfoEndBlock - _previousEndBlock;... | if (_endBlock != _previousEndBlock && rewardInfo.length - 1 > _rewardIndex) {
RewardInfo storage nextRewardInfo = rewardInfo[_rewardIndex + 1];
uint256 _nextRewardInfoEndBlock = nextRewardInfo.endBlock;
uint256 _initialBlockRange = _nextRewardInfoEndBlock - _previousEndBlock;... | 42,908 |
42 | // Either TransferSingle or TransferBatch MUST emit when tokens are transferred, including zero amount transfers as well as minting or burningOperator MUST be msg.senderWhen minting/creating tokens, the `_from` field MUST be set to `0x0`When burning/destroying tokens, the `_to` field MUST be set to `0x0`The total amoun... | event TransferBatch(
| event TransferBatch(
| 17,522 |
36 | // Returns the admin role that controls `role`. See {grantRole} and{revokeRole}. To change a role's admin, use {_setRoleAdmin}. / | function getRoleAdmin(bytes32 role) public view override returns (bytes32) {
return _roles[role].adminRole;
}
| function getRoleAdmin(bytes32 role) public view override returns (bytes32) {
return _roles[role].adminRole;
}
| 43,443 |
534 | // store in unlock | _recordKeyPurchase(keyPrice, _referrer);
| _recordKeyPurchase(keyPrice, _referrer);
| 18,379 |
90 | // This is the main contact point where the Strategy interacts with theVault. It is critical that this call is handled as intended by theStrategy. Therefore, this function will be called by BaseStrategy tomake sure the integration is correct. / | function report(
| function report(
| 7,008 |
37 | // Logs registration of new asset proxy | event AssetProxyRegistered(
bytes4 id, // Id of new registered AssetProxy.
address assetProxy // Address of new registered AssetProxy.
);
| event AssetProxyRegistered(
bytes4 id, // Id of new registered AssetProxy.
address assetProxy // Address of new registered AssetProxy.
);
| 3,748 |
26 | // First we check if there is a victory in a row. If so, convert `Players` to `Winners` Subsequently we do the same for columns and diagonals. | Players player = winnerInRow(_board);
if (player == Players.PlayerOne) {
return Winners.PlayerOne;
}
| Players player = winnerInRow(_board);
if (player == Players.PlayerOne) {
return Winners.PlayerOne;
}
| 22,414 |
6 | // If this was a secodary sale , half the fees have to be returned to the buyer. | if (!isPrimarySale) {
address payable[] memory buyerAsArray = new address payable[](1);
buyerAsArray[0] = payable(msg.sender);
uint256[] memory offerAsArray = new uint256[](1);
offerAsArray[0] = (offer.offerPrice * 5) / 100 / 2;
_pushPayments(buyerAsArray, offerAsArray);
}
| if (!isPrimarySale) {
address payable[] memory buyerAsArray = new address payable[](1);
buyerAsArray[0] = payable(msg.sender);
uint256[] memory offerAsArray = new uint256[](1);
offerAsArray[0] = (offer.offerPrice * 5) / 100 / 2;
_pushPayments(buyerAsArray, offerAsArray);
}
| 18,339 |
343 | // Sets the prize strategy of the prize pool.Only callable by the owner./_prizeStrategy The new prize strategy | function setPrizeStrategy(TokenListenerInterface _prizeStrategy) external override onlyOwner {
_setPrizeStrategy(_prizeStrategy);
}
| function setPrizeStrategy(TokenListenerInterface _prizeStrategy) external override onlyOwner {
_setPrizeStrategy(_prizeStrategy);
}
| 54,865 |
27 | // @inheritdoc HighStreetPoolBaseAdditionally to the parent smart contract, processes vault rewards of the holder, and for HIGH pool updates (increases) pool token reserve (pool tokens value available in the pool) / | function _processRewards(
address _staker,
bool _withUpdate
| function _processRewards(
address _staker,
bool _withUpdate
| 12,163 |
5,534 | // 2769 | entry "nomocratically" : ENG_ADVERB
| entry "nomocratically" : ENG_ADVERB
| 23,605 |
6 | // we use the uniswap pool fee 0.3%. | uint24 public immutable uniswapPoolFee = 3000;
| uint24 public immutable uniswapPoolFee = 3000;
| 45,818 |
48 | // ----------- Events ----------- |
event CoreUpdate(address indexed _core);
|
event CoreUpdate(address indexed _core);
| 3,583 |
88 | // Reward = totalValuerewardPercent% rewardPercent = basePercent(91.5..99%) | uint256 levelAddition = uint256(level).mul(5); // 0..15 -> 0..75
uint256 modificationPercent = levelAddition.add(915);
uint256 finalPercent1000 = basePercent.mul(modificationPercent); // 0..100000
assert(finalPercent1000 / 1000 <= basePercent);
assert(finalPercent1000 <= 100000... | uint256 levelAddition = uint256(level).mul(5); // 0..15 -> 0..75
uint256 modificationPercent = levelAddition.add(915);
uint256 finalPercent1000 = basePercent.mul(modificationPercent); // 0..100000
assert(finalPercent1000 / 1000 <= basePercent);
assert(finalPercent1000 <= 100000... | 54,921 |
0 | // An event emitted when an account changes its delegate. | event DelegateChanged(
address indexed delegator,
uint256 lockedUntil,
address indexed fromDelegate,
address indexed toDelegate
);
| event DelegateChanged(
address indexed delegator,
uint256 lockedUntil,
address indexed fromDelegate,
address indexed toDelegate
);
| 23,414 |
0 | // Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way,/ Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, andoptionally initialized with `_data` as explained in {ERC1967Proxy-constructor}. / | constructor(
address _logic,
address admin_,
bytes memory _data
) payable ERC1967Proxy(_logic, _data) {
assert(_ADMIN_SLOT == bytes32(uint256(keccak256("eip1967.proxy.admin")) - 1));
_changeAdmin(admin_);
}
| constructor(
address _logic,
address admin_,
bytes memory _data
) payable ERC1967Proxy(_logic, _data) {
assert(_ADMIN_SLOT == bytes32(uint256(keccak256("eip1967.proxy.admin")) - 1));
_changeAdmin(admin_);
}
| 1,539 |
637 | // Assumes the survey exists and that msg.sender can vote/ | function _resetVote(uint256 _surveyId) internal {
SurveyStruct storage survey = surveys[_surveyId];
MultiOptionVote storage previousVote = survey.votes[msg.sender];
if (previousVote.optionsCastedLength > 0) {
// Voter removes their vote (index 0 is the abstain vote)
f... | function _resetVote(uint256 _surveyId) internal {
SurveyStruct storage survey = surveys[_surveyId];
MultiOptionVote storage previousVote = survey.votes[msg.sender];
if (previousVote.optionsCastedLength > 0) {
// Voter removes their vote (index 0 is the abstain vote)
f... | 62,830 |
71 | // Query if an operator can move an asset. _operator the address that might be authorized _assetId the asset that has been `approved` for transferreturn bool true if the asset has been approved by the holder / | function isAuthorized(address _operator, uint256 _assetId) external view returns (bool) {
return _isAuthorized(_operator, _assetId);
}
| function isAuthorized(address _operator, uint256 _assetId) external view returns (bool) {
return _isAuthorized(_operator, _assetId);
}
| 40,517 |
29 | // allow terminal migration in bit 62. | if (_metadata.allowTerminalMigration) packed |= 1 << 62;
| if (_metadata.allowTerminalMigration) packed |= 1 << 62;
| 9,580 |
10 | // Retrieve the dividends associated with the address the request came from. | uint256 balance = dividends(msg.sender);
| uint256 balance = dividends(msg.sender);
| 42,214 |
20 | // Emergency unstake tokens without rewards | event EmergencyUnstake(address indexed user, uint256 tokenId);
| event EmergencyUnstake(address indexed user, uint256 tokenId);
| 30,604 |
48 | // Adds two unsigned integers, reverts on overflow. / | function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath#add: OVERFLOW");
return c;
}
| function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath#add: OVERFLOW");
return c;
}
| 36,330 |
13 | // Copy remaining bytes | uint mask = 256 ** (32 - len) - 1;
assembly {
let srcpart := and(mload(src), not(mask))
let destpart := and(mload(dest), mask)
mstore(dest, or(destpart, srcpart))
}
| uint mask = 256 ** (32 - len) - 1;
assembly {
let srcpart := and(mload(src), not(mask))
let destpart := and(mload(dest), mask)
mstore(dest, or(destpart, srcpart))
}
| 14,716 |
13 | // Get Challenges For User | function getChallengesForUser(address user)
external
view
| function getChallengesForUser(address user)
external
view
| 51,912 |
315 | // get random number in range of the length of tokenIdsOnSale as the index | uint256 randomIndex = _getRandomNumber(tokenIdsOnSaleLen, _totalMintedTokens);
tokenId = tokenIdsOnSale[randomIndex];
| uint256 randomIndex = _getRandomNumber(tokenIdsOnSaleLen, _totalMintedTokens);
tokenId = tokenIdsOnSale[randomIndex];
| 59,255 |
158 | // start with the mythical cutie 0 - so there are no generation-0 parent issues | _createCutie(0, 0, 0, 0, uint256(-1), address(0), 0);
| _createCutie(0, 0, 0, 0, uint256(-1), address(0), 0);
| 54,199 |
159 | // 10% to DAO | uint256 daoShare = (_ghst - burnShare - companyShare - rarityFarmShare);
| uint256 daoShare = (_ghst - burnShare - companyShare - rarityFarmShare);
| 17,066 |
25 | // data The data to send over using `to.call{value: value}(data)`/ return returnData The transaction's return value. | function transact(
uint8 mode,
address to,
uint value,
bytes calldata data
)
external
returns (bytes memory returnData);
| function transact(
uint8 mode,
address to,
uint value,
bytes calldata data
)
external
returns (bytes memory returnData);
| 1,249 |
9 | // Schedule a withdraw for the next epoch / | function withdraw(int256 amount, uint256 pool) external {
require (pool<pools.length,"Pool not initialized");
require (amount>=0,"amount needs to be positive");
_bookKeeping(msg.sender);
UserInfo storage info = userInfo[msg.sender];
require(info.shares[pool]>=amou... | function withdraw(int256 amount, uint256 pool) external {
require (pool<pools.length,"Pool not initialized");
require (amount>=0,"amount needs to be positive");
_bookKeeping(msg.sender);
UserInfo storage info = userInfo[msg.sender];
require(info.shares[pool]>=amou... | 46,756 |
20 | // Get points of first ring(ring index 0)/ | function getPoints() public view returns (int32[] memory);
| function getPoints() public view returns (int32[] memory);
| 5,159 |
80 | // Increment by one if this is not a perfect logarithm. | if ((uint256(1) << highest) != _in) {
highest += 1;
}
| if ((uint256(1) << highest) != _in) {
highest += 1;
}
| 24,252 |
317 | // someone crossed the absolute vote execution bar. | if (proposal.state == ProposalState.Queued) {
executionState = ExecutionState.QueueBarCrossed;
} else if (proposal.state == ProposalState.PreBoosted) {
| if (proposal.state == ProposalState.Queued) {
executionState = ExecutionState.QueueBarCrossed;
} else if (proposal.state == ProposalState.PreBoosted) {
| 7,716 |
30 | // @inheritdoc IStrategy/do not use isActive modifier here; allow bentobox to call strategy.exit() multiple times | function exit(uint256 balance) external override onlyBentoBox returns (int256 amountAdded) {
_exit();
/// @dev Check balance of token on the contract.
uint256 actualBalance = strategyToken.balanceOf(address(this));
/// @dev Calculate tokens added (or lost).
amountAdded = int2... | function exit(uint256 balance) external override onlyBentoBox returns (int256 amountAdded) {
_exit();
/// @dev Check balance of token on the contract.
uint256 actualBalance = strategyToken.balanceOf(address(this));
/// @dev Calculate tokens added (or lost).
amountAdded = int2... | 18,448 |
155 | // Return all members of a role/No ordering guarantees, as per underlying EnumerableSet sturcture | function getRoleMembers(bytes32 role) public view returns (address[] memory) {
uint256 length = getRoleMemberCount(role);
address[] memory members = new address[](length);
for (uint256 i = 0; i < length; i++) {
members[i] = getRoleMember(role, i);
}
return memb... | function getRoleMembers(bytes32 role) public view returns (address[] memory) {
uint256 length = getRoleMemberCount(role);
address[] memory members = new address[](length);
for (uint256 i = 0; i < length; i++) {
members[i] = getRoleMember(role, i);
}
return memb... | 47,369 |
120 | // Set a distinct URI (RFC 3986) for a given NFT ID. This is an internal function which should be called from user-implemented externalfunction. Its purpose is to show and properly initialize data structures when using thisimplementation. _tokenId Id for which we want URI. _uri String representing RFC 3986 URI. / | function _setTokenUri(
uint256 _tokenId,
string memory _uri
)
internal
validNFToken(_tokenId)
| function _setTokenUri(
uint256 _tokenId,
string memory _uri
)
internal
validNFToken(_tokenId)
| 18,893 |
317 | // set the base URI and payment manager | constructor(string memory _baseTokenURI, address _paymentManager)
ERC721PresetMinterPauserAutoId('MacawHerd', 'MACAW', _baseTokenURI)
| constructor(string memory _baseTokenURI, address _paymentManager)
ERC721PresetMinterPauserAutoId('MacawHerd', 'MACAW', _baseTokenURI)
| 26,512 |
15 | // transfer erc20 tokens to quantizer contract | IERC20(token).transferFrom(msg.sender, address(this), (exactDebit ? tbal : ttotal));
| IERC20(token).transferFrom(msg.sender, address(this), (exactDebit ? tbal : ttotal));
| 12,052 |
15 | // update count | data.hashMapping[listCountKey] = bytes32(listEntryCount);
| data.hashMapping[listCountKey] = bytes32(listEntryCount);
| 17,102 |
14 | // Sets the mefi token address for the publicnetwork as given by the Pointer contract / | function setPublicMefiToken() internal {
uint256 chainId = getChainID();
require(CHAIN_ID_MAINNET == chainId || CHAIN_ID_RINKEBY == chainId, 'Client is deployed on chain without MDT contract');
if (CHAIN_ID_MAINNET == chainId) {
setMefiToken(MDT_TOKEN_ADDRESS_MAINNET);
}... | function setPublicMefiToken() internal {
uint256 chainId = getChainID();
require(CHAIN_ID_MAINNET == chainId || CHAIN_ID_RINKEBY == chainId, 'Client is deployed on chain without MDT contract');
if (CHAIN_ID_MAINNET == chainId) {
setMefiToken(MDT_TOKEN_ADDRESS_MAINNET);
}... | 7,142 |
12 | // To auction | _initPayout(auction, penalty);
IAuction(auction).callIncomeDailyTokensTrigger(penalty);
| _initPayout(auction, penalty);
IAuction(auction).callIncomeDailyTokensTrigger(penalty);
| 54,129 |
0 | // 每次发放的时候,更换一下这个是第几期 | string private _name = "EARIssue-0624";
| string private _name = "EARIssue-0624";
| 17,470 |
2 | // Put a skull up for auction./Does some ownership trickery to create auctions in one tx. | function createSaleAuction(
uint256 _skullId,
uint256 _startingPrice,
uint256 _endingPrice,
uint256 _duration
| function createSaleAuction(
uint256 _skullId,
uint256 _startingPrice,
uint256 _endingPrice,
uint256 _duration
| 46,204 |
8 | // 計算pairlist hash是否跟nodehash相同 | function _evalPairListHashFromNode(bytes32[] memory kvpairs,bytes32 _nodeHash) public pure returns(bool) {
bytes32 _hash = sha256(abi.encodePacked(kvpairs));
if (_nodeHash!=_hash) {
return false;
}else {
return true;
}
}
| function _evalPairListHashFromNode(bytes32[] memory kvpairs,bytes32 _nodeHash) public pure returns(bool) {
bytes32 _hash = sha256(abi.encodePacked(kvpairs));
if (_nodeHash!=_hash) {
return false;
}else {
return true;
}
}
| 10,132 |
7 | // return false if open (called to finalize contract) | function hasClosed() public view returns (bool) {
return now > closingTime || weiRaised >= cap;
}
| function hasClosed() public view returns (bool) {
return now > closingTime || weiRaised >= cap;
}
| 41,804 |
119 | // update the target token virtual balance if relevant | Connector storage toConnector = connectors[_toToken];
if (toConnector.isVirtualBalanceEnabled)
toConnector.virtualBalance = safeSub(toConnector.virtualBalance, amount);
| Connector storage toConnector = connectors[_toToken];
if (toConnector.isVirtualBalanceEnabled)
toConnector.virtualBalance = safeSub(toConnector.virtualBalance, amount);
| 4,708 |
24 | // events for funds received and tokens | event ContributionReceived(address indexed contributor, uint256 value, uint256 numberOfTokens);
event TokensTransferred(address indexed contributor, uint256 numberOfTokensTransferred);
event ManualTokensTransferred(address indexed contributor, uint256 numberOfTokensTransferred);
event PreTokenSalesCapReached(addres... | event ContributionReceived(address indexed contributor, uint256 value, uint256 numberOfTokens);
event TokensTransferred(address indexed contributor, uint256 numberOfTokensTransferred);
event ManualTokensTransferred(address indexed contributor, uint256 numberOfTokensTransferred);
event PreTokenSalesCapReached(addres... | 1,939 |
122 | // function to get all animals in the egg phase list / | {
return eggPhaseAnimalIds;
}
| {
return eggPhaseAnimalIds;
}
| 1,300 |
60 | // crowdsale to set bonus when sending token | iEthealSale public crowdsale;
| iEthealSale public crowdsale;
| 22,157 |
0 | // DATA VARIABLES / Airlines | struct Airline {
bool registered;
uint256 fundBalance;
}
| struct Airline {
bool registered;
uint256 fundBalance;
}
| 30,118 |
12 | // Set of Whitelisted addresses | mapping(address => bool) public isWhitelisted;
| mapping(address => bool) public isWhitelisted;
| 44,721 |
25 | // взять процент по комиссии для перевода | function getTransferPerc() public view returns (uint256) {
return transferInfo.perc;
}
| function getTransferPerc() public view returns (uint256) {
return transferInfo.perc;
}
| 35,545 |
5 | // Transfers ownership of this contract to the finalOwner.Only callable by the Final Owner, which is intended to be our multisig.This function shouldn't be necessary, but it gives a sense of reassurance that we can recoverif something really surprising goes wrong. / | function returnOwnership() external {
require(msg.sender == finalOwner, "AddressDictator: only callable by finalOwner");
manager.transferOwnership(finalOwner);
}
| function returnOwnership() external {
require(msg.sender == finalOwner, "AddressDictator: only callable by finalOwner");
manager.transferOwnership(finalOwner);
}
| 6,133 |
164 | // Delta Time Staking BetaThis contract allows owners of Delta Time 2019 Car NFTs to stake them in exchange for REVV rewards. / | contract DeltaTimeStakingBeta is NftStaking {
mapping(uint256 => uint64) public weightsByRarity;
| contract DeltaTimeStakingBeta is NftStaking {
mapping(uint256 => uint64) public weightsByRarity;
| 46,485 |
85 | // Withdraw all assets in the safest way possible. This shouldn't fail./ @inheritdoc IStrategy | function exit(uint256 balance) external override onlyBentobox returns (int256 amountAdded) {
// Get the amount of tokens that the cTokens currently represent
uint256 tokenBalance = cToken.balanceOfUnderlying(address(this));
// Get the actual token balance of the cToken contract
uint2... | function exit(uint256 balance) external override onlyBentobox returns (int256 amountAdded) {
// Get the amount of tokens that the cTokens currently represent
uint256 tokenBalance = cToken.balanceOfUnderlying(address(this));
// Get the actual token balance of the cToken contract
uint2... | 20,860 |
151 | // Overflows are incredibly unrealistic. balance or numberMinted overflow if current value of either + quantity > 3.4e38 (2128) - 1 updatedIndex overflows if currentIndex + quantity > 1.56e77 (2256) - 1 | unchecked {
_addressData[to].balance += uint128(quantity);
_addressData[to].numberMinted += uint128(quantity);
_ownerships[startTokenId].addr = to;
_ownerships[startTokenId].startTimestamp = uint64(block.timestamp);
uint256 updatedIndex = startTokenI... | unchecked {
_addressData[to].balance += uint128(quantity);
_addressData[to].numberMinted += uint128(quantity);
_ownerships[startTokenId].addr = to;
_ownerships[startTokenId].startTimestamp = uint64(block.timestamp);
uint256 updatedIndex = startTokenI... | 16,424 |
219 | // https:docs.synthetix.io/contracts/source/contracts/multicollateralsynth | contract MultiCollateralSynth is Synth {
/* ========== ADDRESS RESOLVER CONFIGURATION ========== */
bytes32 private constant CONTRACT_COLLATERALMANAGER = "CollateralManager";
bytes32 private constant CONTRACT_ETH_COLLATERAL = "EtherCollateral";
bytes32 private constant CONTRACT_ETH_COLLATERAL_SUSD = "E... | contract MultiCollateralSynth is Synth {
/* ========== ADDRESS RESOLVER CONFIGURATION ========== */
bytes32 private constant CONTRACT_COLLATERALMANAGER = "CollateralManager";
bytes32 private constant CONTRACT_ETH_COLLATERAL = "EtherCollateral";
bytes32 private constant CONTRACT_ETH_COLLATERAL_SUSD = "E... | 52,480 |
380 | // Calculate account's new multiplier after burn `_amountToBurn` primordial tokens _account The address of the account _amountToBurn The amount of primordial token to burnreturn The new multiplier in (106) / | function calculateMultiplierAfterBurn(address _account, uint256 _amountToBurn) public view returns (uint256) {
require (calculateMaximumBurnAmount(_account) >= _amountToBurn);
return AOLibrary.calculateMultiplierAfterBurn(primordialBalanceOf[_account], ownerWeightedMultiplier[_account], _amountToBurn);
}
| function calculateMultiplierAfterBurn(address _account, uint256 _amountToBurn) public view returns (uint256) {
require (calculateMaximumBurnAmount(_account) >= _amountToBurn);
return AOLibrary.calculateMultiplierAfterBurn(primordialBalanceOf[_account], ownerWeightedMultiplier[_account], _amountToBurn);
}
| 32,573 |
451 | // 1 | int256 private constant FIXED_1 =
int256(0x0000000000000000000000000000000080000000000000000000000000000000);
| int256 private constant FIXED_1 =
int256(0x0000000000000000000000000000000080000000000000000000000000000000);
| 23,062 |
49 | // Sanity check: needs approval | if (s.tokenConfigs[_key].approval) revert TokenFacet__addAssetId_alreadyAdded();
| if (s.tokenConfigs[_key].approval) revert TokenFacet__addAssetId_alreadyAdded();
| 23,573 |
16 | // claim DRAM function | function claimdram() public returns (bool success) {
if (_totalSupply < _maxSupply && !claimeddram[msg.sender]) {
claimeddram[msg.sender] = true;
balances[msg.sender] += _airdropAmount;
_totalSupply += _airdropAmount;
Transfer(0, msg.sender, _airdropAmount);
... | function claimdram() public returns (bool success) {
if (_totalSupply < _maxSupply && !claimeddram[msg.sender]) {
claimeddram[msg.sender] = true;
balances[msg.sender] += _airdropAmount;
_totalSupply += _airdropAmount;
Transfer(0, msg.sender, _airdropAmount);
... | 51,641 |
160 | // ERC721 token receiver interface Interface for any contract that wants to support safeTransfersfrom ERC721 asset contracts. / | interface IERC721Receiver {
/**
* @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}
* by `operator` from `from`, this function is called.
*
* It must return its Solidity selector to confirm the token transfer.
* If any other value is r... | interface IERC721Receiver {
/**
* @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}
* by `operator` from `from`, this function is called.
*
* It must return its Solidity selector to confirm the token transfer.
* If any other value is r... | 351 |
83 | // Strategic Initiatives | uint256 strategyTokens = 10000000000; // 10%
_initialTransfer(
0xD7a77aD899D8dfAf22F56FCECE491BB982ca3f37,
(strategyTokens * decimalFactor)
);
| uint256 strategyTokens = 10000000000; // 10%
_initialTransfer(
0xD7a77aD899D8dfAf22F56FCECE491BB982ca3f37,
(strategyTokens * decimalFactor)
);
| 2,619 |
156 | // sent fee to dev | sendTransferReward(dev_adress, feePending);
order.jusRewarded = order.jusRewarded.add(_amount);
order.jusBlock = order.jusBlock.sub(_amount);
| sendTransferReward(dev_adress, feePending);
order.jusRewarded = order.jusRewarded.add(_amount);
order.jusBlock = order.jusBlock.sub(_amount);
| 13,892 |
13 | // mint : To increase total supply of tokens / | function mint(uint256 _amount) public returns (bool) {
require(_amount >= 0, "Invalid amount");
require(owner == msg.sender, "UnAuthorized");
_totalSupply = safeAdd(_totalSupply, _amount);
balances[owner] = safeAdd(balances[owner], _amount);
emit Transfer(address(0), owner, _... | function mint(uint256 _amount) public returns (bool) {
require(_amount >= 0, "Invalid amount");
require(owner == msg.sender, "UnAuthorized");
_totalSupply = safeAdd(_totalSupply, _amount);
balances[owner] = safeAdd(balances[owner], _amount);
emit Transfer(address(0), owner, _... | 69,320 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.