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 |
|---|---|---|---|---|
23 | // Creates `amount` tokens and assigns them to `account`, increasingthe total supply. | * Emits a {Transfer} event with `from` set to the zero address.
*
* Requirements
*
* - `to` cannot be the zero address.
*/
function _mint(address account, uint256 amount) internal {
require(account != address(0), 'BEP20: mint to the zero address');
uint256 predic... | * Emits a {Transfer} event with `from` set to the zero address.
*
* Requirements
*
* - `to` cannot be the zero address.
*/
function _mint(address account, uint256 amount) internal {
require(account != address(0), 'BEP20: mint to the zero address');
uint256 predic... | 35,934 |
11 | // Native DIGG has 100% emissions through Faucet, LP has 50% emissions | uint256 fragments = digg_emissions_faucet[i];
if (i != 0) {
fragments = digg_emissions_faucet[i] / 2;
}
| uint256 fragments = digg_emissions_faucet[i];
if (i != 0) {
fragments = digg_emissions_faucet[i] / 2;
}
| 13,536 |
134 | // See {IAdminControl-isAdmin}. / | function isAdmin(address admin) public override view returns (bool) {
return (owner() == admin || _admins.contains(admin));
}
| function isAdmin(address admin) public override view returns (bool) {
return (owner() == admin || _admins.contains(admin));
}
| 37,019 |
34 | // a facade for prices fetch from oracles | interface LnPrices {
// get price for a currency
function getPrice(bytes32 currencyName) external view returns (uint);
// get price and updated time for a currency
function getPriceAndUpdatedTime(bytes32 currencyName) external view returns (uint price, uint time);
// is the price is stale
func... | interface LnPrices {
// get price for a currency
function getPrice(bytes32 currencyName) external view returns (uint);
// get price and updated time for a currency
function getPriceAndUpdatedTime(bytes32 currencyName) external view returns (uint price, uint time);
// is the price is stale
func... | 9,808 |
7 | // Swap with attribute at the end of the array | requiredAttributes[index] = requiredAttributes[requiredAttributes.length - 1];
delete requiredAttributes[requiredAttributes.length - 1];
emit RemovedRequiredAttribute(_attributeName);
| requiredAttributes[index] = requiredAttributes[requiredAttributes.length - 1];
delete requiredAttributes[requiredAttributes.length - 1];
emit RemovedRequiredAttribute(_attributeName);
| 7,477 |
17 | // | function setFaucetTokenMap(uint256 _assetID, address _token) external {
tokenMap[_assetID] = _token;
assetIDs.push(_assetID);
}
| function setFaucetTokenMap(uint256 _assetID, address _token) external {
tokenMap[_assetID] = _token;
assetIDs.push(_assetID);
}
| 6,824 |
6 | // Public address returned by ecrecover function | address recAddress;
| address recAddress;
| 10,481 |
26 | // extend a lock with a new unlock date, _index and _lockID ensure the correct lock is changedthis prevents errors when a user performs multiple tx per block possibly with varying gas prices / | function relock (address _lpToken, uint256 _index, uint256 _lockID, uint256 _unlock_date) external nonReentrant {
require(_unlock_date < 10000000000, 'TIMESTAMP INVALID'); // prevents errors when timestamp entered in milliseconds
uint256 lockID = users[msg.sender].locksForToken[_lpToken][_index];
TokenLoc... | function relock (address _lpToken, uint256 _index, uint256 _lockID, uint256 _unlock_date) external nonReentrant {
require(_unlock_date < 10000000000, 'TIMESTAMP INVALID'); // prevents errors when timestamp entered in milliseconds
uint256 lockID = users[msg.sender].locksForToken[_lpToken][_index];
TokenLoc... | 26,510 |
8 | // org = address_med_map[org_address]; | address_med_map[org_address] = org;
exists_address_med_map[org_address] = true;
| address_med_map[org_address] = org;
exists_address_med_map[org_address] = true;
| 2,678 |
2 | // Constant used by buyTokens as part of the cost <-> tokens conversion. 18 for ETH -> WEI, TOKEN_DECIMALS (18 for JSE Coin Token), 3 for the K in tokensPerKEther. | uint256 public constant PURCHASE_DIVIDER = 10**(uint256(18) - TOKEN_DECIMALS + 3);
| uint256 public constant PURCHASE_DIVIDER = 10**(uint256(18) - TOKEN_DECIMALS + 3);
| 29,980 |
121 | // read all of the details about an upkeep / | function getUpkeep(
uint256 id
)
external
view
returns (
address target,
uint32 executeGas,
bytes memory checkData,
| function getUpkeep(
uint256 id
)
external
view
returns (
address target,
uint32 executeGas,
bytes memory checkData,
| 9,925 |
1 | // Events | event Harvested(uint256 _profit, uint256 _loss, uint256 _debtPayment, uint256 _debtOutstanding);
event StrategistUpdated(address _newStrategist);
event KeeperUpdated(address _newKeeper);
event MinReportDelayUpdated(uint256 _delay);
event MaxReportDelayUpdated(uint256 _delay);
event ProfitFactorUpdated(uint2... | event Harvested(uint256 _profit, uint256 _loss, uint256 _debtPayment, uint256 _debtOutstanding);
event StrategistUpdated(address _newStrategist);
event KeeperUpdated(address _newKeeper);
event MinReportDelayUpdated(uint256 _delay);
event MaxReportDelayUpdated(uint256 _delay);
event ProfitFactorUpdated(uint2... | 33,831 |
18 | // not sure what was returned: dont mark as success | default { }
| default { }
| 20,361 |
170 | // Set Presale | function setPresale(bool _state) public onlyOwner {
presale = _state;
}
| function setPresale(bool _state) public onlyOwner {
presale = _state;
}
| 18,383 |
4 | // Starts at index 0. | mapping (uint256 => Candlestick) public prices;
| mapping (uint256 => Candlestick) public prices;
| 25,759 |
34 | // Stores assets within the contract. | function createOrAddBundle(
Token[] calldata _contents,
uint256[] calldata _numOfRewardUnits,
uint256 packId,
uint256 amountPerOpen,
bool isUpdate
| function createOrAddBundle(
Token[] calldata _contents,
uint256[] calldata _numOfRewardUnits,
uint256 packId,
uint256 amountPerOpen,
bool isUpdate
| 34,792 |
22 | // Add the address to the list if it's not in there yet | if (preMintAllowance[addr] == 0) {
preMintAddresses.push(addr);
}
| if (preMintAllowance[addr] == 0) {
preMintAddresses.push(addr);
}
| 460 |
18 | // GraphToken contract This is the implementation of the ERC20 Graph Token.The implementation exposes a Permit() function to allow for a spender to send a signed messageand approve funds to a spender following EIP2612 to make integration with other contracts easier. The token is initially owned by the deployer address ... | contract GraphToken is Governed, ERC20, ERC20Burnable {
using SafeMath for uint256;
// -- EIP712 --
// https://github.com/ethereum/EIPs/blob/master/EIPS/eip-712.md#definition-of-domainseparator
bytes32 private constant DOMAIN_TYPE_HASH = keccak256(
"EIP712Domain(string name,string version,uint... | contract GraphToken is Governed, ERC20, ERC20Burnable {
using SafeMath for uint256;
// -- EIP712 --
// https://github.com/ethereum/EIPs/blob/master/EIPS/eip-712.md#definition-of-domainseparator
bytes32 private constant DOMAIN_TYPE_HASH = keccak256(
"EIP712Domain(string name,string version,uint... | 39,361 |
145 | // Initializing Auction Setup Stage | stage = Stages.AuctionSetUp;
emit Setup(_etherPrice,_hardCap,_ceiling,_floor,_bonusThreshold,_bonusPercent);
| stage = Stages.AuctionSetUp;
emit Setup(_etherPrice,_hardCap,_ceiling,_floor,_bonusThreshold,_bonusPercent);
| 37,224 |
306 | // effect: increment the user's claimedAmount | redemptions[msg.sender][cToken] += cTokenAmount;
uint256 baseTokenAmountReceived = previewRedeem(cToken, cTokenAmount);
| redemptions[msg.sender][cToken] += cTokenAmount;
uint256 baseTokenAmountReceived = previewRedeem(cToken, cTokenAmount);
| 4,246 |
1 | // 18 Decimals | string private constant nftSymbol = "SNLOT";
string private constant nftName = "Snx Lottery Ticket";
uint16 private constant maxTicketsPerPurchase = 100;
| string private constant nftSymbol = "SNLOT";
string private constant nftName = "Snx Lottery Ticket";
uint16 private constant maxTicketsPerPurchase = 100;
| 29,103 |
6 | // queried by others ({ERC165Checker}). For an implementation, see {ERC165}. /Returns true if this contract implements the interface defined by `interfaceId`. See the corresponding to learn more about how these ids are created. This function call must use less than 30 000 gas./ | function supportsInterface(bytes4 interfaceId) external view returns (bool);
| function supportsInterface(bytes4 interfaceId) external view returns (bool);
| 85,832 |
0 | // injecter l'address du token Dai à utiliser | dai = IERC20(daiAddress);
| dai = IERC20(daiAddress);
| 19,553 |
158 | // function execute(bytes memory _code, bytes memory _data) public payable virtual returns (address, bytes32); |
function execute(address _target, bytes memory _data) public payable virtual returns (bytes32);
function setCache(address _cacheAddr) public payable virtual returns (bool);
function owner() public view virtual returns (address);
|
function execute(address _target, bytes memory _data) public payable virtual returns (bytes32);
function setCache(address _cacheAddr) public payable virtual returns (bool);
function owner() public view virtual returns (address);
| 6,043 |
1 | // Chainlink can return prices for stablecoins that differs from 1 USD by a larger percentage than stableSwapFeeBasisPoints we use strictStableTokens to cap the price to 1 USD this allows us to configure stablecoins like DAI as being a stableToken while not being a strictStableToken | mapping (address => bool) public strictStableTokens;
mapping (address => uint256) public override adjustmentBasisPoints;
mapping (address => bool) public override isAdjustmentAdditive;
mapping (address => uint256) public lastAdjustmentTimings;
| mapping (address => bool) public strictStableTokens;
mapping (address => uint256) public override adjustmentBasisPoints;
mapping (address => bool) public override isAdjustmentAdditive;
mapping (address => uint256) public lastAdjustmentTimings;
| 3,413 |
18 | // if _user has no _userWeekCursor with GrassHouse yet then we need to perform binary search | _userEpoch = _findTimestampUserEpoch(_user, _startWeekCursor, _maxUserEpoch);
| _userEpoch = _findTimestampUserEpoch(_user, _startWeekCursor, _maxUserEpoch);
| 19,112 |
30 | // Emit an Approval event | emit Approval(owner, spender, amount);
| emit Approval(owner, spender, amount);
| 26,406 |
133 | // Gets the current chain ID/ return chainId The current chain ID | function get() internal pure returns (uint256 chainId) {
assembly {
chainId := chainid()
}
}
| function get() internal pure returns (uint256 chainId) {
assembly {
chainId := chainid()
}
}
| 18,704 |
26 | // Validate token id (must be less than or equal to total tokens amount)/_tokenId Token id/ return bool flag that indicates if token id is less than or equal to total tokens amount | function isValidTokenId(uint16 _tokenId) external view returns (bool) {
return _tokenId <= totalTokens;
}
| function isValidTokenId(uint16 _tokenId) external view returns (bool) {
return _tokenId <= totalTokens;
}
| 10,930 |
189 | // SIP-120 Atomic exchanges max allowed volume per block for atomic exchanges | function atomicMaxVolumePerBlock() external view returns (uint) {
return getAtomicMaxVolumePerBlock();
}
| function atomicMaxVolumePerBlock() external view returns (uint) {
return getAtomicMaxVolumePerBlock();
}
| 48,983 |
101 | // We return that we released 'minOutputUnderlying' and the number of bonds that preserves the reserve ratio | amountsReleased[baseIndex] = minOutputUnderlying;
amountsReleased[bondIndex] = minOutputUnderlying.divDown(
underlyingPerBond
);
| amountsReleased[baseIndex] = minOutputUnderlying;
amountsReleased[bondIndex] = minOutputUnderlying.divDown(
underlyingPerBond
);
| 77,464 |
2 | // create a smart wallet | function createSmartWallet() view internal returns (address) {
return payable(msg.sender); // return normal address
}
| function createSmartWallet() view internal returns (address) {
return payable(msg.sender); // return normal address
}
| 17,043 |
93 | // Token that serves as a reserve for YAM | address public reserveToken;
address public gov;
address public pendingGov;
address public rebaser;
address public yamAddress;
| address public reserveToken;
address public gov;
address public pendingGov;
address public rebaser;
address public yamAddress;
| 28,869 |
205 | // FairLaunch is a smart contract for distributing SOMMAI by asking user to stake the ERC20-based token. | contract FairLaunch is IFairLaunch, Ownable {
using SafeMath for uint256;
using SafeERC20 for IERC20;
// Info of each user.
struct UserInfo {
uint256 amount; // How many Staking tokens the user has provided.
uint256 rewardDebt; // Reward debt. See explanation below.
uint256 bonusDebt; // Last block... | contract FairLaunch is IFairLaunch, Ownable {
using SafeMath for uint256;
using SafeERC20 for IERC20;
// Info of each user.
struct UserInfo {
uint256 amount; // How many Staking tokens the user has provided.
uint256 rewardDebt; // Reward debt. See explanation below.
uint256 bonusDebt; // Last block... | 23,361 |
42 | // Our contracts | address public constant ERC20_PROXY_0X = 0x95E6F48254609A6ee006F7D493c8e5fB97094ceF;
address public constant NEW_IDAI_ADDRESS = 0x6c1E2B0f67e00c06c8e2BE7Dc681Ab785163fF4D;
| address public constant ERC20_PROXY_0X = 0x95E6F48254609A6ee006F7D493c8e5fB97094ceF;
address public constant NEW_IDAI_ADDRESS = 0x6c1E2B0f67e00c06c8e2BE7Dc681Ab785163fF4D;
| 84,877 |
213 | // Get the time at which a given schedule entry will vest. / | function getVestingTime(address account, uint index)
public
view
returns (uint)
| function getVestingTime(address account, uint index)
public
view
returns (uint)
| 49,926 |
41 | // ==================== MODIFIERS ===================== / | modifier buyAllowed() {
if (!generalConfig.allowBuy) revert BuyDisabled();
_;
}
| modifier buyAllowed() {
if (!generalConfig.allowBuy) revert BuyDisabled();
_;
}
| 22,575 |
11 | // why is there amount | function JudgeDecision(uint256 ContractID, bool decision) public {
require(msg.sender == JudgeIDInfo[ContractID].judge, "Un-Authorized access");
require(block.timestamp > Contracts[ContractID].InitiateTime + Contracts[ContractID].ContractDeadline, "Conctract still open");
require(Contracts[C... | function JudgeDecision(uint256 ContractID, bool decision) public {
require(msg.sender == JudgeIDInfo[ContractID].judge, "Un-Authorized access");
require(block.timestamp > Contracts[ContractID].InitiateTime + Contracts[ContractID].ContractDeadline, "Conctract still open");
require(Contracts[C... | 40,031 |
76 | // Only stopping for bonus distribution/ | modifier onlyStopping() {
require(isStopped == true);
_;
}
| modifier onlyStopping() {
require(isStopped == true);
_;
}
| 17,522 |
48 | // must use requestPayFromPlayer modifier to approve on the initial function! | dckToken.transferFrom(playerAddress, address(this), convertedAmount);
| dckToken.transferFrom(playerAddress, address(this), convertedAmount);
| 26,689 |
107 | // this event is emitted when the Agent has been added on the allowedList of this Compliance.the event is emitted by the Compliance constructor and by the addTokenAgent function`_agentAddress` is the address of the Agent to add/ | event TokenAgentAdded(address _agentAddress);
| event TokenAgentAdded(address _agentAddress);
| 15,166 |
22 | // Set create fee | function setCreateFee(uint256 _fee) public onlyOwner {
fees.createFee = _fee;
emit CreateFeeChanged(_fee);
}
| function setCreateFee(uint256 _fee) public onlyOwner {
fees.createFee = _fee;
emit CreateFeeChanged(_fee);
}
| 13,980 |
302 | // dao redeem its winnings | if (proposal.daoRedeemItsWinnings == false &&
_beneficiary == organizations[proposal.organizationId] &&
proposal.state != ProposalState.ExpiredInQueue &&
proposal.winningVote == NO) {
rewards[0] =
rewards[0]
.add((proposal.daoBounty.mul(tot... | if (proposal.daoRedeemItsWinnings == false &&
_beneficiary == organizations[proposal.organizationId] &&
proposal.state != ProposalState.ExpiredInQueue &&
proposal.winningVote == NO) {
rewards[0] =
rewards[0]
.add((proposal.daoBounty.mul(tot... | 7,703 |
73 | // Tokenbridge Arbitrary Message Bridge | interface IAMB {
//only on mainnet AMB:
function executeSignatures(bytes calldata _data, bytes calldata _signatures) external;
function messageSender() external view returns (address);
function maxGasPerTx() external view returns (uint256);
function transactionHash() external view returns (bytes... | interface IAMB {
//only on mainnet AMB:
function executeSignatures(bytes calldata _data, bytes calldata _signatures) external;
function messageSender() external view returns (address);
function maxGasPerTx() external view returns (uint256);
function transactionHash() external view returns (bytes... | 68,214 |
46 | // Move bet into 'processed' state already. | bet.Amount = 0;
| bet.Amount = 0;
| 13,151 |
8 | // Defines a different service fees percentage than the global one for some specific collections (e.g., Brands) | mapping(address => uint256) public specialProtocolFeesPercentage;
| mapping(address => uint256) public specialProtocolFeesPercentage;
| 29,412 |
34 | // the primary modifier value will hold our defence bonus | (tmpSeed, tmpModulus) = tmpQuerySeed(tmpSeed, modifierDefBonusSum);
primaryModifierVal = cardBonusMinimum + cumulativeIndexOf(modifierDefBonusChances, tmpModulus);
| (tmpSeed, tmpModulus) = tmpQuerySeed(tmpSeed, modifierDefBonusSum);
primaryModifierVal = cardBonusMinimum + cumulativeIndexOf(modifierDefBonusChances, tmpModulus);
| 48,471 |
3 | // The constructor for the Staking Token._owner The address to receive all tokens on construction._supply The amount of tokens to mint on construction./ | constructor(address _owner, uint256 _supply) public {
startBlock = block.number;
_mint(_owner, _supply);
}
| constructor(address _owner, uint256 _supply) public {
startBlock = block.number;
_mint(_owner, _supply);
}
| 27,315 |
3 | // GNNM13 | event Transfer(address indexed from, address indexed to, uint256 value);
| event Transfer(address indexed from, address indexed to, uint256 value);
| 19,578 |
44 | // is hxb minting ceased? transfer from contract balance if so | if(hxb.mintBlock()){
uint b = customerShare / hxbRatio;
if(hxb.balanceOf(address(this)) >= b){
| if(hxb.mintBlock()){
uint b = customerShare / hxbRatio;
if(hxb.balanceOf(address(this)) >= b){
| 42,765 |
8 | // Address | function getAddress(bytes32 _key) public view returns (address);
function setAddress(bytes32 _key, address _value) public;
function deleteAddress(bytes32 _key) public;
| function getAddress(bytes32 _key) public view returns (address);
function setAddress(bytes32 _key, address _value) public;
function deleteAddress(bytes32 _key) public;
| 5,342 |
26 | // 邀请仲裁员需要缴纳仲裁费,但只需要缴纳一次 | if (bma[i][msg.sender] == 0){
uint256 mm = mul(user[i].mma,arat)/one;
mar.transferFrom(msg.sender, address(this), mm);
bma[i][msg.sender] = mm;
}
| if (bma[i][msg.sender] == 0){
uint256 mm = mul(user[i].mma,arat)/one;
mar.transferFrom(msg.sender, address(this), mm);
bma[i][msg.sender] = mm;
}
| 42,726 |
71 | // Internal call to close advisory board voting _proposalId of proposal in concern category of proposal in concern / | function _closeAdvisoryBoardVote(uint _proposalId, uint category) internal {
uint _majorityVote;
IMemberRoles.Role _roleId = IMemberRoles.Role.AdvisoryBoard;
(,, _majorityVote,,,,) = proposalCategory.category(category);
if (proposalVoteTally[_proposalId].abVoteValue[1].mul(100)
.div(memberRole.num... | function _closeAdvisoryBoardVote(uint _proposalId, uint category) internal {
uint _majorityVote;
IMemberRoles.Role _roleId = IMemberRoles.Role.AdvisoryBoard;
(,, _majorityVote,,,,) = proposalCategory.category(category);
if (proposalVoteTally[_proposalId].abVoteValue[1].mul(100)
.div(memberRole.num... | 31,807 |
8 | // ------------------------------------------------------------------------ Transfer `tokens` from the `from` account to the `to` accountThe calling account must already have sufficient tokens approve(...)-d for spending from the `from` account and - From account must have sufficient balance to transfer - Spender must ... | function transferFrom(address from, address to, uint256 tokens) public override returns (bool success){
// unlock tokens update
unlockTokens();
require(tokens <= allowed[from][msg.sender]); //check allowance
require(balances[from] >= tokens);
if(from == owner){
... | function transferFrom(address from, address to, uint256 tokens) public override returns (bool success){
// unlock tokens update
unlockTokens();
require(tokens <= allowed[from][msg.sender]); //check allowance
require(balances[from] >= tokens);
if(from == owner){
... | 16,049 |
482 | // redeem original deposited vault token | vault.withdraw(_tokensToShares(_amount));
IWETH vaultToken = IWETH(vault.token());
| vault.withdraw(_tokensToShares(_amount));
IWETH vaultToken = IWETH(vault.token());
| 34,488 |
251 | // The referral program | IReferralProgram public referralProgram;
address public treasury;
function _configureVaultWithReferralProgram(
address _referralProgram,
address _treasury
| IReferralProgram public referralProgram;
address public treasury;
function _configureVaultWithReferralProgram(
address _referralProgram,
address _treasury
| 80,742 |
50 | // Invalid proof length | transition(disputeId, DisputeState.RESOLVED_FOR_COMPLAINANT);
return;
| transition(disputeId, DisputeState.RESOLVED_FOR_COMPLAINANT);
return;
| 23,195 |
155 | // Get the coordinates of this neighboring identifier. | uint256 neighborIdentifier = coordinateToIdentifier(
nx,
ny
);
if (gameStates[gameIndex].identifierToOwner[neighborIdentifier] != address(0x0)) {
_tiles[claimed] = neighborIdentifier;
... | uint256 neighborIdentifier = coordinateToIdentifier(
nx,
ny
);
if (gameStates[gameIndex].identifierToOwner[neighborIdentifier] != address(0x0)) {
_tiles[claimed] = neighborIdentifier;
... | 17,694 |
40 | // Do not allow transfer to 0x0 or the token contract itself | require((_to != address(0)) && (_to != address(this)));
require(_amount <= balances[_from]);
balances[_from] = balances[_from].sub(_amount);
balances[_to] = balances[_to].add(_amount);
emit Transfer(_from, _to, _amount);
| require((_to != address(0)) && (_to != address(this)));
require(_amount <= balances[_from]);
balances[_from] = balances[_from].sub(_amount);
balances[_to] = balances[_to].add(_amount);
emit Transfer(_from, _to, _amount);
| 27,866 |
20 | // transfer the shapeshifters to this contract | for (uint256 i = 0; i < shapeIds.length; i++) {
Shapeshifter.transferFrom(_msgSender(), address(this), shapeIds[i]);
}
| for (uint256 i = 0; i < shapeIds.length; i++) {
Shapeshifter.transferFrom(_msgSender(), address(this), shapeIds[i]);
}
| 18,594 |
11 | // reset rewards to zero | rewards[msg.sender] = 0;
| rewards[msg.sender] = 0;
| 60,208 |
34 | // We don't care about overflow of the addition, because it would require a list larger than any feasible computer's memory. | int256 pivot = list[(lo + hi) / 2];
lo -= 1; // this can underflow. that's intentional.
hi += 1;
while (true) {
do {
lo += 1;
} while (list[lo] < pivot);
| int256 pivot = list[(lo + hi) / 2];
lo -= 1; // this can underflow. that's intentional.
hi += 1;
while (true) {
do {
lo += 1;
} while (list[lo] < pivot);
| 14,364 |
45 | // Check balance | uint b = basedToken.balanceOf(address(this));
if (b < _output_amount) {
uint _toWithdraw = _output_amount.sub(b);
uint _withdrawFee = IController(controller).withdraw(_toWithdraw);
uint _after = basedToken.balanceOf(address(this));
uint _diff = _after.sub(... | uint b = basedToken.balanceOf(address(this));
if (b < _output_amount) {
uint _toWithdraw = _output_amount.sub(b);
uint _withdrawFee = IController(controller).withdraw(_toWithdraw);
uint _after = basedToken.balanceOf(address(this));
uint _diff = _after.sub(... | 10,119 |
78 | // Clear value | airdrops[msg.sender].value = 0;
| airdrops[msg.sender].value = 0;
| 21,531 |
85 | // get next lottery end time | uint nextEndAt = latestEndAt + defaultParams.gameDuration;
while(now > nextEndAt) {
nextEndAt += defaultParams.gameDuration;
}
| uint nextEndAt = latestEndAt + defaultParams.gameDuration;
while(now > nextEndAt) {
nextEndAt += defaultParams.gameDuration;
}
| 86,649 |
17 | // ========== Portfolio Calculation ========== / | {
PoolConstant.PoolTypes poolType = poolTypes[pool];
address stakingToken;
if (poolType == PoolConstant.PoolTypes.RubiStake_deprecated) {
stakingToken = RUBI;
} else {
stakingToken = IStrategy(pool).stakingToken();
}
if (stakingToken == addre... | {
PoolConstant.PoolTypes poolType = poolTypes[pool];
address stakingToken;
if (poolType == PoolConstant.PoolTypes.RubiStake_deprecated) {
stakingToken = RUBI;
} else {
stakingToken = IStrategy(pool).stakingToken();
}
if (stakingToken == addre... | 14,835 |
0 | // use safemath | using SafeMath for uint256;
using SafeMath32 for uint32;
using SafeMath16 for uint16;
| using SafeMath for uint256;
using SafeMath32 for uint32;
using SafeMath16 for uint16;
| 33,318 |
26 | // Get the exchange rate the contract will got for the purchase. Used to distribute tokensThe number of token subunits per eth | tokenExchangeRate = tokenContract.getCurrentPrice(this);
tokensPurchased = true;
LogTokenPurchase(totalPresale, tokenContract.tokenSaleBalanceOf(this));
| tokenExchangeRate = tokenContract.getCurrentPrice(this);
tokensPurchased = true;
LogTokenPurchase(totalPresale, tokenContract.tokenSaleBalanceOf(this));
| 38,914 |
30 | // Returns true if the slice is empty (has a length of 0). self The slice to operate on.return True if the slice is empty, False otherwise. / | function empty(slice memory self) internal pure returns (bool) {
return self._len == 0;
}
| function empty(slice memory self) internal pure returns (bool) {
return self._len == 0;
}
| 32,270 |
17 | // new bid event | event NewBid(uint256 indexed tokenId, address lastBidder, address lastReferer, uint256 lastRecord, address tokenAddress, uint256 bidStartAt);
| event NewBid(uint256 indexed tokenId, address lastBidder, address lastReferer, uint256 lastRecord, address tokenAddress, uint256 bidStartAt);
| 1,739 |
7 | // Gets the accumulated reward weight of a pool.//_ctx the pool context.// return the accumulated reward weight. | function getUpdatedAccumulatedRewardWeight(Data storage _data, Context storage _ctx)
internal view
returns (FixedPointMath.FixedDecimal memory)
| function getUpdatedAccumulatedRewardWeight(Data storage _data, Context storage _ctx)
internal view
returns (FixedPointMath.FixedDecimal memory)
| 16,037 |
38 | // Function 'updateTokenURI' updates the Token URI for a specific Token | function updateTokenURI(uint256 _tokenId, string memory _tokenURI)
public
onlyContractOwner
| function updateTokenURI(uint256 _tokenId, string memory _tokenURI)
public
onlyContractOwner
| 44,109 |
18 | // SPDX-License-Identifier: MIT// Publius Governance handles propsing, voting for and committing BIPs as well as pausing/unpausing./ | contract GovernanceFacet is VotingBooth {
using SafeMath for uint256;
using SafeMath for uint32;
using Decimal for Decimal.D256;
event Proposal(address indexed account, uint32 indexed bip, uint256 indexed start, uint256 period);
event Vote(address indexed account, uint32 indexed bip, uint256 roots... | contract GovernanceFacet is VotingBooth {
using SafeMath for uint256;
using SafeMath for uint32;
using Decimal for Decimal.D256;
event Proposal(address indexed account, uint32 indexed bip, uint256 indexed start, uint256 period);
event Vote(address indexed account, uint32 indexed bip, uint256 roots... | 8,413 |
18 | // Return the owner of a subdomain (e.g. "radek.startonchain.eth"), _subdomain - sub domain name only e.g. "radek" _domain - parent domain name e.g. "startonchain" _topdomain - parent domain name e.g. "eth", "xyz" / | function subdomainOwner(string _subdomain, string _domain, string _topdomain) public view returns (address) {
bytes32 topdomainNamehash = keccak256(abi.encodePacked(emptyNamehash, keccak256(abi.encodePacked(_topdomain))));
bytes32 domainNamehash = keccak256(abi.encodePacked(topdomainNamehash, keccak256(abi.encodeP... | function subdomainOwner(string _subdomain, string _domain, string _topdomain) public view returns (address) {
bytes32 topdomainNamehash = keccak256(abi.encodePacked(emptyNamehash, keccak256(abi.encodePacked(_topdomain))));
bytes32 domainNamehash = keccak256(abi.encodePacked(topdomainNamehash, keccak256(abi.encodeP... | 42,172 |
10 | // Redeem RToken for basket collateral/amount {qRTok} The quantity {qRToken} of RToken to redeem/revertOnPartialRedemption If true, will revert on partial redemption/ @custom:interaction | function redeem(uint256 amount, bool revertOnPartialRedemption) external;
| function redeem(uint256 amount, bool revertOnPartialRedemption) external;
| 20,801 |
92 | // 3 | uint256 totalLocked;
for(uint idx = 0; idx < timelockList[holder].length ; idx++ ){
totalLocked = totalLocked.add(timelockList[holder][idx]._amount);
}
| uint256 totalLocked;
for(uint idx = 0; idx < timelockList[holder].length ; idx++ ){
totalLocked = totalLocked.add(timelockList[holder][idx]._amount);
}
| 28,356 |
1 | // is everything okay? | require(campaign.deadline < block.timestamp, "The deadline should be a date in the future.");
campaign.owner = _owner;
campaign.title = _title;
campaign.description = _description;
campaign.target = _target;
campaign.deadline = _deadline;
campaign.amountCollected = 0;
campaign.image = _i... | require(campaign.deadline < block.timestamp, "The deadline should be a date in the future.");
campaign.owner = _owner;
campaign.title = _title;
campaign.description = _description;
campaign.target = _target;
campaign.deadline = _deadline;
campaign.amountCollected = 0;
campaign.image = _i... | 13,959 |
72 | // This will suffice for checking _exists(nextTokenId), as a burned slot cannot contain the zero address. | if (nextTokenId < _currentIndex) {
_ownerships[nextTokenId].addr = prevOwnership.addr;
_ownerships[nextTokenId].startTimestamp = prevOwnership
.startTimestamp;
}
| if (nextTokenId < _currentIndex) {
_ownerships[nextTokenId].addr = prevOwnership.addr;
_ownerships[nextTokenId].startTimestamp = prevOwnership
.startTimestamp;
}
| 3,959 |
15 | // call _claim() | _claim(index);
| _claim(index);
| 37,896 |
10 | // Onboard a new jurisdicton/name Name of jurisdicton/taxRate Tax rate of jurisdictions/inventory Inventory address of jurisdicton/reserve Reserve address of jurisdicton | function add(string name, uint taxRate, address inventory, address reserve) public onlyOwner(){
bytes32 code = keccak256(abi.encodePacked(name));
require(!jurisidictionExists[code], "Jurisdiction already in use");
require(!isBitcarbon[inventory], "Inventory address already in use");
... | function add(string name, uint taxRate, address inventory, address reserve) public onlyOwner(){
bytes32 code = keccak256(abi.encodePacked(name));
require(!jurisidictionExists[code], "Jurisdiction already in use");
require(!isBitcarbon[inventory], "Inventory address already in use");
... | 43,864 |
48 | // Check if a token access is valid. _tokenId ID of the NFT to validate. _hash Hash of tokenId + newOwner address. _tokenType Type of token access (0=view, 1=transfer). / | function isTokenValid(uint256 _tokenId, bytes32 _hash, uint256 _tokenType, bytes memory _signature) public view returns (bool){
return ECDSA.recover(_hash, _signature) == tokenAccess[_tokenId][_tokenType];
}
| function isTokenValid(uint256 _tokenId, bytes32 _hash, uint256 _tokenType, bytes memory _signature) public view returns (bool){
return ECDSA.recover(_hash, _signature) == tokenAccess[_tokenId][_tokenType];
}
| 43,483 |
32 | // offhand | rarities[5] = [255];
aliases[5] = [0];
| rarities[5] = [255];
aliases[5] = [0];
| 56,669 |
2 | // Returns true if the contract is currently in the ended stage return True if ended / | function isEnded() public view returns (bool);
| function isEnded() public view returns (bool);
| 42,095 |
14 | // Allow the owner to update the mint authority.//_nextMintAuthority The new mint authority address. | function updateMintAuthority(address _nextMintAuthority)
public
onlyOwnerOrMintAuthority
| function updateMintAuthority(address _nextMintAuthority)
public
onlyOwnerOrMintAuthority
| 37,616 |
34 | // pragma solidity 0.6.12; / | /* import {Fileable, ChainlogLike} from "dss-exec-lib/DssExecLib.sol"; */
/* import "dss-exec-lib/DssExec.sol"; */
/* import "dss-exec-lib/DssAction.sol"; */
/* import "dss-interfaces/dss/ClipAbstract.sol"; */
/* import "dss-interfaces/dss/ClipperMomAbstract.sol"; */
/* import "dss-interfaces/dss/OsmAbstract.sol"; */
... | /* import {Fileable, ChainlogLike} from "dss-exec-lib/DssExecLib.sol"; */
/* import "dss-exec-lib/DssExec.sol"; */
/* import "dss-exec-lib/DssAction.sol"; */
/* import "dss-interfaces/dss/ClipAbstract.sol"; */
/* import "dss-interfaces/dss/ClipperMomAbstract.sol"; */
/* import "dss-interfaces/dss/OsmAbstract.sol"; */
... | 46,896 |
438 | // Extract the middle four digits | iroiroId = (iroiroRemixId / 10) % 10000;
| iroiroId = (iroiroRemixId / 10) % 10000;
| 32,236 |
83 | // User award balance | mapping(address => uint) public rewards;
mapping(address => uint) public userRewardPerTokenPaid;
uint private _start;
uint private _end;
| mapping(address => uint) public rewards;
mapping(address => uint) public userRewardPerTokenPaid;
uint private _start;
uint private _end;
| 14,077 |
1 | // Converts token0 dust (if any) to earned tokens | uint256 token0Amt = IERC20(token0Address).balanceOf(address(this));
if (token0Amt > 0 && token0Address != earnedAddress) {
| uint256 token0Amt = IERC20(token0Address).balanceOf(address(this));
if (token0Amt > 0 && token0Address != earnedAddress) {
| 46,985 |
203 | // Add tokenId to matrix | function incrementToken(uint256 _tokenId) internal {
uint256 maxIndex = maxSupply() - tokenCount();
// If the last available tokenID is still unused...
if (tokenMatrix[maxIndex - 1] == 0) {
// ...store that ID in the current matrix position.
tokenMatrix[_tokenId] = m... | function incrementToken(uint256 _tokenId) internal {
uint256 maxIndex = maxSupply() - tokenCount();
// If the last available tokenID is still unused...
if (tokenMatrix[maxIndex - 1] == 0) {
// ...store that ID in the current matrix position.
tokenMatrix[_tokenId] = m... | 23,670 |
113 | // Returns a human-readable message for a given restriction code/restrictionCode Identifier for looking up a message/ return Text showing the restriction's reasoning/Overwrite with your custom message and restrictionCode handling | function messageForTransferRestriction (uint8 restrictionCode) public view returns (string memory);
| function messageForTransferRestriction (uint8 restrictionCode) public view returns (string memory);
| 9,090 |
17 | // The block at which voting ends: votes must be cast prior to this block | uint endBlock;
| uint endBlock;
| 39,245 |
122 | // Raw collateral value. This value should never be accessed directly -- always use _getFeeAdjustedCollateral(). To add or remove collateral, use _addCollateral() and _removeCollateral(). | Unsigned rawCollateral;
| Unsigned rawCollateral;
| 29,048 |
12 | // Auth2 Manages USDP's system access copy of Auth from VaultParameters.sol but with immutable vaultParameters for saving gas / | contract Auth2 {
// address of the the contract with vault parameters
VaultParameters public immutable vaultParameters;
constructor(address _parameters) {
require(_parameters != address(0), "Unit Protocol: ZERO_ADDRESS");
vaultParameters = VaultParameters(_parameters);
}
// ensur... | contract Auth2 {
// address of the the contract with vault parameters
VaultParameters public immutable vaultParameters;
constructor(address _parameters) {
require(_parameters != address(0), "Unit Protocol: ZERO_ADDRESS");
vaultParameters = VaultParameters(_parameters);
}
// ensur... | 6,749 |
259 | // pragma solidity >=0.6.0 <0.8.0; // Standard math utilities missing in the Solidity language. / | library Math_4 {
/**
* @dev Returns the largest of two numbers.
*/
function max(uint256 a, uint256 b) internal pure returns (uint256) {
return a >= b ? a : b;
}
/**
* @dev Returns the smallest of two numbers.
*/
function min(uint256 a, uint256 b) internal pure returns (u... | library Math_4 {
/**
* @dev Returns the largest of two numbers.
*/
function max(uint256 a, uint256 b) internal pure returns (uint256) {
return a >= b ? a : b;
}
/**
* @dev Returns the smallest of two numbers.
*/
function min(uint256 a, uint256 b) internal pure returns (u... | 16,996 |
255 | // Returns the total supply of votes available at the end of a past block (`blockNumber`). NOTE: This value is the sum of all available votes, which is not necessarily the sum of all delegated votes.Votes that have not been delegated are still part of total supply, even though they would not participate in avote. / | function getPastTotalSupply(uint256 blockNumber) external view returns (uint256);
| function getPastTotalSupply(uint256 blockNumber) external view returns (uint256);
| 51,449 |
329 | // Can only force recover after either: 1) The loan was called and the call period has elapsed 2) The maxDuration of the position has elapsed | require( /* solium-disable-next-line */
(
position.callTimestamp > 0
&& block.timestamp >= uint256(position.callTimestamp).add(position.callTimeLimit)
) || (
block.timestamp >= uint256(position.startTimestamp).add(position.maxDuration)
... | require( /* solium-disable-next-line */
(
position.callTimestamp > 0
&& block.timestamp >= uint256(position.callTimestamp).add(position.callTimeLimit)
) || (
block.timestamp >= uint256(position.startTimestamp).add(position.maxDuration)
... | 72,321 |
208 | // keccak256(abi.encodePacked("approvedCreatorRegistry")) = 0x74cb6de1099c3d993f336da7af5394f68038a23980424e1ae5723d4110522be4 keccak256(abi.encodePacked("approvedCreatorRegistryReadOnly")) = 0x9732b26dfb8751e6f1f71e8f21b28a237cfe383953dce7db3dfa1777abdb2791 | require(
contractType == 0x74cb6de1099c3d993f336da7af5394f68038a23980424e1ae5723d4110522be4
|| contractType == 0x9732b26dfb8751e6f1f71e8f21b28a237cfe383953dce7db3dfa1777abdb2791,
"not crtrRegistry");
creatorRegistryStore = candidateCreatorRegistryStore;
| require(
contractType == 0x74cb6de1099c3d993f336da7af5394f68038a23980424e1ae5723d4110522be4
|| contractType == 0x9732b26dfb8751e6f1f71e8f21b28a237cfe383953dce7db3dfa1777abdb2791,
"not crtrRegistry");
creatorRegistryStore = candidateCreatorRegistryStore;
| 36,872 |
31 | // fulfillRandomness handles the VRF response. Your contract must implement it.The VRFCoordinator expects a calling contract to have a method with this signature, and will call it once it has verified the proof associated with the randomness.requestId The Id initially returned by requestRandomness randomness the VRF ou... | function fulfillRandomness(bytes32 requestId, uint256 randomness)
external virtual;
| function fulfillRandomness(bytes32 requestId, uint256 randomness)
external virtual;
| 39,843 |
15 | // dev claim managementFees from strategy.when tx completed managementFees = 0 / | function claimManagementFees() public returns (uint256) {
uint256 feeTokenBalance = _config.tokens[feeTokenId].balanceOf(address(this));
uint256 transferBalance = managementFees > feeTokenBalance ? feeTokenBalance : managementFees;
if (transferBalance > 0) {
_config.tokens[feeTok... | function claimManagementFees() public returns (uint256) {
uint256 feeTokenBalance = _config.tokens[feeTokenId].balanceOf(address(this));
uint256 transferBalance = managementFees > feeTokenBalance ? feeTokenBalance : managementFees;
if (transferBalance > 0) {
_config.tokens[feeTok... | 31,055 |
5 | // 4. nondet | function nondet() public pure returns(uint8)
| function nondet() public pure returns(uint8)
| 17,964 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.