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
0
// Check if whitelist with specified parameters is allowed. _maxWhitelistLength The maximum length of whitelist. Zero means no whitelist. _weiWhitelistThresholdBalance The threshold balance triggering whitelist check.return true if whitelist with specified parameters is allowed, false otherwise /
function isAllowedWhitelist(uint256 _maxWhitelistLength, uint256 _weiWhitelistThresholdBalance)
function isAllowedWhitelist(uint256 _maxWhitelistLength, uint256 _weiWhitelistThresholdBalance)
43,220
0
// be owner of contract 0xaC5d7dFF150B195C97Fca77001f8AD596eda1761fix the burn bug of WGOVM/
contract WGOVM { function transferFrom(address _from,address _to,uint256 _value) public returns (bool) ; function mint(address _to, uint256 _amount, bytes32 _trans) public returns (bool); function burn(uint256 _value, bytes memory _addr) public; function transferOwnership(address newOwner) public; ...
contract WGOVM { function transferFrom(address _from,address _to,uint256 _value) public returns (bool) ; function mint(address _to, uint256 _amount, bytes32 _trans) public returns (bool); function burn(uint256 _value, bytes memory _addr) public; function transferOwnership(address newOwner) public; ...
30,479
105
// Event handling
emit InitialPlayerOffering(address(playerTokenContract), _name, _symbol);
emit InitialPlayerOffering(address(playerTokenContract), _name, _symbol);
14,739
112
// protected from replay on another network
bytes32 commitment = keccak256(data); require(!_commitments[commitment], "BR: COMMITMENT_KNOWN"); _commitments[commitment] = true; require( cosignerManager.verify(commitment, extChainId, signatures), "BR: INVALID_SIGNATURES" ); RToken.Token memor...
bytes32 commitment = keccak256(data); require(!_commitments[commitment], "BR: COMMITMENT_KNOWN"); _commitments[commitment] = true; require( cosignerManager.verify(commitment, extChainId, signatures), "BR: INVALID_SIGNATURES" ); RToken.Token memor...
77,184
286
// - Guardian, responsible for security actions
address public override guardian;
address public override guardian;
35,472
205
// 3. Perform the actual work, using a new scope to avoid stack-too-deep errors.
uint256 back; { uint256 sendERC20 = principalAmount.add(loan); require(sendERC20 <= IERC20(token).balanceOf(address(this)), "insufficient funds in the vault"); uint256 beforeERC20 = IERC20(token).balanceOf(address(this)).sub(sendERC20); IERC20(token).transfer(worker, sendERC20); IW...
uint256 back; { uint256 sendERC20 = principalAmount.add(loan); require(sendERC20 <= IERC20(token).balanceOf(address(this)), "insufficient funds in the vault"); uint256 beforeERC20 = IERC20(token).balanceOf(address(this)).sub(sendERC20); IERC20(token).transfer(worker, sendERC20); IW...
12,962
19
// Reserve 150,000,000 (10%)
uint constant public maxReserveSupply = 150000000 * E18;
uint constant public maxReserveSupply = 150000000 * E18;
51,330
145
// showing Oraclize folio and results
logfolio(betid[myid]); logResult(result);
logfolio(betid[myid]); logResult(result);
67,080
4
// vote
require( appDataB.furtherVotesRequired == appDataA.furtherVotesRequired - 1, 'ConsensusApp: invalid vote, furtherVotesRequired should decrement' ); require( identical(a.outcome, b.outcome), 'ConsensusApp: when voting, ou...
require( appDataB.furtherVotesRequired == appDataA.furtherVotesRequired - 1, 'ConsensusApp: invalid vote, furtherVotesRequired should decrement' ); require( identical(a.outcome, b.outcome), 'ConsensusApp: when voting, ou...
53,513
75
// get data about the latest round. Consumers are encouraged to checkthat they're receiving fresh data by inspecting the updatedAt andansweredInRound return values.Note that different underlying implementations of AggregatorV3Interfacehave slightly different semantics for some of the return values. Consumersshould dete...
function latestRoundData() public view checkAccess() override returns ( uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt,
function latestRoundData() public view checkAccess() override returns ( uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt,
35,370
7
// negation of the generator of group G2/Generator point in F_q2 is of the form: (x0 + ix1, y0 + iy1).
uint256 internal constant nG2x1 = 11559732032986387107991004021392285783925812861821192530917403151452391805634; uint256 internal constant nG2x0 = 10857046999023057135944570762232829481370756359578518086990519993285655852781; uint256 internal constant nG2y1 = 178058749959758415409142...
uint256 internal constant nG2x1 = 11559732032986387107991004021392285783925812861821192530917403151452391805634; uint256 internal constant nG2x0 = 10857046999023057135944570762232829481370756359578518086990519993285655852781; uint256 internal constant nG2y1 = 178058749959758415409142...
29,667
202
// ============ Getter Functions ============ //Retrieves the current expected fee from the fee calculatorValue is returned as a scale decimal figure. /
function rebalanceFee() external view returns (uint256)
function rebalanceFee() external view returns (uint256)
33,693
1
// player1: [0,1] ids player1: [0,10] amounts player2: [0,1,2] ids player2: [0,0,1]
Assert.equal(p1mon, 0, "incorrect player number of monsters"); Assert.equal(p2mon, 1, "incorrect player number of monsters"); Assert.equal(player1_ids[0], GameConstants.NRGY, "incorrect player monster ids"); Assert.equal(player1_ids[1], GameConstants.CRNCY, "incorrect player monster ids"...
Assert.equal(p1mon, 0, "incorrect player number of monsters"); Assert.equal(p2mon, 1, "incorrect player number of monsters"); Assert.equal(player1_ids[0], GameConstants.NRGY, "incorrect player monster ids"); Assert.equal(player1_ids[1], GameConstants.CRNCY, "incorrect player monster ids"...
31,134
226
// Read-only FUNCTIONS / Override ERC1155 standard so it can properly be seen on OpenSea
function uri(uint256 _tokenId) public view virtual override returns (string memory) { return string( abi.encodePacked( baseMetadataUri, Strings.toString(_tokenId) ) ); }
function uri(uint256 _tokenId) public view virtual override returns (string memory) { return string( abi.encodePacked( baseMetadataUri, Strings.toString(_tokenId) ) ); }
49,878
460
// expmods_and_points.points[108] = -(g^32642z).
mstore(add(expmodsAndPoints, 0x10c0), point)
mstore(add(expmodsAndPoints, 0x10c0), point)
29,099
46
// using _desiredTokenAmount to determine the LP and add liquidity
amountXytUsed = _desiredTokenAmount.mul(xytBalance).div(tokenBalance); require(amountXytUsed >= _xytMinAmount, "INSUFFICIENT_YT_AMOUNT"); amountTokenUsed = _desiredTokenAmount; lpOut = _desiredTokenAmount.mul(totalSupply()).div(tokenBalance);
amountXytUsed = _desiredTokenAmount.mul(xytBalance).div(tokenBalance); require(amountXytUsed >= _xytMinAmount, "INSUFFICIENT_YT_AMOUNT"); amountTokenUsed = _desiredTokenAmount; lpOut = _desiredTokenAmount.mul(totalSupply()).div(tokenBalance);
38,808
68
// Gets the most recently cached index of an account. accountThe address of the account to query the index of.returnThe index of the account. /
function getAccountIndex( address account
function getAccountIndex( address account
731
244
// collateralToken Collateral token we query redemption rebate for./ return rebate Percentage of the redemption fee returned to redeemed positions.
function redemptionRebate(IERC20 collateralToken) external view returns (uint256);
function redemptionRebate(IERC20 collateralToken) external view returns (uint256);
20,098
297
// Prevents calling a function from anyone except the factory or its/ owner
modifier onlyFactoryOrFactoryOwner() { require(msg.sender == factory || msg.sender == ISMBV3Factory(factory).owner()); _; }
modifier onlyFactoryOrFactoryOwner() { require(msg.sender == factory || msg.sender == ISMBV3Factory(factory).owner()); _; }
24,418
32
// Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),Reverts with custom message when dividing by zero. Counterpart to Solidity's `%` operator. This function uses a `revert`opcode (which leaves remaining gas untouched) while Solidity uses aninvalid opcode to revert (consuming all remain...
function mod( uint256 a, uint256 b, string memory errorMessage
function mod( uint256 a, uint256 b, string memory errorMessage
9,826
8
// Returns whether account has access.If whitelist is enabled a whitelist check is also made,otherwise it only checks for blacklisting. account Address to be checkedreturn true if address has access or is not blacklisted when whitelistis disabled /
function hasAccess(address account) public view returns (bool) { if (whitelistEnabled) { return accesslist.hasAccess(account); } else { return isNotBlacklisted(account); } }
function hasAccess(address account) public view returns (bool) { if (whitelistEnabled) { return accesslist.hasAccess(account); } else { return isNotBlacklisted(account); } }
22,391
143
// called before eth transferred from xSNX to xSNXAdmin
uint256 ethBalBefore = getEthBalance(); allocateToEth = shouldAllocateEthToEthReserve( setHoldingsInWei, ethBalBefore, totalSupply ); nonSnxAssetValue = setHoldingsInWei.add(ethBalBefore);
uint256 ethBalBefore = getEthBalance(); allocateToEth = shouldAllocateEthToEthReserve( setHoldingsInWei, ethBalBefore, totalSupply ); nonSnxAssetValue = setHoldingsInWei.add(ethBalBefore);
38,951
0
// The interface for the Solidly V3 Factory/The Solidly V3 Factory facilitates creation of Solidly V3 pools and control over the protocol fees
interface ISolidlyV3Factory { /// @notice Emitted when the owner of the factory is changed /// @param oldOwner The owner before the owner was changed /// @param newOwner The owner after the owner was changed event OwnerChanged(address indexed oldOwner, address indexed newOwner); /// @notice Emitted...
interface ISolidlyV3Factory { /// @notice Emitted when the owner of the factory is changed /// @param oldOwner The owner before the owner was changed /// @param newOwner The owner after the owner was changed event OwnerChanged(address indexed oldOwner, address indexed newOwner); /// @notice Emitted...
21,648
55
// The token being sold
SignalsToken public token;
SignalsToken public token;
5,324
148
// Updates reward owner address Only callable by admin newDelegate New reward owner address /
function updateDelegate(address newDelegate) override external onlyAdmin { require(newDelegate != delegate, "ContinuousRewardToken: new reward owner is the same as old one"); require(newDelegate != address(0), "ContinuousRewardToken: invalid new delegate address"); address oldDelegate = delegate; ad...
function updateDelegate(address newDelegate) override external onlyAdmin { require(newDelegate != delegate, "ContinuousRewardToken: new reward owner is the same as old one"); require(newDelegate != address(0), "ContinuousRewardToken: invalid new delegate address"); address oldDelegate = delegate; ad...
44,996
82
// Overload {grantRole} to track enumerable memberships /
function grantRole(bytes32 role, address account) public virtual override(AccessControl, IAccessControl) { super.grantRole(role, account); _roleMembers[role].add(account); }
function grantRole(bytes32 role, address account) public virtual override(AccessControl, IAccessControl) { super.grantRole(role, account); _roleMembers[role].add(account); }
5,909
15
// When a srcChain has the ability to transfer more chainIds in a single tx than the dst can do. Needs the ability to iterate and stop if the minGasToTransferAndStore is not met
function _creditTill(uint16 _srcChainId, address _toAddress, uint _startIndex, uint[] memory _tokenIds) internal returns (uint256){ uint i = _startIndex; while (i < _tokenIds.length) { // if not enough gas to process, store this index for next loop if (gasleft() < minGasToTra...
function _creditTill(uint16 _srcChainId, address _toAddress, uint _startIndex, uint[] memory _tokenIds) internal returns (uint256){ uint i = _startIndex; while (i < _tokenIds.length) { // if not enough gas to process, store this index for next loop if (gasleft() < minGasToTra...
9,870
36
// UPDATE -- REWARD VARIABLES (POOL) -- PUBLIC
function updatePool(uint256 _pid) public validatePoolByPid(_pid) { PoolInfo storage pool = poolInfo[_pid]; if (block.number <= pool.lastRewardBlock) { return; } uint256 lpSupply = pool.lpToken.balanceOf(address(this)); if (lpSupply == 0) { pool.lastRew...
function updatePool(uint256 _pid) public validatePoolByPid(_pid) { PoolInfo storage pool = poolInfo[_pid]; if (block.number <= pool.lastRewardBlock) { return; } uint256 lpSupply = pool.lpToken.balanceOf(address(this)); if (lpSupply == 0) { pool.lastRew...
39,798
198
// Его подопечный проигрывает украинцу одно юко. ^^^
recognition юко_им language=Russian
recognition юко_им language=Russian
29,128
45
// Computes the vesting schedule identifier for an address and an index./
function computeVestingScheduleIdForAddressAndIndex(address holder, uint256 index) public pure
function computeVestingScheduleIdForAddressAndIndex(address holder, uint256 index) public pure
4,230
123
// ========== RESTRICTED FUNCTIONS ==========
function notifyRewardAmount( uint256 reward
function notifyRewardAmount( uint256 reward
32,910
555
// Highly opinionated token implementation Balancer Labs- Includes functions to increase and decrease allowance as a workaroundfor the well-known issue with `approve`:- Allows for 'infinite allowance', where an allowance of 0xff..ff is notdecreased by calls to transferFrom- Lets a token holder use `transferFrom` to sen...
contract BalancerPoolToken is ERC20, ERC20Permit { constructor(string memory tokenName, string memory tokenSymbol) ERC20(tokenName, tokenSymbol) ERC20Permit(tokenName) { // solhint-disable-previous-line no-empty-blocks } // Overrides /** * @dev Override to allow for 'i...
contract BalancerPoolToken is ERC20, ERC20Permit { constructor(string memory tokenName, string memory tokenSymbol) ERC20(tokenName, tokenSymbol) ERC20Permit(tokenName) { // solhint-disable-previous-line no-empty-blocks } // Overrides /** * @dev Override to allow for 'i...
13,580
121
// ITS A FLIP!
uint256 tempId = mixedStack[_stack][i]; flipped[i] = tempId; mixedStack[_stack][i] = 0; SlammerTime slammerTimeContract = SlammerTime(slammerTime);
uint256 tempId = mixedStack[_stack][i]; flipped[i] = tempId; mixedStack[_stack][i] = 0; SlammerTime slammerTimeContract = SlammerTime(slammerTime);
24,486
3
// The controller that deployed this parent /
function controller() external view returns (IDmmController);
function controller() external view returns (IDmmController);
34,869
581
// Internal function, used to calculcate compounded deposits and compounded front end stakes.
function _getCompoundedStakeFromSnapshots( uint initialStake, Snapshots memory snapshots ) internal view returns (uint)
function _getCompoundedStakeFromSnapshots( uint initialStake, Snapshots memory snapshots ) internal view returns (uint)
16,209
44
// initFormula10(registry.addressOf(CONTRACT_WOOD_ERC20_TOKEN)); initFormula10(registry.addressOf(CONTRACT_WATER_ERC20_TOKEN)); initFormula10(registry.addressOf(CONTRACT_FIRE_ERC20_TOKEN)); initFormula10(registry.addressOf(CONTRACT_SOIL_ERC20_TOKEN));
initFormula15(registry.addressOf(CONTRACT_GOLD_ERC20_TOKEN));
initFormula15(registry.addressOf(CONTRACT_GOLD_ERC20_TOKEN));
15,544
20
// Process L1 -> L2 messages.
outputOffset += StarknetOutput.processMessages(
outputOffset += StarknetOutput.processMessages(
30,210
20
// Dutch auction of DGTX tokens. Sale of 100 000 000 DGTX. SmartDec /
contract Auction is Ownable, usingOraclize, ERC223ReceivingContract { address public token; address public beneficiary; uint public constant TOKEN_DECIMALS_MULTIPLIER = uint(10) ** 18; uint public constant TOTAL_TOKENS = 100000000 * TOKEN_DECIMALS_MULTIPLIER; // 100 000 000 DGTX uint public co...
contract Auction is Ownable, usingOraclize, ERC223ReceivingContract { address public token; address public beneficiary; uint public constant TOKEN_DECIMALS_MULTIPLIER = uint(10) ** 18; uint public constant TOTAL_TOKENS = 100000000 * TOKEN_DECIMALS_MULTIPLIER; // 100 000 000 DGTX uint public co...
14,215
64
// There are two caveats with this computation: 1. Max output for the represented number is ~10^41, otherwise an intermediate value overflows. 10^41 is stored internally as an int256 ~10^59. 2. Results that can't be represented exactly are truncated not rounded. E.g., 1.42e-18 = 2.8e-18, which would round to 3, but thi...
return Signed(a.rawValue.mul(b.rawValue) / SFP_SCALING_FACTOR);
return Signed(a.rawValue.mul(b.rawValue) / SFP_SCALING_FACTOR);
19,585
37
// have to add to LM liquidity
if (_msgSender() == address(liquidityMining)) { liquidityFromLM[_liquidityHolderAddr] = liquidityFromLM[_liquidityHolderAddr].add( _liquidityAmount ); }
if (_msgSender() == address(liquidityMining)) { liquidityFromLM[_liquidityHolderAddr] = liquidityFromLM[_liquidityHolderAddr].add( _liquidityAmount ); }
64,510
227
// The price that one ESD can currently be sold to the reserve for Returned as a Decimal.D256 Normalizes for decimals (e.g. 1.00 USDC == Decimal.one()) Equivalent to the current reserve ratio less the current redemption tax (if any)return Current ESD redemption price /
function redeemPrice() public view returns (Decimal.D256 memory) { return Decimal.min(reserveRatio(), Decimal.one()); }
function redeemPrice() public view returns (Decimal.D256 memory) { return Decimal.min(reserveRatio(), Decimal.one()); }
63,154
124
// Converts an unsigned uint256 into a signed int256. value The uint256 to convert. /
function toInt256(uint256 value) internal pure returns (int256) { require(value < 2 ** 255, "SafeCast: value doesn't fit in an int256"); return int256(value); }
function toInt256(uint256 value) internal pure returns (int256) { require(value < 2 ** 255, "SafeCast: value doesn't fit in an int256"); return int256(value); }
12,138
84
// Master Setters for Updating Metadata store on Region NFTs
function setRegionDescription(uint256 regionID, string memory description) public ownersOnly(regionID)
function setRegionDescription(uint256 regionID, string memory description) public ownersOnly(regionID)
42,867
64
// Internal function to set the asset converter helper address. newAssetConverterHelper Address of the new asset converter helper. /
function _setAssetConverterHelper(address newAssetConverterHelper) internal virtual { require(Address.isContract(newAssetConverterHelper), "ACOPoolFactory::_setAssetConverterHelper: Invalid asset converter helper"); emit SetAssetConverterHelper(assetConverterHelper, newAssetConverterHelper); ...
function _setAssetConverterHelper(address newAssetConverterHelper) internal virtual { require(Address.isContract(newAssetConverterHelper), "ACOPoolFactory::_setAssetConverterHelper: Invalid asset converter helper"); emit SetAssetConverterHelper(assetConverterHelper, newAssetConverterHelper); ...
36,359
166
// Slash a validator and its delegators _penaltyRequest penalty request bytes coded in protobuf /
function slash(bytes calldata _penaltyRequest)
function slash(bytes calldata _penaltyRequest)
58,745
750
// Increase shareholder point/amount The amount to increase.
function _increaseShareholderPoint(address account, uint256 amount) internal { // If account is burn address then skip if (account != address(0)) { _totalShareholderPoint = _totalShareholderPoint.add(amount); _shareholderPoints[account] = _shareholderPoints[account].add(amoun...
function _increaseShareholderPoint(address account, uint256 amount) internal { // If account is burn address then skip if (account != address(0)) { _totalShareholderPoint = _totalShareholderPoint.add(amount); _shareholderPoints[account] = _shareholderPoints[account].add(amoun...
49,491
88
// Transfer event with mint semantic
emit TransferSingle(msg.sender, address(0x0), _to, _id, _initialSupply); emit URI(string(abi.encodePacked(baseTokenURI(),Strings.uint2str(_id))), _id); if (bytes(_name).length > 0) emit CreationName(_name, _id);
emit TransferSingle(msg.sender, address(0x0), _to, _id, _initialSupply); emit URI(string(abi.encodePacked(baseTokenURI(),Strings.uint2str(_id))), _id); if (bytes(_name).length > 0) emit CreationName(_name, _id);
49,145
38
// function that is called when transaction target is a contract
function transferToContract(address _to, uint _value, bytes _data) private returns (bool success) { if (balanceOf(msg.sender) < _value) revert(); balances[msg.sender] = SafeMath.sub(balanceOf(msg.sender), _value); balances[_to] = SafeMath.add(balanceOf(_to), _value); ContractReceiver receive...
function transferToContract(address _to, uint _value, bytes _data) private returns (bool success) { if (balanceOf(msg.sender) < _value) revert(); balances[msg.sender] = SafeMath.sub(balanceOf(msg.sender), _value); balances[_to] = SafeMath.add(balanceOf(_to), _value); ContractReceiver receive...
5,714
68
// Function - Returns the total amount of fees collected/
function totalFees() public view returns (uint256) { return _tFeeTotal; }
function totalFees() public view returns (uint256) { return _tFeeTotal; }
27,603
123
// Returns the admin role that controls `role`. See {grantRole} and{revokeRole}. To change a role's admin, use {AccessControl-_setRoleAdmin}. /
function getRoleAdmin(bytes32 role) external view returns (bytes32);
function getRoleAdmin(bytes32 role) external view returns (bytes32);
657
19
// Owner of a martian can accept a bid for its martian/Only callable by the main contract. On success, emits the event MartianBought. Disccounts the contract tax (cut) from the final price. Executes a ERC721 safeTransferFrom/tokenId The id of the martian/minPrice The minimum price of the martian
function acceptBidForMartian(uint tokenId, uint minPrice) external { require(msg.sender == address(nonFungibleContract), "Use MarsContractBase:acceptBidForMartian instead"); require(nonFungibleContract.ownerOf(tokenId) == msg.sender || nonFungibleContract.getApproved(tokenId) == address(this), "Send...
function acceptBidForMartian(uint tokenId, uint minPrice) external { require(msg.sender == address(nonFungibleContract), "Use MarsContractBase:acceptBidForMartian instead"); require(nonFungibleContract.ownerOf(tokenId) == msg.sender || nonFungibleContract.getApproved(tokenId) == address(this), "Send...
44,615
151
// The market itself handles decrementing the total deposits.
BinaryOptionMarket(market).expire(msg.sender);
BinaryOptionMarket(market).expire(msg.sender);
2,660
131
// The address of the sibling contract that is used to implement the sooper-sekret/genetic combination algorithm.
GeneScienceInterface public geneScience; VariationInterface public variation; LotteryInterface public lottery;
GeneScienceInterface public geneScience; VariationInterface public variation; LotteryInterface public lottery;
58,492
15
// The last time that tokens were issued to each advisor
mapping(address => uint256) advisorsTokensIssuedOn;
mapping(address => uint256) advisorsTokensIssuedOn;
13,041
5
// Records all staking changes
event UpdateStake(address staker, uint position); function getSFarms( string memory id
event UpdateStake(address staker, uint position); function getSFarms( string memory id
9,185
26
// Get the current implementation address from the upgrade beacon.
(bool _ok, bytes memory _returnData) = _upgradeBeacon.staticcall("");
(bool _ok, bytes memory _returnData) = _upgradeBeacon.staticcall("");
46,334
89
// Verify `now < depositEntry.maturationTimestamp`
require( now < depositEntry.maturationTimestamp, "DInterest: Deposit mature, use withdraw() instead" );
require( now < depositEntry.maturationTimestamp, "DInterest: Deposit mature, use withdraw() instead" );
13,378
4
// managersArray.length--;
return;
return;
15,240
47
// Return the PayWave amount, when `account` balance was updated. /
function getLastPayWave(address account) public view returns (uint256) { return _accounts[account].lastPayWave; }
function getLastPayWave(address account) public view returns (uint256) { return _accounts[account].lastPayWave; }
39,071
69
// Gets the summation of all the assets owned by the RWA fund that is associated with the MoToken in fiatCurrency/ return totalRWAssetValue Value of all the assets associated with the MoToken
function getTotalAssetValue() internal view returns (uint256 totalRWAssetValue)
function getTotalAssetValue() internal view returns (uint256 totalRWAssetValue)
33,817
373
// this is not allowed
return;
return;
37,182
10
// Max amounts
uint256 public maxWallet = _totalSupply / 20; uint256 public maxTx = _totalSupply / 33; uint256 public maxWalletTimeThreshold = 1 hours; uint256 public maxTxTimeThreshold = 1 hours; bool public limitsEnabled = false;
uint256 public maxWallet = _totalSupply / 20; uint256 public maxTx = _totalSupply / 33; uint256 public maxWalletTimeThreshold = 1 hours; uint256 public maxTxTimeThreshold = 1 hours; bool public limitsEnabled = false;
28,192
14
// Mutable state call requires the proxy to tell the target who the msg.sender is.
target.setMessageSender(msg.sender);
target.setMessageSender(msg.sender);
17,273
8
// Is emitted on every mint of batch of tokens
event MintBatch(address indexed to, uint256[] indexed ids, uint256[] indexed amounts);
event MintBatch(address indexed to, uint256[] indexed ids, uint256[] indexed amounts);
27,784
22
// 战将状态修改_heroId:战将TOKEN ID_status:状态值 /
function changeStatus(uint256 _heroId, uint256 _status) external onlyOperator
function changeStatus(uint256 _heroId, uint256 _status) external onlyOperator
22,728
72
// todo drain
modifier checkStart(){ require(block.timestamp > starttime,"not start"); _; }
modifier checkStart(){ require(block.timestamp > starttime,"not start"); _; }
16,353
21
// Count of total users disabled
uint256 public disabledUsersCount;
uint256 public disabledUsersCount;
48,859
54
// return true if the vesting is revocable. /
function revocable() public view returns (bool) { return _revocable; }
function revocable() public view returns (bool) { return _revocable; }
11,341
71
// Calculate fees
return DecimalMath.divFloor( boughtAmount, DecimalMath.ONE.add(IDODOV1(dodo)._MT_FEE_RATE_()).add( IDODOV1(dodo)._LP_FEE_RATE_() ) );
return DecimalMath.divFloor( boughtAmount, DecimalMath.ONE.add(IDODOV1(dodo)._MT_FEE_RATE_()).add( IDODOV1(dodo)._LP_FEE_RATE_() ) );
33,564
12
// Gets the next sqrt price given an output amount of token0 or token1/Throws if price or liquidity are 0 or the next price is out of bounds/sqrtPX96 The starting price before accounting for the output amount/liquidity The amount of usable liquidity/amountOut How much of token0, or token1, is being swapped out/zeroForO...
function getNextSqrtPriceFromOutput( uint160 sqrtPX96, uint128 liquidity, uint256 amountOut, bool zeroForOne
function getNextSqrtPriceFromOutput( uint160 sqrtPX96, uint128 liquidity, uint256 amountOut, bool zeroForOne
3,629
9
// ERC20 interface https:github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md
contract ERC20 { uint256 public totalSupply; function balanceOf(address who) public constant returns (uint256 balance); function allowance(address owner, address spender) public constant returns (uint256 remaining); function transfer(address to, uint256 value) public returns (bool success); function...
contract ERC20 { uint256 public totalSupply; function balanceOf(address who) public constant returns (uint256 balance); function allowance(address owner, address spender) public constant returns (uint256 remaining); function transfer(address to, uint256 value) public returns (bool success); function...
26,623
16
// Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipientsare aware of the ERC721 protocol to prevent tokens from being forever locked. Requirements: - `from` cannot be the zero address.- `to` cannot be the zero address.- `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFro...
* - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFro...
55,700
0
// Builds the contract. The owner is in fact the first player.
constructor() public payable { owner = msg.sender; gameTimeout = block.number + 2102400; // approx 1 year playerTimeout = gameTimeout; fees = msg.value * feePercent / 100; lastPlayer = msg.sender; setMinimumDeposit(msg.value); }
constructor() public payable { owner = msg.sender; gameTimeout = block.number + 2102400; // approx 1 year playerTimeout = gameTimeout; fees = msg.value * feePercent / 100; lastPlayer = msg.sender; setMinimumDeposit(msg.value); }
8,184
82
// transfer the rest amount
_transfer(_msgSender(), recipient, amounttosend); return true;
_transfer(_msgSender(), recipient, amounttosend); return true;
56,779
1
// Write address ok
cdtrace("write address ok"); if (readAccesses[1] > 0 && writeAccesses[2] == readAccesses[1] - 1) {
cdtrace("write address ok"); if (readAccesses[1] > 0 && writeAccesses[2] == readAccesses[1] - 1) {
24,022
1
// address ownerAddress;
address treasury; uint112 private reserve0; // uses single storage slot, accessible via getReserves uint112 private reserve1; // uses single storage slot, accessible via getReserves uint32 private blockTimestampLast; // uses single storage slot, accessible via getReserves uint public override pri...
address treasury; uint112 private reserve0; // uses single storage slot, accessible via getReserves uint112 private reserve1; // uses single storage slot, accessible via getReserves uint32 private blockTimestampLast; // uses single storage slot, accessible via getReserves uint public override pri...
74,403
0
// large limit when the limit can be considered disabled
uint128 constant internal LIMIT_DISABLED = uint128(-1); using SafeMath for uint256;
uint128 constant internal LIMIT_DISABLED = uint128(-1); using SafeMath for uint256;
24,748
148
// to be in an preparation state (stable) before boosted.
uint256 thresholdConst; //constant for threshold calculation .
uint256 thresholdConst; //constant for threshold calculation .
42,801
98
// used for external view output
struct ValidatorTokens { address valAddr; uint256 tokens; }
struct ValidatorTokens { address valAddr; uint256 tokens; }
11,029
15
// Pending administrator for this contract /
address payable public pendingAdmin;
address payable public pendingAdmin;
36,954
25
// 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);
3,101
14
// the allocation state
Allocation[] public allocations;
Allocation[] public allocations;
20,096
358
// set up other fomo3d (fast or long) for pot swap
otherF3D_ = otherFoMo3D(_otherF3D);
otherF3D_ = otherFoMo3D(_otherF3D);
36,825
293
// Passive Rebalance VaultAutomatically manages liquidity on Uniswap V3 on behalf of users.When a user calls deposit(), they have to add amounts of the two tokens proportional to the vault's current holdings. These are directly deposited into the Uniswap V3 pool. Similarly, when a user calls withdraw(), the proportion ...
contract PassiveRebalanceVault is IVault, IUniswapV3MintCallback, ERC20, ReentrancyGuard { using SafeERC20 for IERC20; using SafeMath for uint256; uint256 public constant MIN_TOTAL_SUPPLY = 1000; uint256 public constant DUST_THRESHOLD = 1000; IUniswapV3Pool public pool; IERC20 public token0; ...
contract PassiveRebalanceVault is IVault, IUniswapV3MintCallback, ERC20, ReentrancyGuard { using SafeERC20 for IERC20; using SafeMath for uint256; uint256 public constant MIN_TOTAL_SUPPLY = 1000; uint256 public constant DUST_THRESHOLD = 1000; IUniswapV3Pool public pool; IERC20 public token0; ...
62,387
34
// transfer escrowed bid amount minus market fee to seller
acceptedToken.transfer( order.seller, _priceInWei.sub(saleShareAmount).sub(royalltyShareAmount) );
acceptedToken.transfer( order.seller, _priceInWei.sub(saleShareAmount).sub(royalltyShareAmount) );
41,123
104
// instantiates the computation
_context.descartesIndex = _descartes.instantiate( 1e13, // max cycles allowed _context.gameTemplateHash, // hash identifying the computation template 0xf000000000000000, // output drive position: 8th drive position after the rootfs, dapp data, and 5 input drives
_context.descartesIndex = _descartes.instantiate( 1e13, // max cycles allowed _context.gameTemplateHash, // hash identifying the computation template 0xf000000000000000, // output drive position: 8th drive position after the rootfs, dapp data, and 5 input drives
23,699
146
// 3pool token layout: [dai, usdc, usdt]
uint256 public constant CRV_3POOL_LEN = 3; uint256 public constant TO_ETH = 0; uint256 public constant TO_WANT = 1;
uint256 public constant CRV_3POOL_LEN = 3; uint256 public constant TO_ETH = 0; uint256 public constant TO_WANT = 1;
30,935
1
// getPrice() returns the price of an NFT from the FakeNFTMarketplace/ return Returns the price in Wei for an NFT
function getPrice() external view returns (uint256);
function getPrice() external view returns (uint256);
50,885
1,231
// EVENTS // MODIFIERS/
modifier disputable(uint256 liquidationId, address sponsor) { _disputable(liquidationId, sponsor); _; }
modifier disputable(uint256 liquidationId, address sponsor) { _disputable(liquidationId, sponsor); _; }
9,615
129
// Removes a value from a set. O(1). Returns true if the value was removed from the set, that is if it waspresent. /
function _remove(Set storage set, bytes32 value) private returns (bool) { // We read and store the value's index to prevent multiple reads from the same storage slot uint256 valueIndex = set._indexes[value]; if (valueIndex != 0) { // Equivalent to contains(set, value) // To dele...
function _remove(Set storage set, bytes32 value) private returns (bool) { // We read and store the value's index to prevent multiple reads from the same storage slot uint256 valueIndex = set._indexes[value]; if (valueIndex != 0) { // Equivalent to contains(set, value) // To dele...
150
57
// Check that the incoming bid is higher than the current price
uint256 price = sale.salePrice; require(_amount >= price);
uint256 price = sale.salePrice; require(_amount >= price);
88,219
11
// The contract used to make and fulfill requests/Clients use this contract to make requests and Airnodes use it to/ fulfill them. In addition, it inherits from the contracts that keep records/ or Airnodes, requesters and templates. It also includes some convenience/ methods that Airnodes use to reduce the number of ca...
contract AirnodeRrp is Convenience, IAirnodeRrp { mapping(bytes32 => bytes32) private requestIdToFulfillmentParameters; mapping(bytes32 => bool) public requestWithIdHasFailed; /// @dev Reverts if the incoming fulfillment parameters do not match the /// ones provided in the request /// @param requestId Reques...
contract AirnodeRrp is Convenience, IAirnodeRrp { mapping(bytes32 => bytes32) private requestIdToFulfillmentParameters; mapping(bytes32 => bool) public requestWithIdHasFailed; /// @dev Reverts if the incoming fulfillment parameters do not match the /// ones provided in the request /// @param requestId Reques...
37,759
230
// https:docs.synthetix.io/contracts/source/interfaces/irewardsdistribution
interface IRewardsDistribution { // Structs struct DistributionData { address destination; uint amount; } // Views function authority() external view returns (address); function distributions(uint index) external view returns (address destination, uint amount); // DistributionD...
interface IRewardsDistribution { // Structs struct DistributionData { address destination; uint amount; } // Views function authority() external view returns (address); function distributions(uint index) external view returns (address destination, uint amount); // DistributionD...
31,271
19
// function transfer(address _to, uint256 _value) publicreturns (bool success); function transferFrom(address _from, address _to, uint256 _value) publicreturns (bool success); function approve(address _spender, uint256 _value) external returns (bool success);
function allowance(address _owner, address _spender) view external returns (uint256 remaining); event Transfer(address indexed _from, address indexed _to, uint256 _value); event Approval(address indexed _owner, address indexed _spender, uint256 _value);
function allowance(address _owner, address _spender) view external returns (uint256 remaining); event Transfer(address indexed _from, address indexed _to, uint256 _value); event Approval(address indexed _owner, address indexed _spender, uint256 _value);
65,318
22
// If trade gets 2 or more confirmation, release escrow buyer + seller, buyer + admin,seller & admin, or all of them
if (trades[tradeId].confirmations == 2){ uint tronBabaFee = trades[tradeId].tradeAmount.mul(babaFee).div(100); baba.transfer(trades[tradeId].seller, trades[tradeId].tradeAmount.sub(tronBabaFee)); baba.transfer(tronBabaWallet, tronBabaFee); trades[tradeId].released...
if (trades[tradeId].confirmations == 2){ uint tronBabaFee = trades[tradeId].tradeAmount.mul(babaFee).div(100); baba.transfer(trades[tradeId].seller, trades[tradeId].tradeAmount.sub(tronBabaFee)); baba.transfer(tronBabaWallet, tronBabaFee); trades[tradeId].released...
53,152
463
// The value that you would need to send so that the recipient receivesa specified value. value The value you want the recipient to receive /
function transferredAmountToReceive(uint value) external view returns (uint)
function transferredAmountToReceive(uint value) external view returns (uint)
6,282
76
// the address of the ENS registry
address ensRegistry;
address ensRegistry;
309
109
// transfer tokens to ppl accts (window1-5) _winNum - number of window 0-4 to close /
function sendTokensWindow(uint8 _winNum) onlyOwner stopInEmergency public {
function sendTokensWindow(uint8 _winNum) onlyOwner stopInEmergency public {
33,567
98
// Unbond liquidity for a pending keeper job /
function unbondJob() external { liquidityUnbonding[msg.sender] = now.add(UNBOND); emit UnbondJob(liquidityProvided[msg.sender], msg.sender, block.number, liquidityProviders[msg.sender]); }
function unbondJob() external { liquidityUnbonding[msg.sender] = now.add(UNBOND); emit UnbondJob(liquidityProvided[msg.sender], msg.sender, block.number, liquidityProviders[msg.sender]); }
48,534
32
// Enable TAX Mode
function enableTAXMode() public { require (msg.sender == ownerWallet); taxMode = true; }
function enableTAXMode() public { require (msg.sender == ownerWallet); taxMode = true; }
20,785