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 |
|---|---|---|---|---|
186 | // start with current boosted amount | amount = balances[_user].boosted;
uint256 locksLength = locks.length;
| amount = balances[_user].boosted;
uint256 locksLength = locks.length;
| 4,887 |
6 | // Returns the amount which _spender is still allowed to withdraw from _owner | function allowance(address _owner, address _spender) constant returns (uint256 remaining);
| function allowance(address _owner, address _spender) constant returns (uint256 remaining);
| 48,716 |
62 | // Just in rare case, owner wants to transfer Ether from contract to owner address | function manualWithdrawEther()onlyOwner public{
address(address(uint160(owner))).transfer(address(this).balance);
}
| function manualWithdrawEther()onlyOwner public{
address(address(uint160(owner))).transfer(address(this).balance);
}
| 25,963 |
79 | // The zero address indicates there is no approved address. Throws unless `msg.sender` isthe current NFT owner, or an authorized operator of the current owner. Set or reaffirm the approved address for an NFT. This function can be changed to payable. _approved Address to be approved for the given NFT ID. _tokenId ID of ... | function approve(
address _approved,
uint256 _tokenId
)
external
override
canOperate(_tokenId)
validNFToken(_tokenId)
| function approve(
address _approved,
uint256 _tokenId
)
external
override
canOperate(_tokenId)
validNFToken(_tokenId)
| 2,962 |
29 | // The address of the controller is the only address that can call/a function with this modifier | modifier onlyController { if (msg.sender != controller) throw; _; }
address public controller;
constructor() public { controller = msg.sender;}
/// @notice Changes the controller of the contract
/// @param _newController The new controller of the contract
function changeController(address _ne... | modifier onlyController { if (msg.sender != controller) throw; _; }
address public controller;
constructor() public { controller = msg.sender;}
/// @notice Changes the controller of the contract
/// @param _newController The new controller of the contract
function changeController(address _ne... | 6,384 |
70 | // and cursor.next is still in same bucket, move head to cursor.next | if(infos[info.next].expiresAt.div(BUCKET_STEP) == bucket.div(BUCKET_STEP)){
checkPoints[bucket].head = info.next;
} else {
| if(infos[info.next].expiresAt.div(BUCKET_STEP) == bucket.div(BUCKET_STEP)){
checkPoints[bucket].head = info.next;
} else {
| 4,771 |
128 | // totalReserves + actualAddAmount | uint256 totalReservesNew;
uint256 actualAddAmount;
| uint256 totalReservesNew;
uint256 actualAddAmount;
| 27,496 |
209 | // Create a new token and return it to the caller. The caller will become the only minter and burner and the new owner capable of assigning the roles. tokenName used to describe the new token. tokenSymbol short ticker abbreviation of the name. Ideally < 5 chars. tokenDecimals used to define the precision used in the to... | function createToken(
string calldata tokenName,
string calldata tokenSymbol,
uint8 tokenDecimals
| function createToken(
string calldata tokenName,
string calldata tokenSymbol,
uint8 tokenDecimals
| 30,719 |
6 | // send Token to UniPair | stakeGatling.stake(liquidity);
| stakeGatling.stake(liquidity);
| 72,629 |
13 | // pay out the dividends virtually | address _customerAddress = msg.sender;
payoutsTo_[_customerAddress] += (int256) (_dividends * magnitude);
| address _customerAddress = msg.sender;
payoutsTo_[_customerAddress] += (int256) (_dividends * magnitude);
| 5,189 |
0 | // iOVM_L2ToL1MessagePasser / | interface iOVM_L2ToL1MessagePasser {
/**********
* Events *
**********/
event L2ToL1Message(uint256 _nonce, address _sender, bytes _data);
/********************
* Public Functions *
********************/
function passMessageToL1(bytes calldata _message) external;
}
| interface iOVM_L2ToL1MessagePasser {
/**********
* Events *
**********/
event L2ToL1Message(uint256 _nonce, address _sender, bytes _data);
/********************
* Public Functions *
********************/
function passMessageToL1(bytes calldata _message) external;
}
| 31,671 |
143 | // Cyan Payment Plan contract transfers paid amount back to Vault | function earn(uint256 amount, uint256 profit)
external
payable
nonReentrant
onlyRole(CYAN_PAYMENT_PLAN_ROLE)
| function earn(uint256 amount, uint256 profit)
external
payable
nonReentrant
onlyRole(CYAN_PAYMENT_PLAN_ROLE)
| 36,179 |
3 | // set token | info.token = address(this);
| info.token = address(this);
| 14,007 |
40 | // desired, max sent, path, recipient, deadline | IUniswapV2Router02(ROUTER).swapTokensForExactTokens(debt, seized_uUnits, path, address(this), now + 1 minutes);
IERC20(seizeUToken).safeApprove(ROUTER, 0);
| IUniswapV2Router02(ROUTER).swapTokensForExactTokens(debt, seized_uUnits, path, address(this), now + 1 minutes);
IERC20(seizeUToken).safeApprove(ROUTER, 0);
| 25,372 |
240 | // Transition state to `Expired`. | loanState = State.Expired;
emit LoanStateChanged(State.Expired);
| loanState = State.Expired;
emit LoanStateChanged(State.Expired);
| 53,388 |
20 | // Validate Transcript Hash alone of a student _student - Address of student _transcriptHash - Transcript Hash of the GradeSheetreturn Returns true if validation is successful / | function validateTranscriptHash(address _student, uint _docIndx, bytes32 _transcriptHash) public view returns(bool) {
Certification storage certification = studentCertifications[_student];
return (certification.documents[_docIndx]).validateTranscriptHash(_transcriptHash);
}
| function validateTranscriptHash(address _student, uint _docIndx, bytes32 _transcriptHash) public view returns(bool) {
Certification storage certification = studentCertifications[_student];
return (certification.documents[_docIndx]).validateTranscriptHash(_transcriptHash);
}
| 39,869 |
0 | // Internal Functions//RLP encodes a byte string. _in The byte string to encode.return The RLP encoded string in bytes. / | function writeBytes(bytes memory _in) internal pure returns (bytes memory) {
bytes memory encoded;
if (_in.length == 1 && uint8(_in[0]) < 128) {
encoded = _in;
} else {
encoded = abi.encodePacked(_writeLength(_in.length, 128), _in);
}
return encoded;... | function writeBytes(bytes memory _in) internal pure returns (bytes memory) {
bytes memory encoded;
if (_in.length == 1 && uint8(_in[0]) < 128) {
encoded = _in;
} else {
encoded = abi.encodePacked(_writeLength(_in.length, 128), _in);
}
return encoded;... | 28,701 |
23 | // winner price | token.transfer(msg.sender, winnerAllocation*(firstSeasonRewards/(numberOfRewards-claimRewardsCount))/100);
| token.transfer(msg.sender, winnerAllocation*(firstSeasonRewards/(numberOfRewards-claimRewardsCount))/100);
| 8,194 |
249 | // Withdraw all current liquidity from Uniswap pool | _burnAllLiquidity(baseLower, baseUpper);
_burnAllLiquidity(limitLower, limitUpper);
| _burnAllLiquidity(baseLower, baseUpper);
_burnAllLiquidity(limitLower, limitUpper);
| 29,757 |
94 | // Toggle Bot Scanning external service ON/OFF: choose whether or not the external antibot scannel should be active / | function toggleBotScanner() external onlyOwner() returns (bool) {
bool _localBool;
if(botScanner){
botScanner = false;
_localBool = false;
}
else{
botScanner = true;
_localBool = true;
}
return _localBool;
}
| function toggleBotScanner() external onlyOwner() returns (bool) {
bool _localBool;
if(botScanner){
botScanner = false;
_localBool = false;
}
else{
botScanner = true;
_localBool = true;
}
return _localBool;
}
| 39,647 |
169 | // Do the same for private presale | uint privListLen = airdropPrivateList.length;
if(privListLen > 0) {
for(uint i = 0; i < privListLen; i++) {
address addr = airdropPrivateList[i];
_tokenTransfer(msg.sender, addr, airdropTokens[addr]);
| uint privListLen = airdropPrivateList.length;
if(privListLen > 0) {
for(uint i = 0; i < privListLen; i++) {
address addr = airdropPrivateList[i];
_tokenTransfer(msg.sender, addr, airdropTokens[addr]);
| 22,418 |
105 | // Mapping of message leaves to MessageStatus | mapping(bytes32 => MessageStatus) public messages;
| mapping(bytes32 => MessageStatus) public messages;
| 26,871 |
6 | // return the smaller of the two inputs (a or b) | function limitLessThan(uint a, uint b) internal pure returns (uint c) {
if(a > b) return b;
return a;
}
| function limitLessThan(uint a, uint b) internal pure returns (uint c) {
if(a > b) return b;
return a;
}
| 46,194 |
88 | // Vote NO on a loan by staking TRU id Loan ID stake Amount of TRU to stake / | function no(address id, uint256 stake) external override onlyPendingLoans(id) {
vote(id, stake, false);
}
| function no(address id, uint256 stake) external override onlyPendingLoans(id) {
vote(id, stake, false);
}
| 22,894 |
7 | // call the receiveApproval function on the contract you want to be notified. This crafts the function signature manually so one doesn't have to include a contract in here just for this.receiveApproval(address _from, uint256 _value, address _tokenContract, bytes _extraData)it is assumed that when does this that the cal... | require(_spender.call(bytes4(bytes32(sha3("receiveApproval(address,uint256,address,bytes)"))), msg.sender, _value, this, _extraData));
return true;
| require(_spender.call(bytes4(bytes32(sha3("receiveApproval(address,uint256,address,bytes)"))), msg.sender, _value, this, _extraData));
return true;
| 18,027 |
6 | // No error data was returned, revert with "EVMCALLS_CALL_REVERTED" See remix: doing a `revert("EVMCALLS_CALL_REVERTED")` always results in this memory layout | mstore(ptr, 0x08c379a000000000000000000000000000000000000000000000000000000000) // error identifier
mstore(add(ptr, 0x04), 0x0000000000000000000000000000000000000000000000000000000000000020) // starting offset
mstore(add(ptr, 0x24), 0x00000... | mstore(ptr, 0x08c379a000000000000000000000000000000000000000000000000000000000) // error identifier
mstore(add(ptr, 0x04), 0x0000000000000000000000000000000000000000000000000000000000000020) // starting offset
mstore(add(ptr, 0x24), 0x00000... | 32,798 |
537 | // to set the token exponent value_val is new value / | function _setTokenExponent(uint _val) internal {
tokenExponent = _val;
}
| function _setTokenExponent(uint _val) internal {
tokenExponent = _val;
}
| 29,122 |
152 | // The block number when TSTI mining starts. | uint256 public startBlock;
event Deposit(address indexed user, uint256 indexed pid, uint256 amount);
event Withdraw(address indexed user, uint256 indexed pid, uint256 amount);
event EmergencyWithdraw(address indexed user, uint256 indexed pid, uint256 amount);
constructor(
TestyToken _TSTI,... | uint256 public startBlock;
event Deposit(address indexed user, uint256 indexed pid, uint256 amount);
event Withdraw(address indexed user, uint256 indexed pid, uint256 amount);
event EmergencyWithdraw(address indexed user, uint256 indexed pid, uint256 amount);
constructor(
TestyToken _TSTI,... | 11,483 |
56 | // Upgradeability is only provided internally through {_upgradeTo}. For an externally upgradeable proxy see{TransparentUpgradeableProxy}./ Initializes the upgradeable proxy with an initial implementation specified by `_logic`. If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically... | constructor(address _logic, bytes memory _data) public payable {
assert(_IMPLEMENTATION_SLOT == bytes32(uint256(keccak256("eip1967.proxy.implementation")) - 1));
_setImplementation(_logic);
if(_data.length > 0) {
Address.functionDelegateCall(_logic, _data);
}
| constructor(address _logic, bytes memory _data) public payable {
assert(_IMPLEMENTATION_SLOT == bytes32(uint256(keccak256("eip1967.proxy.implementation")) - 1));
_setImplementation(_logic);
if(_data.length > 0) {
Address.functionDelegateCall(_logic, _data);
}
| 12,450 |
12 | // controlled, msg.sender is typically failed ETO | function destroyTokens(uint256 amount) public;
| function destroyTokens(uint256 amount) public;
| 26,360 |
26 | // ============ Constructor ============ //When a new SetToken is created, initializes Positions in default state and adds modules into pending state.All parameter validations are on the SetTokenCreator contract. Validations are performed already on the SetTokenCreator. Initiates the positionMultiplier as 1e18 (no adju... | constructor(
address[] memory _components,
int256[] memory _units,
address[] memory _modules,
IController _controller,
address _manager,
string memory _name,
string memory _symbol
| constructor(
address[] memory _components,
int256[] memory _units,
address[] memory _modules,
IController _controller,
address _manager,
string memory _name,
string memory _symbol
| 6,414 |
33 | // "safeTransfer" which works for KIP7s which return bool or not | rawCall(coins[i], abi.encodeWithSignature("transfer(address,uint256)", msg.sender, value));
| rawCall(coins[i], abi.encodeWithSignature("transfer(address,uint256)", msg.sender, value));
| 20,250 |
248 | // uniswapPercentage = 0.25e18;25% minerLeaguePercentage = 0.1e18;10% operatorPercentage = 0.03e18;3% | err = _setDFLPercentagesFresh(0.25e18, 0.1e18, 0.03e18);
require(err == uint(Error.NO_ERROR), "setting DFL percentages failed");
| err = _setDFLPercentagesFresh(0.25e18, 0.1e18, 0.03e18);
require(err == uint(Error.NO_ERROR), "setting DFL percentages failed");
| 31,067 |
4 | // lendingPoolAddress the address of the lending pool this token is linked to. It is only used to add it as a minter. / | function initialize(address lendingPoolAddress) public {
require(lendingPoolAddress.isContract(), "LP_MUST_BE_CONTRACT");
lendingPool = LendingPoolInterface(lendingPoolAddress);
ERC20Detailed lendingToken = ERC20Detailed(lendingPool.lendingToken());
ERC20Detailed.initialize(
... | function initialize(address lendingPoolAddress) public {
require(lendingPoolAddress.isContract(), "LP_MUST_BE_CONTRACT");
lendingPool = LendingPoolInterface(lendingPoolAddress);
ERC20Detailed lendingToken = ERC20Detailed(lendingPool.lendingToken());
ERC20Detailed.initialize(
... | 15,090 |
4 | // ========== STATE VARIABLES ========== // ---------- Address Resolver Configuration ---------- // ========== CONSTRUCTOR ========== / | ) public Owned(_owner) Pausable() MixinResolver(_resolver, addressesToCache) {
// Temporarily change the owner so that the setters don't revert.
owner = msg.sender;
setExpiryDuration(_expiryDuration);
setMaxOraclePriceAge(_maxOraclePriceAge);
setMaxTimeToMaturity(_maxTimeToMa... | ) public Owned(_owner) Pausable() MixinResolver(_resolver, addressesToCache) {
// Temporarily change the owner so that the setters don't revert.
owner = msg.sender;
setExpiryDuration(_expiryDuration);
setMaxOraclePriceAge(_maxOraclePriceAge);
setMaxTimeToMaturity(_maxTimeToMa... | 2,528 |
101 | // calculates a new senior asset value based on senior redeem and senior supply | function calcSeniorAssetValue(uint seniorRedeem, uint seniorSupply,
uint currSeniorAsset, uint reserve_, uint nav_) public pure returns (uint seniorAsset) {
seniorAsset = safeSub(safeAdd(currSeniorAsset, seniorSupply), seniorRedeem);
uint assets = calcAssets(nav_, reserve_);
if(sen... | function calcSeniorAssetValue(uint seniorRedeem, uint seniorSupply,
uint currSeniorAsset, uint reserve_, uint nav_) public pure returns (uint seniorAsset) {
seniorAsset = safeSub(safeAdd(currSeniorAsset, seniorSupply), seniorRedeem);
uint assets = calcAssets(nav_, reserve_);
if(sen... | 22,387 |
78 | // user's stake gets slashed, converted to stablecoin and sent to treasury | uint256 amount = slash(proposals[id].proposer);
convertAndSendTreasuryFunds(amount);
| uint256 amount = slash(proposals[id].proposer);
convertAndSendTreasuryFunds(amount);
| 72,635 |
4 | // The security window | uint256 public securityWindow;
| uint256 public securityWindow;
| 28,353 |
5 | // Subtracts two unsigned integers, reverts on overflow (i.e. if subtrahend is greater than minuend)./ | function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a);
uint256 c = a - b;
return c;
}
| function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a);
uint256 c = a - b;
return c;
}
| 33,087 |
58 | // Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),reverting with custom message when dividing by zero. CAUTION: This function is deprecated because it requires allocating memory for the error | * message unnecessarily. For custom revert reasons use {tryMod}.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:... | * message unnecessarily. For custom revert reasons use {tryMod}.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:... | 250 |
41 | // This internal function is equivalent to {transfer}, and can be used toe.g. implement automatic token fees, slashing mechanisms, etc. Emits a {Transfer} event. Requirements: - `sender` cannot be the zero address.- `recipient` cannot be the zero address.- `sender` must have a balance of at least `amount`. / | function _transfer(
address sender,
address recipient,
uint256 amount
) internal virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(sender... | function _transfer(
address sender,
address recipient,
uint256 amount
) internal virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(sender... | 1,254 |
54 | // Envelope container | mapping(uint256 => mapping(address => uint256)) internal _assetsEnvelope;
mapping(address => mapping(uint256 => bool)) internal _assetsEnveloped;
| mapping(uint256 => mapping(address => uint256)) internal _assetsEnvelope;
mapping(address => mapping(uint256 => bool)) internal _assetsEnveloped;
| 50,878 |
571 | // Calculate amount given to taker in the right order's maker asset if the right spread will be part of the profit. | if (doesRightMakerAssetProfitExist) {
matchedFillResults.profitInRightMakerAsset = matchedFillResults.right.makerAssetFilledAmount.safeSub(
matchedFillResults.left.takerAssetFilledAmount
);
}
| if (doesRightMakerAssetProfitExist) {
matchedFillResults.profitInRightMakerAsset = matchedFillResults.right.makerAssetFilledAmount.safeSub(
matchedFillResults.left.takerAssetFilledAmount
);
}
| 63,843 |
19 | // 获取单次转手具体信息 | function getSingleHistory(uint _nftId, uint _id) public view user returns(uint, address, address, uint) {
return (
historyOf[_nftId][_id].time,
historyOf[_nftId][_id]._from,
historyOf[_nftId][_id]._to,
historyOf[_nftId][_id].value);
}
| function getSingleHistory(uint _nftId, uint _id) public view user returns(uint, address, address, uint) {
return (
historyOf[_nftId][_id].time,
historyOf[_nftId][_id]._from,
historyOf[_nftId][_id]._to,
historyOf[_nftId][_id].value);
}
| 52,936 |
91 | // enforce minting rules | require(
_internalCall ||
_msgSender() == nameService.getAddress("FUND_MANAGER") ||
hasRole(RESERVE_MINTER_ROLE, _msgSender()),
"GoodReserve: not a minter"
);
require(
IGoodDollar(nameService.getAddress("GOODDOLLAR")).totalSupply() +
_gdToMint <=
| require(
_internalCall ||
_msgSender() == nameService.getAddress("FUND_MANAGER") ||
hasRole(RESERVE_MINTER_ROLE, _msgSender()),
"GoodReserve: not a minter"
);
require(
IGoodDollar(nameService.getAddress("GOODDOLLAR")).totalSupply() +
_gdToMint <=
| 32,126 |
5 | // The token and amount details for a transfer signed in the permit transfer signature | struct TokenPermissions {
// ERC20 token address
address token;
// the maximum amount that can be spent
uint256 amount;
}
| struct TokenPermissions {
// ERC20 token address
address token;
// the maximum amount that can be spent
uint256 amount;
}
| 242 |
28 | // for upgrades | uint256[50] private _gap;
| uint256[50] private _gap;
| 27,367 |
318 | // track the time | uint256 timeNew_ = now;
emit onBuyBlock(_customerAddress, _blockIDArray_, buyBlockPrice_, timeNew_);
| uint256 timeNew_ = now;
emit onBuyBlock(_customerAddress, _blockIDArray_, buyBlockPrice_, timeNew_);
| 37,028 |
8 | // Returns the total amount of tokens in existence. / | function totalSupply() external view returns (uint256 totalSupply_);
| function totalSupply() external view returns (uint256 totalSupply_);
| 4,205 |
773 | // Set ACL base | _setApp(KERNEL_APP_BASES_NAMESPACE, KERNEL_DEFAULT_ACL_APP_ID, _baseAcl);
| _setApp(KERNEL_APP_BASES_NAMESPACE, KERNEL_DEFAULT_ACL_APP_ID, _baseAcl);
| 5,947 |
37 | // report a car/part, ex. in 3 reports, get banned | Car memory carStr = cars[car];
return (
carStr.vin,
carStr.metaIpfsHash,
carStr.seller
);
| Car memory carStr = cars[car];
return (
carStr.vin,
carStr.metaIpfsHash,
carStr.seller
);
| 48,790 |
18 | // Verify computed and expected deposit data roots match | require(node == deposit_data_root, "DepositContract: reconstructed DepositData does not match supplied deposit_data_root");
| require(node == deposit_data_root, "DepositContract: reconstructed DepositData does not match supplied deposit_data_root");
| 30,445 |
137 | // Pool token is redeemed. / | event Redeemed(address indexed provider, uint256 redeemAmount, uint256[] amounts, uint256 feeAmount);
| event Redeemed(address indexed provider, uint256 redeemAmount, uint256[] amounts, uint256 feeAmount);
| 15,807 |
29 | // The oracle will have given you an ID for the VRF keypair they have committed to (let's call it keyHash), and have told you the minimum LINK price for VRF service. Make sure your contract has sufficient LINK, and call requestRandomness(keyHash, fee, seed), where seed is the input you want to generate randomness from.... | abstract contract VRFConsumerBase is VRFRequestIDBase {
using SafeMathChainlink for uint256;
/**
* @notice fulfillRandomness handles the VRF response. Your contract must
* @notice implement it. See "SECURITY CONSIDERATIONS" above for important
* @notice principles to keep in mind when implementing your f... | abstract contract VRFConsumerBase is VRFRequestIDBase {
using SafeMathChainlink for uint256;
/**
* @notice fulfillRandomness handles the VRF response. Your contract must
* @notice implement it. See "SECURITY CONSIDERATIONS" above for important
* @notice principles to keep in mind when implementing your f... | 18,557 |
586 | // The Nouns token URI descriptor | INounsDescriptor public descriptor;
| INounsDescriptor public descriptor;
| 15,271 |
74 | // Shows latest USDC price for given asset/ function toUSDC(address assetAdd, uint256 asset) public view | // returns(uint256) {
// if (asset == 0)
// return 0;
// uint256 value;
// // Asset Price
// uint256 backed = getPrice(assetAdd); //8
// // USDC Price
// uint256 USDCValue = getPrice(USDC); //8
// // Converting to gram
// backed = ... | // returns(uint256) {
// if (asset == 0)
// return 0;
// uint256 value;
// // Asset Price
// uint256 backed = getPrice(assetAdd); //8
// // USDC Price
// uint256 USDCValue = getPrice(USDC); //8
// // Converting to gram
// backed = ... | 24,928 |
6 | // up to 255 item types in 1 product | for(uint8 item_idx = 0; item_idx < counts.length; item_idx++ ){
require(indicies[item_idx] < release_count, "cannot include unreleased items");
require(!releases[indicies[item_idx]].limited, "cannot include limited release");
require(releases[indicies[item_idx]].total_created + counts[item_idx] > ... | for(uint8 item_idx = 0; item_idx < counts.length; item_idx++ ){
require(indicies[item_idx] < release_count, "cannot include unreleased items");
require(!releases[indicies[item_idx]].limited, "cannot include limited release");
require(releases[indicies[item_idx]].total_created + counts[item_idx] > ... | 76,563 |
8 | // | constructor(address _treasury) ERC20("Papi Pepe", "PAPIPEPE") {
IRouter _router = IRouter(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
address _pair = IFactory(_router.factory()).createPair(
address(this),
_router.WETH()
);
router = _router;
pair = _p... | constructor(address _treasury) ERC20("Papi Pepe", "PAPIPEPE") {
IRouter _router = IRouter(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
address _pair = IFactory(_router.factory()).createPair(
address(this),
_router.WETH()
);
router = _router;
pair = _p... | 28,612 |
174 | // Immutable bytecode template. | bytes template;
| bytes template;
| 19,751 |
14 | // Whether or not this market is listed | bool isListed;
| bool isListed;
| 28,115 |
63 | // We also modify the UNBASE supply held in excluded accounts to correctly reflect the circulating supply after the rebase event | for (uint256 i = 0; i < _excluded.length; i++) {
if (_unbaseBalances[_excluded[i]] > 0) {
_unbaseBalances[_excluded[i]] = _unbaseBalances[_excluded[i]].sub(_unbaseBalances[_excluded[i]].mul(_unbasePercent).div(100));
}
| for (uint256 i = 0; i < _excluded.length; i++) {
if (_unbaseBalances[_excluded[i]] > 0) {
_unbaseBalances[_excluded[i]] = _unbaseBalances[_excluded[i]].sub(_unbaseBalances[_excluded[i]].mul(_unbasePercent).div(100));
}
| 13,167 |
2 | // Called when a curve has reached its abump barrier. Because the barrier occurs at the final price in the tick, we need to "shave the price"over into the next tick. The curve has kicked in liquidity that's only activebelow this price, and we need the price to reflect the correct tick. So we burnan economically meaning... | pure internal returns (int128, int128, uint128) {
uint128 burnDown = CurveMath.priceToTokenPrecision
(curve.activeLiquidity(), curve.priceRoot_, inBaseQty);
require(swapLeft > burnDown, "BD");
if (isBuy) {
return setShaveUp(curve, inBaseQty, burnDown);
... | pure internal returns (int128, int128, uint128) {
uint128 burnDown = CurveMath.priceToTokenPrecision
(curve.activeLiquidity(), curve.priceRoot_, inBaseQty);
require(swapLeft > burnDown, "BD");
if (isBuy) {
return setShaveUp(curve, inBaseQty, burnDown);
... | 13,649 |
60 | // direct numerical comparison works here, because ((e,r) <= (e',r')) implies (epochAndRound <= epochAndRound') because alphabetic ordering implies e <= e', and if e = e', then r<=r', so e256+r <= e'256+r', because r, r' < 256 | require(r.hotVars.latestEpochAndRound < epochAndRound, "stale report");
require(_rs.length > r.hotVars.threshold, "not enough signatures");
require(_rs.length <= maxNumOracles, "too many signatures");
require(_ss.length == _rs.length, "signatures out of registration");
require(r.observati... | require(r.hotVars.latestEpochAndRound < epochAndRound, "stale report");
require(_rs.length > r.hotVars.threshold, "not enough signatures");
require(_rs.length <= maxNumOracles, "too many signatures");
require(_ss.length == _rs.length, "signatures out of registration");
require(r.observati... | 11,597 |
243 | // Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no otherfunction in the contract matches the call data. / | fallback() external virtual {
_fallback();
}
| fallback() external virtual {
_fallback();
}
| 846 |
12 | // Get token reserves in ethers | (uint112 reserve_0, uint112 reserve_1, ) = pair.getReserves();
uint256 ethTotal_0 = getEthBalanceByToken(0, reserve_0);
uint256 ethTotal_1 = getEthBalanceByToken(1, reserve_1);
if (hasDeviation(ethTotal_0, ethTotal_1)) {
| (uint112 reserve_0, uint112 reserve_1, ) = pair.getReserves();
uint256 ethTotal_0 = getEthBalanceByToken(0, reserve_0);
uint256 ethTotal_1 = getEthBalanceByToken(1, reserve_1);
if (hasDeviation(ethTotal_0, ethTotal_1)) {
| 30,384 |
112 | // tETH with Governance. | contract tETH_TOKEN is BEP20('tETH Token', 'tETH') {
/// @notice Creates `_amount` token to `_to`. Must only be called by the owner (MasterChef).
function mint(address _to, uint256 _amount) public onlyOwner {
_mint(_to, _amount);
}
constructor(uint256 initAmount) public {
_mint(msg.sende... | contract tETH_TOKEN is BEP20('tETH Token', 'tETH') {
/// @notice Creates `_amount` token to `_to`. Must only be called by the owner (MasterChef).
function mint(address _to, uint256 _amount) public onlyOwner {
_mint(_to, _amount);
}
constructor(uint256 initAmount) public {
_mint(msg.sende... | 13,331 |
3 | // The DAI TOKEN! | IBEP20 public token;
| IBEP20 public token;
| 391 |
484 | // if unfinished calculate payout vested | uint256 payout = info.payout.mul(percentVested).div(10000);
| uint256 payout = info.payout.mul(percentVested).div(10000);
| 23,186 |
4 | // @inheritdoc ERC165 / | function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == _INTERFACEID_LSP1_DELEGATE || super.supportsInterface(interfaceId);
}
| function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == _INTERFACEID_LSP1_DELEGATE || super.supportsInterface(interfaceId);
}
| 6,072 |
23 | // The use of `normalizedWeight.complement()` assumes that the sum of all weights equals FixedPoint.ONE. This may not be the case when weights are stored in a denormalized format or during a gradual weight change due rounding errors during normalization or interpolation. This will result in a small difference between t... | uint256 invariantRatioWithFees = balanceRatioWithFee.mulDown(normalizedWeight).add(
normalizedWeight.complement()
);
if (balanceRatioWithFee > invariantRatioWithFees) {
uint256 nonTaxableAmount = invariantRatioWithFees > FixedPoint.ONE
... | uint256 invariantRatioWithFees = balanceRatioWithFee.mulDown(normalizedWeight).add(
normalizedWeight.complement()
);
if (balanceRatioWithFee > invariantRatioWithFees) {
uint256 nonTaxableAmount = invariantRatioWithFees > FixedPoint.ONE
... | 8,793 |
216 | // expmods_and_points.points[9] = -(g^9z). | mstore(add(expmodsAndPoints, 0x3c0), point)
| mstore(add(expmodsAndPoints, 0x3c0), point)
| 63,453 |
55 | // Check if address is in the tier. The final tier is open to all. | require(
isAddressEligible(msg.sender, tier, merkleProof),
'Invalid Merkle proof'
);
| require(
isAddressEligible(msg.sender, tier, merkleProof),
'Invalid Merkle proof'
);
| 43,485 |
321 | // Event emitted when minting a new NFT. / | event Mint(uint256 indexed index, address indexed minter);
using SafeMath for uint256;
using ECDSA for bytes32;
using Address for address;
address private signVerifier;
uint16 public constant MAX_COUNT = 500;
uint256 public generativeScriptSegmentCount;
| event Mint(uint256 indexed index, address indexed minter);
using SafeMath for uint256;
using ECDSA for bytes32;
using Address for address;
address private signVerifier;
uint16 public constant MAX_COUNT = 500;
uint256 public generativeScriptSegmentCount;
| 5,861 |
94 | // Only owner address can set emergency pause 1 | function ownerPauseGame(bool newStatus) public
onlyOwner
| function ownerPauseGame(bool newStatus) public
onlyOwner
| 10,229 |
16 | // hasSendDirection / | function hasSendDirection(Direction _direction) public pure returns (bool) {
return _direction == Direction.SEND || _direction == Direction.BOTH;
}
| function hasSendDirection(Direction _direction) public pure returns (bool) {
return _direction == Direction.SEND || _direction == Direction.BOTH;
}
| 7,651 |
13 | // Allows only the owner of the contract to execute the function | modifier onlyOwner {
assert(msg.sender == owner);
_;
}
| modifier onlyOwner {
assert(msg.sender == owner);
_;
}
| 18,249 |
429 | // The EIP-712 typehash for the delegation struct used by the contract. | bytes32 public constant DELEGATION_TYPEHASH = keccak256("Delegation(address delegatee,uint256 nonce,uint256 expiry)");
| bytes32 public constant DELEGATION_TYPEHASH = keccak256("Delegation(address delegatee,uint256 nonce,uint256 expiry)");
| 41,460 |
97 | // low level token Pledge function | function procureTokens(address beneficiary) public payable {
uint256 tokens;
uint256 weiAmount = msg.value;
uint256 backAmount;
uint256 rate;
uint hardCap;
require(beneficiary != address(0));
rate = getRateIcoWithBonus();
//icoPreICO
hardCap = hardcapPreICO;
if (now >= start... | function procureTokens(address beneficiary) public payable {
uint256 tokens;
uint256 weiAmount = msg.value;
uint256 backAmount;
uint256 rate;
uint hardCap;
require(beneficiary != address(0));
rate = getRateIcoWithBonus();
//icoPreICO
hardCap = hardcapPreICO;
if (now >= start... | 58,849 |
49 | // transfer output tokens to recipient | if (recipient != address(this)) {
tokenOut.safeTransfer(recipient, tokenAmountOut);
}
| if (recipient != address(this)) {
tokenOut.safeTransfer(recipient, tokenAmountOut);
}
| 3,938 |
27 | // ab does not overflow, return exact math | value = _numA * _numB;
value /= _den;
return value;
| value = _numA * _numB;
value /= _den;
return value;
| 902 |
18 | // Get the token balance for account `tokenOwner` | function balanceOf(address tokenOwner) public constant returns (uint balance) {
return tokenBalances[tokenOwner];
}
| function balanceOf(address tokenOwner) public constant returns (uint balance) {
return tokenBalances[tokenOwner];
}
| 12,414 |
278 | // Tell the information related to a Disputable app_disputable Address of the Disputable app return activated Whether the Disputable app is active return currentCollateralRequirementId Identification number of the current collateral requirement/ | function getDisputableInfo(address _disputable) external view returns (bool activated, uint256 currentCollateralRequirementId) {
DisputableInfo storage disputableInfo = disputableInfos[_disputable];
activated = disputableInfo.activated;
uint256 nextId = disputableInfo.nextCollateralRequireme... | function getDisputableInfo(address _disputable) external view returns (bool activated, uint256 currentCollateralRequirementId) {
DisputableInfo storage disputableInfo = disputableInfos[_disputable];
activated = disputableInfo.activated;
uint256 nextId = disputableInfo.nextCollateralRequireme... | 58,238 |
26 | // used to get key of combined StudyID and patientId -> ("StudyID:PatientID") | function getKey(uint256 _patientId, uint256 _studyId)
internal
pure
returns (string memory key)
| function getKey(uint256 _patientId, uint256 _studyId)
internal
pure
returns (string memory key)
| 38,092 |
408 | // Do pre-exchange validations | BorrowShared.validateTxPreSell(state, transaction);
| BorrowShared.validateTxPreSell(state, transaction);
| 17,885 |
67 | // Fetch the information about user. His claimable balance, fixed balance & stuff / | function fetchUser(address _user) public view returns(uint256[] memory _bundles,string memory username,uint256 claimable,uint256 staked_balance, bool active){
User storage us = user[_user];
return(us.bundles,us.username,us.freebal,us.balance,us.active);
}
| function fetchUser(address _user) public view returns(uint256[] memory _bundles,string memory username,uint256 claimable,uint256 staked_balance, bool active){
User storage us = user[_user];
return(us.bundles,us.username,us.freebal,us.balance,us.active);
}
| 12,350 |
31 | // Calculates the amount that has already vested. account address of the user / | function _vestedAmount(address account) internal view returns (uint256) {
VestedToken storage vested = vestedUser[account];
uint256 totalToken = vested.totalToken;
if(block.timestamp < vested.start.add(vested.cliff)){
return 0;
}else if(block.timestamp >= vested.start.ad... | function _vestedAmount(address account) internal view returns (uint256) {
VestedToken storage vested = vestedUser[account];
uint256 totalToken = vested.totalToken;
if(block.timestamp < vested.start.add(vested.cliff)){
return 0;
}else if(block.timestamp >= vested.start.ad... | 35,454 |
4 | // Depends on the number of requested values that you want sent to the fulfillRandomWords() function. Storing each word costs about 20,000 gas, so 100,000 is a safe default for this example contract. Test and adjust this limit based on the network that you select, the size of the request, and the processing of the call... | uint32 callbackGasLimit = 300000;
| uint32 callbackGasLimit = 300000;
| 7,359 |
543 | // Sandalwood rewarded as part of the Opening Ceremony quests / | contract SandalwoodToken is ERC20, ERC20Burnable {
constructor() ERC20("Sandalwood", "Sandalwood") {
_mint(_msgSender(), 1e12 * 1e18);
}
}
| contract SandalwoodToken is ERC20, ERC20Burnable {
constructor() ERC20("Sandalwood", "Sandalwood") {
_mint(_msgSender(), 1e12 * 1e18);
}
}
| 49,100 |
18 | // Add in first position | if (isSale) {
if (value < orders[firstNode - 1].value) {
saleOrdersMappingByAssets[asset][0] = orderIndex;
saleOrdersMappingByAssets[asset][orderIndex] = firstNode;
numberOfSaleOrdersByAssets[asset] += 1;
return true;
}
| if (isSale) {
if (value < orders[firstNode - 1].value) {
saleOrdersMappingByAssets[asset][0] = orderIndex;
saleOrdersMappingByAssets[asset][orderIndex] = firstNode;
numberOfSaleOrdersByAssets[asset] += 1;
return true;
}
| 25,761 |
360 | // Updates user's fees reward | function _updateFeesReward(address account) internal {
uint liquidity = pool.positionLiquidity(tickLower, tickUpper);
if (liquidity == 0) return; // we can't poke when liquidity is zero
(uint256 collect0, uint256 collect1) = _earnFees();
token0PerShareStored = _toke... | function _updateFeesReward(address account) internal {
uint liquidity = pool.positionLiquidity(tickLower, tickUpper);
if (liquidity == 0) return; // we can't poke when liquidity is zero
(uint256 collect0, uint256 collect1) = _earnFees();
token0PerShareStored = _toke... | 8,715 |
0 | // ERC20 Token Standard, optional extension: Allowance./See https:eips.ethereum.org/EIPS/eip-20/Note: the ERC-165 identifier for this interface is 0x9d075186. | interface IERC20Allowance {
/// @notice Increases the allowance granted to an account by the sender.
/// @notice This is an alternative to {approve} that can be used as a mitigation for transaction ordering problems.
/// @dev Reverts if `spender` is the zero address.
/// @dev Reverts if `spender`'s allo... | interface IERC20Allowance {
/// @notice Increases the allowance granted to an account by the sender.
/// @notice This is an alternative to {approve} that can be used as a mitigation for transaction ordering problems.
/// @dev Reverts if `spender` is the zero address.
/// @dev Reverts if `spender`'s allo... | 41,961 |
123 | // we can take all | if (toWithdraw > liquidity) {
toWithdraw = liquidity;
}
| if (toWithdraw > liquidity) {
toWithdraw = liquidity;
}
| 29,831 |
26 | // Set offerReferrerAddressSlot0 to the first 16B of the referrer address. By shifting the referrer 32 bits to the right we obtain the first 16B. | offer.offerReferrerAddressSlot0 = uint128(uint160(address(referrer)) >> 32);
| offer.offerReferrerAddressSlot0 = uint128(uint160(address(referrer)) >> 32);
| 17,932 |
4 | // Behaviour201911 AZTEC Details the methods and the storage schema of a note registry.Methods are documented in interface. Copyright 2020 Spilsbury Holdings LtdLicensed under the GNU Lesser General Public Licence, Version 3.0 (the "License");you may not use this file except in compliance with the License. This program... | contract Behaviour201911 is Behaviour201907 {
uint256 public constant slowReleaseEnd = 1585699199;
bool public isAvailableDuringSlowRelease = false;
modifier onlyIfAvailable() {
// Not sensitive to small differences in time
require(isAvailableDuringSlowRelease == true || slowReleaseEnd < bl... | contract Behaviour201911 is Behaviour201907 {
uint256 public constant slowReleaseEnd = 1585699199;
bool public isAvailableDuringSlowRelease = false;
modifier onlyIfAvailable() {
// Not sensitive to small differences in time
require(isAvailableDuringSlowRelease == true || slowReleaseEnd < bl... | 45,264 |
63 | // set the new player bool to true | return (true);
| return (true);
| 15,202 |
82 | // This is needed to avoid costly repeat calls to different getter functions It is cheaper gas-wise to just dump everything and only use some of the info | function frax_info() public view returns (uint256, uint256, uint256, uint256, uint256, uint256, uint256, uint256) {
return (
oracle_price(PriceChoice.FRAX), // frax_price()
oracle_price(PriceChoice.FXS), // fxs_price()
totalSupply(), // totalSupply()
global_co... | function frax_info() public view returns (uint256, uint256, uint256, uint256, uint256, uint256, uint256, uint256) {
return (
oracle_price(PriceChoice.FRAX), // frax_price()
oracle_price(PriceChoice.FXS), // fxs_price()
totalSupply(), // totalSupply()
global_co... | 3,980 |
40 | // setter/getter for digits constant (current 1018)/ | function setAdjConstant(uint256 new_adj_constant) external onlyOwner{
adj_constant = new_adj_constant;
}
| function setAdjConstant(uint256 new_adj_constant) external onlyOwner{
adj_constant = new_adj_constant;
}
| 40,084 |
573 | // slope of the stable interest curve when utilization rate > 0 and <= OPTIMAL_UTILIZATION_RATE. Expressed in ray | uint256 internal stableRateSlope1;
| uint256 internal stableRateSlope1;
| 39,883 |
131 | // Get the time remaining until the malicious DKG result/ slashing amount can be updated./ return Remaining time in seconds. | function getRemainingMaliciousDkgResultSlashingAmountUpdateTime()
external
view
returns (uint256)
| function getRemainingMaliciousDkgResultSlashingAmountUpdateTime()
external
view
returns (uint256)
| 35,616 |
65 | // Bad interface | require(upgradeAgent.isUpgradeAgent(), "The provided updateAgent contract is required to be compliant to the UpgradeAgent interface method when setting upgrade agent.");
| require(upgradeAgent.isUpgradeAgent(), "The provided updateAgent contract is required to be compliant to the UpgradeAgent interface method when setting upgrade agent.");
| 28,191 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.