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 |
|---|---|---|---|---|
36 | // The value is stored at length-1, but we add 1 to all indexes and use 0 as a sentinel value | set._indexes[value] = set._values.length;
return true;
| set._indexes[value] = set._values.length;
return true;
| 2,656 |
146 | // 获取账户信息 | function getAccountState(address account)
external
view
returns (
uint256,
uint256,
uint256
)
| function getAccountState(address account)
external
view
returns (
uint256,
uint256,
uint256
)
| 40,119 |
16 | // Событие старта игры Хомяков | event StartHamsterGame();
| event StartHamsterGame();
| 79,316 |
34 | // Year | timestamp += (year - ORIGIN_YEAR) * 1 years;
timestamp += (leapYearsBefore(year) - leapYearsBefore(ORIGIN_YEAR)) * 1 days;
| timestamp += (year - ORIGIN_YEAR) * 1 years;
timestamp += (leapYearsBefore(year) - leapYearsBefore(ORIGIN_YEAR)) * 1 days;
| 39,114 |
88 | // 比率轉換-白金幣換白金 | function convert2Platinum(uint256 _amount) constant returns (uint256) {
return _amount.div(rate);
}
| function convert2Platinum(uint256 _amount) constant returns (uint256) {
return _amount.div(rate);
}
| 20,301 |
23 | // The ERC20 is no longer composed within the token if the balance falls to zero | if (nftContainsERC20 && ERC20Balances[_tokenId][_erc20Contract] == 0) {
ERC20sEmbeddedInNft[_tokenId].remove(_erc20Contract);
}
| if (nftContainsERC20 && ERC20Balances[_tokenId][_erc20Contract] == 0) {
ERC20sEmbeddedInNft[_tokenId].remove(_erc20Contract);
}
| 6,466 |
280 | // See {IERC721-approve}. In this example the added modifier ensures that the operator is allowed by the OperatorFilterRegistry. / | function approve(address operator, uint256 tokenId) public override onlyAllowedOperatorApproval(operator) {
super.approve(operator, tokenId);
}
| function approve(address operator, uint256 tokenId) public override onlyAllowedOperatorApproval(operator) {
super.approve(operator, tokenId);
}
| 8,265 |
7 | // Add the length of _postBytes to the current length of tempBytes and store it as the new length in the first 32 bytes of the tempBytes memory. | length := mload(_postBytes)
mstore(tempBytes, add(length, mload(tempBytes)))
| length := mload(_postBytes)
mstore(tempBytes, add(length, mload(tempBytes)))
| 12,856 |
32 | // Safety check | if(assetAmount == 0)
revert Invalid();
| if(assetAmount == 0)
revert Invalid();
| 7,470 |
350 | // charge fee | uint256 rewardToNotify = _chargeFees(rewardTokens[i], reward);
_approveTokenIfNeeded(rewardTokens[i], sdGauges[_token], rewardToNotify);
ILiquidityGauge(sdGauges[_token]).deposit_reward_token(rewardTokens[i], rewardToNotify);
emit Claimed(rewardTokens[i], rewardToNotify);... | uint256 rewardToNotify = _chargeFees(rewardTokens[i], reward);
_approveTokenIfNeeded(rewardTokens[i], sdGauges[_token], rewardToNotify);
ILiquidityGauge(sdGauges[_token]).deposit_reward_token(rewardTokens[i], rewardToNotify);
emit Claimed(rewardTokens[i], rewardToNotify);... | 39,558 |
91 | // Send the amount of token to an address _amount amount of token _token token address / | function send(GlobalConfig globalConfig, uint256 _amount, address _token) public {
if (Utils._isETH(address(globalConfig), _token)) {
msg.sender.transfer(_amount);
} else {
IERC20(_token).safeTransfer(msg.sender, _amount);
}
}
| function send(GlobalConfig globalConfig, uint256 _amount, address _token) public {
if (Utils._isETH(address(globalConfig), _token)) {
msg.sender.transfer(_amount);
} else {
IERC20(_token).safeTransfer(msg.sender, _amount);
}
}
| 71,040 |
12 | // Ensure no overflow | bidQuantities[i] = int256(resultQuantity) - int256(currentQuantities[i]);
| bidQuantities[i] = int256(resultQuantity) - int256(currentQuantities[i]);
| 33,908 |
4 | // newInterestRate: new loan interest rate newLoanAmount: new loan size (principal from lender) interestInitialAmount: interestAmount sent to determine initial loan length (this is included in one of the below) loanTokenSent: loanTokenAmount + interestAmount + any extra collateralTokenSent: collateralAmountRequired + a... | bytes calldata loanData)
external
nonReentrant
tracksGas
returns (uint256)
| bytes calldata loanData)
external
nonReentrant
tracksGas
returns (uint256)
| 42,678 |
197 | // if we need to liquidate the token0 | IUniswapV2Router02(routerV2).swapExactTokensForTokens(
toToken0,
amountOutMin,
uniswapRoutes[uniLPComponentToken0],
address(this),
block.timestamp
);
token0Amount = IERC20(uniLPComponentToken0).balanceOf(address(this));
| IUniswapV2Router02(routerV2).swapExactTokensForTokens(
toToken0,
amountOutMin,
uniswapRoutes[uniLPComponentToken0],
address(this),
block.timestamp
);
token0Amount = IERC20(uniLPComponentToken0).balanceOf(address(this));
| 37,257 |
67 | // Withdraw partial funds, normally used with a vault withdrawal | function withdraw(uint256 _amount) external {
require(msg.sender == controller, "!controller");
uint256 _balance = IERC20(want).balanceOf(address(this));
if (_balance < _amount) {
_amount = _withdrawSome(_amount.sub(_balance));
_amount = _amount.add(_balance);
... | function withdraw(uint256 _amount) external {
require(msg.sender == controller, "!controller");
uint256 _balance = IERC20(want).balanceOf(address(this));
if (_balance < _amount) {
_amount = _withdrawSome(_amount.sub(_balance));
_amount = _amount.add(_balance);
... | 5,195 |
4 | // Transfers vested tokens to beneficiary. / | function release() public {
uint256 unreleased = releasableAmount();
require(unreleased > 0, "Vesting: no tokens are due");
released += unreleased;
crunch.transfer(beneficiary, unreleased);
emit TokensReleased(unreleased);
}
| function release() public {
uint256 unreleased = releasableAmount();
require(unreleased > 0, "Vesting: no tokens are due");
released += unreleased;
crunch.transfer(beneficiary, unreleased);
emit TokensReleased(unreleased);
}
| 60,032 |
18 | // To change the approve amount you first have to reduce the addresses`allowance to zero by calling `approve(_spender,0)` if it is notalready 0 to mitigate the race condition described here:https:github.com/ethereum/EIPs/issues/20issuecomment-263524729 Note that this doesn't prevent attacks; the user will have to perso... |
if ((value!=0) && (_approvals[msg.sender][spender] !=0)) throw;
_approvals[msg.sender][spender] = value;
Approval( msg.sender, spender, value );
return true;
|
if ((value!=0) && (_approvals[msg.sender][spender] !=0)) throw;
_approvals[msg.sender][spender] = value;
Approval( msg.sender, spender, value );
return true;
| 20,598 |
4 | // Deploys and returns the address of a clone that mimics the behaviour of `implementation`. This function uses the create opcode, which should never revert. / | function clone(address implementation) internal returns (address instance) {
assembly {
let ptr := mload(0x40)
mstore(ptr, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000)
mstore(add(ptr, 0x14), shl(0x60, implementation))
mstore(add(ptr, 0x2... | function clone(address implementation) internal returns (address instance) {
assembly {
let ptr := mload(0x40)
mstore(ptr, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000)
mstore(add(ptr, 0x14), shl(0x60, implementation))
mstore(add(ptr, 0x2... | 777 |
52 | // Returns lastPriceList and triggered price info/tokenAddress Destination token address/count The number of prices that want to return/payback As the charging fee may change, it is suggested that the caller pay more fees, and the excess fees will be returned through this address/ return prices An array which length is... | function lastPriceListAndTriggeredPriceInfo(
address tokenAddress,
uint count,
address payback
) external payable
returns (
uint[] memory prices,
uint triggeredPriceBlockNumber,
uint triggeredPriceValue,
uint triggeredAvgPrice,
| function lastPriceListAndTriggeredPriceInfo(
address tokenAddress,
uint count,
address payback
) external payable
returns (
uint[] memory prices,
uint triggeredPriceBlockNumber,
uint triggeredPriceValue,
uint triggeredAvgPrice,
| 27,571 |
38 | // Enter the Dragon Dungeon! // Minting for whitelisted people onlyBeam me up Scotty!/ | function mintDragonsWhitelisted(uint256 count, bytes32[] calldata _merkleProof)
external
payable
unfrozen
saleIsOpen
whitelistOnly(_merkleProof)
mintRequirementsWhitelist(count)
| function mintDragonsWhitelisted(uint256 count, bytes32[] calldata _merkleProof)
external
payable
unfrozen
saleIsOpen
whitelistOnly(_merkleProof)
mintRequirementsWhitelist(count)
| 50,579 |
133 | // View function to see pending HAPYFs on frontend. | function pendingHAPYF(uint256 _pid, address _user) external view returns (uint256) {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][_user];
uint256 accHAPYFPerShare = pool.accHAPYFPerShare;
uint256 lpSupply = pool.lpToken.balanceOf(address(this));
... | function pendingHAPYF(uint256 _pid, address _user) external view returns (uint256) {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][_user];
uint256 accHAPYFPerShare = pool.accHAPYFPerShare;
uint256 lpSupply = pool.lpToken.balanceOf(address(this));
... | 5,453 |
46 | // Emits when the contract administrator is changed./oldAdmin The address of the previous administrator./newAdmin The address of the new administrator. | event AdminChanged(address oldAdmin, address newAdmin);
| event AdminChanged(address oldAdmin, address newAdmin);
| 56,139 |
48 | // Always call the plugin on the owner | allowedAmount = _callPlugin(
before,
p.owner,
fromPledge,
toPledge,
offset,
p.token,
allowedAmount
);
| allowedAmount = _callPlugin(
before,
p.owner,
fromPledge,
toPledge,
offset,
p.token,
allowedAmount
);
| 4,082 |
35 | // Gets the approved address for a token ID, or zero if no address set _tokenId uint256 ID of the token to query the approval ofreturn address currently approved for the given token ID / | function getApproved(uint256 _tokenId) public view returns (address) {
return tokenApprovals[_tokenId];
}
| function getApproved(uint256 _tokenId) public view returns (address) {
return tokenApprovals[_tokenId];
}
| 5,641 |
139 | // NvsToken with Governance. | contract NvsToken is ERC20("NewVision.money", "NVS"), Ownable {
/// @notice Creates `_amount` token to `_to`. Must only be called by the owner (MasterChef).
function mint(address _to, uint256 _amount) public onlyOwner {
_mint(_to, _amount);
}
}
| contract NvsToken is ERC20("NewVision.money", "NVS"), Ownable {
/// @notice Creates `_amount` token to `_to`. Must only be called by the owner (MasterChef).
function mint(address _to, uint256 _amount) public onlyOwner {
_mint(_to, _amount);
}
}
| 68,559 |
27 | // time of stake end is now + number of daysstepTimestamp which is 24 hours | uint256 end = now.add(stakingDays.mul(stepTimestamp));
| uint256 end = now.add(stakingDays.mul(stepTimestamp));
| 51,003 |
74 | // Introspection interface as per ERC-165 (https:github.com/ethereum/EIPs/issues/165)./Returns true for any standardized interfaces implemented by this contract. We implement/ERC-165 (obviously!) and ERC-721. | function supportsInterface(bytes4 _interfaceID) external view returns (bool)
| function supportsInterface(bytes4 _interfaceID) external view returns (bool)
| 21,984 |
20 | // CHECKS ensure that the manually set maxInvocations is not greater than what is set on the core contract | uint256 maxInvocations;
uint256 invocations;
(invocations, maxInvocations, , , , ) = genArtCoreContract_Base
.projectStateData(_projectId);
require(
_maxInvocations <= maxInvocations,
"Cannot increase project max invocations above core contract set pro... | uint256 maxInvocations;
uint256 invocations;
(invocations, maxInvocations, , , , ) = genArtCoreContract_Base
.projectStateData(_projectId);
require(
_maxInvocations <= maxInvocations,
"Cannot increase project max invocations above core contract set pro... | 29,380 |
154 | // Set inflation fee collector address | inflationCollector = _inflationCollector;
| inflationCollector = _inflationCollector;
| 37,800 |
6 | // Toggles the `cre8ingOpen` flag. | function setCre8ingOpen(
address _target,
bool open
| function setCre8ingOpen(
address _target,
bool open
| 25,628 |
10 | // Adds two unsigned integers, reverts on overflow./ | function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a);
return c;
}
| function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a);
return c;
}
| 1,418 |
2 | // Set contract deployer as owner | constructor() {
owner = msg.sender; // 'msg.sender' is sender of current call, contract deployer for a constructor
emit OwnerSet(address(0), owner);
}
| constructor() {
owner = msg.sender; // 'msg.sender' is sender of current call, contract deployer for a constructor
emit OwnerSet(address(0), owner);
}
| 2,100 |
59 | // loop | for (uint256 i = nLastPayment.add(1); i < nEndPayment; i++) {
| for (uint256 i = nLastPayment.add(1); i < nEndPayment; i++) {
| 8,039 |
297 | // Function to get record. key The key to query the value of. tokenId The token id to fetch.return The value string. / | function get(string memory key, uint256 tokenId) public view whenResolver(tokenId) returns (string memory) {
return _records[tokenId][_tokenPresets[tokenId]][key];
}
| function get(string memory key, uint256 tokenId) public view whenResolver(tokenId) returns (string memory) {
return _records[tokenId][_tokenPresets[tokenId]][key];
}
| 25,159 |
188 | // Submit evidence for a dispute_subject Arbitrable instance submitting the dispute_disputeId Identification number of the dispute receiving new evidence_submitter Address of the account submitting the evidence_evidence Data submitted for the evidence of the dispute/ | function submitEvidence(IArbitrable _subject, uint256 _disputeId, address _submitter, bytes calldata _evidence) external;
| function submitEvidence(IArbitrable _subject, uint256 _disputeId, address _submitter, bytes calldata _evidence) external;
| 39,703 |
22 | // Function to kill contract / | function kill() public onlyOwner {
selfdestruct(address(uint160(owner())));
}
| function kill() public onlyOwner {
selfdestruct(address(uint160(owner())));
}
| 11,688 |
9 | // A struct defining royalty info for the contract. / | struct RoyaltyInfo {
| struct RoyaltyInfo {
| 6,962 |
42 | // Check if transfer is allowed Permissions:OwnerAdminOffeirngContractOtherstransfer (before transferEnabled is true) xxx xtransferFrom (before transferEnabled is true) xvv xtransfer/transferFrom after transferEnabled is true vxx v / | modifier onlyWhenTransferAllowed() {
require(transferEnabled || msg.sender == adminAddr || msg.sender == tokenOfferingAddr);
_;
}
| modifier onlyWhenTransferAllowed() {
require(transferEnabled || msg.sender == adminAddr || msg.sender == tokenOfferingAddr);
_;
}
| 28,709 |
15 | // Deposit into Curve to increase LP position | harvestData.lpComponentDeposited = IERC20Upgradeable(lpComponent).balanceOf(address(this));
if (harvestData.lpComponentDeposited > 0) {
_safeApproveHelper(lpComponent, curveSwap, harvestData.lpComponentDeposited);
_add_liquidity_curve(harvestData.lpComponentDeposited);
}
| harvestData.lpComponentDeposited = IERC20Upgradeable(lpComponent).balanceOf(address(this));
if (harvestData.lpComponentDeposited > 0) {
_safeApproveHelper(lpComponent, curveSwap, harvestData.lpComponentDeposited);
_add_liquidity_curve(harvestData.lpComponentDeposited);
}
| 50,669 |
1 | // Require amount greater than 0 | require(_amount > 0, "amount cannot be 0");
| require(_amount > 0, "amount cannot be 0");
| 44,138 |
1 | // MikeCoin Very simple ERC20 Token example, where all tokens are pre-assigned to the creator.Note they can later distribute these tokens as they wish using `transfer` and other`ERC20` functions. / | contract MikeCoin is ERC20, ERC20Detailed {
uint256 public constant INITIAL_SUPPLY = 10000 * (10 ** uint256(decimals()));
/**
* @dev Constructor that gives msg.sender all of existing tokens.
*/
constructor () public ERC20Detailed("MikeCoin", "MGC", 18) {
_mint(msg.sender, INITIAL_SUPPLY);... | contract MikeCoin is ERC20, ERC20Detailed {
uint256 public constant INITIAL_SUPPLY = 10000 * (10 ** uint256(decimals()));
/**
* @dev Constructor that gives msg.sender all of existing tokens.
*/
constructor () public ERC20Detailed("MikeCoin", "MGC", 18) {
_mint(msg.sender, INITIAL_SUPPLY);... | 53,809 |
1,459 | // Synthetix Integratee. Mocks functionalities from the folllowing synthetix contracts/ Synthetix, SynthetixAddressResolver, SynthetixDelegateApprovals/ Link to contracts: <https:github.com/Synthetixio/synthetix/tree/develop/contracts> | contract MockSynthetixIntegratee is Ownable, MockToken {
using SafeMath for uint256;
mapping(address => mapping(address => bool)) private authorizerToDelegateToApproval;
mapping(bytes32 => address) private currencyKeyToSynth;
address private immutable CENTRALIZED_RATE_PROVIDER;
address private imm... | contract MockSynthetixIntegratee is Ownable, MockToken {
using SafeMath for uint256;
mapping(address => mapping(address => bool)) private authorizerToDelegateToApproval;
mapping(bytes32 => address) private currencyKeyToSynth;
address private immutable CENTRALIZED_RATE_PROVIDER;
address private imm... | 83,283 |
160 | // The user is withdrawing this deposit. Remove it from our queue. We'll just leave a gap, which the purchasing logic can walk past. | pynthsToSend = pynthsToSend.add(deposit.amount);
delete deposits[i];
| pynthsToSend = pynthsToSend.add(deposit.amount);
delete deposits[i];
| 28,231 |
24 | // Send nft back to owner. | _refundNFT(lotteryId);
emit LotteryRefund(lotteryId, lotteries[lotteryId]);
| _refundNFT(lotteryId);
emit LotteryRefund(lotteryId, lotteries[lotteryId]);
| 29,507 |
59 | // TODO:: in demo do not distinguish from sender | payable(msg.sender).transfer(work.price);
work.status = ArtState.Closed;
emit Claim(work.owner, nftcontract, tokenId);
| payable(msg.sender).transfer(work.price);
work.status = ArtState.Closed;
emit Claim(work.owner, nftcontract, tokenId);
| 28,201 |
652 | // Needs to be at least the minimum | uint256 internal constant MIN_LIQUIDITY = 4;
| uint256 internal constant MIN_LIQUIDITY = 4;
| 76,511 |
16 | // method that handles transfer of ERC20 tokens to another addressit assumes the calling address has approved this contract as spender / | function transferTokensMulti(address payable[] memory addrs, uint[] memory amounts) public payable onlyOwner notSuspended{
//require(tokens[symbol_] != address(0));
require(addrs.length <= maxTransactions, "Too many addresses in transaction");
// address contract_ = adb_contract_add... | function transferTokensMulti(address payable[] memory addrs, uint[] memory amounts) public payable onlyOwner notSuspended{
//require(tokens[symbol_] != address(0));
require(addrs.length <= maxTransactions, "Too many addresses in transaction");
// address contract_ = adb_contract_add... | 18,732 |
63 | // e.g. 8e181e18 = 8e36 | uint256 z = x.mul(FULL_SCALE);
| uint256 z = x.mul(FULL_SCALE);
| 18,730 |
7 | // Underlying -> Witnet feed decimals | mapping(address => uint8) public assetsFeedDecimals;
| mapping(address => uint8) public assetsFeedDecimals;
| 31,639 |
40 | // Modifier to make a function callable only when the contract is paused. / | modifier whenPaused() {
require(paused);
_;
}
| modifier whenPaused() {
require(paused);
_;
}
| 500 |
201 | // forward funds to the wallet | forwardFunds(purchaser, purchaseAmount);
| forwardFunds(purchaser, purchaseAmount);
| 20,561 |
13 | // store the amount into a dictionary so that people can withdraw the amount themselves | if(lowestFareAmount != 0)
pendingReturns[driver] += lowestFareAmount;
driver = msg.sender;
lowestFareAmount = msg.value;
emit fareBidAmountDecreased(msg.sender, msg.value);
| if(lowestFareAmount != 0)
pendingReturns[driver] += lowestFareAmount;
driver = msg.sender;
lowestFareAmount = msg.value;
emit fareBidAmountDecreased(msg.sender, msg.value);
| 5,333 |
682 | // Called whenever an action execution is failed./ | event ActionFailed (
uint256 proposalId
);
| event ActionFailed (
uint256 proposalId
);
| 54,794 |
61 | // Module for using AddressConfig contracts. / | contract UsingConfig {
address private _config;
/**
* Initialize the argument as AddressConfig address.
*/
constructor(address _addressConfig) public {
_config = _addressConfig;
}
/**
* Returns the latest AddressConfig instance.
*/
function config() internal view returns (IAddressConfig) {
return IA... | contract UsingConfig {
address private _config;
/**
* Initialize the argument as AddressConfig address.
*/
constructor(address _addressConfig) public {
_config = _addressConfig;
}
/**
* Returns the latest AddressConfig instance.
*/
function config() internal view returns (IAddressConfig) {
return IA... | 38,146 |
4 | // Lets a module admin set the royalty recipient for a particular token Id. | function setRoyaltyInfoForToken(
uint256 tokenId,
address recipient,
uint256 bps
) external;
| function setRoyaltyInfoForToken(
uint256 tokenId,
address recipient,
uint256 bps
) external;
| 650 |
89 | // If the current milestone is the last one, mark the initiative as completed | if (currentMilestone == initiative.milestones.length - 1) {
initiative.state = InitiativeState.COMPLETED;
emit InitiativeCompleted(_hash);
} else {
| if (currentMilestone == initiative.milestones.length - 1) {
initiative.state = InitiativeState.COMPLETED;
emit InitiativeCompleted(_hash);
} else {
| 51,674 |
61 | // Packing occurs on a single side of the diameter; if horizontal && !reflect then we have the effect of gravity having pulled on the circles to the bottom. | bool reflect;
| bool reflect;
| 39,153 |
48 | // if not, they get a legendary :( | return legendary[random % legendary.length];
| return legendary[random % legendary.length];
| 31,049 |
111 | // Bird's BErc20BIRDDelegator Contract BTokens which wrap an EIP-20 underlying and delegate to an implementation / | contract BErc20BIRDDelegator is BTokenInterface, BErc20Interface, BDelegatorInterface {
/**
* @notice Construct a new money market
* @param underlying_ The address of the underlying asset
* @param bController_ The address of the BController
* @param interestRateModel_ The address of the interest... | contract BErc20BIRDDelegator is BTokenInterface, BErc20Interface, BDelegatorInterface {
/**
* @notice Construct a new money market
* @param underlying_ The address of the underlying asset
* @param bController_ The address of the BController
* @param interestRateModel_ The address of the interest... | 14,948 |
1 | // is everything ok | require(campaign.deadline < block.timestamp,"The deadline should be in future.");
campaign.owner = _owner;
campaign.title = _title;
campaign.description = _description;
campaign.target = _target;
campaign.deadline = _deadline;
campaign.amountCollected = 0;
... | require(campaign.deadline < block.timestamp,"The deadline should be in future.");
campaign.owner = _owner;
campaign.title = _title;
campaign.description = _description;
campaign.target = _target;
campaign.deadline = _deadline;
campaign.amountCollected = 0;
... | 27,527 |
5 | // deposit into convex, receive a tokenized deposit.parameter to stake immediately (we always do this). | function deposit(
uint256 _pid,
uint256 _amount,
bool _stake
) external returns (bool);
| function deposit(
uint256 _pid,
uint256 _amount,
bool _stake
) external returns (bool);
| 17,345 |
246 | // Mapping to keep track of breeding Price | mapping(uint256 => uint256)internal _breedCount;
| mapping(uint256 => uint256)internal _breedCount;
| 50,422 |
20 | // get the sub-domain of an ENS nameFor example if the name is "foo.bar.eth", getENSSubdomain(b) returns "foo" / | function getENSSubdomain(
bytes memory b
| function getENSSubdomain(
bytes memory b
| 8,035 |
11 | // A checkpoint for marking balance | struct Checkpoint {
uint timestamp;
uint balanceOf;
}
| struct Checkpoint {
uint timestamp;
uint balanceOf;
}
| 33,165 |
1 | // An event thats emitted when the minter address is changed | event MinterChanged(address minter, address newMinter);
| event MinterChanged(address minter, address newMinter);
| 568 |
618 | // set current amount to amount of last stake | currentAmount = lastStake.amount;
| currentAmount = lastStake.amount;
| 33,689 |
146 | // pay the 101-500th | uint256 _win4 = _pot.mul(10).div(100).div(400);
for (uint256 k = _plyCtr.sub(499); k <= _plyCtr.sub(100); k++) {
plyr_[playOrders_[k]].win = _win4.add(plyr_[playOrders_[k]].win);
}
| uint256 _win4 = _pot.mul(10).div(100).div(400);
for (uint256 k = _plyCtr.sub(499); k <= _plyCtr.sub(100); k++) {
plyr_[playOrders_[k]].win = _win4.add(plyr_[playOrders_[k]].win);
}
| 8,575 |
122 | // Revert on overflow / Store reserves[n+1] = reserves[n] + actualAddAmount | totalReserves = totalReservesNew;
| totalReserves = totalReservesNew;
| 27,785 |
86 | // Allows Foundation to cancel an auction, refunding the bidder and returning the NFT to the seller.This should only be used for extreme cases such as DMCA takedown requests. The reason should always be provided. / | function adminCancelReserveAuction(uint256 auctionId, string memory reason) public onlyFoundationAdmin {
require(bytes(reason).length > 0, "NFTMarketReserveAuction: Include a reason for this cancellation");
ReserveAuction memory auction = auctionIdToAuction[auctionId];
require(auction.amount > 0, "NFTMark... | function adminCancelReserveAuction(uint256 auctionId, string memory reason) public onlyFoundationAdmin {
require(bytes(reason).length > 0, "NFTMarketReserveAuction: Include a reason for this cancellation");
ReserveAuction memory auction = auctionIdToAuction[auctionId];
require(auction.amount > 0, "NFTMark... | 57,267 |
14 | // Extracts Redstone's oracle values from calldata, verifying signaturesand timestamps, and reports it to the SortedOracles contract proposedTimestamp Timestamp that should be lesser or equal to eachtimestamp from the signed data packages in calldata locationsInSortedLinkedLists The array of locations in linked list fo... | function updatePriceValues(
uint256 proposedTimestamp,
LocationInSortedLinkedList[] calldata locationsInSortedLinkedLists
| function updatePriceValues(
uint256 proposedTimestamp,
LocationInSortedLinkedList[] calldata locationsInSortedLinkedLists
| 9,390 |
10 | // Investors can pull their own dividends _dividendIndex Dividend to pull / | function pullDividendPayment(uint256 _dividendIndex) public validDividendIndex(_dividendIndex)
| function pullDividendPayment(uint256 _dividendIndex) public validDividendIndex(_dividendIndex)
| 12,350 |
165 | // Allow to change the team multisig address in the case of emergency. This allows to save a deployed crowdsale wallet in the case the crowdsale has not yet begun(we have done only few test transactions). After the crowdsale is goingthen multisig address stays locked for the safety reasons. / | function setMultisig(address addr) public onlyOwner {
// Change
require(investorCount <= MAX_INVESTMENTS_BEFORE_MULTISIG_CHANGE);
multisigWallet = addr;
}
| function setMultisig(address addr) public onlyOwner {
// Change
require(investorCount <= MAX_INVESTMENTS_BEFORE_MULTISIG_CHANGE);
multisigWallet = addr;
}
| 38,571 |
43 | // if USD limit is lower than tokensUntilMC we apply USD limit | return (tokensAllowedToSellUSDLimit.div(1*10**18),tokensAllowedToSellUSDLimit);
| return (tokensAllowedToSellUSDLimit.div(1*10**18),tokensAllowedToSellUSDLimit);
| 781 |
25 | // Remove permission of the doctor | function RemoveDoctor(address _id) public {
uint index = FindDoctor(_id);
doctorsHospital[index].permission=false;
emit DeleteDoctor(doctorsHospital[index].idDoctor,
doctorsHospital[index].nameDoctor,
doctorsHospital[index].hospital,
doctorsHospital[index].permission)... | function RemoveDoctor(address _id) public {
uint index = FindDoctor(_id);
doctorsHospital[index].permission=false;
emit DeleteDoctor(doctorsHospital[index].idDoctor,
doctorsHospital[index].nameDoctor,
doctorsHospital[index].hospital,
doctorsHospital[index].permission)... | 30,444 |
36 | // Switch to Operational state. This is the only place this can happen. | funding = false;
| funding = false;
| 34,274 |
107 | // increase new representative | uint32 dstRepNum = numCheckpoints[dstRep];
uint256 dstRepOld = dstRepNum > 0 ? checkpoints[dstRep][dstRepNum - 1].votes : 0;
uint256 dstRepNew = dstRepOld.add(amount);
_writeCheckpoint(dstRep, dstRepNum, dstRepOld, dstRepNew);
| uint32 dstRepNum = numCheckpoints[dstRep];
uint256 dstRepOld = dstRepNum > 0 ? checkpoints[dstRep][dstRepNum - 1].votes : 0;
uint256 dstRepNew = dstRepOld.add(amount);
_writeCheckpoint(dstRep, dstRepNum, dstRepOld, dstRepNew);
| 1,235 |
19 | // These functions are used only once while creating any new uniswapV3 Pool | function addPoolAddress(address _poolAddress) external onlyOwner {
isPoolAddress[_poolAddress] = true;
}
| function addPoolAddress(address _poolAddress) external onlyOwner {
isPoolAddress[_poolAddress] = true;
}
| 1,772 |
336 | // This contract defines how sales and synthesis auctions for Kydys are created.VREX Lab Co., Ltd / | contract KydyAuction is KydySynthesis {
/**
* @dev The address of the Auction contract which handles ALL sales of Kydys, both user-generated and Generation 0.
*/
SaleAuction public saleAuction;
/**
* @dev The address of another Auction contract which handles synthesis auctions.
*/
... | contract KydyAuction is KydySynthesis {
/**
* @dev The address of the Auction contract which handles ALL sales of Kydys, both user-generated and Generation 0.
*/
SaleAuction public saleAuction;
/**
* @dev The address of another Auction contract which handles synthesis auctions.
*/
... | 71,396 |
3 | // {qRTok} The min value of total supply to use for redemption throttling The redemption capacity is always at least maxRedemptionChargeredemptionVirtualSupply | uint256 public redemptionVirtualSupply;
| uint256 public redemptionVirtualSupply;
| 31,501 |
6 | // xvalue -> yvaule -> address | mapping(uint256 => mapping(uint256 => address)) remintStateMap;
| mapping(uint256 => mapping(uint256 => address)) remintStateMap;
| 10,084 |
102 | // return 0 if exp(x) is tiny, using MIN_POWER = int(mp.floor(mp.log(mpf(1) / ONE)ONE)) | if (x <= -818323753292969962227)
return 0;
| if (x <= -818323753292969962227)
return 0;
| 20,459 |
120 | // Number of assets acquired by the FrAactionHub | uint256 public numberOfAssets;
| uint256 public numberOfAssets;
| 9,599 |
0 | // Index tokens from 1 | _tokenIdCounter.increment();
| _tokenIdCounter.increment();
| 43,406 |
7 | // sets nominal value of newly issued shares in euro, used to withdraw share capital to Nominee | uint256 public SHARE_NOMINAL_VALUE_EUR_ULPS;
| uint256 public SHARE_NOMINAL_VALUE_EUR_ULPS;
| 19,892 |
37 | // Calculate rent | uint256 rentalCostPerBlock = _getRentalPricePerBlock(_tokenId);
uint256 rentalCost = _numberOfBlocks * rentalCostPerBlock;
require(msg.value == rentalCost, "Frame: Incorrect payment");
| uint256 rentalCostPerBlock = _getRentalPricePerBlock(_tokenId);
uint256 rentalCost = _numberOfBlocks * rentalCostPerBlock;
require(msg.value == rentalCost, "Frame: Incorrect payment");
| 39,976 |
20 | // ================================ amount of shares for each address (scaled number) |
mapping(address => uint256) internal tokenBalanceLedger_ ;
mapping(address => uint256) internal mintingDepositsOf_;
mapping(address => uint256) internal amountCirculated_;
mapping(address => uint256) internal taxesFeeTotalWithdrawn_;
mapping(address => uint256) internal taxesPreviousWithdrawn_;... |
mapping(address => uint256) internal tokenBalanceLedger_ ;
mapping(address => uint256) internal mintingDepositsOf_;
mapping(address => uint256) internal amountCirculated_;
mapping(address => uint256) internal taxesFeeTotalWithdrawn_;
mapping(address => uint256) internal taxesPreviousWithdrawn_;... | 16,534 |
70 | // If no KCory exists, mint it 1:1 to the amount put in | if (totalShares == 0 || totalCory == 0) {
_mint(msg.sender, _amount);
}
| if (totalShares == 0 || totalCory == 0) {
_mint(msg.sender, _amount);
}
| 36,584 |
23 | // returns crowdsale min funding in Eth, low res | function fundingMinInEth() constant returns (uint256 fundingMinimumInEth) {
fundingMinimumInEth = safeDiv(fundingMinInWei,1 ether);
}
| function fundingMinInEth() constant returns (uint256 fundingMinimumInEth) {
fundingMinimumInEth = safeDiv(fundingMinInWei,1 ether);
}
| 11,998 |
13 | // Use to get the Permission flag related the `this` contract return Array of permission flags/ | function getPermissions() public view returns(bytes32[]) {
bytes32[] memory allPermissions = new bytes32[](1);
allPermissions[0] = CHANGE_PERMISSION;
return allPermissions;
}
| function getPermissions() public view returns(bytes32[]) {
bytes32[] memory allPermissions = new bytes32[](1);
allPermissions[0] = CHANGE_PERMISSION;
return allPermissions;
}
| 30,125 |
45 | // SafeMath Math operations with safety checks that throw on error SafeMath adapted for uint96 / | library SafeMathUint96 {
function mul(uint96 a, uint96 b) internal pure returns (uint96) {
uint96 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint96 a, uint96 b) internal pure returns (uint96) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint96... | library SafeMathUint96 {
function mul(uint96 a, uint96 b) internal pure returns (uint96) {
uint96 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint96 a, uint96 b) internal pure returns (uint96) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint96... | 47,174 |
174 | // the base uri for the token | string public baseURI;
mapping(address => bool) private _whitelisted;
mapping(address => bool) private _minted;
| string public baseURI;
mapping(address => bool) private _whitelisted;
mapping(address => bool) private _minted;
| 18,782 |
69 | // sets the contract address of the X Droids contract, / | function setXDroidsContract(address xDroidsAddressParam) external onlyOwner {
if (xDroidsAddressParam == address(0)) {
revert NullAddressParameter();
}
if (xDroidsContractAddress != address(0)) {
revert XDroidAddressChange();
}
xDroidsContractAddress ... | function setXDroidsContract(address xDroidsAddressParam) external onlyOwner {
if (xDroidsAddressParam == address(0)) {
revert NullAddressParameter();
}
if (xDroidsContractAddress != address(0)) {
revert XDroidAddressChange();
}
xDroidsContractAddress ... | 17,513 |
147 | // Tells the address of the owner return the address of the owner/ | function proxyOwner() public view returns (address owner) {
bytes32 position = proxyOwnerPosition;
assembly {
owner := sload(position)
}
}
| function proxyOwner() public view returns (address owner) {
bytes32 position = proxyOwnerPosition;
assembly {
owner := sload(position)
}
}
| 9,215 |
17 | // Calculate the available TWAP interval. | uint256 availableTwapInterval = block.timestamp - oldestAvailableAge;
| uint256 availableTwapInterval = block.timestamp - oldestAvailableAge;
| 41,138 |
138 | // / | uint pricePerShare = CURVE_POOL.get_virtual_price();
uint shares = bal.mul(MUL).mul(1e18).div(pricePerShare);
uint min = shares.mul(SLIP_MAX - slip) / SLIP_MAX;
ZAP.add_liquidity(amounts, min);
| uint pricePerShare = CURVE_POOL.get_virtual_price();
uint shares = bal.mul(MUL).mul(1e18).div(pricePerShare);
uint min = shares.mul(SLIP_MAX - slip) / SLIP_MAX;
ZAP.add_liquidity(amounts, min);
| 4,758 |
100 | // If there were less eth blocks passed in time than expected | if (ethBlocksSinceLastDifficultyPeriod < targetEthBlocksPerDiffPeriod) {
| if (ethBlocksSinceLastDifficultyPeriod < targetEthBlocksPerDiffPeriod) {
| 36,550 |
523 | // increase the total borrows by the compounded interest | reserve.increaseTotalBorrowsStableAndUpdateAverageRate(
_balanceIncrease,
user.stableBorrowRate
);
| reserve.increaseTotalBorrowsStableAndUpdateAverageRate(
_balanceIncrease,
user.stableBorrowRate
);
| 16,395 |
17 | // for RES in range(NUM_RESOURCES) | counts[$$(RES)] = _blockStats[$$(RES)].count;
scores[$$(RES)] = _blockStats[$$(RES)].score;
productions[$$(RES)] = _blockStats[$$(RES)].production;
| counts[$$(RES)] = _blockStats[$$(RES)].count;
scores[$$(RES)] = _blockStats[$$(RES)].score;
productions[$$(RES)] = _blockStats[$$(RES)].production;
| 15,424 |
52 | // Checks if left Exp <= right Exp. / | function lessThanOrEqualExp(Exp memory left, Exp memory right) pure internal returns (bool) {
return left.mantissa <= right.mantissa;
}
| function lessThanOrEqualExp(Exp memory left, Exp memory right) pure internal returns (bool) {
return left.mantissa <= right.mantissa;
}
| 871 |
152 | // Behavior has changed to match OpenZeppelin's `ERC20Burnable.burn(uint256 amount)`/Destoys `amount` tokens from `msg.sender`, reducing the total supply.// Emits a `Transfer` event with `to` set to the zero address./ Requirements:/ - `account` must have at least `amount` tokens. | function mint(uint256 _value) external returns (bool ok);
| function mint(uint256 _value) external returns (bool ok);
| 32,890 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.