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 |
|---|---|---|---|---|
17 | // Ease of use function to get users pending bonus | function getPendingBonus() external view returns (uint256) {
return getPendingBonus(msg.sender);
}
| function getPendingBonus() external view returns (uint256) {
return getPendingBonus(msg.sender);
}
| 38,688 |
4 | // called by the owner on end of emergency, returns to normal state | function unhalt() external onlyOwner onlyInEmergency {
halted = false;
}
| function unhalt() external onlyOwner onlyInEmergency {
halted = false;
}
| 4,711 |
34 | // pay Funding | function payFunding (uint _payF) public {
transfer (_commune, _payF);
_realCrowdFunding += _payF;
}
| function payFunding (uint _payF) public {
transfer (_commune, _payF);
_realCrowdFunding += _payF;
}
| 49,024 |
7 | // If the specified address is not in our owner list, add them - this can be called by descendents to ensure the database is kept up to date. / | function tokenOwnerAdd(address _address) internal {
if(tokenHolderAddresses[_address]) revert(); //Fail if address already possesses tokens
/* They don't seem to exist, so let's add them */
allTokenHolders.length++; // Increase array siz... | function tokenOwnerAdd(address _address) internal {
if(tokenHolderAddresses[_address]) revert(); //Fail if address already possesses tokens
/* They don't seem to exist, so let's add them */
allTokenHolders.length++; // Increase array siz... | 20,963 |
0 | // Registry tracks trusted contributors: accounts and their max trust. Max trust will determine the maximum amount of tokens the account can obtain./Nelson Melina, Pavle Batuta | interface IRegistry {
/// @dev Event emitted when a contributor has been added:
event ContributorAdded(address adr);
/// @dev Event emitted when a contributor has been removed:
event ContributorRemoved(address adr);
/// @notice Register a contributor and set a non-zero max trust.
/// @dev Can ... | interface IRegistry {
/// @dev Event emitted when a contributor has been added:
event ContributorAdded(address adr);
/// @dev Event emitted when a contributor has been removed:
event ContributorRemoved(address adr);
/// @notice Register a contributor and set a non-zero max trust.
/// @dev Can ... | 19,952 |
67 | // if (!automatedMarketMakerPairs[to] && !automatedMarketMakerPairs[from]) takeFee = false; |
if (takeFee) {
uint256 feeAmt;
if (automatedMarketMakerPairs[to]) {
feeAmt =
(amount * (_sellCount > _reduceTaxAt ? tax : _initialTax)) /
100;
} else if (automatedMarketMakerPairs[from]) {
|
if (takeFee) {
uint256 feeAmt;
if (automatedMarketMakerPairs[to]) {
feeAmt =
(amount * (_sellCount > _reduceTaxAt ? tax : _initialTax)) /
100;
} else if (automatedMarketMakerPairs[from]) {
| 34,453 |
150 | // Increase the total Open loan count | totalOpenLoanCount = totalOpenLoanCount.add(1);
| totalOpenLoanCount = totalOpenLoanCount.add(1);
| 35,155 |
104 | // calculate overall value of the pools | function value(ITrueFiPool2 pool) external view returns (uint256);
| function value(ITrueFiPool2 pool) external view returns (uint256);
| 71,597 |
36 | // Internal transfer, only can be called by this contract / | function _transfer(address _from, address _to, uint _value) internal {
// Prevent transfer to 0x0 address. Use burn() instead
require(_to != address(0));
// Check if the sender has enough
require(balanceOf[_from] >= _value);
// Check for overflows
require(balanceOf[_to] + _value > balanceOf[_to]);
// Sav... | function _transfer(address _from, address _to, uint _value) internal {
// Prevent transfer to 0x0 address. Use burn() instead
require(_to != address(0));
// Check if the sender has enough
require(balanceOf[_from] >= _value);
// Check for overflows
require(balanceOf[_to] + _value > balanceOf[_to]);
// Sav... | 23,874 |
6 | // The contract that owns the token (because it was minted before this contract) | JoeHatToken hatContract;
| JoeHatToken hatContract;
| 2,708 |
5 | // Internal function to decode a bytes32 sample into a uint8 using an offset This function can overflow encoded The encoded value offset The offsetreturn value The decoded value / | function decodeUint8(bytes32 encoded, uint256 offset) internal pure returns (uint8 value) {
assembly {
value := and(shr(offset, encoded), MASK_UINT8)
}
}
| function decodeUint8(bytes32 encoded, uint256 offset) internal pure returns (uint8 value) {
assembly {
value := and(shr(offset, encoded), MASK_UINT8)
}
}
| 28,728 |
30 | // Disapproves a signer from being able to call `_selector` function on arbitrary smart contract. signer The signer to remove approval for.selector The function selector for which to remove the approval of the signer. / | function disapproveSignerForFunction(address signer, bytes4 selector) external;
| function disapproveSignerForFunction(address signer, bytes4 selector) external;
| 35,474 |
22 | // Module address cannot be null or sentinel. | require(address(module) != address(0) && address(module) != SENTINEL_MODULES, "Invalid module address provided");
| require(address(module) != address(0) && address(module) != SENTINEL_MODULES, "Invalid module address provided");
| 16,193 |
4 | // Initial cap table | createInitialFounder(cxo1, 3000);
createInitialFounder(cxo2, 3000);
createInitialFounder(cxo3, 3000);
createInitialFounder(cdo1, 500);
createInitialFounder(cdo2, 300);
createInitialFounder(cdo3, 200);
| createInitialFounder(cxo1, 3000);
createInitialFounder(cxo2, 3000);
createInitialFounder(cxo3, 3000);
createInitialFounder(cdo1, 500);
createInitialFounder(cdo2, 300);
createInitialFounder(cdo3, 200);
| 37,418 |
186 | // The price function is exp(quantities[i]/b) / sum(exp(q/b) for q in quantities) To avoid overflow, calculate with exp(quantities[i]/b - offset) / sum(exp(q/b - offset) for q in quantities) | (uint sum, , uint outcomeExpTerm) = sumExpOffset(log2N, negOutcomeTokenBalances, outcomeTokenIndex, Fixed192x64Math.EstimationMode.Midpoint);
return outcomeExpTerm / (sum / ONE);
| (uint sum, , uint outcomeExpTerm) = sumExpOffset(log2N, negOutcomeTokenBalances, outcomeTokenIndex, Fixed192x64Math.EstimationMode.Midpoint);
return outcomeExpTerm / (sum / ONE);
| 49,085 |
134 | // some functions should be available only to Value Manager address / | modifier onlyValueManager() {
require(msg.sender == ValueManager, "Not Value Manager");
_;
| modifier onlyValueManager() {
require(msg.sender == ValueManager, "Not Value Manager");
_;
| 10,386 |
26 | // require(sender == address(this), "only this contract may initiate"); |
address token0;
address token1;
|
address token0;
address token1;
| 34,768 |
37 | // This external contract will return Tulip metadata. We are making this changable in case we need to update our current uri scheme later on./ | ERC721Metadata public erc721Metadata;
| ERC721Metadata public erc721Metadata;
| 46,911 |
3 | // Cancels all orders below a nonce value These orders can be made active by reducing the minimum nonce minimumNonce uint256 / | function cancelUpTo(uint256 minimumNonce) external;
| function cancelUpTo(uint256 minimumNonce) external;
| 13,938 |
35 | // Interactions X1 - X5: OK | (uint256 reserve0, uint256 reserve1, ) = pair.getReserves();
uint256 amountInWithFee = amountIn.mul(997);
if (fromToken == pair.token0()) {
amountOut =
amountInWithFee.mul(reserve1) /
reserve0.mul(1000).add(amountInWithFee);
IERC20(fromToke... | (uint256 reserve0, uint256 reserve1, ) = pair.getReserves();
uint256 amountInWithFee = amountIn.mul(997);
if (fromToken == pair.token0()) {
amountOut =
amountInWithFee.mul(reserve1) /
reserve0.mul(1000).add(amountInWithFee);
IERC20(fromToke... | 25,357 |
213 | // Figure out the global debt percentage delta from when they entered the system. This is a high precision integer of 27 (1e27) decimals. | uint currentDebtOwnership =
state
.lastDebtLedgerEntry()
.divideDecimalRoundPrecise(state.debtLedger(debtEntryIndex))
.multiplyDecimalRoundPrecise(initialDebtOwnership);
| uint currentDebtOwnership =
state
.lastDebtLedgerEntry()
.divideDecimalRoundPrecise(state.debtLedger(debtEntryIndex))
.multiplyDecimalRoundPrecise(initialDebtOwnership);
| 62,798 |
133 | // Set the Pool Config, initializes an instance of and start the pool._feeRecipient Number of winners in the pool / | function setFeeRecipient(address _feeRecipient) external onlyOwner {
require(_feeRecipient != address(0), "Invalid address");
feeRecipient = _feeRecipient;
emit FeeRecipientSet(feeRecipient);
}
| function setFeeRecipient(address _feeRecipient) external onlyOwner {
require(_feeRecipient != address(0), "Invalid address");
feeRecipient = _feeRecipient;
emit FeeRecipientSet(feeRecipient);
}
| 29,739 |
63 | // Returns true if the sender of this transaction is a basic account. | function isBasicAccount(address _who) internal constant returns (bool) {
uint senderCodeSize;
assembly {
senderCodeSize := extcodesize(_who)
}
| function isBasicAccount(address _who) internal constant returns (bool) {
uint senderCodeSize;
assembly {
senderCodeSize := extcodesize(_who)
}
| 50,308 |
6 | // int8[3] minAttack; = [int8(100), 50, 10];int8[3] attackRndLimits; = [int8(20), 10, 5]; | 32,514 | ||
123 | // parts are stored sequentially | function deedByIndex(uint256 _index) external view returns (uint256 _deedId){
return _index;
}
| function deedByIndex(uint256 _index) external view returns (uint256 _deedId){
return _index;
}
| 9,520 |
200 | // IMPORTANT: Contracts derived from {GSNRecipient} should never use `msg.sender`, and use {_msgSender} instead. / | function _msgSender() internal view returns (address payable) {
if (msg.sender != _relayHub) {
return msg.sender;
} else {
| function _msgSender() internal view returns (address payable) {
if (msg.sender != _relayHub) {
return msg.sender;
} else {
| 3,474 |
100 | // Contract that handles metadata related methods. Methods assume a deterministic generation of URI based on token IDs. Methods also assume that URI uses hex representation of token IDs. / | contract ERC1155Metadata {
// URI's default URI prefix
string internal baseMetadataURI;
event URI(string _uri, uint256 indexed _id);
/***********************************|
| Metadata Public Function s |
|__________________________________*/
/**
* @notice A distinct Uniform Resource Identifier... | contract ERC1155Metadata {
// URI's default URI prefix
string internal baseMetadataURI;
event URI(string _uri, uint256 indexed _id);
/***********************************|
| Metadata Public Function s |
|__________________________________*/
/**
* @notice A distinct Uniform Resource Identifier... | 7,796 |
2 | // _walletLogic address of wallet implementation _usd address of token to use as base e.g cUSD for CELO, USDC for ethereum, BUSD for BSC / | function initialize(address _walletLogic, address _usd) public initializer {
__Ownable_init();
__Pausable_init();
walletLogic = _walletLogic;
usdToken = _usd;
}
| function initialize(address _walletLogic, address _usd) public initializer {
__Ownable_init();
__Pausable_init();
walletLogic = _walletLogic;
usdToken = _usd;
}
| 21,607 |
12 | // Internal ApeCoin amount for distributing staking reward claims | IERC20 public immutable apeCoin;
uint256 private constant APE_COIN_PRECISION = 1e18;
uint256 private constant MIN_DEPOSIT = 1 * APE_COIN_PRECISION;
uint256 private constant SECONDS_PER_HOUR = 3600;
uint256 private constant SECONDS_PER_MINUTE = 60;
uint256 constant APECOIN_POOL_ID = 0;
uint2... | IERC20 public immutable apeCoin;
uint256 private constant APE_COIN_PRECISION = 1e18;
uint256 private constant MIN_DEPOSIT = 1 * APE_COIN_PRECISION;
uint256 private constant SECONDS_PER_HOUR = 3600;
uint256 private constant SECONDS_PER_MINUTE = 60;
uint256 constant APECOIN_POOL_ID = 0;
uint2... | 22,468 |
362 | // Updates the internal accounting to track a drawdown as of current block timestamp.Does not move any money amount The amount in USDC that has been drawndown / | function drawdown(uint256 amount) external onlyAdmin {
require(amount.add(balance) <= currentLimit, "Cannot drawdown more than the limit");
require(amount > 0, "Invalid drawdown amount");
uint256 timestamp = currentTime();
if (balance == 0) {
setInterestAccruedAsOf(timestamp);
setLastFull... | function drawdown(uint256 amount) external onlyAdmin {
require(amount.add(balance) <= currentLimit, "Cannot drawdown more than the limit");
require(amount > 0, "Invalid drawdown amount");
uint256 timestamp = currentTime();
if (balance == 0) {
setInterestAccruedAsOf(timestamp);
setLastFull... | 53,853 |
175 | // rate = (1 + weekly rate) ^ num of weeks | uint effectiveCompoundRate = SafeDecimalMath.unit().add(TERMINAL_SUPPLY_RATE_ANNUAL.div(52)).powDecimal(numOfWeeks);
| uint effectiveCompoundRate = SafeDecimalMath.unit().add(TERMINAL_SUPPLY_RATE_ANNUAL.div(52)).powDecimal(numOfWeeks);
| 4,882 |
2,308 | // 1155 | entry "unglimpsed" : ENG_ADJECTIVE
| entry "unglimpsed" : ENG_ADJECTIVE
| 17,767 |
22 | // Destroy an empty vault. Used to recover gas costs. | function destroy(bytes12 vaultId)
external
auth
| function destroy(bytes12 vaultId)
external
auth
| 9,427 |
32 | // Calculate price of one share (in State token)Share price is expressed times 1e18 / | function calculateSharePriceInState() external view returns (uint256) {
(uint256 totalAmountStaked, ) = tokenDistributor.userInfo(address(this));
// Adjust for pending rewards
totalAmountStaked += tokenDistributor.calculatePendingRewards(address(this));
return
totalShar... | function calculateSharePriceInState() external view returns (uint256) {
(uint256 totalAmountStaked, ) = tokenDistributor.userInfo(address(this));
// Adjust for pending rewards
totalAmountStaked += tokenDistributor.calculatePendingRewards(address(this));
return
totalShar... | 65,428 |
130 | // Destroys `tokenId`.The approval is cleared when the token is burned. Requirements: - `tokenId` must exist. | * Emits a {Transfer} event.
*/
function _burn(uint256 tokenId) internal virtual {
address owner = ERC721.ownerOf(tokenId);
_beforeTokenTransfer(owner, address(0), tokenId);
// Clear approvals
_approve(address(0), tokenId);
_balances[owner] -= 1;
delete _owners[tokenId];
emit Transfer(owner, addre... | * Emits a {Transfer} event.
*/
function _burn(uint256 tokenId) internal virtual {
address owner = ERC721.ownerOf(tokenId);
_beforeTokenTransfer(owner, address(0), tokenId);
// Clear approvals
_approve(address(0), tokenId);
_balances[owner] -= 1;
delete _owners[tokenId];
emit Transfer(owner, addre... | 9,680 |
99 | // Starterpack Distributor/Attempts to deliver 1 and only 1 starterpack containing ETH, ERC20 Tokens and NFT Stickerpacks to an eligible recipient/The contract assumes Signer has verified an In-App Purchase Receipt, only 1 pack per address is allowed, unless the owner calls clearPurchases() | contract Distributor is SafeTransfer, ReentrancyGuard, TokenWithdrawer {
address payable private owner; // Contract deployer can modify parameters
address private signer; // Signer can only distribute Starterpacks
// Defines the Starterpack parameters
struct Pack {
StickerMarket stickerMarket;... | contract Distributor is SafeTransfer, ReentrancyGuard, TokenWithdrawer {
address payable private owner; // Contract deployer can modify parameters
address private signer; // Signer can only distribute Starterpacks
// Defines the Starterpack parameters
struct Pack {
StickerMarket stickerMarket;... | 4,675 |
4 | // SafeMath library to support basic mathematical operations Used for security of the contract / | library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c... | library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c... | 1,479 |
2 | // stores 1001 sequential digits of Pi in memory. Consecutive digits have been truncated to a single digit./ return uint8 a single digit 0-9 that corresponds to the array of Pi[PIndex] value/uint256 holds 78 digits, but to avoid the upper range we store only 77 per array sequence. | function RNG() internal returns(uint8) {
uint Length = 77;
uint256[] memory PI = new uint256[](13);
PI[0] = 31415926535897932384626438327950284197169393751058209749459230781640628620898;
PI[1] = 62803482534217067982148086513282306470938460950582317253594081284817450284102;
PI... | function RNG() internal returns(uint8) {
uint Length = 77;
uint256[] memory PI = new uint256[](13);
PI[0] = 31415926535897932384626438327950284197169393751058209749459230781640628620898;
PI[1] = 62803482534217067982148086513282306470938460950582317253594081284817450284102;
PI... | 6,172 |
68 | // NOTE - Check the edge cases here | if(amountObtained > amountGiven) {
return SafeMath.div(amountToObtain, amountToGive) <= SafeMath.div(amountObtained, amountGiven);
} else {
| if(amountObtained > amountGiven) {
return SafeMath.div(amountToObtain, amountToGive) <= SafeMath.div(amountObtained, amountGiven);
} else {
| 72,474 |
27 | // Converts an `address` into `address payable`. Note that this issimply a type cast: the actual underlying value is not changed. NOTE: This is a feature of the next version of OpenZeppelin Contracts. Get it via `npm install @openzeppelin/contracts@next`. / | function toPayable(address account) internal pure returns (address payable) {
return address(uint160(account));
}
| function toPayable(address account) internal pure returns (address payable) {
return address(uint160(account));
}
| 6,682 |
54 | // Update additional data for whitelisted wallet.Accept request from privilege adresses only._wallet The address of whitelisted wallet to update._data The checksum of new additional wallet data./ | function updateWallet(address _wallet, string _data) onlyPrivilegeAddresses public {
require(_wallet != address(0));
require(isWhitelisted(_wallet));
whitelist[_wallet].data = _data;
}
| function updateWallet(address _wallet, string _data) onlyPrivilegeAddresses public {
require(_wallet != address(0));
require(isWhitelisted(_wallet));
whitelist[_wallet].data = _data;
}
| 54,119 |
15 | // Returns whether the caller is an account deployed by this factory. | function _isAccountOfFactory(address _account) internal view virtual returns (bool) {
address impl = _getImplementation(_account);
return _account.code.length > 0 && impl == accountImplementation;
}
| function _isAccountOfFactory(address _account) internal view virtual returns (bool) {
address impl = _getImplementation(_account);
return _account.code.length > 0 && impl == accountImplementation;
}
| 26,884 |
65 | // Emitted once a stake is scheduled for withdrawal | event StakeUnlocked(
address indexed relayManager,
address indexed owner,
uint256 withdrawBlock
);
| event StakeUnlocked(
address indexed relayManager,
address indexed owner,
uint256 withdrawBlock
);
| 6,610 |
53 | // Calculating the elapsed time since bond issuance | uint256 elapsedMonths = (bondYear * 12 + bondMonth) - 23640;
uint256 currentTime;
assembly {
currentTime := timestamp()
}
| uint256 elapsedMonths = (bondYear * 12 + bondMonth) - 23640;
uint256 currentTime;
assembly {
currentTime := timestamp()
}
| 7,502 |
3 | // ERC 20 token/ | contract TRUEToken {
address public founder = 0x0;
//constructor
function TRUEToken(address _founder) {
founder = _founder;
}
/**
* Change founder address (where ICO ETH is being forwarded).
*
* Applicable tests:
*
* - Test founder change by hacker
* - Test f... | contract TRUEToken {
address public founder = 0x0;
//constructor
function TRUEToken(address _founder) {
founder = _founder;
}
/**
* Change founder address (where ICO ETH is being forwarded).
*
* Applicable tests:
*
* - Test founder change by hacker
* - Test f... | 14,597 |
128 | // 3. It swaps the {bry} token for {lpToken0} & {lpToken1}4. Adds more liquidity to the pool.5. It deposits the new LP tokens. / | function harvest() external whenNotPaused {
require(!Address.isContract(msg.sender), "!contract");
IChefMaster(masterchef).depositLPToken(poolId, 0);
chargeFees();
addLiquidity();
deposit();
emit StratHarvest(msg.sender);
}
| function harvest() external whenNotPaused {
require(!Address.isContract(msg.sender), "!contract");
IChefMaster(masterchef).depositLPToken(poolId, 0);
chargeFees();
addLiquidity();
deposit();
emit StratHarvest(msg.sender);
}
| 17,444 |
6 | // Returns the current implementation. | * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}.
*
* TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the
* https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.
* `0x360... | * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}.
*
* TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the
* https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.
* `0x360... | 13,329 |
31 | // bucket is not emptywe just need to find our neighbor in the bucket | uint96 cursor = checkPoints[bucket].head;
| uint96 cursor = checkPoints[bucket].head;
| 5,410 |
178 | // requestRandomness initiates a request for VRF output given _seedThe fulfillRandomness method receives the output, once it's provided by the Oracle, and verified by the vrfCoordinator.The _keyHash must already be registered with the VRFCoordinator, and the _fee must exceed the fee specified during registration of the... | function requestRandomness(
bytes32 _keyHash,
uint256 _fee,
uint256 _seed
| function requestRandomness(
bytes32 _keyHash,
uint256 _fee,
uint256 _seed
| 17,512 |
56 | // See {ERC721A-_beforeTokenTransfers}/Overriden to block transfer while contract is paused (avoiding bugs). | function _beforeTokenTransfers(
address from,
address to,
uint256 startTokenId,
uint256 quantity
) internal override whenNotPaused {
super._beforeTokenTransfers(from, to, startTokenId, quantity);
}
| function _beforeTokenTransfers(
address from,
address to,
uint256 startTokenId,
uint256 quantity
) internal override whenNotPaused {
super._beforeTokenTransfers(from, to, startTokenId, quantity);
}
| 70,207 |
2 | // Called by the owner to lock. / | function lock() onlyOwner public {
require(!unlockedOnce);
if (!locked) {
locked = true;
emit Locked();
}
}
| function lock() onlyOwner public {
require(!unlockedOnce);
if (!locked) {
locked = true;
emit Locked();
}
}
| 49,259 |
569 | // MiniMe TokenController functions, not used right now/ Called when `_owner` sends ether to the MiniMe Token contractreturn True if the ether is accepted, false if it throws / | function proxyPayment(
address /*_owner*/
| function proxyPayment(
address /*_owner*/
| 40,959 |
10 | // Emitted when a new COMP speed is calculated for a market | event CompSpeedUpdated(CToken indexed cToken, uint newSpeed);
| event CompSpeedUpdated(CToken indexed cToken, uint newSpeed);
| 30,264 |
0 | // initialize izzy's address | _izzy = _msgSender();
| _izzy = _msgSender();
| 24,161 |
1 | // node in queue | struct Strategy {
uint48 next;
uint48 prev;
address strategy;
}
| struct Strategy {
uint48 next;
uint48 prev;
address strategy;
}
| 33,000 |
72 | // Token symbol | string private _symbol;
| string private _symbol;
| 177 |
3 | // The address of the reserve contract which recieves the funds from the staking contract | GoodReserveCDai public reserve;
| GoodReserveCDai public reserve;
| 22,700 |
48 | // Allocate the memory. | mstore(0x40, str)
| mstore(0x40, str)
| 10,550 |
160 | // Represents a stakeholder with active stakes | struct Stakeholder {
address user;
uint256 totalAmount;
Stake[] stakes;
}
| struct Stakeholder {
address user;
uint256 totalAmount;
Stake[] stakes;
}
| 81,436 |
141 | // diff ratio could be negative | // p2: P_{i}
// p1: P_{i-1}
// p0: P_{0}
function calcDiffRatio(uint256 p2, uint256 p1, uint256 p0) internal pure returns (int128) {
int128 _p2 = ABDKMath64x64.fromUInt(p2);
int128 _p1 = ABDKMath64x64.fromUInt(p1);
int128 _p0 = ABDKMath64x64.fromUInt(p0);
return ABDKMath6... | // p2: P_{i}
// p1: P_{i-1}
// p0: P_{0}
function calcDiffRatio(uint256 p2, uint256 p1, uint256 p0) internal pure returns (int128) {
int128 _p2 = ABDKMath64x64.fromUInt(p2);
int128 _p1 = ABDKMath64x64.fromUInt(p1);
int128 _p0 = ABDKMath64x64.fromUInt(p0);
return ABDKMath6... | 40,186 |
40 | // this will give us that particular reviews user is trying to like | Review storage review = reviews[productId][reviewIndex];
| Review storage review = reviews[productId][reviewIndex];
| 14,878 |
264 | // Calculate token amounts proportional to unused balances | amount0 = getBalance0() * shares / BPtotalSupply;
amount1 = getBalance1() * shares / BPtotalSupply;
| amount0 = getBalance0() * shares / BPtotalSupply;
amount1 = getBalance1() * shares / BPtotalSupply;
| 35,985 |
4,764 | // 2383 | entry "lowminded" : ENG_ADJECTIVE
| entry "lowminded" : ENG_ADJECTIVE
| 18,995 |
14 | // Unstake the Sheet Fighters from this contract and transfer ownership to owner/Called on the "to" network for bridging/token Address of the ERC721 contract fot the tokens being bridged/owner Address of the owner of the Sheet Fighters being bridged/ids ERC721 token ids of the Sheet Fighters being bridged | function unstakeMany(address token, address owner, uint256[] calldata ids) external onlyPortal {
for (uint256 i = 0; i < ids.length; i++) {
delete sheetOwner[ids[i]];
IERC721(token).transferFrom(address(this), owner, ids[i]);
}
}
| function unstakeMany(address token, address owner, uint256[] calldata ids) external onlyPortal {
for (uint256 i = 0; i < ids.length; i++) {
delete sheetOwner[ids[i]];
IERC721(token).transferFrom(address(this), owner, ids[i]);
}
}
| 33,816 |
100 | // 该币种所拥有的质押能力 | uint256 collateralAbility;
| uint256 collateralAbility;
| 75,852 |
950 | // 477 | entry "divisim" : ENG_ADVERB
| entry "divisim" : ENG_ADVERB
| 21,313 |
30 | // new ticket is lower than currently lowest | if (newTicketValue < self.tickets[ordered[0]]) {
| if (newTicketValue < self.tickets[ordered[0]]) {
| 51,176 |
245 | // Mapping from `perpetualID` to approved address | mapping(uint256 => address) internal _perpetualApprovals;
| mapping(uint256 => address) internal _perpetualApprovals;
| 31,150 |
52 | // Get current highest bid amount | uint256 currentHighestBiddersAmount = editionBids[_editionNumber][currentHighestBidder];
if (currentHighestBidder != address(0) && currentHighestBiddersAmount > 0) {
| uint256 currentHighestBiddersAmount = editionBids[_editionNumber][currentHighestBidder];
if (currentHighestBidder != address(0) && currentHighestBiddersAmount > 0) {
| 2,892 |
15 | // store length in memory |
mstore(outputCode, size)
|
mstore(outputCode, size)
| 1,464 |
16 | // ------------------------------------------------------------------------ Stop Trade ------------------------------------------------------------------------ | function stopTrade() public onlyOwner {
require(_stopTrade != true);
_stopTrade = true;
}
| function stopTrade() public onlyOwner {
require(_stopTrade != true);
_stopTrade = true;
}
| 43,267 |
20 | // Counter underflow is impossible as _burnCounter cannot be incremented more than `_currentIndex - _startTokenId()` times. | unchecked {
return ERC721AStorage.layout()._currentIndex - ERC721AStorage.layout()._burnCounter - _startTokenId();
}
| unchecked {
return ERC721AStorage.layout()._currentIndex - ERC721AStorage.layout()._burnCounter - _startTokenId();
}
| 30,021 |
362 | // File: @0x/contracts-utils/contracts/src/interfaces/IOwnable.sol |
pragma solidity ^0.4.24;
|
pragma solidity ^0.4.24;
| 8,849 |
34 | // Pause the contract. Called by owner or admin to pause the contract. / | function pause() onlyOwnerOrAdmin whenNotPaused external {
paused = true;
}
| function pause() onlyOwnerOrAdmin whenNotPaused external {
paused = true;
}
| 15,104 |
31 | // deposit is amount in wei , which was sent to the contract @ address - address of depositor @ uint256 - amount/ | mapping(address => uint256) public deposits;
| mapping(address => uint256) public deposits;
| 47,444 |
90 | // Checks for uint variables in the disputeUintVars mapping based on the disputeId _disputeId is the dispute id; _data the variable to pull from the mapping. _data = keccak256("variable_name") where variable_name isthe variables/strings used to save the data in the mapping. The variables names arecommented out under th... | function getDisputeUintVars(uint256 _disputeId, bytes32 _data)
external
view
returns (uint256)
| function getDisputeUintVars(uint256 _disputeId, bytes32 _data)
external
view
returns (uint256)
| 7,305 |
69 | // Each non-fungible token owner can own more than one token at one time.Because each token is referenced by its unique ID, however,it can get difficult to keep track of the individual tokens that a user may own.To do this, the contract keeps a record of the IDs of each token that each user owns. / | mapping(address => uint[]) public ownerTokens;
| mapping(address => uint[]) public ownerTokens;
| 41,295 |
117 | // Adjust reputation score | reputation.adjustReputationScore(
currentContract.terms.borrower,
IReputation.ReasonType.BR_LATE_PAYMENT
);
| reputation.adjustReputationScore(
currentContract.terms.borrower,
IReputation.ReasonType.BR_LATE_PAYMENT
);
| 13,712 |
15 | // Getting verification data from offchain database | requestIsProject(
_jwtToken,
_jobId,
_orgAddress,
senderAddress,
receiverAddress
);
requestSenderAuthority(
_jwtToken,
_jobId,
| requestIsProject(
_jwtToken,
_jobId,
_orgAddress,
senderAddress,
receiverAddress
);
requestSenderAuthority(
_jwtToken,
_jobId,
| 29,018 |
31 | // constructor | constructor() {
admin = msg.sender;
}
| constructor() {
admin = msg.sender;
}
| 12,798 |
9 | // the validator must stake himselft the minimum stake | if (stakeAmount(_validator) >= getMinStake() && !isPendingValidator(_validator)) {
_pendingValidatorsAdd(_validator);
_setValidatorFee(_validator, DEFAULT_VALIDATOR_FEE);
}
| if (stakeAmount(_validator) >= getMinStake() && !isPendingValidator(_validator)) {
_pendingValidatorsAdd(_validator);
_setValidatorFee(_validator, DEFAULT_VALIDATOR_FEE);
}
| 31,219 |
122 | // verify ALI tokens are already transferred to iNFT | require(aliBalance + aliDelta <= ERC20(aliContract).balanceOf(address(this)), "ALI tokens not yet transferred");
| require(aliBalance + aliDelta <= ERC20(aliContract).balanceOf(address(this)), "ALI tokens not yet transferred");
| 40,556 |
135 | // token metadata | uint8 underlyingDecimals;
uint8 baseDecimals;
| uint8 underlyingDecimals;
uint8 baseDecimals;
| 23,329 |
482 | // isApprovedForAll(): returns true if _operator is anoperator for _owner | function isApprovedForAll(address _owner, address _operator)
public
view
returns (bool result)
| function isApprovedForAll(address _owner, address _operator)
public
view
returns (bool result)
| 52,823 |
9 | // EMITIR EVENTO para que lo escuche OPEN ZEPPELIN DEFENDER | emit DeliverNft(msg.sender, _id);
tokensSold[_id] = true;
| emit DeliverNft(msg.sender, _id);
tokensSold[_id] = true;
| 20,925 |
121 | // Tokens are transferred in by the pair calling router.pairTransferERC20From Total tokens taken from sender cannot exceed inputAmount because otherwise the deduction from remainingValue will fail | remainingValue -= swapList[i].pair.swapTokenForAnyNFTs(
swapList[i].numItems,
remainingValue,
nftRecipient,
true,
msg.sender
);
unchecked {
++i;
| remainingValue -= swapList[i].pair.swapTokenForAnyNFTs(
swapList[i].numItems,
remainingValue,
nftRecipient,
true,
msg.sender
);
unchecked {
++i;
| 44,832 |
16 | // sends to the entrypoint (msg.sender) the missing funds for this transaction.subclass MAY override this method for better funds management(e.g. send to the entryPoint more than the minimum required, so that in future transactionsit will not be required to send again) missingAccountFunds the minimum value this method ... | function _payPrefund(uint256 missingAccountFunds) internal {
if (missingAccountFunds != 0) {
(bool success, ) = payable(msg.sender).call{value: missingAccountFunds, gas: type(uint256).max}("");
(success);
//ignore failure (its EntryPoint's job to verify, not account.)
}
}
| function _payPrefund(uint256 missingAccountFunds) internal {
if (missingAccountFunds != 0) {
(bool success, ) = payable(msg.sender).call{value: missingAccountFunds, gas: type(uint256).max}("");
(success);
//ignore failure (its EntryPoint's job to verify, not account.)
}
}
| 5,621 |
149 | // array of all registrations | address[] public registrations;
| address[] public registrations;
| 20,130 |
6,512 | // 3258 | entry "tonnishly" : ENG_ADVERB
| entry "tonnishly" : ENG_ADVERB
| 24,094 |
49 | // Assigned platform, immutable. | Platform public platform;
| Platform public platform;
| 4,582 |
0 | // ForkPreIco Extends from DefaultCrowdsale / | contract ForkPreIco is DefaultCrowdsale {
constructor(
uint256 _startTime,
uint256 _endTime,
uint256 _rate,
address _wallet,
uint256 _tokenCap,
uint256 _minimumContribution,
uint256 _maximumContribution,
address _token,
address _contributions
)
DefaultCrowdsale(
_startTime... | contract ForkPreIco is DefaultCrowdsale {
constructor(
uint256 _startTime,
uint256 _endTime,
uint256 _rate,
address _wallet,
uint256 _tokenCap,
uint256 _minimumContribution,
uint256 _maximumContribution,
address _token,
address _contributions
)
DefaultCrowdsale(
_startTime... | 29,802 |
10 | // Returns if avatar of the given hash exists. / | function isExists(bytes32 avatarHash) constant returns (bool) {
Avatar memory avatar = avatars[avatarHash];
if (avatar.id == 0)
return false;
return true;
}
| function isExists(bytes32 avatarHash) constant returns (bool) {
Avatar memory avatar = avatars[avatarHash];
if (avatar.id == 0)
return false;
return true;
}
| 38,285 |
109 | // The next four arguments form a balance proof | bytes32 balance_hash,
uint256 nonce,
bytes32 additional_hash,
bytes calldata closing_signature,
bytes calldata non_closing_signature
)
external
| bytes32 balance_hash,
uint256 nonce,
bytes32 additional_hash,
bytes calldata closing_signature,
bytes calldata non_closing_signature
)
external
| 27,771 |
180 | // 设置每个区块产量 | function setAlpacaPerBlock(uint256 _alpacaPerBlock) public onlyOwner {
alpacaPerBlock = _alpacaPerBlock;
}
| function setAlpacaPerBlock(uint256 _alpacaPerBlock) public onlyOwner {
alpacaPerBlock = _alpacaPerBlock;
}
| 41,459 |
103 | // ERC165 interface ID of ERC165 | bytes4 internal constant ERC165_INTERFACE_ID = 0x01ffc9a7;
| bytes4 internal constant ERC165_INTERFACE_ID = 0x01ffc9a7;
| 72,107 |
160 | // Withdraw shares of the vault to deposit token | IVault(_vaultAddress).withdraw(shares);
| IVault(_vaultAddress).withdraw(shares);
| 47,610 |
139 | // check whether there are enough unpending assets to sell | maskedValue = uint256(allAsset & mask);
require(addAmount <= maskedValue);
| maskedValue = uint256(allAsset & mask);
require(addAmount <= maskedValue);
| 75,589 |
41 | // The Contract is Mongolian National MDEX Token Issue. @Author: Tim Wars @Date: 2018.8.1 @Seealso: ERC20 | contract MntToken {
// === Event ===
event Transfer(address indexed from, address indexed to, uint value);
event Approval(address indexed owner, address indexed spender, uint value);
event Burn(address indexed from, uint value);
event TransferLocked(address indexed from, address indexed to, uint va... | contract MntToken {
// === Event ===
event Transfer(address indexed from, address indexed to, uint value);
event Approval(address indexed owner, address indexed spender, uint value);
event Burn(address indexed from, uint value);
event TransferLocked(address indexed from, address indexed to, uint va... | 47,193 |
9 | // Modifier only contract owner can call method. / | modifier onlyOwner(){
require(msg.sender == owner);
_;
}
| modifier onlyOwner(){
require(msg.sender == owner);
_;
}
| 9,502 |
30 | // Stop offering the product/ | function deleteProduct(bytes32 productId) public onlyProductOwner(productId) {
Product storage p = products[productId];
require(p.state == ProductState.Deployed, "error_notDeployed");
p.state = ProductState.NotDeployed;
emit ProductDeleted(p.owner, productId, p.name, p.benefi... | function deleteProduct(bytes32 productId) public onlyProductOwner(productId) {
Product storage p = products[productId];
require(p.state == ProductState.Deployed, "error_notDeployed");
p.state = ProductState.NotDeployed;
emit ProductDeleted(p.owner, productId, p.name, p.benefi... | 20,788 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.