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 |
|---|---|---|---|---|
87 | // function updateMinerAndInterceptor(Data.Mining memory mining)internalpure | // {
//
// if (mining.miner == address(0x0)) {
// mining.miner = mining.feeRecipient;
// }
//
// // We do not support any interceptors for now
// /* else { */
// /* (bool registered, address interceptor) = ctx.minerBrokerRegistry.getBroker( */
// /* mi... | // {
//
// if (mining.miner == address(0x0)) {
// mining.miner = mining.feeRecipient;
// }
//
// // We do not support any interceptors for now
// /* else { */
// /* (bool registered, address interceptor) = ctx.minerBrokerRegistry.getBroker( */
// /* mi... | 42,354 |
39 | // Make sure that this tokenId has actually won | uint256 winningTokensAreGTE = 0;
if (_tokenIdCounter > 10) {
winningTokensAreGTE = _tokenIdCounter - 10;
}
| uint256 winningTokensAreGTE = 0;
if (_tokenIdCounter > 10) {
winningTokensAreGTE = _tokenIdCounter - 10;
}
| 11,888 |
1,124 | // tokens addresses | address aTokenAddress;
address stableDebtTokenAddress;
address variableDebtTokenAddress;
| address aTokenAddress;
address stableDebtTokenAddress;
address variableDebtTokenAddress;
| 4,123 |
60 | // internal method to save new optimum orders are expressed as currency all parameter are 10^18 | function _saveNewOptimum(uint seniorRedeem, uint juniorRedeem, uint juniorSupply,
uint seniorSupply, uint score) internal {
bestSubmission.seniorRedeem = seniorRedeem;
bestSubmission.juniorRedeem = juniorRedeem;
bestSubmission.juniorSupply = juniorSupply;
bestSubmission.seni... | function _saveNewOptimum(uint seniorRedeem, uint juniorRedeem, uint juniorSupply,
uint seniorSupply, uint score) internal {
bestSubmission.seniorRedeem = seniorRedeem;
bestSubmission.juniorRedeem = juniorRedeem;
bestSubmission.juniorSupply = juniorSupply;
bestSubmission.seni... | 16,026 |
66 | // Mapping from token ID to account balances | mapping(uint256 => mapping(address => uint256)) private _balances;
| mapping(uint256 => mapping(address => uint256)) private _balances;
| 4,255 |
2 | // Variate output length | equal(
callAndReturn(model, hex"ffffffff00000006112233445566778899aabbccddeeff", 8),
hex"1122334455660000",
"6 bytes and zeroed after, shorter than actual output"
);
equal(
callAndReturn(model, hex"ffffffff0000000a112233445566778899aabbccddeeff", 0xa + 1),
hex"1122334455667788... | equal(
callAndReturn(model, hex"ffffffff00000006112233445566778899aabbccddeeff", 8),
hex"1122334455660000",
"6 bytes and zeroed after, shorter than actual output"
);
equal(
callAndReturn(model, hex"ffffffff0000000a112233445566778899aabbccddeeff", 0xa + 1),
hex"1122334455667788... | 2,047 |
530 | // Error trackers for the error correction in the offset calculation | uint public lastETHError_Offset;
uint public lastLUSDLossError_Offset;
| uint public lastETHError_Offset;
uint public lastLUSDLossError_Offset;
| 16,181 |
20 | // modular algorithm : calculatebe mod m | function modExp(uint256 _b, uint256 _e, uint256 _m) private returns (uint256 result) {
assembly {
// Free memory pointer
let pointer := mload(0x40)
// Define length of base, exponent and modulus. 0x20 == 32 bytes
mstore(pointer, 0x20)
mstore(add(p... | function modExp(uint256 _b, uint256 _e, uint256 _m) private returns (uint256 result) {
assembly {
// Free memory pointer
let pointer := mload(0x40)
// Define length of base, exponent and modulus. 0x20 == 32 bytes
mstore(pointer, 0x20)
mstore(add(p... | 34,541 |
488 | // And then release all the ETH to the payees | IMorningsPayments(payments).releaseAllETH();
| IMorningsPayments(payments).releaseAllETH();
| 26,663 |
2 | // Mapping (voterBalance) keys to token balances of a voter | mapping(address => uint) public voterBalance;
| mapping(address => uint) public voterBalance;
| 23,958 |
1 | // Deposits an `amount` of underlying asset into the reserve, receiving in return overlying aTokens.- E.g. User deposits 100 USDC and gets in return 100 aUSDC asset The address of the underlying asset to deposit amount The amount to be deposited onBehalfOf The address that will receive the aTokens, same as msg.sender i... | function getReserveNormalizedIncome(address asset) external view returns (uint256);
| function getReserveNormalizedIncome(address asset) external view returns (uint256);
| 4,270 |
20 | // Returns the allowlist at the given uid. | function getAllowlistById(uint256 _allowlistId)
external
view
returns (Allowlist memory allowlist)
| function getAllowlistById(uint256 _allowlistId)
external
view
returns (Allowlist memory allowlist)
| 17,581 |
2 | // share settings | address[] private addressList = [
0x8fd413668962F8CbcE60619E95585D118d0EDDF2,
0x873Da4ff1FDAb40464B5abeD1C906ab1BB47B62c,
0xf74062e36Fa02C73261F453d35C51EDbC8f9FAB2,
0x731C300fbecfCAE1A03DEa818FA0bA479dbC9b2c
];
uint[] private shareList = [25,25,25,25];
constructor(
string memory _name,
string memory _symbol,... | address[] private addressList = [
0x8fd413668962F8CbcE60619E95585D118d0EDDF2,
0x873Da4ff1FDAb40464B5abeD1C906ab1BB47B62c,
0xf74062e36Fa02C73261F453d35C51EDbC8f9FAB2,
0x731C300fbecfCAE1A03DEa818FA0bA479dbC9b2c
];
uint[] private shareList = [25,25,25,25];
constructor(
string memory _name,
string memory _symbol,... | 15,477 |
9 | // Delete funds from an account. Must be an authoritative address. | function removeFunds(uint256 _amt, address _addr) external returns (bool success) {
require(isAuthority(msg.sender), "NUCoin/Security/A non-authoritative address cannot remove funds from another account.");
_balances[_addr].sub(_amt, "NUCoin/Economy/Transfer amount exceeds balance");
return ... | function removeFunds(uint256 _amt, address _addr) external returns (bool success) {
require(isAuthority(msg.sender), "NUCoin/Security/A non-authoritative address cannot remove funds from another account.");
_balances[_addr].sub(_amt, "NUCoin/Economy/Transfer amount exceeds balance");
return ... | 14,353 |
33 | // transfer without any checks because the lender (and admin) can always retrieve the token again | _veryUnsafeTransferFrom(msg.sender, receiver, tokenId);
| _veryUnsafeTransferFrom(msg.sender, receiver, tokenId);
| 32,136 |
72 | // add an address to the whitelist _addr address will be one of the multiOwner _side the side name of the multiOwnerreturn true if the address was added to the multiOwners list,false if the address was already in the multiOwners list / | function initAddressAsMultiOwner(address _addr, string _side)
onlyOwner
canInitial
public
| function initAddressAsMultiOwner(address _addr, string _side)
onlyOwner
canInitial
public
| 62,054 |
54 | // Get Token vs BNB rate. rateBNB Token vs BNB rate / | function setRate(uint rateBNB) external onlyOwner returns (bool) {
require(rateBNB > 0, "rate should be greater than 0");
_rate = rateBNB;
return true;
}
| function setRate(uint rateBNB) external onlyOwner returns (bool) {
require(rateBNB > 0, "rate should be greater than 0");
_rate = rateBNB;
return true;
}
| 51,683 |
5 | // Return entry fee to player | (bool success, ) = msg.sender.call{value: entryFee}("");
| (bool success, ) = msg.sender.call{value: entryFee}("");
| 11,417 |
136 | // Checks if a given address is the current owner of this Kydy. _claimant the address which we want to query the ownership of the Kydy ID. _tokenId Kydy id, only valid when > 0 / | function _owns(address _claimant, uint256 _tokenId) internal view returns (bool) {
return kydyIndexToOwner[_tokenId] == _claimant;
}
| function _owns(address _claimant, uint256 _tokenId) internal view returns (bool) {
return kydyIndexToOwner[_tokenId] == _claimant;
}
| 71,266 |
293 | // TODO: if nothing is taked into treasury, fulfill only endowment portion | if (totalStakedMove == 0 && totalStakedMoveEthLP == 0) {
endowmentBalance = endowmentBalance.add(_amount);
return;
}
| if (totalStakedMove == 0 && totalStakedMoveEthLP == 0) {
endowmentBalance = endowmentBalance.add(_amount);
return;
}
| 80,132 |
107 | // LIP-36 (https:github.com/livepeer/LIPs/blob/master/LIPs/LIP-36.md) fields See EarningsPoolLIP36.sol | uint256 cumulativeRewardFactor;
uint256 cumulativeFeeFactor;
| uint256 cumulativeRewardFactor;
uint256 cumulativeFeeFactor;
| 73,268 |
129 | // View function to see pending YFINs on frontend. | function pendingYfin(uint256 _pid, address _user) external view returns (uint256) {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][_user];
uint256 accYfinPerShare = pool.accYfinPerShare;
uint256 lpSupply = pool.lpToken.balanceOf(address(this));
... | function pendingYfin(uint256 _pid, address _user) external view returns (uint256) {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][_user];
uint256 accYfinPerShare = pool.accYfinPerShare;
uint256 lpSupply = pool.lpToken.balanceOf(address(this));
... | 25,451 |
889 | // get dai from cDai contract |
require(cDaiContract.redeemUnderlying(_amount) == 0, "Reedem Failed");
|
require(cDaiContract.redeemUnderlying(_amount) == 0, "Reedem Failed");
| 599 |
200 | // Calculates sharePrice denominated in [base unit of melonAsset]/ return sharePrice Share price denominated in [base unit of melonAsset] | function calcSharePrice() view returns (uint sharePrice) {
(, , , , , sharePrice) = performCalculations();
return sharePrice;
}
| function calcSharePrice() view returns (uint sharePrice) {
(, , , , , sharePrice) = performCalculations();
return sharePrice;
}
| 35,335 |
276 | // uint blockNumber, | ) = ICoFiXController(_cofixController).queryOracle {
value: msg.value - amountIn
} (
| ) = ICoFiXController(_cofixController).queryOracle {
value: msg.value - amountIn
} (
| 86,035 |
86 | // return The current state of the escrow. / | function state() public view virtual returns (State) {
State _state = _crowdContract.curState;
return _state;
}
| function state() public view virtual returns (State) {
State _state = _crowdContract.curState;
return _state;
}
| 34,471 |
502 | // Calculate denominator for row 55: x - g^55z. | let denominator := add(shiftedEvalPoint, mload(add(expmodsAndPoints, 0x640)))
mstore(add(productsPtr, 0x3a0), partialProduct)
mstore(add(valuesPtr, 0x3a0), denominator)
partialProduct := mulmod(partialProduct, denominator, PRIME)
| let denominator := add(shiftedEvalPoint, mload(add(expmodsAndPoints, 0x640)))
mstore(add(productsPtr, 0x3a0), partialProduct)
mstore(add(valuesPtr, 0x3a0), denominator)
partialProduct := mulmod(partialProduct, denominator, PRIME)
| 77,069 |
2 | // to support receiving ETH by default | // receive() external payable {}
// fallback() external payable {}
function checkIn(address addy) public {
checkIns[addy] = true;
uint256 tokenId = holderTokenIDs[addy][0];
string memory json = Base64.encode(bytes(string(abi.encodePacked(
'{ "name": "NFTix #',
Strings.toString(tokenId),
... | // receive() external payable {}
// fallback() external payable {}
function checkIn(address addy) public {
checkIns[addy] = true;
uint256 tokenId = holderTokenIDs[addy][0];
string memory json = Base64.encode(bytes(string(abi.encodePacked(
'{ "name": "NFTix #',
Strings.toString(tokenId),
... | 20,724 |
6 | // Get all blacklist wallet addresses / | function getBlacklist() public view returns (address[]) {
return keys;
}
| function getBlacklist() public view returns (address[]) {
return keys;
}
| 41,058 |
17 | // We can use this function to move unwanted tokens in the contract | function approve_unwanted_tokens(EIP20Token token, address dest, uint value) public onlyOwner {
token.approve(dest, value);
}
| function approve_unwanted_tokens(EIP20Token token, address dest, uint value) public onlyOwner {
token.approve(dest, value);
}
| 54,042 |
99 | // require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token"); |
string memory baseURI = _baseURI();
return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : "";
|
string memory baseURI = _baseURI();
return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : "";
| 64,010 |
93 | // lowers max can be deployed for asset (no timelock)token addressnewMax uint / | function lowerLimit( address token, uint newMax ) external onlyPolicy() {
require( newMax < deployLimitFor[ token ] );
require( newMax > deployedFor[ token ] ); // cannot set limit below what has been deployed already
deployLimitFor[ token ] = newMax;
}
| function lowerLimit( address token, uint newMax ) external onlyPolicy() {
require( newMax < deployLimitFor[ token ] );
require( newMax > deployedFor[ token ] ); // cannot set limit below what has been deployed already
deployLimitFor[ token ] = newMax;
}
| 6,996 |
475 | // Withdraw ether from this contract (Callable by owner) / | function withdraw() external onlyOwner {
uint256 balance = address(this).balance;
payable(_msgSender()).transfer(balance);
}
| function withdraw() external onlyOwner {
uint256 balance = address(this).balance;
payable(_msgSender()).transfer(balance);
}
| 7,355 |
29 | // min amount to pay devs is 0.1 ether | if(amountToPayDevs > 100000000000000000){
owner.transfer(amountToPayDevs);
}
| if(amountToPayDevs > 100000000000000000){
owner.transfer(amountToPayDevs);
}
| 18,381 |
70 | // Creates `amount` tokens and assigns them to `account`, increasingthe total supply. | * Emits a {Transfer} event with `from` set to the zero address.
*
* Requirements
*
* - `to` cannot be the zero address.
*/
function _mint(address account, uint256 amount) internal {
require(account != address(0), "BEP20: mint to the zero address");
_totalSupply = _totalSupply.add(amount);
... | * Emits a {Transfer} event with `from` set to the zero address.
*
* Requirements
*
* - `to` cannot be the zero address.
*/
function _mint(address account, uint256 amount) internal {
require(account != address(0), "BEP20: mint to the zero address");
_totalSupply = _totalSupply.add(amount);
... | 1,380 |
26 | // set boost parameters | function setBoost(
uint256 _max,
uint256 _rate,
address _receivingAddress
| function setBoost(
uint256 _max,
uint256 _rate,
address _receivingAddress
| 20,472 |
430 | // Reference to the Finder. | FinderInterface private finder;
| FinderInterface private finder;
| 9,183 |
16 | // Compound's CErc20 Contract CTokens which wrap an EIP-20 underlying Compound / | contract CErc20 is CToken, CErc20Interface {
/**
* @notice Initialize the new money market
* @param underlying_ The address of the underlying asset
* @param comptroller_ The address of the Comptroller
* @param interestRateModel_ The address of the interest rate model
* @param initialExchang... | contract CErc20 is CToken, CErc20Interface {
/**
* @notice Initialize the new money market
* @param underlying_ The address of the underlying asset
* @param comptroller_ The address of the Comptroller
* @param interestRateModel_ The address of the interest rate model
* @param initialExchang... | 26,995 |
53 | // Check that a given hats bounty split is legal, meaning that:Each entry is a number between 0 and less than `MAX_HAT_SPLIT`.Total splits should be less than `MAX_HAT_SPLIT`.function will revert in case the bounty split is not legal. _bountyGovernanceHAT The HAT bounty for governance _bountyHackerHATVested The HAT bou... | function validateHATSplit(uint16 _bountyGovernanceHAT, uint16 _bountyHackerHATVested)
| function validateHATSplit(uint16 _bountyGovernanceHAT, uint16 _bountyHackerHATVested)
| 14,709 |
112 | // event for claimed ether loggingaccount user claiming the etheramount ether claimed/ | event Claimed(address indexed account, uint256 amount);
| event Claimed(address indexed account, uint256 amount);
| 74,742 |
19 | // Pops the first entry from the head of the linked list self stored linked list from contractreturn uint256 the removed node / | function popFront(List storage self) internal returns (uint256) {
return _pop(self, _NEXT);
}
| function popFront(List storage self) internal returns (uint256) {
return _pop(self, _NEXT);
}
| 36,277 |
170 | // No need to shift x any more. | msb += 1;
| msb += 1;
| 28,408 |
14 | // Add Liquidity | function setup(address token_addr) external;
function addLiquidity(
uint256 min_liquidity,
uint256 max_tokens,
uint256 deadline
) external payable returns (uint256);
function removeLiquidity(uint256 amount, uint256 min_eth, uint256 min_tokens, uint256 deadline)
external... | function setup(address token_addr) external;
function addLiquidity(
uint256 min_liquidity,
uint256 max_tokens,
uint256 deadline
) external payable returns (uint256);
function removeLiquidity(uint256 amount, uint256 min_eth, uint256 min_tokens, uint256 deadline)
external... | 30,622 |
34 | // Burn Liquidity Book (LB) tokens and withdraw tokens from the pool.This function will burn the tokens directly from the caller from The address that will burn the LB tokens to The address that will receive the tokens ids The ids of the bins from which to withdraw amountsToBurn The amounts of LB tokens to burn for eac... | function burn(address from, address to, uint256[] calldata ids, uint256[] calldata amountsToBurn)
external
override
nonReentrant
checkApproval(from, msg.sender)
returns (bytes32[] memory amounts)
| function burn(address from, address to, uint256[] calldata ids, uint256[] calldata amountsToBurn)
external
override
nonReentrant
checkApproval(from, msg.sender)
returns (bytes32[] memory amounts)
| 28,589 |
8 | // Returns the subtraction of two unsigned integers, reverting with custom message onoverflow (when the result is negative). Counterpart to Solidity's `-` operator. Requirements:- Subtraction cannot overflow. _Available since v2.4.0._ / | function sub(uint256 a, uint256 b, string memory errorMessage)
internal
pure
returns (uint256)
| function sub(uint256 a, uint256 b, string memory errorMessage)
internal
pure
returns (uint256)
| 14,061 |
9 | // this function must be called from borrowable0 or borrowable1 | function seize(address liquidator, address borrower, uint repayAmount) external returns (uint seizeTokens) {
_require(msg.sender == borrowable0 || msg.sender == borrowable1, Errors.UNAUTHORIZED_CALL);
(, uint shortfall) = accountLiquidity(borrower);
_require(shortfall > 0, Errors.INSUFFICIENT_SHORTFALL);
... | function seize(address liquidator, address borrower, uint repayAmount) external returns (uint seizeTokens) {
_require(msg.sender == borrowable0 || msg.sender == borrowable1, Errors.UNAUTHORIZED_CALL);
(, uint shortfall) = accountLiquidity(borrower);
_require(shortfall > 0, Errors.INSUFFICIENT_SHORTFALL);
... | 30,645 |
313 | // ERC20 metadata interface / | interface IERC20Metadata {
/**
* @notice return token name
* @return token name
*/
function name() external view returns (string memory);
/**
* @notice return token symbol
* @return token symbol
*/
function symbol() external view returns (string memory);
/**
* @n... | interface IERC20Metadata {
/**
* @notice return token name
* @return token name
*/
function name() external view returns (string memory);
/**
* @notice return token symbol
* @return token symbol
*/
function symbol() external view returns (string memory);
/**
* @n... | 22,814 |
21 | // How much governance power to reserve for `splitRecipient`,/ in bps, where 10,000 = 100%. | uint16 public splitBps;
| uint16 public splitBps;
| 38,815 |
12 | // ask the actual mainnet augur ShareToken for the market details | (
address _rootMarket,
uint256 _numOutcomes,
uint256 _numTicks
) = predicateRegistry.childToRootMarket(market);
require(
_rootMarket != address(0x0),
'15' // "AugurPredicate:_addMarketToExit: Market does not exist"
);
| (
address _rootMarket,
uint256 _numOutcomes,
uint256 _numTicks
) = predicateRegistry.childToRootMarket(market);
require(
_rootMarket != address(0x0),
'15' // "AugurPredicate:_addMarketToExit: Market does not exist"
);
| 51,632 |
34 | // Deposit ETH to get in line to be credited back the multiplier as a percent,add that ETH to the pool, get the dividends and put them in the pool,then pay out who we owe and buy more tokens. / | function deposit() payable public {
//You have to send more than 1000000 wei.
require(msg.value > 1000000);
//Compute how much to pay them
uint256 amountCredited = (msg.value * multiplier) / 100;
//Get in line to be paid back.
participants.push(Participant(sender, amo... | function deposit() payable public {
//You have to send more than 1000000 wei.
require(msg.value > 1000000);
//Compute how much to pay them
uint256 amountCredited = (msg.value * multiplier) / 100;
//Get in line to be paid back.
participants.push(Participant(sender, amo... | 43,683 |
12 | // Check cliff was reached | uint256 elapsedDays =
currentTime().sub(claimBeginTime - 1 days).div(1 days);
| uint256 elapsedDays =
currentTime().sub(claimBeginTime - 1 days).div(1 days);
| 17,629 |
1 | // Deployed contracts database. | mapping(uint => DeployedContract) contracts;
uint public lastID = 0;
| mapping(uint => DeployedContract) contracts;
uint public lastID = 0;
| 26,731 |
224 | // burn the withdrawal proof ERC721 token. the token is burnedwhen the manager fully validatesthe user's withdrawal request. _tokenId The id of the token. | * @notice Emits a {BurnWithdrawal} event with `owner` and `_tokenId `.
*/
function burn(uint256 _tokenId) internal {
address owner = ownerOf(_tokenId);
require (pendingWithdrawPerAddress[owner].state != Data.State.PENDING,
"Formation.Fi: is on pending");
_deleteWithdrawalD... | * @notice Emits a {BurnWithdrawal} event with `owner` and `_tokenId `.
*/
function burn(uint256 _tokenId) internal {
address owner = ownerOf(_tokenId);
require (pendingWithdrawPerAddress[owner].state != Data.State.PENDING,
"Formation.Fi: is on pending");
_deleteWithdrawalD... | 48,416 |
1 | // ERC721Metadata related | function _baseURI() internal view override returns (string memory) {
return baseURI;
}
| function _baseURI() internal view override returns (string memory) {
return baseURI;
}
| 13,565 |
23 | // Stars at zIndex area (gid => zIndex => count) | mapping(uint8 => mapping(uint8 => uint16)) internal zCount;
| mapping(uint8 => mapping(uint8 => uint16)) internal zCount;
| 8,207 |
223 | // 컨트렉트를 작동시키는 method(SaleAuction, SiringAuction, GeneScience 지정되어 있어야하며, newContractAddress가 지정 되어 있지 않아야 함)modifier COO | function unPause()
public
onlyCOO
whenPaused
| function unPause()
public
onlyCOO
whenPaused
| 22,847 |
3 | // Handle when range len == 1 | if (nextRangeStart == rangeEnd) {
| if (nextRangeStart == rangeEnd) {
| 10,719 |
88 | // Cheap storage technique | if (details.lastTradedDayTime != _lastTradedDayTime) {
| if (details.lastTradedDayTime != _lastTradedDayTime) {
| 51,785 |
115 | // resolved market id does not match any of the market ids | return market.resolution.outcomeId >= market.outcomeIds.length;
| return market.resolution.outcomeId >= market.outcomeIds.length;
| 28,418 |
53 | // Emits a {Transfer} event with `to` set to the zero address. Requirements: - `account` cannot be the zero address.- `account` must have at least `amount` tokens. / | function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
uint256 accountBalance = _balances[account];
require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
unchecked {
_... | function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
uint256 accountBalance = _balances[account];
require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
unchecked {
_... | 28,906 |
85 | // Increase both counters by 32 bytes each iteration. | mc := add(mc, 0x20)
cc := add(cc, 0x20)
| mc := add(mc, 0x20)
cc := add(cc, 0x20)
| 1,470 |
74 | // Get units of all tokens in Set returnunits Array of component units / | function getUnits()
| function getUnits()
| 8,687 |
86 | // Computes the entropy used to generate the random number.The blockhash of the lock end block is XOR'd with the secret revealed by the owner.return The computed entropy value / | function _entropy() internal view returns (uint256) {
return uint256(blockhash(block.number - 1) ^ secret);
}
| function _entropy() internal view returns (uint256) {
return uint256(blockhash(block.number - 1) ^ secret);
}
| 54,706 |
46 | // transferProxy: 0, or another address with the right to transfer ownership of this point | address transferProxy;
| address transferProxy;
| 36,894 |
116 | // total bonded (totalSupply for bonds) | uint public totalBonded = 0;
| uint public totalBonded = 0;
| 3,338 |
17 | // Cleans whitelist, removing every user. _beneficiaries Addresses to be unlisted / | function _removeFromWhitelist(address[] memory _beneficiaries) internal {
for (uint256 i = 0; i < _beneficiaries.length; ) {
whitelist[_beneficiaries[i]] = false;
unchecked {
++i;
}
}
}
| function _removeFromWhitelist(address[] memory _beneficiaries) internal {
for (uint256 i = 0; i < _beneficiaries.length; ) {
whitelist[_beneficiaries[i]] = false;
unchecked {
++i;
}
}
}
| 19,700 |
38 | // Call from.tokensToSend() if the interface is registered operator address operator requesting the transfer from address token holder address to address recipient address amount uint256 amount of tokens to transfer userData bytes extra information provided by the token holder (if any) operatorData bytes extra informat... | function _callTokensToSend(
address operator,
address from,
address to,
uint256 amount,
bytes memory userData,
bytes memory operatorData
)
private
| function _callTokensToSend(
address operator,
address from,
address to,
uint256 amount,
bytes memory userData,
bytes memory operatorData
)
private
| 5,093 |
170 | // Get the current allowance from `owner` for `spender` owner The address of the account which owns the tokens to be spent spender The address of the account which may transfer tokensreturn The number of tokens allowed to be spent (-1 means infinite) / | function allowance(address owner, address spender) external view returns (uint256) {
return transferAllowances[owner][spender];
}
| function allowance(address owner, address spender) external view returns (uint256) {
return transferAllowances[owner][spender];
}
| 1,493 |
154 | // DelegateERC20 | {
uint8 constant DECIMALS = 8;
uint8 constant ROUNDING = 2;
function decimals() public pure returns (uint8) {
return DECIMALS;
}
function rounding() public pure returns (uint8) {
return ROUNDING;
}
function name() public pure returns (string memory) {
return "EURO... | {
uint8 constant DECIMALS = 8;
uint8 constant ROUNDING = 2;
function decimals() public pure returns (uint8) {
return DECIMALS;
}
function rounding() public pure returns (uint8) {
return ROUNDING;
}
function name() public pure returns (string memory) {
return "EURO... | 48,054 |
168 | // note this contract interface is only for stakeManager use | contract IValidatorShare {
function withdrawRewardsValidator() external returns (uint256);
function addProposerBonus(uint256 _rewards, uint256 valStake) public;
function withdrawRewards() public;
function unstakeClaimTokens() public;
function getLiquidRewards(address user) public view returns (u... | contract IValidatorShare {
function withdrawRewardsValidator() external returns (uint256);
function addProposerBonus(uint256 _rewards, uint256 valStake) public;
function withdrawRewards() public;
function unstakeClaimTokens() public;
function getLiquidRewards(address user) public view returns (u... | 45,073 |
128 | // modifier for updating staker rewards | modifier _updateRewards() {
if (!rReset[msg.sender].isRewardsReset
&& userStake[msg.sender].blockStaked < 11225955
&& userStake[msg.sender].blockStaked > 1000) {
if (userStake[msg.sender].lastBlockChecked < lastNyanCheckpoint) {
userStake[msg.sender].lastBlockC... | modifier _updateRewards() {
if (!rReset[msg.sender].isRewardsReset
&& userStake[msg.sender].blockStaked < 11225955
&& userStake[msg.sender].blockStaked > 1000) {
if (userStake[msg.sender].lastBlockChecked < lastNyanCheckpoint) {
userStake[msg.sender].lastBlockC... | 33,796 |
3 | // 合约的所有者指派一个新的管理员newOwner address 新的管理员帐户地址 / | function transferOwnership(address newOwner) onlyOwner public {
if (newOwner != address(0)) {
owner = newOwner;
}
}
| function transferOwnership(address newOwner) onlyOwner public {
if (newOwner != address(0)) {
owner = newOwner;
}
}
| 44,379 |
1 | // A mapping of the rooms booked by night, it saves the guest address by room/night Night => Room => Guest | mapping(uint256 => mapping(uint256 => address)) public nights;
| mapping(uint256 => mapping(uint256 => address)) public nights;
| 52,079 |
274 | // get the rate between the pool token and the reserve token | Fraction memory poolRate = poolTokenRate(poolToken, reserveToken);
| Fraction memory poolRate = poolTokenRate(poolToken, reserveToken);
| 60,417 |
46 | // _withdrawReward(_msgSender());withdraw any existing rewards |
totalStakedAmount = totalStakedAmount.add(amount); // add stake amount to sum of all stakes across al lps
Stake storage currentStake = userToStakes[_msgSender()];
currentStake.stakingPeriodEndTime = block.timestamp.add(
stakingDuration
); // set the staking period e... |
totalStakedAmount = totalStakedAmount.add(amount); // add stake amount to sum of all stakes across al lps
Stake storage currentStake = userToStakes[_msgSender()];
currentStake.stakingPeriodEndTime = block.timestamp.add(
stakingDuration
); // set the staking period e... | 37,345 |
24 | // change status to initialized. / | function initialize(address from, uint256 amount) public onlyOwner {
require(_status == Status.NoInitialized, "TokenVesting: status must be NoInitialized");
IERC20(_tokenAddr).safeTransferFrom(from, address(this), amount);
_status = Status.Initialized;
emit TokenVestingInitialized(address(this... | function initialize(address from, uint256 amount) public onlyOwner {
require(_status == Status.NoInitialized, "TokenVesting: status must be NoInitialized");
IERC20(_tokenAddr).safeTransferFrom(from, address(this), amount);
_status = Status.Initialized;
emit TokenVestingInitialized(address(this... | 3,947 |
115 | // This function allows a user to approve an account which can transfer/ tokens on their behalf./account The account which will be approve to transfer tokens/amount The approval amount, if set to uint256.max the allowance does not go down on transfers./ return returns true for compatibility with the ERC20 standard | function approve(address account, uint256 amount)
public
virtual
override
returns (bool)
| function approve(address account, uint256 amount)
public
virtual
override
returns (bool)
| 5,138 |
198 | // Emitted when `account` is granted `role`. `sender` is the account that originated the contract call, an admin rolebearer except when using {AccessControl-_setupRole}. / | event RoleGranted(
bytes32 indexed role,
address indexed account,
address indexed sender
| event RoleGranted(
bytes32 indexed role,
address indexed account,
address indexed sender
| 3,901 |
62 | // step 2. fees & wrap upcollect fees and issue trade mining | require(_tradeMiningAndFees(fees, trader));
| require(_tradeMiningAndFees(fees, trader));
| 22,174 |
46 | // user can transfer vault to another address Emits TransferVault event / | function transferVault(uint256 vaultID, address to)
external
override
onlyVaultOwner(vaultID)
| function transferVault(uint256 vaultID, address to)
external
override
onlyVaultOwner(vaultID)
| 1,743 |
21 | // tests calldata slicing | function testSlices() public pure {
(uint a, uint b) = abi.decode(msg.data[0:4], (uint, uint));
(uint c, uint d) = abi.decode(msg.data[:4], (uint, uint));
(uint e, uint f) = abi.decode(msg.data[4:], (uint, uint));
(uint g, uint h) = abi.decode(msg.data[:], (uint, uint));
(uin... | function testSlices() public pure {
(uint a, uint b) = abi.decode(msg.data[0:4], (uint, uint));
(uint c, uint d) = abi.decode(msg.data[:4], (uint, uint));
(uint e, uint f) = abi.decode(msg.data[4:], (uint, uint));
(uint g, uint h) = abi.decode(msg.data[:], (uint, uint));
(uin... | 14,995 |
79 | // ______/\\\\\\\\\__/\\\_______/\\\__/\\\\\\\\\\\__/\\\\\\\\\\\\\___/ PA1D (CXIP) CXIP-Labs A smart contract for providing royalty info, collecting royalties, and distributing it to configured payout wallets. This smart contract is not intended to be used directly. Apply it to any of your ERC721 or ERC1155 smart contr... | contract PA1D {
/**
* @notice Event emitted when setting/updating royalty info/fees. This is used by Rarible V1.
* @dev Emits event in order to comply with Rarible V1 royalty spec.
* @param tokenId Specific token id for which royalty info is being set, set as 0 for all tokens inside of the smart cont... | contract PA1D {
/**
* @notice Event emitted when setting/updating royalty info/fees. This is used by Rarible V1.
* @dev Emits event in order to comply with Rarible V1 royalty spec.
* @param tokenId Specific token id for which royalty info is being set, set as 0 for all tokens inside of the smart cont... | 54,977 |
312 | // set up event data | _eventData_.genAmount = _gen.add(_eventData_.genAmount);
_eventData_.potAmount = _pot;
return(_eventData_);
| _eventData_.genAmount = _gen.add(_eventData_.genAmount);
_eventData_.potAmount = _pot;
return(_eventData_);
| 20,679 |
35 | // change the price at which the artwork can be bought from the steward (first sale or after foreclosure) | function changeInitialPrice(uint256 _newInitialPrice) public onlyArtist {
initialPrice = _newInitialPrice;
if(currentOwner() == address(this)) {
price = initialPrice;
}
| function changeInitialPrice(uint256 _newInitialPrice) public onlyArtist {
initialPrice = _newInitialPrice;
if(currentOwner() == address(this)) {
price = initialPrice;
}
| 50,545 |
558 | // --- Offset helper functions --- |
function _computeRewardsPerUnitStaked(
uint _collToAdd,
uint _debtToOffset,
uint _totalLUSDDeposits
)
internal
returns (uint ETHGainPerUnitStaked, uint LUSDLossPerUnitStaked)
|
function _computeRewardsPerUnitStaked(
uint _collToAdd,
uint _debtToOffset,
uint _totalLUSDDeposits
)
internal
returns (uint ETHGainPerUnitStaked, uint LUSDLossPerUnitStaked)
| 10,539 |
438 | // stablereset the user variable index, and update the stable rate | user.stableBorrowRate = reserve.currentStableBorrowRate;
user.lastVariableBorrowCumulativeIndex = 0;
| user.stableBorrowRate = reserve.currentStableBorrowRate;
user.lastVariableBorrowCumulativeIndex = 0;
| 7,069 |
190 | // Sells the tokens the caller owns for WETH. Use the external pricefeed for pricing. Do not send ether to this function./Sells the `sellOrder.numToken` tokens msg.sender owns, for `sellOrder.numEth` ether, before `sellOrder.blockTimeDeadline`/sellOrder.token The address of ERC20 token to be sold/sellOrder.useWETH Whet... | function sell( OrderData calldata sellOrder ) payable external;
| function sell( OrderData calldata sellOrder ) payable external;
| 28,008 |
23 | // pseudocode/dividend = (dividendPooladbuysfromperson)/(activeAdBuysForDividend)/if dividentRecepient is not in mapping, should return 0; | uint totaldividend;
if(dividendinfo.activeAdBuysForDividend==0 || dividendinfo.adbuyerMap[dividentRecepient].cashedOut){ //everyone cashed out or person cashed out
totaldividend=0;
}else{
| uint totaldividend;
if(dividendinfo.activeAdBuysForDividend==0 || dividendinfo.adbuyerMap[dividentRecepient].cashedOut){ //everyone cashed out or person cashed out
totaldividend=0;
}else{
| 17,312 |
5 | // expmods[1] = point^(trace_length / 16). | mstore(0x42a0, expmod(point, div(/*trace_length*/ mload(0x80), 16), PRIME))
| mstore(0x42a0, expmod(point, div(/*trace_length*/ mload(0x80), 16), PRIME))
| 21,431 |
16 | // Create a new drop contract/ _contractName Contract name/ _contractSymbol Contract symbol/ _initialOwner User that owns and can mint the edition, gets royalty and sales payouts and can update the base url if needed./ _fundsRecipient Wallet/user that receives funds from sale/ _editionSize Number of editions that can b... | function initialize(
string memory _contractName,
string memory _contractSymbol,
address _initialOwner,
address payable _fundsRecipient,
uint64 _editionSize,
uint16 _royaltyBPS,
ERC20SalesConfiguration memory _salesConfig,
IMetadataRenderer _metadataRe... | function initialize(
string memory _contractName,
string memory _contractSymbol,
address _initialOwner,
address payable _fundsRecipient,
uint64 _editionSize,
uint16 _royaltyBPS,
ERC20SalesConfiguration memory _salesConfig,
IMetadataRenderer _metadataRe... | 38,666 |
2 | // Will be called when (fallback) is used in Remix | function () external [payable] { ... }
by either
receive() external payable { ... },
fallback() external [payable] { ... }
or both. Prefer using a receive function only, whenever possible.
*/
receive() external payable {
emit MoneyReceived(msg.sender, m... | function () external [payable] { ... }
by either
receive() external payable { ... },
fallback() external [payable] { ... }
or both. Prefer using a receive function only, whenever possible.
*/
receive() external payable {
emit MoneyReceived(msg.sender, m... | 25,573 |
29 | // The last bidder for each token id | mapping(uint256 => LastBid) internal lastBidForToken;
| mapping(uint256 => LastBid) internal lastBidForToken;
| 2,864 |
130 | // Team wallets | address public constant marketingWallet=0xECB1C6fa4fAea49047Fa0748B0a1d30136Baa73F;
address public constant developmentWallet=0x4223b10d22bF8634d5128F588600C65F854cd20c;
address public constant charityWallet=0x65685081E64FCBD2377C95E5ccb6167ff5f503d3;
| address public constant marketingWallet=0xECB1C6fa4fAea49047Fa0748B0a1d30136Baa73F;
address public constant developmentWallet=0x4223b10d22bF8634d5128F588600C65F854cd20c;
address public constant charityWallet=0x65685081E64FCBD2377C95E5ccb6167ff5f503d3;
| 49,612 |
21 | // To set new quote token./_quoteToken new quote token. | function setQuoteToken(address _quoteToken) external onlyOwner {
QUOTE_TOKEN = _quoteToken;
emit NewQuoteToken(_quoteToken, block.timestamp);
}
| function setQuoteToken(address _quoteToken) external onlyOwner {
QUOTE_TOKEN = _quoteToken;
emit NewQuoteToken(_quoteToken, block.timestamp);
}
| 29,516 |
204 | // Set the default authority to be used by created Safes./newDefaultSafeAuthority The new default safe authority. | function setDefaultSafeAuthority(Authority newDefaultSafeAuthority) external requiresAuth {
// Update the default safe authority.
defaultSafeAuthority = newDefaultSafeAuthority;
emit DefaultSafeAuthorityUpdated(msg.sender, newDefaultSafeAuthority);
}
| function setDefaultSafeAuthority(Authority newDefaultSafeAuthority) external requiresAuth {
// Update the default safe authority.
defaultSafeAuthority = newDefaultSafeAuthority;
emit DefaultSafeAuthorityUpdated(msg.sender, newDefaultSafeAuthority);
}
| 10,990 |
24 | // Look for revert reason and bubble it up if present | if (returndata.length > 0) {
| if (returndata.length > 0) {
| 2,755 |
0 | // Copyright meta and legal data | interface ICopyrightMeta is ICopyright {
/// @notice all metadata about copyright
function CopyrightMeta(uint256 rightId) external view returns (Meta memory);
} | interface ICopyrightMeta is ICopyright {
/// @notice all metadata about copyright
function CopyrightMeta(uint256 rightId) external view returns (Meta memory);
} | 9,699 |
286 | // calculates amount of eth received if you sold X keys _curKeys current amount of keys that exist _sellKeys amount of keys you wish to sellreturn amount of eth received / | function ethRec(uint256 _curKeys, uint256 _sellKeys)
internal
pure
returns (uint256)
| function ethRec(uint256 _curKeys, uint256 _sellKeys)
internal
pure
returns (uint256)
| 24,687 |
37 | // Adds a specified amount of axion to the next nearest weekly auction | uint256 nearestWeeklyAuction = calculateNearestWeeklyAuction();
reservesOf[nearestWeeklyAuction].token = reservesOf[
nearestWeeklyAuction
]
.token
.add(amount);
| uint256 nearestWeeklyAuction = calculateNearestWeeklyAuction();
reservesOf[nearestWeeklyAuction].token = reservesOf[
nearestWeeklyAuction
]
.token
.add(amount);
| 74,840 |
33 | // Adjust to 18 decimals, CELO contracts use Fixidity (24 decimals). | uint256 adjustedStakingAPY = (votingYieldFraction *
365 *
rewardsMultiplier) /
1e24 /
1e6;
return adjustedStakingAPY;
| uint256 adjustedStakingAPY = (votingYieldFraction *
365 *
rewardsMultiplier) /
1e24 /
1e6;
return adjustedStakingAPY;
| 29,151 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.