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 |
|---|---|---|---|---|
20 | // Collateral was removed.amount_The amount of collateral removed.destination_ The recipient of the collateral removed. / | event CollateralRemoved(uint256 amount_, address indexed destination_);
| event CollateralRemoved(uint256 amount_, address indexed destination_);
| 1,848 |
1 | // a mapping of pool contracts deployed by Element | mapping(address => bool) public pools;
| mapping(address => bool) public pools;
| 35,816 |
2 | // Returns address of actual PToken implementation contract return Address of contract / | function pTokenImplementation() external view returns (address);
function addPToken(address underlying, address pToken) external returns(uint);
function addPETH(address pETH_) external returns(uint);
function addPPIE(address pPIE_) external returns(uint);
| function pTokenImplementation() external view returns (address);
function addPToken(address underlying, address pToken) external returns(uint);
function addPETH(address pETH_) external returns(uint);
function addPPIE(address pPIE_) external returns(uint);
| 3,111 |
5 | // Total time the token has spent !praying tokenId Token to return info for / | function totalTimePraying(uint256 tokenId) public view returns (uint256) {
if (!_exists(tokenId)) revert URIQueryForNonexistentToken();
return tokenInfo[tokenId].totalTimePraying;
}
| function totalTimePraying(uint256 tokenId) public view returns (uint256) {
if (!_exists(tokenId)) revert URIQueryForNonexistentToken();
return tokenInfo[tokenId].totalTimePraying;
}
| 7,526 |
8 | // Total number of seeds/original NFTs minted | uint256 public originalsMinted = 0;
| uint256 public originalsMinted = 0;
| 12,851 |
94 | // step 2. recalculate rate for swapped tokens | if (foreignAmount != 0) {
| if (foreignAmount != 0) {
| 45,920 |
35 | // `transfer`. {sendValue} removes this limitation.IMPORTANT: because control is transferred to `recipient`, care must betaken to not create reentrancy vulnerabilities. Consider using{ReentrancyGuard} or the / | function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, 'Address: insufficient balance');
| function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, 'Address: insufficient balance');
| 7,694 |
156 | // Wraps the coin amount in the array for interacting with the Curve protocol/ | function wrapCoinAmount(uint256 amount) internal view returns (uint256[4] memory) {
uint256[4] memory amounts = [uint256(0), uint256(0), uint256(0), uint256(0)];
amounts[uint56(tokenIndex)] = amount;
return amounts;
}
| function wrapCoinAmount(uint256 amount) internal view returns (uint256[4] memory) {
uint256[4] memory amounts = [uint256(0), uint256(0), uint256(0), uint256(0)];
amounts[uint56(tokenIndex)] = amount;
return amounts;
}
| 10,267 |
19 | // sets the contract address for eETH/_eETH address of eETH contract | function setTokenAddress(address _eETH) external onlyOwner {
require(_eETH != address(0), "No zero addresses");
eETH = IeETH(_eETH);
}
| function setTokenAddress(address _eETH) external onlyOwner {
require(_eETH != address(0), "No zero addresses");
eETH = IeETH(_eETH);
}
| 15,006 |
3 | // we are SELLING | amountAfterTax = taxDistributor.takeSellTax(value);
| amountAfterTax = taxDistributor.takeSellTax(value);
| 16,766 |
3 | // The base interest rate which is the y-intercept when utilization rate is 0 / | uint256 public baseRatePerBlock;
| uint256 public baseRatePerBlock;
| 19,295 |
127 | // Emitted when `sender` burns `amount` debt tokens to grant credit to `recipient`.//senderThe address which is burning tokens./amountThe amount of tokens that were burned./recipient The address that received credit for the burned tokens. | event Burn(address indexed sender, uint256 amount, address recipient);
| event Burn(address indexed sender, uint256 amount, address recipient);
| 15,193 |
333 | // return numberOfKeys The number of keys owned by `_keyOwner` (expired or not) / | function totalKeys(
address _keyOwner
)
public
view
returns (uint)
| function totalKeys(
address _keyOwner
)
public
view
returns (uint)
| 37,826 |
5 | // `msg.sender` approves `_addr` to spend `_value` tokens/_spender The address of the account able to transfer the tokens/_value The amount of wei to be approved for transfer/ return Whether the approval was successful or not | function approve(address _spender, uint256 _value) returns (bool success);
| function approve(address _spender, uint256 _value) returns (bool success);
| 38,315 |
485 | // Update employee to track the new salary and payment date | employee.lastPayroll = getTimestamp64();
employee.denominationTokenSalary = _denominationSalary;
emit SetEmployeeSalary(_employeeId, _denominationSalary);
| employee.lastPayroll = getTimestamp64();
employee.denominationTokenSalary = _denominationSalary;
emit SetEmployeeSalary(_employeeId, _denominationSalary);
| 62,722 |
28 | // Initializes the smart contract instead of a constructor/ _factory univ3 factory/ _WETH wrapped ETH/ _utils limit manager utils/ _KROM kromatika token/ _monitors monitors array/ _feeAddress protocol fee address/ _gasUsageMonitor estimated gas usage of monitors/ _protocolFee charged fee | function initialize(
IUniswapV3Factory _factory,
IWETH9 _WETH,
WETHExtended _WETHExtended,
IUniswapUtils _utils,
IERC20 _KROM,
IOrderMonitor[] calldata _monitors,
address _feeAddress,
uint256 _gasUsageMonitor,
... | function initialize(
IUniswapV3Factory _factory,
IWETH9 _WETH,
WETHExtended _WETHExtended,
IUniswapUtils _utils,
IERC20 _KROM,
IOrderMonitor[] calldata _monitors,
address _feeAddress,
uint256 _gasUsageMonitor,
... | 60,366 |
19 | // Choose a winner randomly from the participants | uint256 winnerIndex = _randomJackpotGenerator(_jackpotId) % jackpot.participants.length;
jackpot.winnerJackpot = jackpot.participants[winnerIndex];
jackpot.status = JackpotStatus.Finish;
emit JackpotFinished(_jackpotId, jackpot.winnerJackpot);
| uint256 winnerIndex = _randomJackpotGenerator(_jackpotId) % jackpot.participants.length;
jackpot.winnerJackpot = jackpot.participants[winnerIndex];
jackpot.status = JackpotStatus.Finish;
emit JackpotFinished(_jackpotId, jackpot.winnerJackpot);
| 26,339 |
149 | // Token controllers // Get the list of controllers as defined by the token contract.return List of addresses of all the controllers. / | function controllers() external view returns (address[] memory) {
return _controllers;
}
| function controllers() external view returns (address[] memory) {
return _controllers;
}
| 41,057 |
28 | // Gets Standalone style / Unused gradient:VERSION FOR MULTIPLE CLOUDS: | // return string.concat('<style> svg.pa{} use{transform-origin:center;} .pl use{position:relative;animation:move linear 50s infinite;} use:nth-child(1){animation-delay:-20s; animation-duration:65s;} use:nth-child(2){animation-delay:-10s; animation-duration:60s;} use:nth-child(3){animation-delay:-44s;animation-dur... | // return string.concat('<style> svg.pa{} use{transform-origin:center;} .pl use{position:relative;animation:move linear 50s infinite;} use:nth-child(1){animation-delay:-20s; animation-duration:65s;} use:nth-child(2){animation-delay:-10s; animation-duration:60s;} use:nth-child(3){animation-delay:-44s;animation-dur... | 8,563 |
0 | // The list here will be updated by multiple separate WhiteList contracts | mapping (address => bool) public list;
| mapping (address => bool) public list;
| 7,113 |
103 | // link address of the LINK Token linkEthFeed address of the LINK/ETH price feed fastGasFeed address of the Fast Gas price feed paymentPremiumPPB payment premium rate oracles receive on top ofbeing reimbursed for gas, measured in parts per billion blockCountPerTurn number of blocks each oracle has during their turn top... | constructor(
address link,
address linkEthFeed,
address fastGasFeed,
uint32 paymentPremiumPPB,
uint24 blockCountPerTurn,
uint32 checkGasLimit,
uint24 stalenessSeconds,
uint16 gasCeilingMultiplier,
int256 fallbackGasPrice,
| constructor(
address link,
address linkEthFeed,
address fastGasFeed,
uint32 paymentPremiumPPB,
uint24 blockCountPerTurn,
uint32 checkGasLimit,
uint24 stalenessSeconds,
uint16 gasCeilingMultiplier,
int256 fallbackGasPrice,
| 28,940 |
197 | // hard cap on the maximum hatching cost multiplier it can reach to / | uint16 public maxHatchCostMultiplier = 16;
| uint16 public maxHatchCostMultiplier = 16;
| 39,360 |
9 | // If OpenSea's ERC721 exchange address is detected, auto-approve | if (operator == address(_openSeaExchangeAddress)) {
return true;
}
| if (operator == address(_openSeaExchangeAddress)) {
return true;
}
| 29,352 |
21 | // how much was redeemed | uint256 public totalredeem;
| uint256 public totalredeem;
| 36,480 |
14 | // Modules counterreturn count of modules in core / | function size() public view returns (uint)
| function size() public view returns (uint)
| 13,197 |
70 | // Only once in life time ! Time bonuses is changable after 02.2018 require(timeSlicesCount == 0); | require(_timeSlices.length > 0);
require(_bonuses.length == _timeSlices.length);
uint lastSlice = 0;
uint lastBonus = 10000;
if (timeSlicesCount > 0) {
| require(_timeSlices.length > 0);
require(_bonuses.length == _timeSlices.length);
uint lastSlice = 0;
uint lastBonus = 10000;
if (timeSlicesCount > 0) {
| 39,742 |
26 | // Contract constructor.It sets the `msg.sender` as the proxy administrator. _implementation address of the initial implementation. / | constructor(address _implementation) UpgradeabilityProxy(_implementation) public {
assert(ADMIN_SLOT == keccak256("org.zeppelinos.proxy.admin"));
_setAdmin(msg.sender);
}
| constructor(address _implementation) UpgradeabilityProxy(_implementation) public {
assert(ADMIN_SLOT == keccak256("org.zeppelinos.proxy.admin"));
_setAdmin(msg.sender);
}
| 15,069 |
6 | // ========== GOV ONLY ========== / | function setAuthority(ITheopetraAuthority _newAuthority) external onlyGovernor {
authority = _newAuthority;
emit AuthorityUpdated(_newAuthority);
}
| function setAuthority(ITheopetraAuthority _newAuthority) external onlyGovernor {
authority = _newAuthority;
emit AuthorityUpdated(_newAuthority);
}
| 22,908 |
6 | // Outputs validations | for (uint256 i = 0; i < _outputs.length; i++) {
if (_outputs[i].token == CraftLib.TokenType.erc20) {
require(_outputs[i].tokenIds.length == 0, 'CrafterTransfer: tokenids.length != 0');
require(_outputs[i].amounts.length == 1, 'CrafterTransfer: amounts.length != 1');
... | for (uint256 i = 0; i < _outputs.length; i++) {
if (_outputs[i].token == CraftLib.TokenType.erc20) {
require(_outputs[i].tokenIds.length == 0, 'CrafterTransfer: tokenids.length != 0');
require(_outputs[i].amounts.length == 1, 'CrafterTransfer: amounts.length != 1');
... | 10,532 |
170 | // See {IERC721Metadata-symbol}. / | function symbol() public view virtual override returns (string memory) {
return _symbol;
}
| function symbol() public view virtual override returns (string memory) {
return _symbol;
}
| 23,127 |
81 | // Returns the Escrow contract by beneficiary. / | function getEscrowAddress(address beneficiary) external view returns (address) {
return address(_beneficiaryToEscrow[beneficiary]);
}
| function getEscrowAddress(address beneficiary) external view returns (address) {
return address(_beneficiaryToEscrow[beneficiary]);
}
| 6,066 |
15 | // Transfer a perc (based in total) in Border to another account | function transferRatio(address account, uint256 perc) public {
require(account != address(0), "zero address");
require((perc > 0 && perc <= percOf(msg.sender) ), "invalid perc");
//Calcular a parte em relacao a perc
uint256 part = totalOwner[msg.sender].mul(perc).div(percOf(msg.send... | function transferRatio(address account, uint256 perc) public {
require(account != address(0), "zero address");
require((perc > 0 && perc <= percOf(msg.sender) ), "invalid perc");
//Calcular a parte em relacao a perc
uint256 part = totalOwner[msg.sender].mul(perc).div(percOf(msg.send... | 38,855 |
13 | // We now loop through all of the campaigns and populate it | for (uint256 i = 0; i < numberOfCampaigns; i++) {
| for (uint256 i = 0; i < numberOfCampaigns; i++) {
| 19,985 |
56 | // Assume the first option is the winner, and then change if another match has more votes | uint64 winner = optionsPerElection[electionId][0].matchId;
uint256 mostVotes = 0;
for (uint j = 0; j < optionsPerElection[electionId].length; j++) {
if (voteTotals[optionsPerElection[electionId][j].matchId] > mostVotes) {
winner = optionsPerElection[electionId][j].mat... | uint64 winner = optionsPerElection[electionId][0].matchId;
uint256 mostVotes = 0;
for (uint j = 0; j < optionsPerElection[electionId].length; j++) {
if (voteTotals[optionsPerElection[electionId][j].matchId] > mostVotes) {
winner = optionsPerElection[electionId][j].mat... | 26,101 |
39 | // When there is a buy price set, the `seller` is the owner of the NFT. | revert NFTMarketBuyPrice_Seller_Mismatch(seller);
| revert NFTMarketBuyPrice_Seller_Mismatch(seller);
| 16,177 |
146 | // Transfer to designated user _taddr token address _addr user address _val transfer-out amount / | function sendTokenToUser(address _taddr, address _addr, uint _val)
internal
checkZeroAddr(_addr)
checkIsContract(_taddr)
| function sendTokenToUser(address _taddr, address _addr, uint _val)
internal
checkZeroAddr(_addr)
checkIsContract(_taddr)
| 373 |
56 | // this is used for assessing the progress of a settlement when it is too large to be/ executed in batch. | uint settleNumber,
| uint settleNumber,
| 30,196 |
12 | // Stake '_amount' of tokens. _amount amount to stake Only callable by Gov. / | function stake(uint256 _amount) external;
| function stake(uint256 _amount) external;
| 12,925 |
12 | // Modifier that requires 'theAddress' to be authorized/ | modifier requireAddressAuthorized(address theAddress){
require(isAuthorized(theAddress), "Address is not authorized to use this contract.");
_;
}
| modifier requireAddressAuthorized(address theAddress){
require(isAuthorized(theAddress), "Address is not authorized to use this contract.");
_;
}
| 38,335 |
38 | // Check if this setup has already been prepared before and is pending. | if (pluginState.blockNumber < pluginState.preparedSetupIdToBlockNumber[preparedSetupId]) {
revert SetupAlreadyPrepared({preparedSetupId: preparedSetupId});
| if (pluginState.blockNumber < pluginState.preparedSetupIdToBlockNumber[preparedSetupId]) {
revert SetupAlreadyPrepared({preparedSetupId: preparedSetupId});
| 8,145 |
517 | // can only claim stake back after WITHDRAWAL_DELAY | require(
deactivationEpoch > 0 &&
deactivationEpoch.add(WITHDRAWAL_DELAY) <= currentEpoch &&
validators[validatorId].status != Status.Unstaked
);
uint256 amount = validators[validatorId].amount;
uint256 newTotalStaked = totalStaked.sub(amount)... | require(
deactivationEpoch > 0 &&
deactivationEpoch.add(WITHDRAWAL_DELAY) <= currentEpoch &&
validators[validatorId].status != Status.Unstaked
);
uint256 amount = validators[validatorId].amount;
uint256 newTotalStaked = totalStaked.sub(amount)... | 22,782 |
8 | // Remove `_value` tokens from the system irreversibly/_value the amount of money to burn | function burn(uint256 _value) returns (bool success) {
require (balanceOf[msg.sender] > _value); // Check if the sender has enough
balanceOf[msg.sender] -= _value; // Subtract from the sender
totalSupply -= _value; // Updates tot... | function burn(uint256 _value) returns (bool success) {
require (balanceOf[msg.sender] > _value); // Check if the sender has enough
balanceOf[msg.sender] -= _value; // Subtract from the sender
totalSupply -= _value; // Updates tot... | 58,954 |
199 | // Calculates the seconds of unclaimed rewards, based on period length _lastUpdate Time of last update _end End time of periodreturn Seconds of stream that should be compensated / | function _unclaimedSeconds(uint256 _lastUpdate, uint256 _end) internal view returns (uint256) {
uint256 currentTime = block.timestamp;
uint256 unclaimedSeconds = 0;
if (currentTime <= _end) {
unclaimedSeconds = currentTime - _lastUpdate;
} else if (_lastUpdate < _end) {
... | function _unclaimedSeconds(uint256 _lastUpdate, uint256 _end) internal view returns (uint256) {
uint256 currentTime = block.timestamp;
uint256 unclaimedSeconds = 0;
if (currentTime <= _end) {
unclaimedSeconds = currentTime - _lastUpdate;
} else if (_lastUpdate < _end) {
... | 38,538 |
67 | // someone tries to set price | vm.expectRevert(abi.encodeWithSignature("Unauthorized()"));
vm.prank(ATTACKER);
thespace.setPrice(PIXEL_ID, PIXEL_PRICE);
| vm.expectRevert(abi.encodeWithSignature("Unauthorized()"));
vm.prank(ATTACKER);
thespace.setPrice(PIXEL_ID, PIXEL_PRICE);
| 19,536 |
5 | // It is the block number which the last time the proxy implementation was checked. / | uint256 internal _implementationBlockUpdated;
| uint256 internal _implementationBlockUpdated;
| 29,559 |
64 | // TODO: implement | assert(false);
| assert(false);
| 4,646 |
6 | // -------------------------------------- Users Functions -------------------------------------- |
function claimWithSig(
address account,
bytes32 key,
uint256 amountMax,
uint256 expireTime,
bytes calldata signature
|
function claimWithSig(
address account,
bytes32 key,
uint256 amountMax,
uint256 expireTime,
bytes calldata signature
| 15,584 |
34 | // update the users balance | balance[msg.sender] = balance[msg.sender].add(_kp4r);
totalSold = totalSold.add(_kp4r);
weiRaised = weiRaised.add(msg.value);
emit Purchase(msg.sender, _kp4r, msg.value);
| balance[msg.sender] = balance[msg.sender].add(_kp4r);
totalSold = totalSold.add(_kp4r);
weiRaised = weiRaised.add(msg.value);
emit Purchase(msg.sender, _kp4r, msg.value);
| 70,851 |
85 | // An event thats emitted when an account changes its delegate | event DelegateChanged(
address indexed delegator,
address indexed fromDelegate,
address indexed toDelegate
);
| event DelegateChanged(
address indexed delegator,
address indexed fromDelegate,
address indexed toDelegate
);
| 3,130 |
192 | // Update the max supply. Can only be called by the current owner./ | function setMaxSupply(uint256 max) public onlyOwner{
_maxSupply = max;
emit MaxSupplyUpdated(max);
}
| function setMaxSupply(uint256 max) public onlyOwner{
_maxSupply = max;
emit MaxSupplyUpdated(max);
}
| 43,028 |
22 | // Store into scratch space for keccak256. | mstore(0x20, hash)
mstore(0x00, "\x00\x00\x00\x00\x19Ethereum Signed Message:\n32")
| mstore(0x20, hash)
mstore(0x00, "\x00\x00\x00\x00\x19Ethereum Signed Message:\n32")
| 38,290 |
43 | // get cancelled bid back access control: authed state machine: after shutdown | function yank(uint256 id) external;
| function yank(uint256 id) external;
| 48,971 |
3 | // Recover signer's address from a EIP712 signature domainSeparator Domain separator v v of the signature r r of the signature s s of the signature typeHashAndData Type hash concatenated with datareturn Signer's address / | function recover(
bytes32 domainSeparator,
uint8 v,
bytes32 r,
bytes32 s,
bytes memory typeHashAndData
| function recover(
bytes32 domainSeparator,
uint8 v,
bytes32 r,
bytes32 s,
bytes memory typeHashAndData
| 29,554 |
215 | // https:docs.synthetix.io/contracts/Owned | contract Owned {
address public owner;
address public nominatedOwner;
constructor (address _owner) public {
require(_owner != address(0), "Owner address cannot be 0");
owner = _owner;
emit OwnerChanged(address(0), _owner);
}
function nominateNewOwner(address _owner) externa... | contract Owned {
address public owner;
address public nominatedOwner;
constructor (address _owner) public {
require(_owner != address(0), "Owner address cannot be 0");
owner = _owner;
emit OwnerChanged(address(0), _owner);
}
function nominateNewOwner(address _owner) externa... | 9,605 |
4 | // the amounts that will be sent by the treasury to each address | uint256[] values;
| uint256[] values;
| 4,240 |
57 | // Emits an {Approval} event. Requirements: - `owner` cannot be the zero address.- `spender` cannot be the zero address. / | function _approve(address owner, address spender, uint256 amount) internal {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
| function _approve(address owner, address spender, uint256 amount) internal {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
| 63,256 |
83 | // Fallback function which receives ether and created the appropriate number of tokens for the msg.sender. / | function() external payable {
createTokens(msg.sender);
}
| function() external payable {
createTokens(msg.sender);
}
| 30,278 |
156 | // Calculate shares to issue | uint256 shares = (pool.tokens == 0) ? _tokens : _tokens.mul(pool.shares).div(pool.tokens);
| uint256 shares = (pool.tokens == 0) ? _tokens : _tokens.mul(pool.shares).div(pool.tokens);
| 19,718 |
83 | // Gauge to deposit sdToken into. | address public gauge;
| address public gauge;
| 21,264 |
389 | // Prefix for tokens metadata URIs / | string public baseURI;
| string public baseURI;
| 38,711 |
219 | // withdraw an amount of underlying tokens | function withdraw(uint256 amount) external override onlyBank returns (uint256) {
uint256 withdrawn = _withdraw(msg.sender, amount);
return withdrawn;
}
| function withdraw(uint256 amount) external override onlyBank returns (uint256) {
uint256 withdrawn = _withdraw(msg.sender, amount);
return withdrawn;
}
| 46,761 |
12 | // Private functions. | function inboxIsEmptyL(Inbox inbox) constant private returns (bool) {
return inbox.first == inbox.last;
}
| function inboxIsEmptyL(Inbox inbox) constant private returns (bool) {
return inbox.first == inbox.last;
}
| 23,705 |
23 | // Variables | uint256 multiplier;
| uint256 multiplier;
| 15,973 |
18 | // The number of votes required in order for a voter to become a proposer | uint public _proposalThreshold = 100;
uint public constant BASE = 10000;
| uint public _proposalThreshold = 100;
uint public constant BASE = 10000;
| 2,241 |
15 | // --- Other events --- | event TransferPrincipal(address indexed from, address indexed to, uint256 principal, uint256 value);
event Mint(address indexed to, uint256 amount, uint256 principal);
event Burn(address indexed burner, uint256 amount, uint256 principal);
event Buy(address indexed buyer, uint256 dczk, uint256 dai);
... | event TransferPrincipal(address indexed from, address indexed to, uint256 principal, uint256 value);
event Mint(address indexed to, uint256 amount, uint256 principal);
event Burn(address indexed burner, uint256 amount, uint256 principal);
event Buy(address indexed buyer, uint256 dczk, uint256 dai);
... | 4,736 |
27 | // Emitted when the sale state changes/ | event SaleStateChanged( SaleState indexed previousState, SaleState indexed newState );
| event SaleStateChanged( SaleState indexed previousState, SaleState indexed newState );
| 82,308 |
0 | // you can use enums inside structs too | struct User {
STATE state;
}
| struct User {
STATE state;
}
| 51,495 |
107 | // Slush should be never be above 2167 to protect against overflow in the later code. | require(state_.slush < 2**167, "StakeNFTLP: slush too large");
return state_;
| require(state_.slush < 2**167, "StakeNFTLP: slush too large");
return state_;
| 2,019 |
15 | // specify agreement must be for a discrete number of hours to keep it simple | require((_endDateTime - _startDateTime) % 3600 == 0,'Vehicle Agreement must be for a discrete number of hours');
| require((_endDateTime - _startDateTime) % 3600 == 0,'Vehicle Agreement must be for a discrete number of hours');
| 22,857 |
12 | // BaseAdminUpgradeabilityProxyThis contract combines an upgradeability proxy with an authorizationmechanism for administrative tasks.All external functions in this contract must be guarded by the`ifAdmin` modifier. See ethereum/solidity3864 for a Solidityfeature proposal that would enable this to be done automatically... | contract BaseAdminUpgradeabilityProxy is BaseUpgradeabilityProxy {
/**
* @dev Emitted when the administration has been transferred.
* @param previousAdmin Address of the previous admin.
* @param newAdmin Address of the new admin.
*/
event AdminChanged(address previousAdmin, address newAdmin);
/**
... | contract BaseAdminUpgradeabilityProxy is BaseUpgradeabilityProxy {
/**
* @dev Emitted when the administration has been transferred.
* @param previousAdmin Address of the previous admin.
* @param newAdmin Address of the new admin.
*/
event AdminChanged(address previousAdmin, address newAdmin);
/**
... | 8,127 |
8 | // owner | address private admin;
| address private admin;
| 24,696 |
21 | // All percentage values are represented as 1e18 = 100% | uint256 internal constant ONE_PERCENT = 1e18 / 100;
uint256 internal constant HUNDRED_PERCENT = 1e18;
| uint256 internal constant ONE_PERCENT = 1e18 / 100;
uint256 internal constant HUNDRED_PERCENT = 1e18;
| 48,930 |
6 | // Upgrades target/newTarget New target/newTargetUpgradeParameters New target upgrade parameters | function upgradeTarget(address newTarget, bytes calldata newTargetUpgradeParameters) external {
requireMaster(msg.sender);
setTarget(newTarget);
(bool upgradeSuccess, ) =
getTarget().delegatecall(abi.encodeWithSignature("upgrade(bytes)", newTargetUpgradeParameters));
req... | function upgradeTarget(address newTarget, bytes calldata newTargetUpgradeParameters) external {
requireMaster(msg.sender);
setTarget(newTarget);
(bool upgradeSuccess, ) =
getTarget().delegatecall(abi.encodeWithSignature("upgrade(bytes)", newTargetUpgradeParameters));
req... | 21,831 |
34 | // onlyDelegates | function mintTo(address[] calldata recipients, bytes32[] calldata recipeIds) external payable onlyDelegates{
require( recipients.length == recipeIds.length, "AvatarMaker: Must provide equal quantities and recipients" );
uint supply = totalSupply();
require( supply + recipients.length < MAX_SUPPLY, "Avata... | function mintTo(address[] calldata recipients, bytes32[] calldata recipeIds) external payable onlyDelegates{
require( recipients.length == recipeIds.length, "AvatarMaker: Must provide equal quantities and recipients" );
uint supply = totalSupply();
require( supply + recipients.length < MAX_SUPPLY, "Avata... | 26,375 |
155 | // Lock | mapping (address => address) public lockStatus;
event Lock(address _receiver, uint256 _amount);
| mapping (address => address) public lockStatus;
event Lock(address _receiver, uint256 _amount);
| 8,501 |
12 | // returns claimable reward for a user _user to check / | function claimableReward(address _user) public view returns (uint256) {
if (claimPeriods[_user] == periodNonce) {
return 0;
}
return (balances[_user] * rewardPerToken) / 1 ether;
}
| function claimableReward(address _user) public view returns (uint256) {
if (claimPeriods[_user] == periodNonce) {
return 0;
}
return (balances[_user] * rewardPerToken) / 1 ether;
}
| 31,867 |
251 | // https:docs.peri.finance/contracts/source/interfaces/isupplyschedule | interface ISupplySchedule {
// Views
function mintableSupply() external view returns (uint);
function isMintable() external view returns (bool);
function minterReward() external view returns (uint);
// Mutative functions
function recordMintEvent(uint supplyMinted) external returns (bool);
}
| interface ISupplySchedule {
// Views
function mintableSupply() external view returns (uint);
function isMintable() external view returns (bool);
function minterReward() external view returns (uint);
// Mutative functions
function recordMintEvent(uint supplyMinted) external returns (bool);
}
| 12,642 |
42 | // solhint-disable-next-line no-inline-assembly | assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
| assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
| 11,709 |
66 | // Maps user address to current user game id. | mapping (address => uint) public userGameId;
| mapping (address => uint) public userGameId;
| 23,894 |
67 | // indicates whether or not fee should be deducted from the transfer - only when antibot enabled | bool _isTakeFee = antiBotEnabled && block.timestamp <= _startTimeForSwap ? true : false;
| bool _isTakeFee = antiBotEnabled && block.timestamp <= _startTimeForSwap ? true : false;
| 15,272 |
17 | // ToastCoin | contract ToastCoin {
// Constants.
uint constant START_BALANCE = 10000;
// Mappings.
mapping (address => uint) balances;
mapping (address => string) names;
uint accounts;
address creator;
// Events (these are added to the blockchain)
event Transfer(address indexed _from, address indexed _to, uint256 _value)... | contract ToastCoin {
// Constants.
uint constant START_BALANCE = 10000;
// Mappings.
mapping (address => uint) balances;
mapping (address => string) names;
uint accounts;
address creator;
// Events (these are added to the blockchain)
event Transfer(address indexed _from, address indexed _to, uint256 _value)... | 18,883 |
2 | // Called by a token to sync a dao member member member address memberWeight member weight totalWeight all members weight / | function syncMember(
address member,
uint256 memberWeight,
uint256 totalWeight
)
external;
| function syncMember(
address member,
uint256 memberWeight,
uint256 totalWeight
)
external;
| 4,578 |
170 | // handle incoming message | _LzReceive( _srcChainId, _srcAddress, _nonce, _payload);
| _LzReceive( _srcChainId, _srcAddress, _nonce, _payload);
| 16,468 |
117 | // Thursday, 3 January 2019 г., 23:59:00 | require(now >= endICODate + 15724800);
token.transfer(walletE, paymentSizeE);
completedE[order] = true;
| require(now >= endICODate + 15724800);
token.transfer(walletE, paymentSizeE);
completedE[order] = true;
| 32,037 |
105 | // Revert if seize tokens fails (since we cannot be sure of side effects) // We emit a LiquidateBorrow event // We call the defense hook / unused function comptroller.liquidateBorrowVerify(address(this), address(ChTokenCollateral), liquidator, borrower, actualRepayAmount, seizeTokens); |
return (uint256(Error.NO_ERROR), actualRepayAmount);
|
return (uint256(Error.NO_ERROR), actualRepayAmount);
| 13,953 |
23 | // fallback function / | function () isWhitelisted acceptingPayments payable public {
require(msg.value >= 0.2 ether);
require(msg.value <= 500 ether);
require(msg.sender != address(0));
uint256 contribution = msg.value;
// add to sender's weiPaid record
weiPaid[msg.sender] += msg.value;
// add to amount rai... | function () isWhitelisted acceptingPayments payable public {
require(msg.value >= 0.2 ether);
require(msg.value <= 500 ether);
require(msg.sender != address(0));
uint256 contribution = msg.value;
// add to sender's weiPaid record
weiPaid[msg.sender] += msg.value;
// add to amount rai... | 23,845 |
77 | // Emitted when a relay is removed (deregistered). unstakeTime is the time when unstake will be callable. | event RelayRemoved(address indexed relay, uint256 unstakeTime);
| event RelayRemoved(address indexed relay, uint256 unstakeTime);
| 43,504 |
5 | // Approve vault to use the tokens which were just pulled in | _approve(token0, address(vault), amount0Max);
_approve(token1, address(vault), amount1Max);
| _approve(token0, address(vault), amount0Max);
_approve(token1, address(vault), amount1Max);
| 12,747 |
18 | // important to receive ETH | receive() payable external {}
} | receive() payable external {}
} | 27,010 |
1 | // Main smart contract code | contract HelloWorld {
// Returns a constant string
function SayHello() public pure returns(bytes32) {
return "Hello, World!";
}
} | contract HelloWorld {
// Returns a constant string
function SayHello() public pure returns(bytes32) {
return "Hello, World!";
}
} | 8,865 |
1 | // Emitted once a stake is scheduled for withdrawal. | event StakeUnlocked(
address indexed relayManager,
address indexed owner,
uint256 withdrawTime
);
| event StakeUnlocked(
address indexed relayManager,
address indexed owner,
uint256 withdrawTime
);
| 7,221 |
70 | // can later be changed with {transferOwnership}./ The Ownable constructor sets the original `owner` of the contract to the senderaccount. / | function init(address sender) internal virtual initializer {
_owner = sender;
}
| function init(address sender) internal virtual initializer {
_owner = sender;
}
| 47,986 |
471 | // Constants regarding bin sizes for balance packing IDS_BITS_SIZE MUST be a power of 2 (e.g. 2, 4, 8, 16, 32, 64, 128) | uint256 internal constant IDS_BITS_SIZE = 32; // Max balance amount in bits per token ID
uint256 internal constant IDS_PER_UINT256 = 256 / IDS_BITS_SIZE; // Number of ids per uint256
| uint256 internal constant IDS_BITS_SIZE = 32; // Max balance amount in bits per token ID
uint256 internal constant IDS_PER_UINT256 = 256 / IDS_BITS_SIZE; // Number of ids per uint256
| 35,161 |
42 | // Returns the downcasted int240 from int256, reverting onoverflow (when the input is less than smallest int240 orgreater than largest int240). Counterpart to Solidity's `int240` operator. Requirements: - input must fit into 240 bits _Available since v4.7._ / | function toInt240(int256 value) internal pure returns (int240 downcasted) {
downcasted = int240(value);
require(downcasted == value, "SafeCast: value doesn't fit in 240 bits");
}
| function toInt240(int256 value) internal pure returns (int240 downcasted) {
downcasted = int240(value);
require(downcasted == value, "SafeCast: value doesn't fit in 240 bits");
}
| 32,154 |
14 | // Calls winningProposal() function to get the index of the winner contained in the proposals array and thenreturn winnerName_ the name of the winner / | function winnerName() public view
returns (bytes32 winnerName_)
| function winnerName() public view
returns (bytes32 winnerName_)
| 2,292 |
69 | // Function modifier that calls update reward function | modifier updateReward(address account) {
_updateReward(account);
_;
}
| modifier updateReward(address account) {
_updateReward(account);
_;
}
| 12,360 |
19 | // emit event to customer that broker has settled trade |
emit BrokerageSettled(brokerageTrades1[msg.sender][_tradeId]);
|
emit BrokerageSettled(brokerageTrades1[msg.sender][_tradeId]);
| 47,556 |
19 | // returns the total assets (in WETH) held by the strategy | function totalAssets() public view override returns (uint256 assets) {
// value of the supplied collateral in eth terms using chainlink oracle
assets = _totalCollateralInWeth();
// subtract the debt
assets -= totalDebt();
// add float
assets += asset.balanceOf(addre... | function totalAssets() public view override returns (uint256 assets) {
// value of the supplied collateral in eth terms using chainlink oracle
assets = _totalCollateralInWeth();
// subtract the debt
assets -= totalDebt();
// add float
assets += asset.balanceOf(addre... | 3,657 |
56 | // If no period is desired, instead set startBonus = 100% and bonusPeriod to a small value like 1sec. | require(bonusPeriodSec_ != 0, 'TokenGeyser: bonus period is zero');
require(initialSharesPerToken > 0, 'TokenGeyser: initialSharesPerToken is zero');
_stakingPool = new TokenPool(stakingToken);
_unlockedPool = new TokenPool(distributionToken);
_lockedPool = new TokenPool(distrib... | require(bonusPeriodSec_ != 0, 'TokenGeyser: bonus period is zero');
require(initialSharesPerToken > 0, 'TokenGeyser: initialSharesPerToken is zero');
_stakingPool = new TokenPool(stakingToken);
_unlockedPool = new TokenPool(distributionToken);
_lockedPool = new TokenPool(distrib... | 9,387 |
35 | // Take tokens out from circulation | totalSupply = safeSub(totalSupply,value);
totalUpgraded = safeAdd(totalUpgraded,value);
| totalSupply = safeSub(totalSupply,value);
totalUpgraded = safeAdd(totalUpgraded,value);
| 16,773 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.