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 |
|---|---|---|---|---|
18 | // create a solarsystem | addSolarSystem(_ssAddress, msg.sender);
| addSolarSystem(_ssAddress, msg.sender);
| 44,092 |
30 | // Container for borrow balance information@member principal Total balance (with accrued interest), after applying the most recent balance-changing action@member interestIndex Global borrowIndex as of the most recent balance-changing action / | struct BorrowSnapshot {
uint principal;
uint interestIndex;
}
| struct BorrowSnapshot {
uint principal;
uint interestIndex;
}
| 18,965 |
15 | // Adds two numbers, returns an error on overflow./ | function addUInt(uint a, uint b) internal pure returns (MathError, uint) {
uint c = a + b;
if (c >= a) {
return (MathError.NO_ERROR, c);
} else {
return (MathError.INTEGER_OVERFLOW, 0);
}
}
| function addUInt(uint a, uint b) internal pure returns (MathError, uint) {
uint c = a + b;
if (c >= a) {
return (MathError.NO_ERROR, c);
} else {
return (MathError.INTEGER_OVERFLOW, 0);
}
}
| 10,585 |
7 | // if the referral address does not exist in the mapping, add it | referrals[_referralAddress] = referralData(
_referralAddress,
1,
referralBonus
);
myReferrals[_referralAddress].push(msg.sender);
| referrals[_referralAddress] = referralData(
_referralAddress,
1,
referralBonus
);
myReferrals[_referralAddress].push(msg.sender);
| 6,889 |
97 | // Changes market factory address / | function changeMarket(uint8 idx, address _market) external onlyAdmin {
require(_market != address(0), "Token address cannot be 0");
require(idx < 3, "Wrong market index");
market[idx] = _market;
}
| function changeMarket(uint8 idx, address _market) external onlyAdmin {
require(_market != address(0), "Token address cannot be 0");
require(idx < 3, "Wrong market index");
market[idx] = _market;
}
| 43,990 |
273 | // address of BB Tranche token contract | address public BBTranche;
| address public BBTranche;
| 29,498 |
2 | // The start of the distribution period in seconds divided by 604,800 seconds in a week | uint32 epoch;
| uint32 epoch;
| 63,824 |
8 | // Performance fee (taken when options are sold) | uint16 public performanceFee;
| uint16 public performanceFee;
| 7,449 |
205 | // the last timestamp where fees were claimed | uint256 public lastClaimed;
| uint256 public lastClaimed;
| 65,488 |
22 | // View the amount of dividend in wei that an address has earned in total./accumulativeDividendOf(_owner) = withdrawableDividendOf(_owner) + withdrawnDividendOf(_owner)/_owner The address of a token holder./ return The amount of dividend in wei that `_owner` has earned in total. | function accumulativeDividendOf(address _owner) external view returns(uint256);
| function accumulativeDividendOf(address _owner) external view returns(uint256);
| 6,067 |
346 | // Deposit `amount` stablecoin to vault |
vault.deposit(amount);
|
vault.deposit(amount);
| 2,193 |
9 | // Update last Reward | (address[] memory _tokens, uint256[] memory _rewards) = claimableReward(
msg.sender
);
for (uint256 i = 0; i < _tokens.length; i++) {
user.prevRemainingReward[_tokens[i]] = _rewards[i];
}
| (address[] memory _tokens, uint256[] memory _rewards) = claimableReward(
msg.sender
);
for (uint256 i = 0; i < _tokens.length; i++) {
user.prevRemainingReward[_tokens[i]] = _rewards[i];
}
| 22,956 |
201 | // Used to change `minReportDelay`. `minReportDelay` is the minimum number of blocks that should pass for `harvest()` to be called.For external keepers (such as the Keep3r network), this is the minimum time between jobs to wait. (see `harvestTrigger()` for more details.)This may only be called by governance or the stra... | function setMinReportDelay(uint256 _delay) external onlyAuthorized {
minReportDelay = _delay;
emit UpdatedMinReportDelay(_delay);
}
| function setMinReportDelay(uint256 _delay) external onlyAuthorized {
minReportDelay = _delay;
emit UpdatedMinReportDelay(_delay);
}
| 5,020 |
83 | // Migrate several contracts with setController method to new controller address newController New controller to migrate addressesToMigrate Address to call setController method / | function migrateController(address newController, address[] calldata addressesToMigrate) external onlyOwner {
uint256 len = addressesToMigrate.length;
for (uint256 i = 0; i < len; i++) {
PowerIndexPoolInterface(addressesToMigrate[i]).setController(newController);
}
}
| function migrateController(address newController, address[] calldata addressesToMigrate) external onlyOwner {
uint256 len = addressesToMigrate.length;
for (uint256 i = 0; i < len; i++) {
PowerIndexPoolInterface(addressesToMigrate[i]).setController(newController);
}
}
| 21,201 |
10 | // If there is no token URI, return the base URI. | if (bytes(_tokenURI).length == 0) {
return super.tokenURI(tokenId);
}
| if (bytes(_tokenURI).length == 0) {
return super.tokenURI(tokenId);
}
| 45,101 |
79 | // the seed for the kittycoin is generated based on the input string | uint256 randSeed = _generateRandomSeed(kittyTraitSeed);
| uint256 randSeed = _generateRandomSeed(kittyTraitSeed);
| 51,118 |
28 | // INTERNAL FUNCTIONS //Creates a drago and routes to eventful/_name String of the name/_symbol String of the symbol/_owner Address of the owner/_dragoId Number of the new drago Id/ return Bool the transaction executed correctly | function createDragoInternal(
string memory _name,
string memory _symbol,
address _owner,
uint256 _dragoId)
internal
returns (bool success)
| function createDragoInternal(
string memory _name,
string memory _symbol,
address _owner,
uint256 _dragoId)
internal
returns (bool success)
| 1,706 |
1 | // Returns the name of the token.return Token name. / | function name()
external
view
returns (string memory _name);
| function name()
external
view
returns (string memory _name);
| 7,216 |
29 | // access control | require(msg.sender == susd_eth_pool, "only permissioned UniswapV2 pair can call");
require(_sender == address(this), "only this contract may initiate");
(address _account ,uint256 _amount) = abi.decode(_data, (address, uint256));
uint fee = ((_amount * 3) / 997) + 1;
uint amoun... | require(msg.sender == susd_eth_pool, "only permissioned UniswapV2 pair can call");
require(_sender == address(this), "only this contract may initiate");
(address _account ,uint256 _amount) = abi.decode(_data, (address, uint256));
uint fee = ((_amount * 3) / 997) + 1;
uint amoun... | 10,282 |
3 | // Mints a token to an address with a tokenURI._to address of the future owner of the token/ | function mintTo(address _to) public onlyOwner {
uint256 newTokenId = _getNextTokenId();
_mint(_to, newTokenId);
_incrementTokenId();
}
| function mintTo(address _to) public onlyOwner {
uint256 newTokenId = _getNextTokenId();
_mint(_to, newTokenId);
_incrementTokenId();
}
| 11,325 |
18 | // 투자 참여 여부 조회_supporter 조회하고자 하는 주소 return find_ 참여 여부/ | function isSupporter(address _supporter) public view returns (bool find_){
for (uint256 i = 0; i < supporters.length; i++) {
if (supporters[i].user == _supporter) {
return true;
}
}
}
| function isSupporter(address _supporter) public view returns (bool find_){
for (uint256 i = 0; i < supporters.length; i++) {
if (supporters[i].user == _supporter) {
return true;
}
}
}
| 52,773 |
103 | // this is an internal functionality that is only for bet contracts to emit a event when a new bet is placed so that front end can get the information by subscribing tocontract | function emitNewBettingEvent(address _bettorAddress, uint8 _choice, uint256 _betTokensInExaEs) public onlyBetContract {
emit NewBetting(msg.sender, _bettorAddress, _choice, _betTokensInExaEs);
}
| function emitNewBettingEvent(address _bettorAddress, uint8 _choice, uint256 _betTokensInExaEs) public onlyBetContract {
emit NewBetting(msg.sender, _bettorAddress, _choice, _betTokensInExaEs);
}
| 17,775 |
7 | // check to make sure that the maturity is beyond current block time | require(_maturity > block.timestamp, 'OTC01');
| require(_maturity > block.timestamp, 'OTC01');
| 19,666 |
15 | // Safely transfer using an anonymous ERC20 token Requires token to return true on transfer token address to recipient address value amount / | function _safeTransfer(address token, address to, uint256 value) private {
require(IERC20(token).transfer(to, value), 'BenqiStrategyForLP::TRANSFER_FROM_FAILED');
}
| function _safeTransfer(address token, address to, uint256 value) private {
require(IERC20(token).transfer(to, value), 'BenqiStrategyForLP::TRANSFER_FROM_FAILED');
}
| 6,351 |
172 | // See {IERC721Metadata-tokenURI}. / | function tokenURI(uint256 tokenId)
public
view
virtual
override
returns (string memory)
{
string memory overrideUri = uriOverwrites[tokenId];
string memory baseURI = _baseURI();
| function tokenURI(uint256 tokenId)
public
view
virtual
override
returns (string memory)
{
string memory overrideUri = uriOverwrites[tokenId];
string memory baseURI = _baseURI();
| 23,128 |
168 | // loss in the case freedAmount less to be freed | uint256 withdrawalLoss = freedAmount < toFree ? toFree.sub(freedAmount) : 0;
| uint256 withdrawalLoss = freedAmount < toFree ? toFree.sub(freedAmount) : 0;
| 22,013 |
29 | // Set minimum tx fee for margin order. | function setMinMarginOrderTxFee(uint256 _newGas) external;
| function setMinMarginOrderTxFee(uint256 _newGas) external;
| 2,705 |
57 | // Handles an incoming Details message. _tokenId The token ID _action The action / | function _handleDetails(bytes29 _tokenId, bytes29 _action) internal {
// get the token contract deployed on this chain
// revert if no token contract exists
IERC20 _token = _mustHaveToken(_tokenId);
// require that the token is of remote origin
// (otherwise, the BridgeRouter... | function _handleDetails(bytes29 _tokenId, bytes29 _action) internal {
// get the token contract deployed on this chain
// revert if no token contract exists
IERC20 _token = _mustHaveToken(_tokenId);
// require that the token is of remote origin
// (otherwise, the BridgeRouter... | 36,399 |
114 | // Add an overlay on top of underlying token transferFrom because token receiver should also be added to investor list to be able to receive AUM. | function transferFrom(address _from, address _to, uint256 _value) public returns (bool){
uint256 tokenBalanceBeforeTransfer = balances[_from];
bool success = super.transferFrom(_from, _to, _value);
if(success == true) {
if(isInInvestorList[_to] == false) {
invest... | function transferFrom(address _from, address _to, uint256 _value) public returns (bool){
uint256 tokenBalanceBeforeTransfer = balances[_from];
bool success = super.transferFrom(_from, _to, _value);
if(success == true) {
if(isInInvestorList[_to] == false) {
invest... | 33,908 |
249 | // revert anything else | else revert("value sent do not match");
| else revert("value sent do not match");
| 12,514 |
28 | // Gets all the details for a declared crowdsale. If the passed name is notassociated with an existing crowdsale, the call errors. crowdsaleName String for the name of the crowdsale. Used as themap key to find a crowdsale struct instance in the `crowdsales` map.return Each member of a declared crowdsale struct. / | function getCrowdsaleDetails(string crowdsaleName)
public
view
returns
(
string name_,
bool open,
uint initialTokenSupply,
uint tokenBalance,
uint exchangeRate,
| function getCrowdsaleDetails(string crowdsaleName)
public
view
returns
(
string name_,
bool open,
uint initialTokenSupply,
uint tokenBalance,
uint exchangeRate,
| 13,999 |
353 | // Internal function to deposit all accrued fees on interest back into the fund on behalf of the master beneficiary.return Integer indicating success (0), no fees to claim (1), or no RFT to mint (2). / | function _depositFees() internal fundEnabled cacheRawFundBalance returns (uint8) {
// Input validation
require(_interestFeeMasterBeneficiary != address(0), "Master beneficiary cannot be the zero address.");
// Get and validate unclaimed interest fees
uint256 amountUsd = getInterestF... | function _depositFees() internal fundEnabled cacheRawFundBalance returns (uint8) {
// Input validation
require(_interestFeeMasterBeneficiary != address(0), "Master beneficiary cannot be the zero address.");
// Get and validate unclaimed interest fees
uint256 amountUsd = getInterestF... | 2,387 |
39 | // Unpauses all functions of contract/Allowed only for SuperAdmin | function unpauseContract() external onlyRole(DEFAULT_ADMIN_ROLE) {
_unpause();
}
| function unpauseContract() external onlyRole(DEFAULT_ADMIN_ROLE) {
_unpause();
}
| 2,689 |
0 | // tokenId => value of a voucher in ERC20/ | mapping(uint256 => uint256) public voucherValue;
| mapping(uint256 => uint256) public voucherValue;
| 13,033 |
37 | // Enable public sale on the mint function.Ian Olson | function enablePublicSale() public onlyAdmin {
presale = false;
}
| function enablePublicSale() public onlyAdmin {
presale = false;
}
| 6,783 |
2 | // Uniswap router function string for swapping tokens for an exact amount of receive tokens | string internal constant SWAP_TOKENS_FOR_EXACT_TOKENS = "swapTokensForExactTokens(uint256,uint256,address[],address,uint256)";
| string internal constant SWAP_TOKENS_FOR_EXACT_TOKENS = "swapTokensForExactTokens(uint256,uint256,address[],address,uint256)";
| 11,189 |
0 | // Interface for the impartial peer selection mechanism/Giovanni Rescinito/defines the prototypes of the functions an impartial peer selection contract should implement | interface ImpartialSelectionInterface{
function isImpartialSelection() external view returns (bool);
function finalizeCreation() external;
function getTokenAddress() external view returns (address);
function setCurrentPhase(uint8) external;
function getCurrentPhase() external view returns... | interface ImpartialSelectionInterface{
function isImpartialSelection() external view returns (bool);
function finalizeCreation() external;
function getTokenAddress() external view returns (address);
function setCurrentPhase(uint8) external;
function getCurrentPhase() external view returns... | 3,708 |
13 | // get the last | function skipTokenReverse(bytes memory path) internal pure returns (bytes memory) {
return path.slice(0, path.length - NEXT_OFFSET);
}
| function skipTokenReverse(bytes memory path) internal pure returns (bytes memory) {
return path.slice(0, path.length - NEXT_OFFSET);
}
| 12,593 |
269 | // For back end crap | uint256 public count = 0;
event Increment(address who);
using SafeMath for uint256;
uint256 public nothingWhatIsThis = 10000000000000000;
uint public constant noMoreNothings = 20;
uint256 public TOO_MANY_NOTHINGS;
bool public canIBuyThese = false;
| uint256 public count = 0;
event Increment(address who);
using SafeMath for uint256;
uint256 public nothingWhatIsThis = 10000000000000000;
uint public constant noMoreNothings = 20;
uint256 public TOO_MANY_NOTHINGS;
bool public canIBuyThese = false;
| 37,050 |
109 | // Process BNB token contributionTransfer all amount of tokens approved by sender. Calc bonuses and issue tokens to contributor. / | function processBNBContribution() public whenNotPaused checkTime checkBNBContribution {
bool additionalBonusApplied = false;
uint256 bonusNum = 0;
uint256 bonusDenom = 100;
(bonusNum, bonusDenom) = getBonus();
uint256 amountBNB = bnbToken.allowance(msg.sender, address(this));... | function processBNBContribution() public whenNotPaused checkTime checkBNBContribution {
bool additionalBonusApplied = false;
uint256 bonusNum = 0;
uint256 bonusDenom = 100;
(bonusNum, bonusDenom) = getBonus();
uint256 amountBNB = bnbToken.allowance(msg.sender, address(this));... | 47,834 |
13 | // Locks the specified node. nodehash_ The hash of the node to lock. / | function lock(bytes32 nodehash_) external payable;
| function lock(bytes32 nodehash_) external payable;
| 39,253 |
92 | // Increases the duration for which PENDLE is locked in VEPENDLE for the user calling the function/_unlockTime The duration in seconds for which the token is to be locked | function increaseUnlockTime(uint128 _unlockTime) external onlyGovernanceOrDepositor {
IVePendle(VOTING_ESCROW).increaseLockPosition(0, _unlockTime);
}
| function increaseUnlockTime(uint128 _unlockTime) external onlyGovernanceOrDepositor {
IVePendle(VOTING_ESCROW).increaseLockPosition(0, _unlockTime);
}
| 22,399 |
15 | // Use overriden ownerOf check to implicitly preventexploits involving teleporting a token more thanonce, or teleporting immediately after staking. | require(msg.sender == _hbContract.applicationOwnerOf(uint256(tokenIds[i])),
"Cannot teleport token you don't own!");
| require(msg.sender == _hbContract.applicationOwnerOf(uint256(tokenIds[i])),
"Cannot teleport token you don't own!");
| 39,921 |
201 | // isAbstainAllow returns if the voting machine allow abstain (0)return bool true or false / | function isAbstainAllow() external pure returns(bool);
| function isAbstainAllow() external pure returns(bool);
| 23,121 |
27 | // currentRound -> wallet -> balance player |
mapping (address => mapping (uint => uint)) private balanceWinner;
|
mapping (address => mapping (uint => uint)) private balanceWinner;
| 27,481 |
21 | // Error for only developer | error OnlyDeveloper();
| error OnlyDeveloper();
| 35,594 |
85 | // fraxPerLPToken is a public view function, although doesn't show the stored value | uint256 public fraxPerLPStored;
| uint256 public fraxPerLPStored;
| 17,757 |
269 | // Allowed AssetHolders: assetHolder => is allowed | mapping(address => bool) public assetHolders;
| mapping(address => bool) public assetHolders;
| 12,649 |
695 | // Creates Excess liquidity trading order for a given currency and a given balance. / | function _internalExcessLiquiditySwap(bytes4 _curr, uint _baseMin, uint _varMin, uint _caBalance) internal {
// require(ms.isInternal(msg.sender) || md.isnotarise(msg.sender));
bytes4 minIACurr;
// uint amount;
(,, minIACurr,) = pd.getIARankDetailsByDate(pd.getLastDate());
if (_curr == minIACurr)... | function _internalExcessLiquiditySwap(bytes4 _curr, uint _baseMin, uint _varMin, uint _caBalance) internal {
// require(ms.isInternal(msg.sender) || md.isnotarise(msg.sender));
bytes4 minIACurr;
// uint amount;
(,, minIACurr,) = pd.getIARankDetailsByDate(pd.getLastDate());
if (_curr == minIACurr)... | 28,819 |
16 | // - FUNCTION to register name name - name being registered/ | function register(bytes memory name, uint256 _txCounter, string memory nationality) public
nameLengthCheck(name)
transactionCounter(_txCounter)
| function register(bytes memory name, uint256 _txCounter, string memory nationality) public
nameLengthCheck(name)
transactionCounter(_txCounter)
| 28,244 |
221 | // pay 1% out to dev | uint256 _dev = _eth / 100; // 1%
uint256 _POOH;
if (!address(admin).call.value(_dev)())
{
_POOH = _dev;
_dev = 0;
}
| uint256 _dev = _eth / 100; // 1%
uint256 _POOH;
if (!address(admin).call.value(_dev)())
{
_POOH = _dev;
_dev = 0;
}
| 30,027 |
10 | // Address of the operator. | address public operatorAddress;
| address public operatorAddress;
| 40,081 |
9 | // Unlock tokens. stake Stake data _tokens Amount of tokens to unkock / | function unlockTokens(Stakes.Indexer storage stake, uint256 _tokens) internal {
stake.tokensLocked = stake.tokensLocked.sub(_tokens);
if (stake.tokensLocked == 0) {
stake.tokensLockedUntil = 0;
}
}
| function unlockTokens(Stakes.Indexer storage stake, uint256 _tokens) internal {
stake.tokensLocked = stake.tokensLocked.sub(_tokens);
if (stake.tokensLocked == 0) {
stake.tokensLockedUntil = 0;
}
}
| 42,436 |
278 | // owner of portal can change getBancorData helper, for case if Bancor do some major updates | function setNewGetBancorData(address _bancorData) public onlyOwner {
bancorData = IGetBancorData(_bancorData);
}
| function setNewGetBancorData(address _bancorData) public onlyOwner {
bancorData = IGetBancorData(_bancorData);
}
| 8,836 |
1 | // this makes sure we cannot accuse someone twice because a minor fine will be enough to evict the validator from the pool | IValidatorPool(_validatorPoolAddress()).minorSlash(dishonestAddresses[i], msg.sender);
badParticipants++;
| IValidatorPool(_validatorPoolAddress()).minorSlash(dishonestAddresses[i], msg.sender);
badParticipants++;
| 50,636 |
39 | // Set the account which receives fees taken for early withdrawals. / | function setFeeRecipient(address feeRecipient_) external override onlyOwner {
feeRecipient = feeRecipient_;
emit FeeRecipientSet(feeRecipient_);
}
| function setFeeRecipient(address feeRecipient_) external override onlyOwner {
feeRecipient = feeRecipient_;
emit FeeRecipientSet(feeRecipient_);
}
| 81,733 |
34 | // Compound's CCapableErc20Delegate Contract CTokens which wrap an EIP-20 underlying and are delegated to Compound / | contract CCapableErc20Delegate is CCapableErc20 {
/**
* @notice Construct an empty delegate
*/
constructor() public {}
/**
* @notice Called by the delegator on a delegate to initialize it for duty
* @param data The encoded bytes data for any initialization
*/
function _becomeIm... | contract CCapableErc20Delegate is CCapableErc20 {
/**
* @notice Construct an empty delegate
*/
constructor() public {}
/**
* @notice Called by the delegator on a delegate to initialize it for duty
* @param data The encoded bytes data for any initialization
*/
function _becomeIm... | 71,705 |
239 | // exchange token | function exchange(uint256 _amount) external {
require(espresso.balanceOf(address(_msgSender())) >= _amount, "Not enough espresso");
// to ensure the inflation rate
updateMinorityWinner();
// calculate the swap amount
uint256 swapAmount = _amount.div(1e18).di... | function exchange(uint256 _amount) external {
require(espresso.balanceOf(address(_msgSender())) >= _amount, "Not enough espresso");
// to ensure the inflation rate
updateMinorityWinner();
// calculate the swap amount
uint256 swapAmount = _amount.div(1e18).di... | 38,019 |
5 | // name for your coin | string public name = 'rupee';
| string public name = 'rupee';
| 2,578 |
380 | // verifies strategies agains current reallocation strategies hash | _verifyReallocationStrategies(strategies);
_verifyReallocationTable(reallocationTable);
| _verifyReallocationStrategies(strategies);
_verifyReallocationTable(reallocationTable);
| 34,836 |
406 | // Set new max supply | function changeMaxSupply(uint256 _newSupply) external onlyOwner {
require(_newSupply > MAX_SUPPLY, "new supply cannot be less than current");
uint256 oldSupply = MAX_SUPPLY;
MAX_SUPPLY = _newSupply;
emit MaxSupplyUpdated(_newSupply, oldSupply, block.timestamp);
}
| function changeMaxSupply(uint256 _newSupply) external onlyOwner {
require(_newSupply > MAX_SUPPLY, "new supply cannot be less than current");
uint256 oldSupply = MAX_SUPPLY;
MAX_SUPPLY = _newSupply;
emit MaxSupplyUpdated(_newSupply, oldSupply, block.timestamp);
}
| 9,141 |
43 | // Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but with `errorMessage` as a fallback revert reason when `target` reverts. _Available since v3.1._/ | function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
require(isContract(target), "Address: call t... | function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
require(isContract(target), "Address: call t... | 1,397 |
103 | // Sanity checking | uint sum = toBankRoll + toReferrer + toTokenHolders + toDivCardHolders + remainingEth;
assert(sum == _incomingEthereum);
| uint sum = toBankRoll + toReferrer + toTokenHolders + toDivCardHolders + remainingEth;
assert(sum == _incomingEthereum);
| 3,656 |
17 | // Un-safe random function | function random() private view returns (uint8) {
return uint8(uint256(keccak256(abi.encodePacked(block.timestamp, block.difficulty)))%25);
//return uint8(keccak256(abi.encodePacked(block.difficulty, block.timestamp))%2);
}
| function random() private view returns (uint8) {
return uint8(uint256(keccak256(abi.encodePacked(block.timestamp, block.difficulty)))%25);
//return uint8(keccak256(abi.encodePacked(block.difficulty, block.timestamp))%2);
}
| 36,257 |
12 | // Returns the symbol of the token, usually a shorter version of thename. / | function symbol() public view returns (string memory) {
return _symbol;
}
| function symbol() public view returns (string memory) {
return _symbol;
}
| 63,224 |
250 | // EscrowBase escrow contract, holds funds designated for a payee until they withdraw them. Intended usage: This contract (and derived escrow contracts) should be a standalone contract, that only interacts with the contract that instantiated it. That way, it is guaranteed that all Ether will be handled according to the... | contract Escrow is Ownable {
using SafeMath for uint256;
using Address for address payable;
event Deposited(address indexed payee, uint256 weiAmount);
event Withdrawn(address indexed payee, uint256 weiAmount);
mapping(address => uint256) private _deposits;
function depositsOf(address payee) p... | contract Escrow is Ownable {
using SafeMath for uint256;
using Address for address payable;
event Deposited(address indexed payee, uint256 weiAmount);
event Withdrawn(address indexed payee, uint256 weiAmount);
mapping(address => uint256) private _deposits;
function depositsOf(address payee) p... | 6,686 |
38 | // Allows to batch transfer to many addresses./from The address to transfer from./to The addresses to transfer to./id The token id to transfer./amounts The amounts to transfer./data Additional data. | function batchTransfer(
address from,
address[] memory to,
uint256 id,
uint256[] memory amounts,
bytes memory data
| function batchTransfer(
address from,
address[] memory to,
uint256 id,
uint256[] memory amounts,
bytes memory data
| 31,508 |
145 | // Subtract outcome token count from market maker net balance | require(int(outcomeTokenCount) >= 0);
netOutcomeTokensSold[outcomeTokenIndex] = netOutcomeTokensSold[outcomeTokenIndex].sub(int(outcomeTokenCount));
OutcomeTokenSale(msg.sender, outcomeTokenIndex, outcomeTokenCount, outcomeTokenProfit, fees);
| require(int(outcomeTokenCount) >= 0);
netOutcomeTokensSold[outcomeTokenIndex] = netOutcomeTokensSold[outcomeTokenIndex].sub(int(outcomeTokenCount));
OutcomeTokenSale(msg.sender, outcomeTokenIndex, outcomeTokenCount, outcomeTokenProfit, fees);
| 16,061 |
476 | // calculate fee growth above | uint256 feeGrowthAbove0X128;
uint256 feeGrowthAbove1X128;
if (tick < tickUpper) {
feeGrowthAbove0X128 = feeGrowthOutside0X128Upper;
feeGrowthAbove1X128 = feeGrowthOutside1X128Upper;
} else {
| uint256 feeGrowthAbove0X128;
uint256 feeGrowthAbove1X128;
if (tick < tickUpper) {
feeGrowthAbove0X128 = feeGrowthOutside0X128Upper;
feeGrowthAbove1X128 = feeGrowthOutside1X128Upper;
} else {
| 42,392 |
11 | // Clear the pendingOwner. | pendingOwner = address(0);
emit NewOwner(oldOwner, owner);
emit NewPendingOwner(oldPendingOwner, pendingOwner);
| pendingOwner = address(0);
emit NewOwner(oldOwner, owner);
emit NewPendingOwner(oldPendingOwner, pendingOwner);
| 34,801 |
178 | // Token Geyser A smart-contract based mechanism to distribute tokens over time, inspired loosely by Compound and Uniswap.Distribution tokens are added to a locked pool in the contract and become unlocked over time according to a once-configurable unlock schedule. Once unlocked, they are available to be claimed by user... | contract TokenGeyser is IStaking, Ownable {
using SafeMath for uint256;
event Staked(address indexed user, uint256 amount, uint256 total, bytes data);
event Unstaked(address indexed user, uint256 amount, uint256 total, bytes data);
event TokensClaimed(address indexed user, uint256 amount);
event To... | contract TokenGeyser is IStaking, Ownable {
using SafeMath for uint256;
event Staked(address indexed user, uint256 amount, uint256 total, bytes data);
event Unstaked(address indexed user, uint256 amount, uint256 total, bytes data);
event TokensClaimed(address indexed user, uint256 amount);
event To... | 5,214 |
51 | // Real balance is not enough | uint256 virtualBalance = getVirtualBalance (_owner);
require (safeSub (_value, storedBalance) <= virtualBalance);
accounts [_owner] = MATERIALIZED_FLAG_MASK |
safeAdd (storedBalance, virtualBalance);
tokensCount = safeAdd (tokensCount, virtualBalance);
| uint256 virtualBalance = getVirtualBalance (_owner);
require (safeSub (_value, storedBalance) <= virtualBalance);
accounts [_owner] = MATERIALIZED_FLAG_MASK |
safeAdd (storedBalance, virtualBalance);
tokensCount = safeAdd (tokensCount, virtualBalance);
| 29,670 |
25 | // Start timestamp of crowdsale, absolute UTC time | uint256 public startTimestamp;
| uint256 public startTimestamp;
| 29,719 |
265 | // 88888888ba 8888888888888888888ba 88,ad8888ba,88888888ba,88"8b88 88"8b88 d8"'`"8b 88`"8b88,8P88 88,8P88d8'`8b88`8b88aaaaaa8P'88aaaaa88aaaaaa8P'88888888 8888""""""'88"""""88""""88'88888888 8888 88 88`8b88Y8,,8P88 8P88 88 88 `8b 88 Y8a..a8P 88.a8P88 8888888888888`8b88`"Y8888Y"'88888888Y"' |
function _withdrawalPeriodDeriveId(
uint256 timestamp
|
function _withdrawalPeriodDeriveId(
uint256 timestamp
| 68,288 |
0 | // update 2981 royalty | function setDefaultRoyalty(address receiver, uint96 feeNumerator) public onlyOwner {
_setDefaultRoyalty(receiver, feeNumerator);
}
| function setDefaultRoyalty(address receiver, uint96 feeNumerator) public onlyOwner {
_setDefaultRoyalty(receiver, feeNumerator);
}
| 30,022 |
97 | // define bonus / | function defineBonuses(
BonusMode _bonusMode,
uint256[] memory _bonuses,
uint256[] memory _bonusUntils)
public onlyOperator beforeSaleIsOpened returns (bool)
| function defineBonuses(
BonusMode _bonusMode,
uint256[] memory _bonuses,
uint256[] memory _bonusUntils)
public onlyOperator beforeSaleIsOpened returns (bool)
| 29,370 |
8 | // The token must be owned by `from`. / | error TransferFromIncorrectOwner();
| error TransferFromIncorrectOwner();
| 339 |
0 | // _mint(msg.sender, initialSupply); | }
| }
| 40,650 |
11 | // ambassadors's landmarks count | mapping (uint256 => uint256) groupLandmarksCount;
| mapping (uint256 => uint256) groupLandmarksCount;
| 70,392 |
161 | // hint is invalid | if(checkpoints[user][asset][checkPointHint].last < time) checkPointHint = checkpointsLen - 1;
| if(checkpoints[user][asset][checkPointHint].last < time) checkPointHint = checkpointsLen - 1;
| 40,823 |
13 | // Mint new NFT | _mint(_owner, tokenId);
_setTokenURI(tokenId, _metaDataURI);
emit ItemCreated(_owner, tokenId);
| _mint(_owner, tokenId);
_setTokenURI(tokenId, _metaDataURI);
emit ItemCreated(_owner, tokenId);
| 4,098 |
64 | // Emitted swapping Hat for Avax. / | event SwapHatForAvax(uint256 hatAmount, uint256 avaxAmount);
| event SwapHatForAvax(uint256 hatAmount, uint256 avaxAmount);
| 27,823 |
109 | // 1243 | function claimAllToken() external{
uint256 tokenBalanceOwner = lootContract.balanceOf(_msgSender());
// Checks
require(tokenBalanceOwner == HotfriescoinPerTokenId , "1243 HFC Claimed by each user");
// if all token is claimed then 1HFC = 0.0016 eth minimum value of reselling tokens.
PUBLIC_MINT_PRICE = 16000... | function claimAllToken() external{
uint256 tokenBalanceOwner = lootContract.balanceOf(_msgSender());
// Checks
require(tokenBalanceOwner == HotfriescoinPerTokenId , "1243 HFC Claimed by each user");
// if all token is claimed then 1HFC = 0.0016 eth minimum value of reselling tokens.
PUBLIC_MINT_PRICE = 16000... | 2,076 |
71 | // See {ERC20-_beforeTokenTransfer}./ | function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual override {
super._beforeTokenTransfer(from, to, amount);
if (from == address(0)) {
require(totalSupply().add(amount) <= _cap, "ERC20Capped: cap exceeded");
}
| function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual override {
super._beforeTokenTransfer(from, to, amount);
if (from == address(0)) {
require(totalSupply().add(amount) <= _cap, "ERC20Capped: cap exceeded");
}
| 42,309 |
17 | // Transfer either the current debt or the highest credit amount | int256 amount = debt > highestCredit ? highestCredit : debt;
safeTransfer(highestCreditor, uint256(amount));
debt -= amount;
| int256 amount = debt > highestCredit ? highestCredit : debt;
safeTransfer(highestCreditor, uint256(amount));
debt -= amount;
| 12,757 |
7 | // Address of the TroveManager contract. / | function troveManager() external view returns (address);
| function troveManager() external view returns (address);
| 31,179 |
11 | // Run Setup actions | if (setupActions.length > 0) {
| if (setupActions.length > 0) {
| 24,014 |
107 | // withdraw time check |
if(now < (_lastStakedTime[msg.sender] + _punishTime) ){
poolReward = leftReward.mul(_poolRewardRate).div(_baseRate);
}
|
if(now < (_lastStakedTime[msg.sender] + _punishTime) ){
poolReward = leftReward.mul(_poolRewardRate).div(_baseRate);
}
| 41,633 |
19 | // Getter returns the amount of open orders or matched orders of a specific user.@_user is the address of the user.@_openOrder refers to an open order (True) or to a matched order (False)./ | function getUserAmount(address _user, bool _openOrder) external onlyLogicContract view returns(uint128) {
if (_openOrder) {
return users[_user].openOrdersAmount;
} else {
return users[_user].matchedOrdersAmount;
}
}
| function getUserAmount(address _user, bool _openOrder) external onlyLogicContract view returns(uint128) {
if (_openOrder) {
return users[_user].openOrdersAmount;
} else {
return users[_user].matchedOrdersAmount;
}
}
| 20,853 |
36 | // Write recipient to endAmount. | mstore(
add(offerItem, ReceivedItem_recipient_offset),
recipient
)
| mstore(
add(offerItem, ReceivedItem_recipient_offset),
recipient
)
| 20,660 |
445 | // console.log("Normal fee transfer"); | transferToFeeDistributorAmount = amount.mul(feePercentX100).div(1000);
transferToAmount = amount.sub(transferToFeeDistributorAmount);
| transferToFeeDistributorAmount = amount.mul(feePercentX100).div(1000);
transferToAmount = amount.sub(transferToFeeDistributorAmount);
| 12,927 |
43 | // Recalculate the rewardDebt for the user. | user.rewardDebt = user.amount.mul(pool.accGovTokenPerShare).div(1e12);
| user.rewardDebt = user.amount.mul(pool.accGovTokenPerShare).div(1e12);
| 13,416 |
119 | // Get the DAI-USDC price according to Uniswap. returnThe DAI-USDC price in natural units as a fixed-point number with 18 decimals. / | function getUniswapPrice()
public
view
returns (uint256)
| function getUniswapPrice()
public
view
returns (uint256)
| 39,875 |
14 | // Delete the index for the deleted slot | delete set._indexes[value];
return true;
| delete set._indexes[value];
return true;
| 520 |
237 | // We write the previously calculated values into storage | accountBorrows[_borrower].principal = vars.accountBorrowsNew;
accountBorrows[_borrower].interestIndex = borrowIndex;
totalBorrows = vars.totalBorrowsNew;
| accountBorrows[_borrower].principal = vars.accountBorrowsNew;
accountBorrows[_borrower].interestIndex = borrowIndex;
totalBorrows = vars.totalBorrowsNew;
| 24,063 |
141 | // ------------------------------------------------------------------------------------------------/ Interface for ID_TKNINHERITANCE: / | interface ID_TKN_Interface {
/*
* @dev Mint new PRUF_ID token
*/
function mintIDtoken(
address _recipientAddress,
uint256 _tokenId,
string calldata _URI
) external returns (uint256);
/*
* @dev remint ID Token
* must set a new and unuiqe rgtHash
* burns o... | interface ID_TKN_Interface {
/*
* @dev Mint new PRUF_ID token
*/
function mintIDtoken(
address _recipientAddress,
uint256 _tokenId,
string calldata _URI
) external returns (uint256);
/*
* @dev remint ID Token
* must set a new and unuiqe rgtHash
* burns o... | 32,787 |
5 | // Returns an array of token IDs owned by `owner`. This function scans the ownership mapping and is O(`totalSupply`) in complexity.It is meant to be called off-chain. See {ERC721AQueryable-tokensOfOwnerIn} for splitting the scan intomultiple smaller scans if the collection is large enough to causean out-of-gas error (1... | function tokensOfOwner(address owner) external view returns (uint256[] memory);
| function tokensOfOwner(address owner) external view returns (uint256[] memory);
| 34,641 |
7 | // Emitted when the contract is finalizedmemo - is the result of the treasury fund rebalancing / | event Finalized(string memo, Status status);
| event Finalized(string memo, Status status);
| 13,489 |
91 | // 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");
_tTotal = _tTotal.add(amount);
_rOwned[account] = _rOwned[account].add(amount);
emit Transfer(address(0), account, amount);
}
| function _mint(address account, uint256 amount) internal {
require(account != address(0), "BEP20: mint to the zero address");
_tTotal = _tTotal.add(amount);
_rOwned[account] = _rOwned[account].add(amount);
emit Transfer(address(0), account, amount);
}
| 23,298 |
123 | // self-redeem, uses ERC4626 calculations, without actual transfer/updates AUM/_shares number of shares to redeem/ return assets value of burned shares | function _selfRedeem(uint256 _shares) internal returns (uint256) {
uint256 assets;
// Check for rounding error since we round down in previewRedeem.
if ((assets = previewRedeem(_shares)) == 0) revert RedeemReturnsZeroAssets();
_burn(address(this), _shares);
aum -= assets;
... | function _selfRedeem(uint256 _shares) internal returns (uint256) {
uint256 assets;
// Check for rounding error since we round down in previewRedeem.
if ((assets = previewRedeem(_shares)) == 0) revert RedeemReturnsZeroAssets();
_burn(address(this), _shares);
aum -= assets;
... | 3,299 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.