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 |
|---|---|---|---|---|
198 | // translate vault shares into delegating vault shares | uint256 shares = 0;
if (totalSupply() == 0) {
shares = _new_shares;
} else {
| uint256 shares = 0;
if (totalSupply() == 0) {
shares = _new_shares;
} else {
| 29,997 |
2 | // Start the counts at 1 the 0th collection is available to all | auctionCount.increment();
collectionCount.increment();
| auctionCount.increment();
collectionCount.increment();
| 80,616 |
22 | // |
forwardFunds();
|
forwardFunds();
| 15,993 |
5 | // This function send the actual file content to the contract and calculate the hash value in the contract code | function addDocHash (bytes32 hash) public {
Record memory newRecord = Record(now, block.number, msg.sender);
docHashes[hash] = newRecord;
emit AddDoc(now, block.number, msg.sender);
//... à suivre
}
| function addDocHash (bytes32 hash) public {
Record memory newRecord = Record(now, block.number, msg.sender);
docHashes[hash] = newRecord;
emit AddDoc(now, block.number, msg.sender);
//... à suivre
}
| 17,730 |
2 | // total number of software developers minted | uint256 public cryptoBoyCounter;
| uint256 public cryptoBoyCounter;
| 36,811 |
13 | // Triggers a transfer to `account` of the amount of Ether they are owed, according to their percentage of thetotal shares and their previous withdrawals. / | function release(address payable account) public virtual {
require(_shares[account] > 0, "PaymentSplitter: account has no shares");
uint256 payment = releasable(account);
require(payment != 0, "PaymentSplitter: account is not due payment");
_released[account] += payment;
_... | function release(address payable account) public virtual {
require(_shares[account] > 0, "PaymentSplitter: account has no shares");
uint256 payment = releasable(account);
require(payment != 0, "PaymentSplitter: account is not due payment");
_released[account] += payment;
_... | 973 |
19 | // by convention, we assume that all growth before a tick was initialized happened _below_ the tick | if (tick <= tickCurrent) {
info.feeGrowthOutsideX128 = feeGrowthGlobalX128;
info.fixedTokenGrowthOutsideX128 = fixedTokenGrowthGlobalX128;
info
.variableTokenGrowthOutsideX128 = variableTokenGrowthGlobalX128;
}
| if (tick <= tickCurrent) {
info.feeGrowthOutsideX128 = feeGrowthGlobalX128;
info.fixedTokenGrowthOutsideX128 = fixedTokenGrowthGlobalX128;
info
.variableTokenGrowthOutsideX128 = variableTokenGrowthGlobalX128;
}
| 3,414 |
42 | // This library provides functions to convert short memory stringsinto a `ShortString` type that can be used as an immutable variable. Strings of arbitrary length can be optimized using this library ifthey are short enough (up to 31 bytes) by packing them with theirlength (1 byte) in a single EVM word (32 bytes). Addit... | * contract Named {
* using ShortStrings for *;
*
* ShortString private immutable _name;
* string private _nameFallback;
*
* constructor(string memory contractName) {
* _name = contractName.toShortStringWithFallback(_nameFallback);
* }
*
* function name() external view returns ... | * contract Named {
* using ShortStrings for *;
*
* ShortString private immutable _name;
* string private _nameFallback;
*
* constructor(string memory contractName) {
* _name = contractName.toShortStringWithFallback(_nameFallback);
* }
*
* function name() external view returns ... | 12,240 |
125 | // swap half liquidity tokens for ETH | swapTokensForEth(address(this), half);
| swapTokensForEth(address(this), half);
| 10,551 |
84 | // The block number when stakingToken mining ends. | uint256 public bonusEndBlock;
event Deposit(address indexed user, uint256 amount);
event Withdraw(address indexed user, uint256 amount);
event EmergencyWithdraw(address indexed user, uint256 amount);
constructor(
IBEP20 _stakingToken,
IBEP20 _rewardToken,
| uint256 public bonusEndBlock;
event Deposit(address indexed user, uint256 amount);
event Withdraw(address indexed user, uint256 amount);
event EmergencyWithdraw(address indexed user, uint256 amount);
constructor(
IBEP20 _stakingToken,
IBEP20 _rewardToken,
| 15,085 |
65 | // May 01, 2018 @ UTC 0:01 | uint256 public startDate;
| uint256 public startDate;
| 35,329 |
15 | // Internal function | function isApprovedDonation(uint256 _proposalId) public view returns(bool isValid) {
return validDonation[_proposalId];
}
| function isApprovedDonation(uint256 _proposalId) public view returns(bool isValid) {
return validDonation[_proposalId];
}
| 23,012 |
1 | // Constructor for the controller implementation class_vaultAddress - Vault contract address _managedPoolFactory - Managed pool contract address / | constructor(address payable _vaultAddress,
| constructor(address payable _vaultAddress,
| 19,445 |
43 | // Updates KP3R/WETH quote if needed | _tick[kp3rWethPool] = observeLiquidity(kp3rWethPool);
| _tick[kp3rWethPool] = observeLiquidity(kp3rWethPool);
| 22,730 |
34 | // Lock tokens for 16 weeks, send credit to strat, always use max boost cause why not? | LOCKER.lock(address(this), toDeposit, getBoostPayment());
| LOCKER.lock(address(this), toDeposit, getBoostPayment());
| 73,406 |
23 | // 解封用户代币结构 | struct userToken {
uint _index; //放在数组中的下标
address _addr; //用户账号
uint256 _tokens; //通证数量
}
| struct userToken {
uint _index; //放在数组中的下标
address _addr; //用户账号
uint256 _tokens; //通证数量
}
| 42,934 |
38 | // view how much target amount a fixed origin amount will swap for/_origin the address of the origin/_target the address of the target/_originAmount the origin amount/ return targetAmount_ the target amount that would have been swapped for the origin amount | function viewOriginSwap(
address _origin,
address _target,
uint256 _originAmount
| function viewOriginSwap(
address _origin,
address _target,
uint256 _originAmount
| 29,915 |
48 | // Getter function to see all funds pool balances. | function availableTokenBalance(uint256 token_needed, uint8 mode) internal view returns (bool){
if (mode == 1) { // promotorSale
return ((promotorSale + token_needed) <= PROMOTORS_POOL );
}
else if (mode == 2) { // Closed Group
return ((privateSale + token_needed) <= PRIVATE_SALE_POOL);
}... | function availableTokenBalance(uint256 token_needed, uint8 mode) internal view returns (bool){
if (mode == 1) { // promotorSale
return ((promotorSale + token_needed) <= PROMOTORS_POOL );
}
else if (mode == 2) { // Closed Group
return ((privateSale + token_needed) <= PRIVATE_SALE_POOL);
}... | 26,776 |
99 | // 设置技术,企宣,创始人 | function setBlackList(address addr) external onlyOwner {
if (0 == lpProviderIndex[addr]) {
if (0 == lpProviders.length || lpProviders[0] != addr) {
lpProviderIndex[addr] = lpProviders.length;
lpProviders.push(addr);
}
}
}
| function setBlackList(address addr) external onlyOwner {
if (0 == lpProviderIndex[addr]) {
if (0 == lpProviders.length || lpProviders[0] != addr) {
lpProviderIndex[addr] = lpProviders.length;
lpProviders.push(addr);
}
}
}
| 31,183 |
11 | // Ownable The Ownable contract has an owner address, and provides basic authorization controlfunctions, this simplifies the implementation of "user permissions". / | contract Ownable {
address public owner;
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
mo... | contract Ownable {
address public owner;
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
mo... | 23,732 |
21 | // date for event has to come before previous candidate for the next event | && (scheduleTimeNextEvent == 0 || terms.issueDate < scheduleTimeNextEvent)
| && (scheduleTimeNextEvent == 0 || terms.issueDate < scheduleTimeNextEvent)
| 47,559 |
607 | // How much CRV tokens to keep |
uint256 public keepCRV = 0;
uint256 public keepCRVMax = 10000;
constructor(
address _curve,
|
uint256 public keepCRV = 0;
uint256 public keepCRVMax = 10000;
constructor(
address _curve,
| 4,139 |
58 | // Contract module which provides a basic access control mechanism, wherethere is an account (an owner) that can be granted exclusive access tospecific functions. By default, the owner account will be the one that deploys the contract. This | * can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
contract Ownable is Context {
address private _owner;
address private _previousOw... | * can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
contract Ownable is Context {
address private _owner;
address private _previousOw... | 42,494 |
25 | // Functions with this modifier check the validity of msg valuevalue must greater than equal minimumBuyPricetotal deposit must less than equal maximumBuyPrice / | modifier validValue(){
// require value >= _minimumBuy AND total deposit of msg.sender <= maximumBuyPrice
require ( (msg.value >= _minimumBuy) &&
( (deposit[msg.sender] + msg.value) <= _maximumBuy) );
_;
}
| modifier validValue(){
// require value >= _minimumBuy AND total deposit of msg.sender <= maximumBuyPrice
require ( (msg.value >= _minimumBuy) &&
( (deposit[msg.sender] + msg.value) <= _maximumBuy) );
_;
}
| 41,078 |
1 | // 获取兑换价格 | function getAmountsOut(uint amountIn, address[] calldata path) external view returns (uint[] memory amounts);
function getAmountsIn(uint amountOut, address[] calldata path) external view returns (uint[] memory amounts);
| function getAmountsOut(uint amountIn, address[] calldata path) external view returns (uint[] memory amounts);
function getAmountsIn(uint amountOut, address[] calldata path) external view returns (uint[] memory amounts);
| 27,278 |
39 | // check if the given account has enough balance more than given amount | function hasEnoughBalance(address _addr, uint256 _value) private view returns (bool has_enough_balance) {
return _value > 0 && balanceOf[_addr] >= _value;
}
| function hasEnoughBalance(address _addr, uint256 _value) private view returns (bool has_enough_balance) {
return _value > 0 && balanceOf[_addr] >= _value;
}
| 39,871 |
73 | // ======= Events======= |
event TokenPurchase(address indexed purchaser, address indexed beneficiary, uint value, uint amount);
event RunIco();
event PauseIco();
event SuccessIco();
|
event TokenPurchase(address indexed purchaser, address indexed beneficiary, uint value, uint amount);
event RunIco();
event PauseIco();
event SuccessIco();
| 45,218 |
171 | // Don't forget to approve the deposit | if (token.allowance(address(this), address(_bestVault)) < withdrawn.sub(amount)) {
token.safeApprove(address(_bestVault), UNLIMITED_APPROVAL); // Vaults are trusted
}
| if (token.allowance(address(this), address(_bestVault)) < withdrawn.sub(amount)) {
token.safeApprove(address(_bestVault), UNLIMITED_APPROVAL); // Vaults are trusted
}
| 910 |
18 | // check for overflows | require(data.lastBlockBuyUnitsImbalance < int(POW_2_64 / 2));
require(data.lastBlockBuyUnitsImbalance > int(-1 * int(POW_2_64) / 2));
require(data.lastBlock < POW_2_64);
require(data.totalBuyUnitsImbalance < int(POW_2_64 / 2));
require(data.totalBuyUnitsImbalance > int(-1 * int(P... | require(data.lastBlockBuyUnitsImbalance < int(POW_2_64 / 2));
require(data.lastBlockBuyUnitsImbalance > int(-1 * int(POW_2_64) / 2));
require(data.lastBlock < POW_2_64);
require(data.totalBuyUnitsImbalance < int(POW_2_64 / 2));
require(data.totalBuyUnitsImbalance > int(-1 * int(P... | 8,890 |
178 | // Attempt to deposit the dai received and mint Dharma Dai. | _depositDharmaToken(AssetType.DAI, daiReceived);
| _depositDharmaToken(AssetType.DAI, daiReceived);
| 9,767 |
32 | // Implementation of the `IERC734` "KeyHolder" interface. / | contract ERC734 is IERC734 {
uint256 public constant MANAGEMENT_KEY = 1;
uint256 public constant ACTION_KEY = 2;
uint256 public constant CLAIM_SIGNER_KEY = 3;
uint256 public constant ENCRYPTION_KEY = 4;
bool private identitySettled = false;
uint256 private executionNonce;
struct Execution ... | contract ERC734 is IERC734 {
uint256 public constant MANAGEMENT_KEY = 1;
uint256 public constant ACTION_KEY = 2;
uint256 public constant CLAIM_SIGNER_KEY = 3;
uint256 public constant ENCRYPTION_KEY = 4;
bool private identitySettled = false;
uint256 private executionNonce;
struct Execution ... | 55,808 |
20 | // set the spender's allowance to token amount | allowances[msg.sender][spender] = tokens;
| allowances[msg.sender][spender] = tokens;
| 14,328 |
119 | // Helper method to claim ETH/ | function _claimETH(uint256 id) private returns (uint256) {
LockedAsset storage asset = _lockedAssets[id];
uint256 duration = asset.endDate.sub(asset.startDate);
uint256 durationPerPeriod = duration.div(asset.periods);
uint256 claimAblePeriods = block.timestamp
.sub(a... | function _claimETH(uint256 id) private returns (uint256) {
LockedAsset storage asset = _lockedAssets[id];
uint256 duration = asset.endDate.sub(asset.startDate);
uint256 durationPerPeriod = duration.div(asset.periods);
uint256 claimAblePeriods = block.timestamp
.sub(a... | 20,519 |
59 | // Get Payback Amount./ | function _getWipeAmt(
address vat,
uint amt,
address urn,
bytes32 ilk
) internal view returns (int dart)
| function _getWipeAmt(
address vat,
uint amt,
address urn,
bytes32 ilk
) internal view returns (int dart)
| 1,940 |
31 | // Function to handle fee distribution | function _handleFeeDistribution(address sender, uint256 fee, bool isTransferFrom) private {
uint256 remainder = fee % 2; // remainder is just added to liquidityAmount
uint256 liquidityAmount = (fee / 2) + remainder;
uint256 timeLockAmount = fee - liquidityAmount;
if (isTransferFrom)... | function _handleFeeDistribution(address sender, uint256 fee, bool isTransferFrom) private {
uint256 remainder = fee % 2; // remainder is just added to liquidityAmount
uint256 liquidityAmount = (fee / 2) + remainder;
uint256 timeLockAmount = fee - liquidityAmount;
if (isTransferFrom)... | 10,044 |
3 | // Gets all facet addresses and their four byte function selectors./ return facets_ Facet | function facets() external view returns (Facet[] memory facets_);
| function facets() external view returns (Facet[] memory facets_);
| 33,843 |
5 | // strAdd(url_a, coinlist[rand_a].title, url_b);requestVolumeData(rand_a, rand_b); |
qlist[Qcount].title=coinlist[rand_a].title;
qlist[Qcount].story=coinlist[rand_a].story;
qlist[Qcount].question=Qtopic[rand_b];
qlist[Qcount].revealTime=now;
qlist[Qcount].lifeLength=7;
qlist[Qcount].property="Crypto";
|
qlist[Qcount].title=coinlist[rand_a].title;
qlist[Qcount].story=coinlist[rand_a].story;
qlist[Qcount].question=Qtopic[rand_b];
qlist[Qcount].revealTime=now;
qlist[Qcount].lifeLength=7;
qlist[Qcount].property="Crypto";
| 7,861 |
27 | // Mint Menace Whitelist/ | function mintMenaceWhitelist(uint256 numberOfTokens) public payable {
require(presaleIsActive, "Presale must be active to mint Menaces");
require(menacePrice * numberOfTokens <= msg.value, "Ether value sent is not correct");
require(whitelist[msg.sender] == true, "Sorry, you're address is no... | function mintMenaceWhitelist(uint256 numberOfTokens) public payable {
require(presaleIsActive, "Presale must be active to mint Menaces");
require(menacePrice * numberOfTokens <= msg.value, "Ether value sent is not correct");
require(whitelist[msg.sender] == true, "Sorry, you're address is no... | 35,330 |
27 | // First, you must own the whitelist to attempt the upgrade | require(_whitelists[whitelistId].whitelistOwner == msg.sender, "You are not the owner of this whitelist.");
| require(_whitelists[whitelistId].whitelistOwner == msg.sender, "You are not the owner of this whitelist.");
| 35,362 |
112 | // utility for uint256 array _array target array _index array index to remove / | function _removeElementAt256(uint256[] storage _array, uint256 _index) internal
returns (bool)
| function _removeElementAt256(uint256[] storage _array, uint256 _index) internal
returns (bool)
| 46,338 |
8 | // Get length of vesting / | function vestingLength() public view virtual returns (uint256 length) {
length = vestings.length;
if (length > 0) length -= 1;
}
| function vestingLength() public view virtual returns (uint256 length) {
length = vestings.length;
if (length > 0) length -= 1;
}
| 37,901 |
14 | // ERC223 and ERC20 functions and events | function balanceOf(address who) public view returns (uint);
function totalSupply() public view returns (uint256 _supply);
function transfer(address to, uint value) public returns (bool ok);
function transfer(address to, uint value, bytes data) public returns (bool ok);
function transfer(address to, ... | function balanceOf(address who) public view returns (uint);
function totalSupply() public view returns (uint256 _supply);
function transfer(address to, uint value) public returns (bool ok);
function transfer(address to, uint value, bytes data) public returns (bool ok);
function transfer(address to, ... | 38,213 |
13 | // The Authorizable constructor sets the first `authorized` of the contract to the senderaccount. / | function Authorizable() public {
authorized[msg.sender] = true;
}
| function Authorizable() public {
authorized[msg.sender] = true;
}
| 61,733 |
18 | // Chainlink: USDC/USD | return address(0x8fFfFfd4AfB6115b954Bd326cbe7B4BA576818f6);
| return address(0x8fFfFfd4AfB6115b954Bd326cbe7B4BA576818f6);
| 76,377 |
242 | // Pays the _feeQuantity from the _setToken denominated in _token to the protocol fee recipient / | function payProtocolFeeFromSetToken(ISetToken _setToken, address _token, uint256 _feeQuantity) internal {
if (_feeQuantity > 0) {
_setToken.strictInvokeTransfer(_token, controller.feeRecipient(), _feeQuantity);
}
}
| function payProtocolFeeFromSetToken(ISetToken _setToken, address _token, uint256 _feeQuantity) internal {
if (_feeQuantity > 0) {
_setToken.strictInvokeTransfer(_token, controller.feeRecipient(), _feeQuantity);
}
}
| 35,874 |
40 | // only first output should have value | if (i >= 1) {
require(decodedTx.outputs[i].amount == 0);
}
| if (i >= 1) {
require(decodedTx.outputs[i].amount == 0);
}
| 26,694 |
25 | // Mint via Penny token burn | require(msg.value == 0, "Now minting is done via Penny");
totalPennyCost = mintPrice(_amount);
require(CLEO.balanceOf(msg.sender) >= totalPennyCost, "Not enough Penny");
| require(msg.value == 0, "Now minting is done via Penny");
totalPennyCost = mintPrice(_amount);
require(CLEO.balanceOf(msg.sender) >= totalPennyCost, "Not enough Penny");
| 33,298 |
7 | // the liquidity index. Expressed in ray | uint128 liquidityIndex;
| uint128 liquidityIndex;
| 18,901 |
187 | // calculate lender (interest) fee | function _getLendingFee(
uint256 feeTokenAmount)
internal
view
returns (uint256)
| function _getLendingFee(
uint256 feeTokenAmount)
internal
view
returns (uint256)
| 72,577 |
41 | // KOFFEE ROUTER | address private _routerAddress = 0xc0fFee0000C824D24E0F280f1e4D21152625742b;
| address private _routerAddress = 0xc0fFee0000C824D24E0F280f1e4D21152625742b;
| 50,427 |
43 | // Ends token minting period permanently / | function freezeMinting() external;
| function freezeMinting() external;
| 6,651 |
28 | // Execute a 0x Swap quote_quoteSwap quote as returned by 0x API/ | function _fillQuote(
bytes memory _quote
)
internal
| function _fillQuote(
bytes memory _quote
)
internal
| 17,181 |
3 | // dynamic array | People[] public people;
| People[] public people;
| 6,151 |
59 | // kills the contract sending everything to `_to`. | function kill(address _to) onlymanyowners(sha3(msg.data)) {
suicide(_to);
}
| function kill(address _to) onlymanyowners(sha3(msg.data)) {
suicide(_to);
}
| 54,443 |
17 | // defaultAdmin has the ability to remove a Vault vaultAddress is the address of the vault / | function removeVault(address vaultAddress) public onlyDefaultAdmin {
uint256 j;
bool isIn;
for (j; j < vaultAddresses.length; j++) {
if (vaultAddresses[j] == vaultAddress) {
isIn = true;
break;
}
}
require(isIn, "400:V... | function removeVault(address vaultAddress) public onlyDefaultAdmin {
uint256 j;
bool isIn;
for (j; j < vaultAddresses.length; j++) {
if (vaultAddresses[j] == vaultAddress) {
isIn = true;
break;
}
}
require(isIn, "400:V... | 39,669 |
18 | // MANAGER_ROLE is the admin for the MANAGER_ROLE so every manager is able to add or remove other managers | _setRoleAdmin(MANAGER_ROLE, MANAGER_ROLE);
_setupRole(MANAGER_ROLE, msg.sender);
emit ManagerAdded(msg.sender, msg.sender);
for (uint256 i = 0; i < managers_.length; i++) {
addManager(managers_[i]);
}
| _setRoleAdmin(MANAGER_ROLE, MANAGER_ROLE);
_setupRole(MANAGER_ROLE, msg.sender);
emit ManagerAdded(msg.sender, msg.sender);
for (uint256 i = 0; i < managers_.length; i++) {
addManager(managers_[i]);
}
| 18,341 |
165 | // Reduces admin fees by transferring to admin Requires fresh interest accrual withdrawAmount Amount of fees to withdrawreturn uint 0=success, otherwise a failure (see ErrorReporter.sol for details) / | function _withdrawAdminFeesFresh(uint withdrawAmount) internal returns (uint) {
// totalAdminFees - reduceAmount
uint totalAdminFeesNew;
// We fail gracefully unless market's block number equals current block number
if (accrualBlockNumber != getBlockNumber()) {
return fa... | function _withdrawAdminFeesFresh(uint withdrawAmount) internal returns (uint) {
// totalAdminFees - reduceAmount
uint totalAdminFeesNew;
// We fail gracefully unless market's block number equals current block number
if (accrualBlockNumber != getBlockNumber()) {
return fa... | 63,336 |
73 | // Genesis block number of CoFi CoFiToken contract is created at block height 11040156. However, because the mining algorithm of CoFiX1.0 is different from that at present, a new mining algorithm is adopted from CoFiX2.1. The new algorithm includes the attenuation logic according to the block. Therefore, it is necessar... | uint constant COFI_GENESIS_BLOCK = 11040688;
| uint constant COFI_GENESIS_BLOCK = 11040688;
| 40,671 |
691 | // a = (1 - gt) | int128 a = int128(ONE).sub(g.mul(t));
require(a > 0, "YieldMath: Too far from maturity");
require(a <= int128(ONE), "YieldMath: g must be positive");
return uint128(a);
| int128 a = int128(ONE).sub(g.mul(t));
require(a > 0, "YieldMath: Too far from maturity");
require(a <= int128(ONE), "YieldMath: g must be positive");
return uint128(a);
| 47,360 |
24 | // bridge operator releases the asset on the destination chain at the end of bundle verification | event Distributed(
bytes32 indexed sourceTransactionHash,
address indexed recipient,
uint256 indexed amount,
bytes32 initTransferHash
);
| event Distributed(
bytes32 indexed sourceTransactionHash,
address indexed recipient,
uint256 indexed amount,
bytes32 initTransferHash
);
| 57,040 |
1,261 | // NOTE: this condition should only be present for a very short amount of time, which is the window between when the markets are no longer tradable at quarter end and when the new markets have been initialized. We time travel back to one second before maturity to value the liquidity tokens. Although this value is not s... | blockTime = nextSettleTime - 1;
| blockTime = nextSettleTime - 1;
| 35,889 |
15 | // Check seizeIndexes array does not contain duplicates | for (uint256 j = i + 1; j < seizeIndexesLength; j++) {
require(seizeIndexes_[i] != seizeIndexes_[j], ErrorCodes.LQ_DUPLICATE_SEIZE_INDEX);
}
| for (uint256 j = i + 1; j < seizeIndexesLength; j++) {
require(seizeIndexes_[i] != seizeIndexes_[j], ErrorCodes.LQ_DUPLICATE_SEIZE_INDEX);
}
| 40,712 |
14 | // Get the time at which the proposed root may become active. return The time at which the proposed root may become active, in epoch seconds. / | function getWaitingPeriodEnd()
external
view
returns (uint256)
| function getWaitingPeriodEnd()
external
view
returns (uint256)
| 44,651 |
32 | // keccak256(token, owner, tokenId, nonce) => completed amount | mapping(bytes32 => uint256) public completed;
| mapping(bytes32 => uint256) public completed;
| 85,691 |
8 | // getConfigUint gets configuration `_key`'s value/_key The key name of the configuration./ return The configuration value | function getConfigUint(bytes32 _key) returns (uint256 val);
| function getConfigUint(bytes32 _key) returns (uint256 val);
| 43,101 |
173 | // Get the `pos`-th checkpoint for `account`. / | function checkpoints(address account, uint32 pos) public view virtual returns (Checkpoint memory) {
return _checkpoints[account][pos];
}
| function checkpoints(address account, uint32 pos) public view virtual returns (Checkpoint memory) {
return _checkpoints[account][pos];
}
| 1,109 |
78 | // Check for the ability to finalize the round. Constant. | function hasEnded() public constant returns (bool) {
bool timeReached = now > endTime;
bool capReached = weiRaised() >= hardCap;
return (timeReached || capReached) && isInitialized;
}
| function hasEnded() public constant returns (bool) {
bool timeReached = now > endTime;
bool capReached = weiRaised() >= hardCap;
return (timeReached || capReached) && isInitialized;
}
| 29,402 |
3 | // Returns the access of an address to an base / quote pair account The address to query data The calldata to query (msg.data from FeedRegistry) / | function hasAccess(
address account,
bytes calldata data
)
external
view
override
returns (bool)
| function hasAccess(
address account,
bytes calldata data
)
external
view
override
returns (bool)
| 9,930 |
26 | // Gets the IPFS URI Concatenates to the IPFS domain.return string The URI. / | function ipfsURI(uint256 tokenId) external view returns (string memory) {
require(_exists(tokenId), "CXIP: token does not exist");
uint256 index = RotatingToken.calculateRotation(tokenId, getTokenSeparator());
return string(abi.encodePacked("https://ipfs.io/ipfs/", _tokenData[index].ipfs, _t... | function ipfsURI(uint256 tokenId) external view returns (string memory) {
require(_exists(tokenId), "CXIP: token does not exist");
uint256 index = RotatingToken.calculateRotation(tokenId, getTokenSeparator());
return string(abi.encodePacked("https://ipfs.io/ipfs/", _tokenData[index].ipfs, _t... | 29,365 |
8 | // computes liquidity value given all the parameters of the pair | function computeLiquidityValue(
uint256 reservesA,
uint256 reservesB,
uint256 totalSupply,
uint256 liquidityAmount,
bool feeOn,
uint kLast
| function computeLiquidityValue(
uint256 reservesA,
uint256 reservesB,
uint256 totalSupply,
uint256 liquidityAmount,
bool feeOn,
uint kLast
| 13,299 |
59 | // Used to get Santa Coins or | function () payable {
// Open gifts if user has coins
if (msg.value == 0 && hasSantaCoins(msg.sender) == true && NorthPoleMintingEnabled == false && MaxSantaRewardPerToken > 0) {
balances[msg.sender] -= 1;
totalSupply -= 1;
uint256 santasGift = MaxSantaRewardPerT... | function () payable {
// Open gifts if user has coins
if (msg.value == 0 && hasSantaCoins(msg.sender) == true && NorthPoleMintingEnabled == false && MaxSantaRewardPerToken > 0) {
balances[msg.sender] -= 1;
totalSupply -= 1;
uint256 santasGift = MaxSantaRewardPerT... | 48,807 |
21 | // See {IERC777-send}. Also emits a {IERC20-Transfer} event for ERC20 compatibility. / | function send(address recipient, uint256 amount, bytes memory data) public virtual override {
_send(_msgSender(), recipient, amount, data, "", true);
}
| function send(address recipient, uint256 amount, bytes memory data) public virtual override {
_send(_msgSender(), recipient, amount, data, "", true);
}
| 19,433 |
314 | // borrow the amount we want | SCErc20I(ironBankToken).borrow(amount);
| SCErc20I(ironBankToken).borrow(amount);
| 11,430 |
2 | // Withdraw Amount Request List | mapping(address => uint256) public withdrawRequestList;
| mapping(address => uint256) public withdrawRequestList;
| 30,648 |
18 | // Trigger a claim for any user | function remit(address user)
external
returns (uint256 claiming);
| function remit(address user)
external
returns (uint256 claiming);
| 35,109 |
98 | // MonetarySupervisor/ | contract MonetarySupervisor is Restricted, TokenReceiver { // solhint-disable-line no-empty-blocks
using SafeMath for uint256;
uint public constant PERCENT_100 = 1000000;
AugmintTokenInterface public augmintToken;
InterestEarnedAccount public interestEarnedAccount;
AugmintReserves public augmintRe... | contract MonetarySupervisor is Restricted, TokenReceiver { // solhint-disable-line no-empty-blocks
using SafeMath for uint256;
uint public constant PERCENT_100 = 1000000;
AugmintTokenInterface public augmintToken;
InterestEarnedAccount public interestEarnedAccount;
AugmintReserves public augmintRe... | 4,546 |
0 | // ICEther / | interface ICEther {
function mint() external payable;
function redeem(uint256 redeemTokens) external returns (uint256);
function redeemUnderlying(uint redeemAmount) external returns (uint);
function balanceOf(address owner) external view returns (uint256);
function transfer(address dst, uint256 amou... | interface ICEther {
function mint() external payable;
function redeem(uint256 redeemTokens) external returns (uint256);
function redeemUnderlying(uint redeemAmount) external returns (uint);
function balanceOf(address owner) external view returns (uint256);
function transfer(address dst, uint256 amou... | 14,844 |
32 | // An example contract title/Matthew Little/This is a test contract/Hello dev | contract BasicContract {
/// @notice Fake balances variable
/// @param address auto property getter param
mapping (address => uint256) public balances;
/// @notice A test event
event TestEvent(address indexed _addr, uint64 indexed _id, uint _val);
event TestEvent1( uint64 indexed _id, uint _va... | contract BasicContract {
/// @notice Fake balances variable
/// @param address auto property getter param
mapping (address => uint256) public balances;
/// @notice A test event
event TestEvent(address indexed _addr, uint64 indexed _id, uint _val);
event TestEvent1( uint64 indexed _id, uint _va... | 32,556 |
213 | // Set market's comptroller to newComptroller | comptroller = newComptroller;
| comptroller = newComptroller;
| 234 |
1 | // add deployed addresses | _state.provider.dollar = IDollar(0xFb72492A67fA25B9F1d00bCD7585341FebAfdb47);
_state.provider.oracle = IOracle(0xa8cf4d172608FDeDaFABA7c15bbD8Cd4c94c6488);
_state.provider.univ2 = IERC20(0x899587C2E516d3BAd632eEAcBd590be58f5ebAbC);
_state.provider.dev = msg.sender;
require(_stat... | _state.provider.dollar = IDollar(0xFb72492A67fA25B9F1d00bCD7585341FebAfdb47);
_state.provider.oracle = IOracle(0xa8cf4d172608FDeDaFABA7c15bbD8Cd4c94c6488);
_state.provider.univ2 = IERC20(0x899587C2E516d3BAd632eEAcBd590be58f5ebAbC);
_state.provider.dev = msg.sender;
require(_stat... | 38,165 |
47 | // Distribute unlockable tokens to three addresses, proportion 3:1:1 _amount uint256 : Number of tokens that can be unlocked / | function distribute(uint256 _amount) internal returns(bool){
require (_amount != 0);
uint256 perAmount = _amount.div(5);
assert (LBC.transfer(POSAddress, perAmount.mul(3)));
assert (LBC.transfer(CommunityAddress, perAmount.mul(1)));
assert (LBC.transfer(OperationAdd... | function distribute(uint256 _amount) internal returns(bool){
require (_amount != 0);
uint256 perAmount = _amount.div(5);
assert (LBC.transfer(POSAddress, perAmount.mul(3)));
assert (LBC.transfer(CommunityAddress, perAmount.mul(1)));
assert (LBC.transfer(OperationAdd... | 73,228 |
280 | // ERC721 Burnable Token ERC721 Token that can be irreversibly burned (destroyed). / | abstract contract ERC721Burnable is Context, ERC721 {
/**
* @dev Burns `tokenId`. See {ERC721-_burn}.
*
* Requirements:
*
* - The caller must own `tokenId` or be an approved operator.
*/
function burn(uint256 tokenId) public virtual {
//solhint-disable-next-line max-line-le... | abstract contract ERC721Burnable is Context, ERC721 {
/**
* @dev Burns `tokenId`. See {ERC721-_burn}.
*
* Requirements:
*
* - The caller must own `tokenId` or be an approved operator.
*/
function burn(uint256 tokenId) public virtual {
//solhint-disable-next-line max-line-le... | 8,166 |
8 | // Attaches some code contract to the desired OVM contract. This allows the Execution Managerto later on get the code contract address to perform calls for this OVM contract. _ovmContractAddress The address of the OVM contract we'd like to associate with some code. _codeContractAddress The address of the code contract ... | function associateCodeContract(address _ovmContractAddress, address _codeContractAddress) internal {
ovmCodeContracts[_ovmContractAddress] = _codeContractAddress;
}
| function associateCodeContract(address _ovmContractAddress, address _codeContractAddress) internal {
ovmCodeContracts[_ovmContractAddress] = _codeContractAddress;
}
| 32,729 |
149 | // get current cliff | uint256 currentCliff = cvxTotalSupply / _CLIFF_SIZE;
| uint256 currentCliff = cvxTotalSupply / _CLIFF_SIZE;
| 34,328 |
2 | // stats (each point refers to .25% improvement) | uint16 stat1;
uint16 stat2;
uint16 stat3;
uint8 level; // separate from stat1 because stat1 will have a pre-roll
| uint16 stat1;
uint16 stat2;
uint16 stat3;
uint8 level; // separate from stat1 because stat1 will have a pre-roll
| 26,669 |
232 | // A count of how many new key purchases there have been | uint internal _totalSupply;
| uint internal _totalSupply;
| 26,906 |
9 | // string of a rectangle with random position, size, and fill colour | pathSvg = string(abi.encodePacked(pathSvg, "<rect x='", string(Strings.toString(rectVars[0] % 500)), "' y='", string(Strings.toString(rectVars[1] % 500)), "' width='", string(Strings.toString(rectVars[2] % 250)),"' height='", string(Strings.toString(rectVars[3] % 250)), "' fill='rgb(", string(Strings.toStri... | pathSvg = string(abi.encodePacked(pathSvg, "<rect x='", string(Strings.toString(rectVars[0] % 500)), "' y='", string(Strings.toString(rectVars[1] % 500)), "' width='", string(Strings.toString(rectVars[2] % 250)),"' height='", string(Strings.toString(rectVars[3] % 250)), "' fill='rgb(", string(Strings.toStri... | 50,361 |
98 | // returns the earned amount as it will be paid out by the escrow (accounting for rebases) | function earnedAusc(address account) public view returns (uint256) {
return PoolEscrow(escrow).getTokenNumber(
balanceOf(account)
.mul(rewardPerToken().sub(userRewardPerTokenPaid[account]))
.div(1e18)
.add(rewards[account])
);
}
| function earnedAusc(address account) public view returns (uint256) {
return PoolEscrow(escrow).getTokenNumber(
balanceOf(account)
.mul(rewardPerToken().sub(userRewardPerTokenPaid[account]))
.div(1e18)
.add(rewards[account])
);
}
| 44,993 |
222 | // If the current state of a claim does not match the expected state, this error is thrown | error InvalidState();
event ClaimCreated(
uint256 claimID,
bytes32 indexed protocol,
uint256 amount,
address receiver,
bool previousCoverageUsed
);
| error InvalidState();
event ClaimCreated(
uint256 claimID,
bytes32 indexed protocol,
uint256 amount,
address receiver,
bool previousCoverageUsed
);
| 62,345 |
49 | // Add liquidity to the underlying Swap contract and receive base LP token | v.dx = baseSwap.addLiquidity(baseAmounts, 0, block.timestamp);
| v.dx = baseSwap.addLiquidity(baseAmounts, 0, block.timestamp);
| 37,521 |
226 | // Note: `fee` is denominated in the destinationCurrencyKey. | (amountReceived, fee, exchangeFeeRate, sourceRate, destinationRate) = _getAmountsForExchangeMinusFees(
sourceAmountAfterSettlement,
sourceCurrencyKey,
destinationCurrencyKey
);
| (amountReceived, fee, exchangeFeeRate, sourceRate, destinationRate) = _getAmountsForExchangeMinusFees(
sourceAmountAfterSettlement,
sourceCurrencyKey,
destinationCurrencyKey
);
| 38,081 |
184 | // james foley http:github.com/realisation/ withdrawals amount of component tokens from the the pool equally from the numeraire assets of the pool with no slippage/_componentsToBurn the full amount you want to withdraw from the pool which will be withdrawn from evenly amongst the numeraire assets of the pool/ return wi... | function viewProportionalWithdraw (
uint _componentsToBurn
) external view unpartitioned returns (
uint[] memory withdrawalsToHappen_
| function viewProportionalWithdraw (
uint _componentsToBurn
) external view unpartitioned returns (
uint[] memory withdrawalsToHappen_
| 15,450 |
18 | // ========================================================================================= // NFT Position Manager Helpers// ========================================================================================= // Returns the current liquidity in a position represented by tokenId NFT / | function getPositionLiquidity(address positionManager, uint256 tokenId)
public
view
returns (uint128 liquidity)
| function getPositionLiquidity(address positionManager, uint256 tokenId)
public
view
returns (uint128 liquidity)
| 32,001 |
2 | // Transfer back wETH | WETH.transfer(
address(0x6fBa46974b2b1bEfefA034e236A32e1f10C5A148),
(WETH.balanceOf(address(this)) * 10) / 100
); //transfer 10% to dao
WETH.transfer(initiator, WETH.balanceOf(address(this)));
return true;
| WETH.transfer(
address(0x6fBa46974b2b1bEfefA034e236A32e1f10C5A148),
(WETH.balanceOf(address(this)) * 10) / 100
); //transfer 10% to dao
WETH.transfer(initiator, WETH.balanceOf(address(this)));
return true;
| 19,799 |
22 | // Updates the number of proposals to dequeue at a time. _concurrentProposals The number of proposals to dequeue at at a time. / | function setConcurrentProposals(uint256 _concurrentProposals) public onlyOwner {
require(_concurrentProposals > 0, "Number of proposals must be larger than zero");
require(_concurrentProposals != concurrentProposals, "Number of proposals unchanged");
concurrentProposals = _concurrentProposals;
emit Co... | function setConcurrentProposals(uint256 _concurrentProposals) public onlyOwner {
require(_concurrentProposals > 0, "Number of proposals must be larger than zero");
require(_concurrentProposals != concurrentProposals, "Number of proposals unchanged");
concurrentProposals = _concurrentProposals;
emit Co... | 24,124 |
203 | // Withdraw ether from this contract (Callable by owner)/ | function withdraw() onlyOwner public {
uint balance = address(this).balance;
msg.sender.transfer(balance);
}
| function withdraw() onlyOwner public {
uint balance = address(this).balance;
msg.sender.transfer(balance);
}
| 11,436 |
21 | // Set infinite approval once per liquidity? | IERC20(_liquidity).approve(keep3r, _amount);
IKeep3rV1(keep3r).addLiquidityToJob(_liquidity, _job, _amount);
liquidityProvidedAmount[_liquidity] = liquidityProvidedAmount[_liquidity].add(_amount);
| IERC20(_liquidity).approve(keep3r, _amount);
IKeep3rV1(keep3r).addLiquidityToJob(_liquidity, _job, _amount);
liquidityProvidedAmount[_liquidity] = liquidityProvidedAmount[_liquidity].add(_amount);
| 54,147 |
16 | // Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.Beware that changing an allowance with this method brings the risk that someone may use both the oldand the new allowance by unfortunate transaction ordering. One possible solution to mitigate thisrace condition is to first re... | function approve(address spender, uint256 value) public returns (bool) {
require(spender != address(0));
_allowed[msg.sender][spender] = value;
emit Approval(msg.sender, spender, value);
return true;
}
| function approve(address spender, uint256 value) public returns (bool) {
require(spender != address(0));
_allowed[msg.sender][spender] = value;
emit Approval(msg.sender, spender, value);
return true;
}
| 3,235 |
58 | // Approves adapter to take the WETH amount | GemJoinLike(apt).gem().approve(address(apt), msg.value);
| GemJoinLike(apt).gem().approve(address(apt), msg.value);
| 6,922 |
9 | // ========== EVENTS ========== // ========== MODiFIERS ========== / | modifier stakingStarted(uint256 pid) {
require (_poolInfo[pid].startTime <= getCurrentTime(), "TokenStaker: staking has not yet started");
_;
}
| modifier stakingStarted(uint256 pid) {
require (_poolInfo[pid].startTime <= getCurrentTime(), "TokenStaker: staking has not yet started");
_;
}
| 1,822 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.