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 |
|---|---|---|---|---|
61 | // INTERNAL// Return two actions for training or hybridizing a kitty using the given type. _specialType The type of actions that shall be learned. 0 for "any" actions.return Two new special moves./ | {
uint256 upper = cuddleData.getActionCount(_specialType);
uint256 action1 = random(_specialType, 1, upper);
uint256 action2 = random(action1 + 1, 1, upper);
if (action1 == action2) {
action2 = unduplicate(action1, upper);
}
uint256 typeBase = 10... | {
uint256 upper = cuddleData.getActionCount(_specialType);
uint256 action1 = random(_specialType, 1, upper);
uint256 action2 = random(action1 + 1, 1, upper);
if (action1 == action2) {
action2 = unduplicate(action1, upper);
}
uint256 typeBase = 10... | 42,956 |
12 | // Transfer in offer asset - erc20 to this contract | ERC20(erc20Address).SAFETRANSFERFROM181(address(msg.sender), address(this), erc20Amount);
_abonus.SWITCHTOETHFORNTOKENOFFER869.value(ethMining)(nTokenAddress);
| ERC20(erc20Address).SAFETRANSFERFROM181(address(msg.sender), address(this), erc20Amount);
_abonus.SWITCHTOETHFORNTOKENOFFER869.value(ethMining)(nTokenAddress);
| 42,738 |
373 | // Calculate COMP accrued by a borrower and possibly transfer it to them Borrowers will not begin to accrue until after the first interaction with the protocol. cToken The market in which the borrower is interacting borrower The address of the borrower to distribute COMP to / | function distributeBorrowerComp(address cToken, address borrower, Exp memory marketBorrowIndex) internal {
CompMarketState storage borrowState = compBorrowState[cToken];
Double memory borrowIndex = Double({mantissa: borrowState.index});
Double memory borrowerIndex = Double({mantissa: compBor... | function distributeBorrowerComp(address cToken, address borrower, Exp memory marketBorrowIndex) internal {
CompMarketState storage borrowState = compBorrowState[cToken];
Double memory borrowIndex = Double({mantissa: borrowState.index});
Double memory borrowerIndex = Double({mantissa: compBor... | 21,559 |
1 | // Insurace Constants | uint256 AIRLINE_REGISTRATION_FEE = 10 ether;
uint256 MAX_INSURANCE_PLAN = 1 ether;
uint256 INSURANCE_PAYOUT = 150; // Must divide by 100 to get percentage payout
| uint256 AIRLINE_REGISTRATION_FEE = 10 ether;
uint256 MAX_INSURANCE_PLAN = 1 ether;
uint256 INSURANCE_PAYOUT = 150; // Must divide by 100 to get percentage payout
| 7,363 |
158 | // Move the pointer 32 bytes leftwards to make room for the length. | ptr := sub(ptr, 32)
| ptr := sub(ptr, 32)
| 296 |
25 | // The last weekly epoch to have rewards distributed. | uint32 lastEpoch;
| uint32 lastEpoch;
| 64,115 |
953 | // Slashes + distributes rewards or frees up the sequencer's bond, only called by/ `FraudVerifier.finalizeFraudVerification` | function finalize(bytes32 _preStateRoot, address publisher, uint256 timestamp) override public {
require(msg.sender == resolve("OVM_FraudVerifier"), Errors.ONLY_FRAUD_VERIFIER);
require(witnessProviders[_preStateRoot].canClaim == false, Errors.ALREADY_FINALIZED);
// allow users to claim fro... | function finalize(bytes32 _preStateRoot, address publisher, uint256 timestamp) override public {
require(msg.sender == resolve("OVM_FraudVerifier"), Errors.ONLY_FRAUD_VERIFIER);
require(witnessProviders[_preStateRoot].canClaim == false, Errors.ALREADY_FINALIZED);
// allow users to claim fro... | 57,064 |
150 | // GOVERNANCE / | function set_governance(address to) external override {
require(msg.sender == governance, "must be governance");
governance = to;
}
| function set_governance(address to) external override {
require(msg.sender == governance, "must be governance");
governance = to;
}
| 23,051 |
5 | // Get parent state. | ItemState storage state = itemState[itemId];
| ItemState storage state = itemState[itemId];
| 6,303 |
53 | // ========================================================================================= // Uniswap helpers // ========================================================================================= // Swap token 0 for token 1 in CLR using Uni V3 Pool amounts should be in 18 decimals amountIn - amount as maximum ... | function swapToken0ForToken1(uint256 amountIn, uint256 amountOut) private {
UniswapLibrary.swapToken0ForToken1(
amountIn,
amountOut,
UniswapLibrary.PositionDetails({
poolFee: poolFee,
twapPeriod: twapPeriod,
priceLower: pric... | function swapToken0ForToken1(uint256 amountIn, uint256 amountOut) private {
UniswapLibrary.swapToken0ForToken1(
amountIn,
amountOut,
UniswapLibrary.PositionDetails({
poolFee: poolFee,
twapPeriod: twapPeriod,
priceLower: pric... | 23,648 |
111 | // requestOracleData is version 2, enabling multi-word responses | bytes4 constant private OPERATOR_REQUEST_SELECTOR = this.requestOracleData.selector;
LinkTokenInterface internal immutable linkToken;
mapping(bytes32 => Commitment) private s_commitments;
| bytes4 constant private OPERATOR_REQUEST_SELECTOR = this.requestOracleData.selector;
LinkTokenInterface internal immutable linkToken;
mapping(bytes32 => Commitment) private s_commitments;
| 68,898 |
112 | // Swap native ETH for CRV on Curve/amount - amount to swap/minAmountOut - minimum expected amount of output tokens/ return amount of CRV obtained after the swap | function _swapEthToCrv(uint256 amount, uint256 minAmountOut)
internal
returns (uint256)
| function _swapEthToCrv(uint256 amount, uint256 minAmountOut)
internal
returns (uint256)
| 10,374 |
132 | // Returns the Uniform Resource Identifier (URI) for `tokenId` token. / | function tokenURI(uint256 tokenId) external view returns (string memory);
| function tokenURI(uint256 tokenId) external view returns (string memory);
| 6,546 |
73 | // burn shares and loot | _setSharesLoot(memberAddress, sharesToBurn, lootToBurn, false);
for (uint256 i = 0; i < approvedTokens.length; i++) {
uint256 amountToRagequit = fairShare(
userTokenBalances[GUILD][approvedTokens[i]],
sharesAndLootToBurn,
initialTotalSharesAnd... | _setSharesLoot(memberAddress, sharesToBurn, lootToBurn, false);
for (uint256 i = 0; i < approvedTokens.length; i++) {
uint256 amountToRagequit = fairShare(
userTokenBalances[GUILD][approvedTokens[i]],
sharesAndLootToBurn,
initialTotalSharesAnd... | 8,704 |
409 | // The amount the recipient will receive if you are performing an exchange and thedestination currency will be worth a certain number of tokens. value The amount of destination currency tokens they received after the exchange. / | function amountReceivedFromExchange(uint value) external view returns (uint) {
return value.multiplyDecimal(SafeDecimalMath.unit().sub(exchangeFeeRate));
}
| function amountReceivedFromExchange(uint value) external view returns (uint) {
return value.multiplyDecimal(SafeDecimalMath.unit().sub(exchangeFeeRate));
}
| 38,879 |
65 | // Admin can revoke '_account' address operator and admin privileges. _account address that should be revoked operator and admin privileges. / | function removeOperatorAndAdmin(address _account) public onlyAdminOrRelay {
require(_account != msg.sender, "BaseOperators: admin can not remove himself");
_removeAdmin(_account);
_removeOperator(_account);
}
| function removeOperatorAndAdmin(address _account) public onlyAdminOrRelay {
require(_account != msg.sender, "BaseOperators: admin can not remove himself");
_removeAdmin(_account);
_removeOperator(_account);
}
| 24,497 |
9 | // Event action | event OnUpgradeLevelRobot(address user, uint256 tokenId, uint256 level);
event OnStartLearn(address user, uint256 tokenId, uint256 level, uint256 startBlockLearn, uint256 pendingBlockLearn);
event OnStopLearn(address user, uint256 tokenId, uint256 level, uint256 totalBlockLearnEachTime, uint256 stopBlockLea... | event OnUpgradeLevelRobot(address user, uint256 tokenId, uint256 level);
event OnStartLearn(address user, uint256 tokenId, uint256 level, uint256 startBlockLearn, uint256 pendingBlockLearn);
event OnStopLearn(address user, uint256 tokenId, uint256 level, uint256 totalBlockLearnEachTime, uint256 stopBlockLea... | 19,396 |
75 | // Destroy tokens Remove `_value` tokens from the system irreversibly_value the amount of money to burn / | function burn(uint256 _value)onlyOwner public returns(bool success) {
require(balances[msg.sender] >= _value); // Check if the sender has enough
balances[msg.sender] = balances[msg.sender].sub(_value); // Subtract from the sender
_totalSupply = _totalSupply.sub(_value); // Updates totalSupply
emit Burn(msg.sen... | function burn(uint256 _value)onlyOwner public returns(bool success) {
require(balances[msg.sender] >= _value); // Check if the sender has enough
balances[msg.sender] = balances[msg.sender].sub(_value); // Subtract from the sender
_totalSupply = _totalSupply.sub(_value); // Updates totalSupply
emit Burn(msg.sen... | 21,977 |
73 | // Check if the item is stamped or not | require (
(self.stampingInitiated == 0),
"Item Stamping Initiated"
);
| require (
(self.stampingInitiated == 0),
"Item Stamping Initiated"
);
| 24,505 |
54 | // Pausable token StandardToken modified with pausable transfers. / | contract PausableToken is StandardToken, Pausable {
function transfer(address _to, uint256 _value) public whenNotPaused returns (bool) {
return super.transfer(_to, _value);
}
function transferFrom(address _from, address _to, uint256 _value) public whenNotPaused returns (bool) {
return super.transferFrom... | contract PausableToken is StandardToken, Pausable {
function transfer(address _to, uint256 _value) public whenNotPaused returns (bool) {
return super.transfer(_to, _value);
}
function transferFrom(address _from, address _to, uint256 _value) public whenNotPaused returns (bool) {
return super.transferFrom... | 5,101 |
1 | // Returns a data point for given id. Has to be implement by each Oracle Feed Proxy. It should never revert. identifier identifier of the datareturn Int256 value, isSet / | function getData(bytes32 identifier) external view returns (int256, bool);
| function getData(bytes32 identifier) external view returns (int256, bool);
| 26,055 |
1 | // This contract is abstract, and thus cannot be instantiated directly | require(owner != address(0), "Owner must be set");
associatedContract = _associatedContract;
emit AssociatedContractUpdated(_associatedContract);
| require(owner != address(0), "Owner must be set");
associatedContract = _associatedContract;
emit AssociatedContractUpdated(_associatedContract);
| 23,181 |
54 | // Update var state | medianResult = converterResultCumulative / timeSinceFirst;
updates = addition(updates, 1);
linkAggregatorTimestamp = aggregatorTimestamp;
lastUpdateTime = now;
emit UpdateResult(medianResult);
| medianResult = converterResultCumulative / timeSinceFirst;
updates = addition(updates, 1);
linkAggregatorTimestamp = aggregatorTimestamp;
lastUpdateTime = now;
emit UpdateResult(medianResult);
| 8,877 |
287 | // Now actually transfer the markets over to the new manager. | receivingManager.receiveMarkets(active, marketsToMigrate);
| receivingManager.receiveMarkets(active, marketsToMigrate);
| 14,532 |
417 | // ========== Internal ========== //Convert amount to mStable credits amount for redeem. | function _getRedeemInput(uint256 amount) internal view returns (uint256 credits) {
// Add 1 because the amounts always round down
// e.g. i have 51 credits, e4 10 = 20.4
// to withdraw 20 i need 20*10/4 = 50 + 1
credits = amount.mul(1e18).div(IMStable(savingsContract).exchangeRate())... | function _getRedeemInput(uint256 amount) internal view returns (uint256 credits) {
// Add 1 because the amounts always round down
// e.g. i have 51 credits, e4 10 = 20.4
// to withdraw 20 i need 20*10/4 = 50 + 1
credits = amount.mul(1e18).div(IMStable(savingsContract).exchangeRate())... | 49,316 |
12 | // > [[[[[[[[[[[ Clone functions ]]]]]]]]]]] |
function emitWritingEditionPurchased(
uint256 tokenId,
address recipient,
uint256 price,
string memory message,
uint256 flatFeeAmount
|
function emitWritingEditionPurchased(
uint256 tokenId,
address recipient,
uint256 price,
string memory message,
uint256 flatFeeAmount
| 16,853 |
58 | // get amount of fee charged based on total profit amount earned in a cycle. / | function _getPerformanceFee(uint256 _profitAmount) internal view returns (uint256) {
return _profitAmount.mul(performanceFeePercentage).div(BASE);
}
| function _getPerformanceFee(uint256 _profitAmount) internal view returns (uint256) {
return _profitAmount.mul(performanceFeePercentage).div(BASE);
}
| 56,188 |
119 | // Gets the token namereturn string representing the token name / | function name() external view returns (string memory) {
return _name;
}
| function name() external view returns (string memory) {
return _name;
}
| 35,718 |
43 | // Burns tokens from its total supply./ | /// @dev Reverts with a {CallFailed} error if execution of the burn fails or returns an unexpected value.
///
/// @param token The token to burn.
/// @param owner The owner of the tokens.
/// @param amount The amount of tokens to burn.
function safeBurnFrom(address token, address owner, uint25... | /// @dev Reverts with a {CallFailed} error if execution of the burn fails or returns an unexpected value.
///
/// @param token The token to burn.
/// @param owner The owner of the tokens.
/// @param amount The amount of tokens to burn.
function safeBurnFrom(address token, address owner, uint25... | 77,380 |
22 | // WETH to deposit token path | address[] public weth2DepositPath;
| address[] public weth2DepositPath;
| 82,568 |
228 | // Set the DEX that should be used for swapping for a specific coin.If Uniswap is active, it will switch to SushiSwap and vice versa. Only SushiSwap and Uniswap are supported. token Address of token for which the DEX should be updated. / | function swapDex(address token) external onlyGovernance returns (bool) {
UniswapRouter02 currentDex = tokenDex[token];
require(address(currentDex) != address(0), Error.NO_DEX_SET);
UniswapRouter02 newDex = currentDex == _SUSHISWAP ? _UNISWAP : _SUSHISWAP;
_setDex(token, newDex);
... | function swapDex(address token) external onlyGovernance returns (bool) {
UniswapRouter02 currentDex = tokenDex[token];
require(address(currentDex) != address(0), Error.NO_DEX_SET);
UniswapRouter02 newDex = currentDex == _SUSHISWAP ? _UNISWAP : _SUSHISWAP;
_setDex(token, newDex);
... | 34,359 |
386 | // Tell if a vote is open for voting_vote Vote instance being queried_setting Setting instance applicable to the vote return True if the vote is open for voting/ | function _isVoteOpenForVoting(Vote storage _vote, Setting storage _setting) internal view returns (bool) {
return _isNormal(_vote) && !_hasEnded(_vote, _setting);
}
| function _isVoteOpenForVoting(Vote storage _vote, Setting storage _setting) internal view returns (bool) {
return _isNormal(_vote) && !_hasEnded(_vote, _setting);
}
| 52,525 |
27 | // Valve-To-Pipe CRUD Functions //Modify multi flow function which is called after any modification of agreement. / | ) internal returns (bytes memory newCtx) {
newCtx = _ctx;
ISuperfluid.Context memory sfContext = host.decodeCtx(_ctx);
Allocations memory userDataAllocations = _parseUserData(sfContext.userData);
// get the newly created/updated userToValve flow rate
(int96 oldUserToValveFl... | ) internal returns (bytes memory newCtx) {
newCtx = _ctx;
ISuperfluid.Context memory sfContext = host.decodeCtx(_ctx);
Allocations memory userDataAllocations = _parseUserData(sfContext.userData);
// get the newly created/updated userToValve flow rate
(int96 oldUserToValveFl... | 19,197 |
95 | // pay 2% out to community rewards | uint256 _aff;
uint256 _com;
uint256 _holders;
uint256 _self;
| uint256 _aff;
uint256 _com;
uint256 _holders;
uint256 _self;
| 39,775 |
6 | // 2. Badger --> WETH --> WBTC | uint256 _badger = IERC20Upgradeable(BADGER).balanceOf(address(this));
if (_badger > 0) {
IERC20Upgradeable(BADGER).safeApprove(UNISWAP, 0);
IERC20Upgradeable(BADGER).safeApprove(UNISWAP, _badger);
address[] memory _path = new address[](3);
_path[0] = BADG... | uint256 _badger = IERC20Upgradeable(BADGER).balanceOf(address(this));
if (_badger > 0) {
IERC20Upgradeable(BADGER).safeApprove(UNISWAP, 0);
IERC20Upgradeable(BADGER).safeApprove(UNISWAP, _badger);
address[] memory _path = new address[](3);
_path[0] = BADG... | 10,555 |
53 | // Returns acquired user's DXN rewards account user's account / | function accountAcquiredDxnRewards(address account) public view returns (uint256) {
if (totalBurnCredits == 0) {
return 0;
}
return (totalAccountBurnCredits[account] * totalDxnCollected) / totalBurnCredits;
}
| function accountAcquiredDxnRewards(address account) public view returns (uint256) {
if (totalBurnCredits == 0) {
return 0;
}
return (totalAccountBurnCredits[account] * totalDxnCollected) / totalBurnCredits;
}
| 30,232 |
189 | // Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) bypresenting a message signed by the account. By not relying on `{IERC20-approve}`, the token holder account doesn'tkeccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)... | bytes32 private immutable _PERMIT_TYPEHASH = 0x6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9;
| bytes32 private immutable _PERMIT_TYPEHASH = 0x6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9;
| 6,689 |
13 | // Mint admin/recipient recipient to mint to/quantity quantity to mint | function adminMint(
address recipient,
uint256 quantity
)
external
onlyRoleOrAdmin(MINTER_ROLE)
canMintTokens(quantity)
returns (uint256)
| function adminMint(
address recipient,
uint256 quantity
)
external
onlyRoleOrAdmin(MINTER_ROLE)
canMintTokens(quantity)
returns (uint256)
| 17,209 |
46 | // Holds the disscounted fees for later distribution | uint256 private _transferFeesBalance;
| uint256 private _transferFeesBalance;
| 41,493 |
38 | // Tokens given to investors who sent ether investments | mapping(address => uint256) public tokensSoldForEther;
| mapping(address => uint256) public tokensSoldForEther;
| 29,845 |
19 | // Allows to refund the ETH to destination address. Transaction has to be sent by an owner./_to Destination address./_value Wei to transfer. | function refund(address _to, uint256 _value)
ownerExists(msg.sender)
| function refund(address _to, uint256 _value)
ownerExists(msg.sender)
| 40,212 |
334 | // set the balance for the maker | state.setPar(
args.makerAccount,
args.inputMarket,
newInputPar
);
state.setPar(
args.makerAccount,
args.outputMarket,
newOutputPar
);
| state.setPar(
args.makerAccount,
args.inputMarket,
newInputPar
);
state.setPar(
args.makerAccount,
args.outputMarket,
newOutputPar
);
| 40,431 |
10 | // Withdraw operations | function withdraw(address userTip3Wallet, uint32 marketId, uint256 tokensToWithdraw) external view;
function writeWithdrawInfo(address userTip3Wallet, uint32 marketId, uint256 tokensToWithdraw, uint256 tokensToSend) external;
function requestWithdrawInfo(address userTip3Wallet, uint32 marketId, uint256 toke... | function withdraw(address userTip3Wallet, uint32 marketId, uint256 tokensToWithdraw) external view;
function writeWithdrawInfo(address userTip3Wallet, uint32 marketId, uint256 tokensToWithdraw, uint256 tokensToSend) external;
function requestWithdrawInfo(address userTip3Wallet, uint32 marketId, uint256 toke... | 47,738 |
35 | // If the reward is higher than max, set it to max | if (calculatedReward > maxPossibleReward) {
calculatedReward = maxPossibleReward;
}
| if (calculatedReward > maxPossibleReward) {
calculatedReward = maxPossibleReward;
}
| 36,021 |
177 | // Groups [11, 15]: A majority of guardians needed per group | numVotes += hasMajority(signed[i], total[i]) ? 1 : 0;
| numVotes += hasMajority(signed[i], total[i]) ? 1 : 0;
| 52,599 |
5 | // Transfer ERC20 tokens to the custody on behalf of the user/token Token contract address/amount Amount to put in custody/tezosAddress Destination address of the wrap on Tezos blockchain | function wrapERC20(
address token,
uint256 amount,
string calldata tezosAddress
| function wrapERC20(
address token,
uint256 amount,
string calldata tezosAddress
| 8,310 |
19 | // rount bounty less than or equal to tournament bounty | LibTournament.RoundDetails memory rDetails;
rDetails.bounty = 50;
rDetails.duration = 2;
| LibTournament.RoundDetails memory rDetails;
rDetails.bounty = 50;
rDetails.duration = 2;
| 37,114 |
19 | // set success to whether it returned true | success := iszero(iszero(mload(0)))
| success := iszero(iszero(mload(0)))
| 114 |
24 | // A call to an address target failed. The target may have reverted. / | error FailedInnerCall();
| error FailedInnerCall();
| 8,686 |
69 | // Makes a fee contribution to the current round. _arbitrationID The ID of the arbitration. _party The party which to contribute. _contributor The address of the contributor. _availableAmount The amount the contributor has sent. _totalRequired The total amount required for the party.return remainder The remainder to se... | function contribute(
uint256 _arbitrationID,
Party _party,
address _contributor,
uint256 _availableAmount,
uint256 _totalRequired
| function contribute(
uint256 _arbitrationID,
Party _party,
address _contributor,
uint256 _availableAmount,
uint256 _totalRequired
| 22,702 |
175 | // function allowing to freeze tokens partially in batchIMPORTANT : THIS TRANSACTION COULD EXCEED GAS LIMIT IF `_userAddresses.length` IS TOO HIGH,USE WITH CARE OR YOU COULD LOSE TX FEES WITH AN "OUT OF GAS" TRANSACTION _userAddresses The addresses on which tokens need to be frozen _amounts the amount of tokens to free... | function batchFreezePartialTokens(address[] calldata _userAddresses, uint256[] calldata _amounts) external;
| function batchFreezePartialTokens(address[] calldata _userAddresses, uint256[] calldata _amounts) external;
| 86,799 |
2 | // the very fifth example | contract Example5 {
event Message(
string msg
);
mapping (address => uint) accounts;
function deposit() public payable {
accounts[msg.sender] += msg.value;
emit Message("deposit!");
}
function withdraw(uint amount) public returns (bool){
assert(amount <= accou... | contract Example5 {
event Message(
string msg
);
mapping (address => uint) accounts;
function deposit() public payable {
accounts[msg.sender] += msg.value;
emit Message("deposit!");
}
function withdraw(uint amount) public returns (bool){
assert(amount <= accou... | 11,180 |
30 | // if no more selectors for facet address then delete the facet address | if (lastSelectorPosition == 0) {
| if (lastSelectorPosition == 0) {
| 14,812 |
24 | // change indexes | indexes[addressLeaderboard[index]] = index;
indexes[addressLeaderboard[index-1]] = index-1;
| indexes[addressLeaderboard[index]] = index;
indexes[addressLeaderboard[index-1]] = index-1;
| 13,915 |
33 | // MAPPING//tokenId to ownertokenId -> address | mapping (uint256 => address) public captainTokenIdToOwner;
| mapping (uint256 => address) public captainTokenIdToOwner;
| 27,312 |
15 | // update the DID store access modifiers and storage pointer should be implemented in DIDRegistry _self refers to storage pointer _did refers to decentralized identifier (a byte32 length ID) _checksum includes a one-way HASH calculated using the DDO content _url includes the url resolving to the DID Document (DDO) / | function update(
DIDRegisterList storage _self,
bytes32 _did,
bytes32 _checksum,
string calldata _url
)
external
returns (uint size)
| function update(
DIDRegisterList storage _self,
bytes32 _did,
bytes32 _checksum,
string calldata _url
)
external
returns (uint size)
| 27,504 |
0 | // owner | address private owner;
| address private owner;
| 17,154 |
0 | // view | returns(
uint256 returnAmount,
uint[] memory distribution // [Uniswap, Kyber, Bancor, Oasis]
)
| returns(
uint256 returnAmount,
uint[] memory distribution // [Uniswap, Kyber, Bancor, Oasis]
)
| 6,794 |
4 | // ========== STATE VARIABLES ========== // ========== CONSTRUCTOR ========== / | constructor(address _share, address _control, address _ideafund, address _theOracle) {
share = _share;
control = _control;
ideaFund = _ideafund;
theOracle = _theOracle;
BoardSnapshotShare memory genesisSSnapshot = BoardSnapshotShare({
time: block.number,
... | constructor(address _share, address _control, address _ideafund, address _theOracle) {
share = _share;
control = _control;
ideaFund = _ideafund;
theOracle = _theOracle;
BoardSnapshotShare memory genesisSSnapshot = BoardSnapshotShare({
time: block.number,
... | 30,673 |
6 | // Return the config, with times (t0, t1, t2) and max supply / | function getSaleConfig() external view returns (SaleConfig memory config);
| function getSaleConfig() external view returns (SaleConfig memory config);
| 11,848 |
0 | // people have to pay for their NFT on this marketplace | uint256 listingPrice = 0.035 ether;
| uint256 listingPrice = 0.035 ether;
| 46,170 |
76 | // 修改单笔募集上限 | function setMaxWei (
uint256 _value
)
public
| function setMaxWei (
uint256 _value
)
public
| 77,947 |
0 | // Testing Charger all functions. start from initialising new Charger with preset normal parameters. |
uint16 public power = 42; // in kW
Charger.TypeOfCable cableType;
uint public tariff = 13; // tariff is represented in wei per minute
string public latitude = "55.423791"; ... |
uint16 public power = 42; // in kW
Charger.TypeOfCable cableType;
uint public tariff = 13; // tariff is represented in wei per minute
string public latitude = "55.423791"; ... | 33,225 |
0 | // Interface for the NFT Royalty Standard. A standardized way to retrieve royalty payment information for non-fungible tokens (NFTs) to enable universalsupport for royalty payments across all NFT marketplaces and ecosystem participants. _Available since v4.5._ / | interface IERC2981 is IERC165 {
/**
* @dev Returns how much royalty is owed and to whom, based on a sale price that may be denominated in any unit of
* exchange. The royalty amount is denominated and should be payed in that same unit of exchange.
*/
function royaltyInfo(uint256 tokenId, uint256 s... | interface IERC2981 is IERC165 {
/**
* @dev Returns how much royalty is owed and to whom, based on a sale price that may be denominated in any unit of
* exchange. The royalty amount is denominated and should be payed in that same unit of exchange.
*/
function royaltyInfo(uint256 tokenId, uint256 s... | 1,934 |
21 | // Return the precision-adjusted balances of all tokens in the pool self Swap struct to read fromreturn the pool balances "scaled" to the pool's precision, allowingthem to be more easily compared. / | function _xp(SwapUtils.Swap storage self, uint256 baseVirtualPrice)
internal
view
returns (uint256[] memory)
| function _xp(SwapUtils.Swap storage self, uint256 baseVirtualPrice)
internal
view
returns (uint256[] memory)
| 37,500 |
11 | // Sets the maximum number of tokens that can be minted in a batch. Only the contract owner can call this function. | function setMaxMintPerWallet(uint256 newMaxMintPerWallet) public onlyOwner {
maxMintPerWallet = newMaxMintPerWallet;
}
| function setMaxMintPerWallet(uint256 newMaxMintPerWallet) public onlyOwner {
maxMintPerWallet = newMaxMintPerWallet;
}
| 9,968 |
30 | // Count up matrix size | Position memory current = positions[id];
for(uint i = 0; i < MATRIX_REWARD_RATES.length; i++){
if(current.id != current.matrixRef) positions[current.matrixRef].matrixSize++;
current = positions[current.matrixRef];
}
| Position memory current = positions[id];
for(uint i = 0; i < MATRIX_REWARD_RATES.length; i++){
if(current.id != current.matrixRef) positions[current.matrixRef].matrixSize++;
current = positions[current.matrixRef];
}
| 41,573 |
42 | // Get Ether while anyone send Ether to ico contract address/ | function () payable crowdsaleOpen {
// Throw if the value = 0
require (msg.value != 0);
// Check if the sender is a new user
if (tokenUsersSave[msg.sender].token == 0){
// Add a new user to the participant index
participantIndex[nextParticipantI... | function () payable crowdsaleOpen {
// Throw if the value = 0
require (msg.value != 0);
// Check if the sender is a new user
if (tokenUsersSave[msg.sender].token == 0){
// Add a new user to the participant index
participantIndex[nextParticipantI... | 16,227 |
91 | // View function which shows user Sushi reward for displayment on frontend | function sushiEarned(address account) public view returns (uint256) {
return _sushiEarned(account, sushiPerToken());
}
| function sushiEarned(address account) public view returns (uint256) {
return _sushiEarned(account, sushiPerToken());
}
| 22,998 |
10 | // Create a uint256 from a RLPItem item RLPItem / | function toUint(RLPItem memory item) internal pure returns (uint256) {
require(item.len > 0 && item.len <= 33, "Item length must be between 1 and 33 bytes");
uint256 itemLen = decodeItemLengthUnsafe(item.memPtr);
require(itemLen <= item.len, "Decoded length is greater than input data");
... | function toUint(RLPItem memory item) internal pure returns (uint256) {
require(item.len > 0 && item.len <= 33, "Item length must be between 1 and 33 bytes");
uint256 itemLen = decodeItemLengthUnsafe(item.memPtr);
require(itemLen <= item.len, "Decoded length is greater than input data");
... | 39,717 |
126 | // Returns message's nonce field | function nonce(bytes29 _message) internal pure returns (uint32) {
return uint32(_message.indexUint(36, 4));
}
| function nonce(bytes29 _message) internal pure returns (uint32) {
return uint32(_message.indexUint(36, 4));
}
| 50,721 |
52 | // Update recipient's state | updateWeight(recipient);
require(_balances[sender]>=amount,"ERC20:");
_balances[sender]=_balances[sender].sub(amount);
_balances[recipient]=_balances[recipient].add(amount);
_totalLiquid=_totalLiquid.add(amount);
| updateWeight(recipient);
require(_balances[sender]>=amount,"ERC20:");
_balances[sender]=_balances[sender].sub(amount);
_balances[recipient]=_balances[recipient].add(amount);
_totalLiquid=_totalLiquid.add(amount);
| 17,603 |
37 | // Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),Reverts 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 remaining gas). Requiremen... | function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, 'SafeMath: modulo by zero');
}
| function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, 'SafeMath: modulo by zero');
}
| 2,384 |
111 | // Perform any adjustments to the core position(s) of this Strategy givenwhat change the Vault made in the "investable capital" available to theStrategy. Note that all "free capital" in the Strategy after the reportwas made is available for reinvestment. Also note that this numbercould be 0, and you should handle that ... | function adjustPosition(uint256 _debtOutstanding) internal virtual;
| function adjustPosition(uint256 _debtOutstanding) internal virtual;
| 2,601 |
46 | // Contract Creator can change the stable currency contract address that memebrs use to deposit and withdraweg. switch from BUSD to DAI etc._addressThe token contract address return True if the action complete / | function setStableContractAddress(address _address)
public
restricted
returns (bool)
| function setStableContractAddress(address _address)
public
restricted
returns (bool)
| 31,914 |
216 | // globalConstraintsCount return the global constraint pre and post count return uint256 globalConstraintsPre count. return uint256 globalConstraintsPost count./ | function globalConstraintsCount(address _avatar)
external
isAvatarValid(_avatar)
view
returns(uint, uint)
| function globalConstraintsCount(address _avatar)
external
isAvatarValid(_avatar)
view
returns(uint, uint)
| 24,107 |
11 | // @custom:security-contact security-contact@inblocks.io | contract InBlocksNFT2 is IERC721Metadata, ERC721, ERC721Enumerable, ERC721Burnable, Ownable {
string private _metadataURI;
string private _baseTokenURI;
constructor(string memory name, string memory symbol, string memory metadataURI, string memory baseTokenURI)
ERC721(name, symbol)
{
_m... | contract InBlocksNFT2 is IERC721Metadata, ERC721, ERC721Enumerable, ERC721Burnable, Ownable {
string private _metadataURI;
string private _baseTokenURI;
constructor(string memory name, string memory symbol, string memory metadataURI, string memory baseTokenURI)
ERC721(name, symbol)
{
_m... | 23,361 |
37 | // find min amount; | if ( amount < firstMinAmount) {
if (firstMinAmount < secondMinAmount) {
secondMinAmount = firstMinAmount;
}
| if ( amount < firstMinAmount) {
if (firstMinAmount < secondMinAmount) {
secondMinAmount = firstMinAmount;
}
| 22,787 |
3 | // Avoid any re-entrancy issues | delete lockersByAddress[msg.sender];
for (uint i = 0; i < memLockers.length; i++) {
if (memLockers[i].creationTime + memLockers[i].holdTime < now) {
msg.sender.transfer(memLockers[i].balance);
Withdrawal(msg.sender, memLockers[i].balance);
}
| delete lockersByAddress[msg.sender];
for (uint i = 0; i < memLockers.length; i++) {
if (memLockers[i].creationTime + memLockers[i].holdTime < now) {
msg.sender.transfer(memLockers[i].balance);
Withdrawal(msg.sender, memLockers[i].balance);
}
| 28,744 |
245 | // Library computes the startBlock, computes startWeights as the current denormalized weights of the core pool tokens. | SmartPoolManager.updateWeightsGradually(
bPool,
gradualUpdate,
newWeights,
startBlock,
endBlock,
minimumWeightChangeBlockPeriod
);
| SmartPoolManager.updateWeightsGradually(
bPool,
gradualUpdate,
newWeights,
startBlock,
endBlock,
minimumWeightChangeBlockPeriod
);
| 6,722 |
9 | // MAPPING | mapping (address => voter) public voters;
| mapping (address => voter) public voters;
| 9,408 |
46 | // If (0- Activity, 7- Sequential Multi-Instance) ||/ Sub-process(0- Activity, 5- Sub-process) or Call-Activity(0- Activity, 4- Call-Activity) / but NOT Event Sub-process(12- Event Subprocess) | IData(createInstance(eInd, pCase)).setInstanceCount(eInd, IFlow(cFlow).getInstanceCount(eInd));
pState[1] |= (1 << eInd);
| IData(createInstance(eInd, pCase)).setInstanceCount(eInd, IFlow(cFlow).getInstanceCount(eInd));
pState[1] |= (1 << eInd);
| 22,754 |
271 | // Emit when the token holder is added/removed from the exemption list | event ChangedExemptWalletList(address indexed _wallet, bool _exempted);
| event ChangedExemptWalletList(address indexed _wallet, bool _exempted);
| 33,380 |
9 | // transfer : Transfer token to another etherum address / | function transfer(address to, uint tokens) virtual override public returns (bool success) {
require(to != address(0), "Null address");
require(tokens > 0, "Invalid Value");
balances[msg.sender] = safeSub(balances[msg.sender], tokens);
balances... | function transfer(address to, uint tokens) virtual override public returns (bool success) {
require(to != address(0), "Null address");
require(tokens > 0, "Invalid Value");
balances[msg.sender] = safeSub(balances[msg.sender], tokens);
balances... | 9,177 |
1 | // Structure for listed items | struct Listing {
uint256 quantity;
uint256 pricePerItem;
uint256 startingTime;
address allowedAddress;
}
| struct Listing {
uint256 quantity;
uint256 pricePerItem;
uint256 startingTime;
address allowedAddress;
}
| 31,042 |
68 | // Add component to isComponent mapping | isComponent[currentComponent] = true;
| isComponent[currentComponent] = true;
| 7,342 |
131 | // transfer toTokens to sender | if (toTokenAddress == address(0)) {
totalGoodwillPortion = _subtractGoodwill(
ETHAddress,
tokensRec,
affiliate,
true
);
payable(msg.sender).transfer(tokensRec - totalGoodwillPortion);
} else {
| if (toTokenAddress == address(0)) {
totalGoodwillPortion = _subtractGoodwill(
ETHAddress,
tokensRec,
affiliate,
true
);
payable(msg.sender).transfer(tokensRec - totalGoodwillPortion);
} else {
| 37,475 |
4 | // /Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`// `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite | /// {RoleAdminChanged} not being emitted signaling this.
///
///
event RoleAdminChanged(
bytes32 role,
bytes32 previousAdminRole,
bytes32 newAdminRole
);
///
/// @dev Emitted when `account` is granted `role` by `sender`
/// `sender` is the Admin that originated th... | /// {RoleAdminChanged} not being emitted signaling this.
///
///
event RoleAdminChanged(
bytes32 role,
bytes32 previousAdminRole,
bytes32 newAdminRole
);
///
/// @dev Emitted when `account` is granted `role` by `sender`
/// `sender` is the Admin that originated th... | 24,931 |
0 | // Aave Provider/ | AaveProviderInterface constant internal aaveProvider = AaveProviderInterface(0x24a42fD28C976A61Df5D00D0599C34c4f90748c8);
| AaveProviderInterface constant internal aaveProvider = AaveProviderInterface(0x24a42fD28C976A61Df5D00D0599C34c4f90748c8);
| 7,964 |
8 | // Returns the address of the Maple Globals contract. return globals The address of the Maple Globals contract. / | function globals() external view returns (address globals);
| function globals() external view returns (address globals);
| 7,946 |
177 | // <circle cx="175" cy="175" r="35" fill="yellow" stroke="black"/>string memory hexString = toString(rand); | return string(abi.encodePacked('<circle cx="175" cy="175" r="35" fill="rgb(', toString(random(string(abi.encodePacked("CORECOLOR1", toString(tokenId)))) % 256), ',', toString(random(string(abi.encodePacked("CORECOLOR2", toString(tokenId)))) % 256), ',', toString(random(string(abi.encodePacked("CORECOLOR3", toSt... | return string(abi.encodePacked('<circle cx="175" cy="175" r="35" fill="rgb(', toString(random(string(abi.encodePacked("CORECOLOR1", toString(tokenId)))) % 256), ',', toString(random(string(abi.encodePacked("CORECOLOR2", toString(tokenId)))) % 256), ',', toString(random(string(abi.encodePacked("CORECOLOR3", toSt... | 32,954 |
3 | // Cap is a max amount of funds raised in wei. 1 Ether = 1018 wei. / | uint256 public cap = 1000000 ether;
| uint256 public cap = 1000000 ether;
| 5,604 |
9 | // Represents the address where the ETH funds will be located. / | address public fundsAddress;
| address public fundsAddress;
| 6,574 |
17 | // Appends a byte to the buffer. Resizes if doing so would exceed thecapacity of the buffer.buf The buffer to append to.data The data to append. return The original buffer, for chaining./ | function appendUint8(buffer memory buf, uint8 data) internal pure returns(buffer memory) {
uint off = buf.buf.length;
uint offPlusOne = off + 1;
if (off >= buf.capacity) {
resize(buf, offPlusOne * 2);
}
assembly {
// Memory address of the buffer data
... | function appendUint8(buffer memory buf, uint8 data) internal pure returns(buffer memory) {
uint off = buf.buf.length;
uint offPlusOne = off + 1;
if (off >= buf.capacity) {
resize(buf, offPlusOne * 2);
}
assembly {
// Memory address of the buffer data
... | 17,330 |
89 | // send all token balance of an arbitrary erc20 tokenin the contract to another address token token to reclaim _to address to send eth balance to / | function reclaimToken(IERC20 token, address _to) external onlyOwner {
uint256 balance = token.balanceOf(address(this));
token.transfer(_to, balance);
}
| function reclaimToken(IERC20 token, address _to) external onlyOwner {
uint256 balance = token.balanceOf(address(this));
token.transfer(_to, balance);
}
| 18,568 |
21 | // Adds in liquidity for DAI/Token | _dai = IERC20(dai).balanceOf(address(this));
uint256 _token1 = IERC20(token1).balanceOf(address(this));
if (_dai > 0 && _token1 > 0) {
UniswapRouterV2(univ2Router2).addLiquidity(
dai,
token1,
_dai,
_token1,
... | _dai = IERC20(dai).balanceOf(address(this));
uint256 _token1 = IERC20(token1).balanceOf(address(this));
if (_dai > 0 && _token1 > 0) {
UniswapRouterV2(univ2Router2).addLiquidity(
dai,
token1,
_dai,
_token1,
... | 80,791 |
136 | // Implements the price function from EidooEngineInterface. Calculates the price as tokens/ether based on the corresponding bonus bracket.return Price as tokens/ether. / | function price() public view returns (uint256 _price) {
if (block.timestamp <= start.add(BONUS_DURATION_1)) {
return tokenPerEth.mul(BONUS_TIER1).div(1e2);
} else if (block.timestamp <= start.add(BONUS_DURATION_2)) {
return tokenPerEth.mul(BONUS_TIER2).div(1e2);
} els... | function price() public view returns (uint256 _price) {
if (block.timestamp <= start.add(BONUS_DURATION_1)) {
return tokenPerEth.mul(BONUS_TIER1).div(1e2);
} else if (block.timestamp <= start.add(BONUS_DURATION_2)) {
return tokenPerEth.mul(BONUS_TIER2).div(1e2);
} els... | 35,438 |
65 | // Store the caller as the highest bidder | auction.highestBidder = msg.sender;
| auction.highestBidder = msg.sender;
| 26,948 |
3 | // Private method is used instead of inlining into modifier because modifiers are copied into each method,/ and the use of immutable means the address bytes are copied in every place the modifier is used. | function checkNotDelegateCall() private view {
require(address(this) == original, "Delegate calls restricted");
}
| function checkNotDelegateCall() private view {
require(address(this) == original, "Delegate calls restricted");
}
| 5,090 |
31 | // insert bid | Bid memory newBid;
newBid.from = msg.sender;
newBid.amount = ethAmountSent;
auctionBids[_auctionId].push(newBid);
emit BidSuccess(msg.sender, _auctionId);
| Bid memory newBid;
newBid.from = msg.sender;
newBid.amount = ethAmountSent;
auctionBids[_auctionId].push(newBid);
emit BidSuccess(msg.sender, _auctionId);
| 99 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.