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 |
|---|---|---|---|---|
29 | // Returns the integer division of two unsigned integers, reverting with custom message ondivision by zero. The result is rounded towards zero. Counterpart to Solidity's '/ ' operator. Note: this function uses a'revert' opcode (which leaves remaining gas untouched) while Solidityuses an invalid opcode to revert (consum... | function div(
uint256 a,
uint256 b,
string memory errorMessage
| function div(
uint256 a,
uint256 b,
string memory errorMessage
| 50,648 |
239 | // 0% collateral-backed | function mintAlgorithmicFRAX(uint256 fxs_amount_d18, uint256 FRAX_out_min) external notMintPaused {
uint256 fxs_price = FRAX.fxs_price();
require(FRAX.global_collateral_ratio() == 0, "Collateral ratio must be 0");
(uint256 frax_amount_d18) = FraxPoolLibrary.calcMintAlgorithmicFRAX(
... | function mintAlgorithmicFRAX(uint256 fxs_amount_d18, uint256 FRAX_out_min) external notMintPaused {
uint256 fxs_price = FRAX.fxs_price();
require(FRAX.global_collateral_ratio() == 0, "Collateral ratio must be 0");
(uint256 frax_amount_d18) = FraxPoolLibrary.calcMintAlgorithmicFRAX(
... | 22,902 |
1,073 | // Buys a _destAmount of tokens at UniswapV2/_srcAddr From token/_destAddr To token/_destAmount To amount/ return uint srcAmount | function buy(address _srcAddr, address _destAddr, uint _destAmount, bytes memory _additionalData) external override payable returns(uint) {
_srcAddr = ethToWethAddr(_srcAddr);
_destAddr = ethToWethAddr(_destAddr);
uint[] memory amounts;
address[] memory path = abi.decode(_additiona... | function buy(address _srcAddr, address _destAddr, uint _destAmount, bytes memory _additionalData) external override payable returns(uint) {
_srcAddr = ethToWethAddr(_srcAddr);
_destAddr = ethToWethAddr(_destAddr);
uint[] memory amounts;
address[] memory path = abi.decode(_additiona... | 13,235 |
140 | // See `GSNRecipient._approveRelayedCall`. This overload forwards `context` to _preRelayedCall and _postRelayedCall. / | function _approveRelayedCall(bytes memory context) internal pure returns (uint256, bytes memory) {
return (_RELAYED_CALL_ACCEPTED, context);
}
| function _approveRelayedCall(bytes memory context) internal pure returns (uint256, bytes memory) {
return (_RELAYED_CALL_ACCEPTED, context);
}
| 32,752 |
40 | // Withdraw the owner's Ether | function ownerWithdraw() public onlyOwner {
uint amount = ownerBalance;
ownerBalance = 0;
owner.transfer(amount);
}
| function ownerWithdraw() public onlyOwner {
uint amount = ownerBalance;
ownerBalance = 0;
owner.transfer(amount);
}
| 28,375 |
69 | // Saves Credential Item name._id Ontology record ID._name Credential Item name./ | function setName(bytes32 _id, string _name) internal {
// records[_id].name = _name;
stringStorage[keccak256(abi.encodePacked("records.", _id, ".name"))] = _name;
}
| function setName(bytes32 _id, string _name) internal {
// records[_id].name = _name;
stringStorage[keccak256(abi.encodePacked("records.", _id, ".name"))] = _name;
}
| 43,746 |
178 | // Allows SkaleManager to change a node's last reward date. / | function changeNodeLastRewardDate(uint nodeIndex)
external
checkNodeExists(nodeIndex)
allow("SkaleManager")
| function changeNodeLastRewardDate(uint nodeIndex)
external
checkNodeExists(nodeIndex)
allow("SkaleManager")
| 31,885 |
22 | // A method to allow a stakeholder to check his rewards. _stakeholder The stakeholder to check rewards for. / | function rewardOf(address _stakeholder) public view returns(uint256)
| function rewardOf(address _stakeholder) public view returns(uint256)
| 26,667 |
13 | // we cannot allow for CDOGEDOLA unbonds during expansions, to enforce the pro-rata redemptions | require(_state13.price.lessThan(Decimal.one()), "Market: not in contraction");
_unbondCDOGEDOLA(amount);
| require(_state13.price.lessThan(Decimal.one()), "Market: not in contraction");
_unbondCDOGEDOLA(amount);
| 8,964 |
6 | // 100 = 1% | uint32 public lenderFee = 100;
| uint32 public lenderFee = 100;
| 40,383 |
4 | // Structure animales | string name; // Nom de l'animal
string dateBirth; // Date de naissance de l'animal
string sexe; // Sexe de l'animal
bool vaccin; // Si il est vacciné ou non
Animals animals; // Enumération de chien chat furret
| string name; // Nom de l'animal
string dateBirth; // Date de naissance de l'animal
string sexe; // Sexe de l'animal
bool vaccin; // Si il est vacciné ou non
Animals animals; // Enumération de chien chat furret
| 39,009 |
68 | // if not correctly abi-encoded array of address[] | !LSP2Utils.isEncodedArrayOfAddresses(allowedAddresses)
) return;
address[] memory allowedAddressesList = abi.decode(allowedAddresses, (address[]));
for (uint256 ii = 0; ii < allowedAddressesList.length; ii++) {
if (_to == allowedAddressesList[ii]) return;
}
| !LSP2Utils.isEncodedArrayOfAddresses(allowedAddresses)
) return;
address[] memory allowedAddressesList = abi.decode(allowedAddresses, (address[]));
for (uint256 ii = 0; ii < allowedAddressesList.length; ii++) {
if (_to == allowedAddressesList[ii]) return;
}
| 48,467 |
86 | // Notify status update | BoardStatusUpdated(boardId, newStatus);
| BoardStatusUpdated(boardId, newStatus);
| 33,014 |
211 | // 8. This fee is denominated in the currency of the loan | uint issueFee = amount.multiplyDecimalRound(issueFeeRate);
| uint issueFee = amount.multiplyDecimalRound(issueFeeRate);
| 47,812 |
97 | // Admin methods. | function setMintFeeBps(uint256 _mintFeeBps) external onlyOwner {
require(_mintFeeBps <= MAX_BPS, "badger-ren-adapter/excessive-mint-fee");
mintFeeBps = _mintFeeBps;
}
| function setMintFeeBps(uint256 _mintFeeBps) external onlyOwner {
require(_mintFeeBps <= MAX_BPS, "badger-ren-adapter/excessive-mint-fee");
mintFeeBps = _mintFeeBps;
}
| 11,548 |
17 | // this contract gives owner the ability to allow tokens. for pairs in which both tokens are allowed, fees may be collected on that pair and send to feeRecipient, though only after burning all fees up to that point | contract FeeTo {
address public owner;
address public feeRecipient;
struct TokenAllowState {
bool allowed;
uint128 disallowCount;
}
mapping(address => TokenAllowState) public tokenAllowStates;
struct PairAllowState {
uint128 token0DisallowCount;
uint128 token... | contract FeeTo {
address public owner;
address public feeRecipient;
struct TokenAllowState {
bool allowed;
uint128 disallowCount;
}
mapping(address => TokenAllowState) public tokenAllowStates;
struct PairAllowState {
uint128 token0DisallowCount;
uint128 token... | 20,341 |
3 | // Approve `amount` stablecoin to lendingPool | stablecoin.safeIncreaseAllowance(address(lendingPool), amount);
| stablecoin.safeIncreaseAllowance(address(lendingPool), amount);
| 33,710 |
13 | // No need to check for dividing by 0 -- Solidity automatically throws on division by 0 | int256 c = a / b;
return c;
| int256 c = a / b;
return c;
| 1,067 |
758 | // ensure that message has not been proven or processed | require(messages[_leaf] == MessageStatus.None, "!MessageStatus.None");
| require(messages[_leaf] == MessageStatus.None, "!MessageStatus.None");
| 22,612 |
99 | // Returns true if and only if the function is running in the constructor | function isConstructor() private view returns (bool) {
// extcodesize checks the size of the code stored in an address, and
// address returns the current address. Since the code is still not
// deployed when running a constructor, any checks on its code size will
// yield zero, making it an effective... | function isConstructor() private view returns (bool) {
// extcodesize checks the size of the code stored in an address, and
// address returns the current address. Since the code is still not
// deployed when running a constructor, any checks on its code size will
// yield zero, making it an effective... | 10,821 |
61 | // Function returns timestamp when pool entered or will enter provisional default at given interest rate/interestRate Borrows interest rate at current period/ return Timestamp of entering provisional default (0 if won't ever enter) | function _entranceOfProvisionalDefault(uint256 interestRate) internal view returns (uint256) {
/// @dev If pool is already in provisional default, return its timestamp
if (_info.enteredProvisionalDefault != 0) {
return _info.enteredProvisionalDefault;
}
if (_info.borrows == 0 || interestRate == ... | function _entranceOfProvisionalDefault(uint256 interestRate) internal view returns (uint256) {
/// @dev If pool is already in provisional default, return its timestamp
if (_info.enteredProvisionalDefault != 0) {
return _info.enteredProvisionalDefault;
}
if (_info.borrows == 0 || interestRate == ... | 1,203 |
6 | // Approved users to call weave This is v important as invalid inputs will be basically a "fat finger" | mapping(address => bool) public approvedWeavers;
| mapping(address => bool) public approvedWeavers;
| 45,150 |
0 | // Public variables for contract indexing | string public name = 'TrapdoorLottery 0.2';
string public symbol = 'LOT';
string public description;
| string public name = 'TrapdoorLottery 0.2';
string public symbol = 'LOT';
string public description;
| 13,662 |
327 | // Sets the prize strategy of the prize pool.Only callable by the owner./_prizeStrategy The new prize strategy | function _setPrizeStrategy(address _prizeStrategy) internal {
require(_prizeStrategy != address(0), "PrizePool/prizeStrategy-not-zero");
prizeStrategy = _prizeStrategy;
emit PrizeStrategySet(_prizeStrategy);
}
| function _setPrizeStrategy(address _prizeStrategy) internal {
require(_prizeStrategy != address(0), "PrizePool/prizeStrategy-not-zero");
prizeStrategy = _prizeStrategy;
emit PrizeStrategySet(_prizeStrategy);
}
| 49,831 |
11 | // setup | address _customerAddress = msg.sender;
| address _customerAddress = msg.sender;
| 9,180 |
234 | // function to see if an address is the owner/role - bytes32 role created in inheriting contracts/potentialRoleMember - address to check for role membership | function hasRole(bytes32 role, address potentialRoleMember) public view returns (bool) {
return _roleStatus[_c][role][potentialRoleMember];
}
| function hasRole(bytes32 role, address potentialRoleMember) public view returns (bool) {
return _roleStatus[_c][role][potentialRoleMember];
}
| 43,590 |
209 | // burn | _updateAccountSnapshot(from);
_updateTotalSupplySnapshot();
| _updateAccountSnapshot(from);
_updateTotalSupplySnapshot();
| 1,735 |
76 | // updatetotal dividends shared | totalDividends = SafeMath.add(totalDividends,_undividedDividends);
require(_amountOfTokens > 0 && (SafeMath.add(_amountOfTokens,tokenSupply_) > tokenSupply_));
if(
| totalDividends = SafeMath.add(totalDividends,_undividedDividends);
require(_amountOfTokens > 0 && (SafeMath.add(_amountOfTokens,tokenSupply_) > tokenSupply_));
if(
| 26,301 |
0 | // holds the balances of everyone who owes tokens of this contract | mapping (address => uint256) private _balances;
| mapping (address => uint256) private _balances;
| 5,323 |
224 | // compute maximum shares that can be minted from `amount0Max` and `amount1Max`/amount0Max The maximum amount of token0 to forward on mint/amount0Max The maximum amount of token1 to forward on mint/ return amount0 actual amount of token0 to forward when minting `mintAmount`/ return amount1 actual amount of token1 to fo... | function getMintAmounts(uint256 amount0Max, uint256 amount1Max)
external
view
returns (
uint256 amount0,
uint256 amount1,
uint256 mintAmount
)
| function getMintAmounts(uint256 amount0Max, uint256 amount1Max)
external
view
returns (
uint256 amount0,
uint256 amount1,
uint256 mintAmount
)
| 61,494 |
189 | // emit newMaturedBonds(sender, poioPotAll); | hasWon = true;
uint256 amount = poioPotAll;
| hasWon = true;
uint256 amount = poioPotAll;
| 16,513 |
80 | // 如果用户拥有luckyStone 那么抽到好卡的概率翻倍 Free lottery can only get normal card | if (randomNumber % 100 < userCurrentMartial.mythNumber.mul(luckyStoneFactor) && userCurrentMartial.mythNumber > 0 && currentLotteryPrice>0) {
lotteryCardLevel = 3;
listedMartials[userCurrentMartialId].mythNumber = listedMartials[userCurrentMartialId].mythNumber.sub(1);
} else if (randomNumber % 100 ... | if (randomNumber % 100 < userCurrentMartial.mythNumber.mul(luckyStoneFactor) && userCurrentMartial.mythNumber > 0 && currentLotteryPrice>0) {
lotteryCardLevel = 3;
listedMartials[userCurrentMartialId].mythNumber = listedMartials[userCurrentMartialId].mythNumber.sub(1);
} else if (randomNumber % 100 ... | 34,161 |
78 | // The same as submit, but for multiply investors/Provided arrays should have the same length/investors Array of investors/amounts Array of receivable amounts/lockPercent Which percent of tokens should be available immediately (after start), and which should be locked | function submitMulti(
address[] memory investors,
uint256[] memory amounts,
uint256 lockPercent
| function submitMulti(
address[] memory investors,
uint256[] memory amounts,
uint256 lockPercent
| 20,166 |
1 | // emitted when a supplier receives shipment | event ShipmentReceived(uint256 indexed itemID, address indexed receiver, bytes32 hash, string metadata);
| event ShipmentReceived(uint256 indexed itemID, address indexed receiver, bytes32 hash, string metadata);
| 15,874 |
24 | // Give who a ward on all core contracts | function giveAdminAccess(DssInstance memory dss, address who) internal {
if (address(dss.vat) != address(0)) GodMode.setWard(address(dss.vat), who, 1);
if (address(dss.dai) != address(0)) GodMode.setWard(address(dss.dai), who, 1);
if (address(dss.vow) != address(0)) GodMode.setWard(address(d... | function giveAdminAccess(DssInstance memory dss, address who) internal {
if (address(dss.vat) != address(0)) GodMode.setWard(address(dss.vat), who, 1);
if (address(dss.dai) != address(0)) GodMode.setWard(address(dss.dai), who, 1);
if (address(dss.vow) != address(0)) GodMode.setWard(address(d... | 24,629 |
199 | // Bonus muliplier for early cake makers. | uint256 public BONUS_MULTIPLIER = 1;
| uint256 public BONUS_MULTIPLIER = 1;
| 35,585 |
21 | // path is an array of addresses. this path array will have 3 addresses [tokenIn, WETH, tokenOut] the if statement below takes into account if token in or token out is WETH.then the path is only 2 addresses | address[] memory path;
if (_tokenIn == WAVAX || _tokenOut == WAVAX) {
path = new address[](2);
path[0] = _tokenIn;
path[1] = _tokenOut;
} else {
| address[] memory path;
if (_tokenIn == WAVAX || _tokenOut == WAVAX) {
path = new address[](2);
path[0] = _tokenIn;
path[1] = _tokenOut;
} else {
| 29,940 |
159 | // update cached unlockedRewards | unlockedRewards = unlockedRewards.sub(currentReward);
| unlockedRewards = unlockedRewards.sub(currentReward);
| 12,088 |
11 | // Swaps to a flexible amount, from an exact input amount | function swap(
address recipient,
uint256 shareToMin,
uint256 shareFrom
| function swap(
address recipient,
uint256 shareToMin,
uint256 shareFrom
| 24,029 |
27 | // Check if the border has already been registered | require(
borders[baseParcelKey][borderKey].beneficiary == address(0),
"Border has already been registered"
);
require(
senderHasSufficentBalanceToCoverFees(
settings.borderRegistrationFee
)
... | require(
borders[baseParcelKey][borderKey].beneficiary == address(0),
"Border has already been registered"
);
require(
senderHasSufficentBalanceToCoverFees(
settings.borderRegistrationFee
)
... | 4,861 |
28 | // Moves tokens `amount` from `sender` to `recipient`. This is internal function is equivalent to `transfer`, and can be used toe.g. implement automatic token fees, slashing mechanisms, etc. Emits a `Transfer` event. Requirements: - `sender` cannot be the zero address.- `recipient` cannot be the zero address.- `sender`... | function _transfer(address sender, address recipient, uint256 amount) internal {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_balances[sender] = _balances[sender].sub(amount);
_balan... | function _transfer(address sender, address recipient, uint256 amount) internal {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_balances[sender] = _balances[sender].sub(amount);
_balan... | 418 |
92 | // {address[]}return {bool} / | function addWhitelist(address[] memory addresses, uint256 tier)
external
onlyOwner
returns (bool)
{
uint256 addressesLength = addresses.length;
for (uint256 i = 0; i < addressesLength; i++) {
address address_ = addresses[i];
Whitelist memory white... | function addWhitelist(address[] memory addresses, uint256 tier)
external
onlyOwner
returns (bool)
{
uint256 addressesLength = addresses.length;
for (uint256 i = 0; i < addressesLength; i++) {
address address_ = addresses[i];
Whitelist memory white... | 61,277 |
2 | // insuredOrder.startingPrice = PriceConsumerV3.getLatestPrice(); | insuredOrder.startingPrice = 5;
insuredOrder.state = InsuredState.Processing;
insuredOrder.createdAt = block.timestamp;
| insuredOrder.startingPrice = 5;
insuredOrder.state = InsuredState.Processing;
insuredOrder.createdAt = block.timestamp;
| 635 |
10 | // Function to stop minting new tokens. return True if the operation was successful./ | function finishMinting()
public
onlyOwner
canMint
returns (bool)
| function finishMinting()
public
onlyOwner
canMint
returns (bool)
| 12,248 |
0 | // Goerliusd/eth:0xD4a33860578De61DBAbDc8BFdb98FD742fA7028e usdt use wstfx:0x8f7296E684BD57c5C898FA78043d06D164208c3D |
address private usdtEthPair = 0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419;
address private usdtAddress = 0xdAC17F958D2ee523a2206206994597C13D831ec7;
AggregatorV3Interface internal priceFeed;
bool private _active;
bool private _claim;
mapping(address => uint256) private _accountTotalPurchased;
... |
address private usdtEthPair = 0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419;
address private usdtAddress = 0xdAC17F958D2ee523a2206206994597C13D831ec7;
AggregatorV3Interface internal priceFeed;
bool private _active;
bool private _claim;
mapping(address => uint256) private _accountTotalPurchased;
... | 9,956 |
70 | // GENERATE THE PANCAKE PAIR PATH OF TOKEN -> WETH | address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapRouter.WETH();
_approve(address(this), address(uniswapRouter), tokenAmount);
| address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapRouter.WETH();
_approve(address(this), address(uniswapRouter), tokenAmount);
| 41,488 |
17 | // Gets current interest data for a loan/loanId A unique id representing the loan/ return loanToken The loan token that interest is paid in/ return interestOwedPerDay The amount of interest the borrower is paying per day/ return interestDepositTotal The total amount of interest the borrower has deposited/ return intere... | function getLoanInterestData(
bytes32 loanId)
external
view
returns (
address loanToken,
uint256 interestOwedPerDay,
uint256 interestDepositTotal,
uint256 interestDepositRemaining)
| function getLoanInterestData(
bytes32 loanId)
external
view
returns (
address loanToken,
uint256 interestOwedPerDay,
uint256 interestDepositTotal,
uint256 interestDepositRemaining)
| 36,524 |
101 | // Check is user registered//_user user address// return status | function isRegisteredUser(address _user) public view returns (bool) {
return memberAddress2index[_user] != 0;
}
| function isRegisteredUser(address _user) public view returns (bool) {
return memberAddress2index[_user] != 0;
}
| 16,993 |
4 | // Need to stake first!!!! | error NoStake();
event Stake(address indexed addr, int amount);
event Claim(address indexed addr, uint amount);
| error NoStake();
event Stake(address indexed addr, int amount);
event Claim(address indexed addr, uint amount);
| 13,155 |
6 | // Revert with an error when attempting to set the rotator to the null address. / | error RotatorCannotBeNullAddress();
| error RotatorCannotBeNullAddress();
| 19,344 |
16 | // Treat retweets basically as empty replies | newTweet.originalTweet =_originalTweet;
return addTweet(_userId, _tweetNum, newTweet);
| newTweet.originalTweet =_originalTweet;
return addTweet(_userId, _tweetNum, newTweet);
| 29,277 |
13 | // Creates `_amount` PWDR token to `_to`.Can only be called by the LGE, Slopes, and Avalanche contractswhen epoch and max supply numbers allow | function mint(address _to, uint256 _amount)
external
override
Accumulation
MaxSupplyNotReached
OnlyAuthorized
| function mint(address _to, uint256 _amount)
external
override
Accumulation
MaxSupplyNotReached
OnlyAuthorized
| 21,918 |
7 | // return total supply of the token | function totalSupply()
public
override
view
returns (uint)
| function totalSupply()
public
override
view
returns (uint)
| 14,265 |
2 | // key = keccak256(owner, device_id), value = permissions bit array | mapping(bytes32 => uint8) private m_access_list;
| mapping(bytes32 => uint8) private m_access_list;
| 15,442 |
24 | // recommend function | function recommend(uint256 _refference)public payable onlyAmount onlyFirst(_refference) firstExist
| function recommend(uint256 _refference)public payable onlyAmount onlyFirst(_refference) firstExist
| 32,845 |
111 | // emit event for off-chain indexing | emit AcceptedArtistAddressesAndSplits(_projectId);
| emit AcceptedArtistAddressesAndSplits(_projectId);
| 33,145 |
1,206 | // ConfigStore stores configuration settings for a perpetual contract and provides an interface for itto query settings such as reward rates, proposal bond sizes, etc. The configuration settings can be upgradedby a privileged account and the upgraded changes are timelocked. / | contract ConfigStore is ConfigStoreInterface, Testable, Lockable, Ownable {
using SafeMath for uint256;
using FixedPoint for FixedPoint.Unsigned;
/****************************************
* STORE DATA STRUCTURES *
****************************************/
// Make currentConfig... | contract ConfigStore is ConfigStoreInterface, Testable, Lockable, Ownable {
using SafeMath for uint256;
using FixedPoint for FixedPoint.Unsigned;
/****************************************
* STORE DATA STRUCTURES *
****************************************/
// Make currentConfig... | 52,053 |
1 | // -------------------------------------------------------------------------- //USER// -------------------------------------------------------------------------- //Mints an amount of tokens and transfers them to the caller during the public sale./amount The amount of tokens to mint. | function publicMint(uint256 amount) external payable {
require(isSaleActive, "Sale is not active");
require(msg.sender == tx.origin, "No contracts allowed");
uint256 _totalSupply = totalSupply();
if (_totalSupply < MAX_FREE) {
require(!hasClaimed[msg.sender], "Already claimed");
hasClaimed[msg.sender] =... | function publicMint(uint256 amount) external payable {
require(isSaleActive, "Sale is not active");
require(msg.sender == tx.origin, "No contracts allowed");
uint256 _totalSupply = totalSupply();
if (_totalSupply < MAX_FREE) {
require(!hasClaimed[msg.sender], "Already claimed");
hasClaimed[msg.sender] =... | 53,993 |
26 | // can't work before timestamp | require(block.timestamp > dateStart, "Initial vesting in progress");
| require(block.timestamp > dateStart, "Initial vesting in progress");
| 23,110 |
17 | // ValueVaultMaster manages all the vaults and strategies of our Value Vaults system. / | contract ValueVaultMaster {
address public governance;
address public bank;
address public minorPool;
address public profitSharer;
address public govToken; // VALUE
address public yfv; // When harvesting, convert some parts to YFV for govVault
address public usdc; // we only used USDC to e... | contract ValueVaultMaster {
address public governance;
address public bank;
address public minorPool;
address public profitSharer;
address public govToken; // VALUE
address public yfv; // When harvesting, convert some parts to YFV for govVault
address public usdc; // we only used USDC to e... | 14,648 |
43 | // Batch deposits token in pools / | function batchDeposits(address from, BatchDeposit[] memory deposits)
external
onlyRole(DEFAULT_ADMIN_ROLE)
| function batchDeposits(address from, BatchDeposit[] memory deposits)
external
onlyRole(DEFAULT_ADMIN_ROLE)
| 37,106 |
173 | // Safe pickle transfer function, just in case if rounding error causes pool to not have enough PICKLEs. | function safePickleTransfer(address _to, uint256 _amount) internal {
uint256 pickleBal = pickle.balanceOf(address(this));
if (_amount > pickleBal) {
pickle.transfer(_to, pickleBal);
} else {
pickle.transfer(_to, _amount);
}
}
| function safePickleTransfer(address _to, uint256 _amount) internal {
uint256 pickleBal = pickle.balanceOf(address(this));
if (_amount > pickleBal) {
pickle.transfer(_to, pickleBal);
} else {
pickle.transfer(_to, _amount);
}
}
| 45,916 |
4 | // Emitted when a payment is received. from Address from which payment is received. amount Amount of `_paymentToken` received. / | event PaymentReceived(address from, uint256 amount);
| event PaymentReceived(address from, uint256 amount);
| 27,875 |
0 | // {ERC1155} token, including:This contract uses {AccessControl} to lock permissioned functions using the/ Grants `DEFAULT_ADMIN_ROLE`, `MINTER_ROLE`, and `PAUSER_ROLE` to the account thatdeploys the contract. / | constructor(string memory uri) ERC1155(uri) {
_setupRole(DEFAULT_ADMIN_ROLE, _msgSender());
_setupRole(MINTER_ROLE, _msgSender());
_setupRole(PAUSER_ROLE, _msgSender());
}
| constructor(string memory uri) ERC1155(uri) {
_setupRole(DEFAULT_ADMIN_ROLE, _msgSender());
_setupRole(MINTER_ROLE, _msgSender());
_setupRole(PAUSER_ROLE, _msgSender());
}
| 1,420 |
94 | // The address `addr` is now whitelisted, any funds sent FROM this address will not incur a burn. /addr Address of Contract / EOA to whitelist | event AddedToWhitelistFrom(address indexed addr);
| event AddedToWhitelistFrom(address indexed addr);
| 10,996 |
377 | // Set royalties of a token / | function setRoyalties(uint256 tokenId, address payable[] calldata receivers, uint256[] calldata basisPoints) external;
| function setRoyalties(uint256 tokenId, address payable[] calldata receivers, uint256[] calldata basisPoints) external;
| 25,136 |
0 | // Make sure the sender is the owner of contract / | modifier onlyOwner{
require(_msgSender() == owner, "Only owner can process");
_;
}
| modifier onlyOwner{
require(_msgSender() == owner, "Only owner can process");
_;
}
| 41,440 |
13 | // Read the result of the Witnet request The `witnetReadResult` method comes with `UsingWitnet` | Witnet.Result memory result = witnetReadResult(lastRequestId);
| Witnet.Result memory result = witnetReadResult(lastRequestId);
| 38,693 |
98 | // grab time | uint256 _now = now;
| uint256 _now = now;
| 5,140 |
10 | // registration check here would be redundant, as any `transferFrom` the 0 address will necessarily fail. save an sload | require(bTransfer <= MAX, "Deposit amount out of range."); // uint, so other way not necessary?
require(bTransfer + bTotal <= MAX, "Fund pushes contract past maximum value.");
| require(bTransfer <= MAX, "Deposit amount out of range."); // uint, so other way not necessary?
require(bTransfer + bTotal <= MAX, "Fund pushes contract past maximum value.");
| 20,856 |
36 | // fast check | require(path.length >= 2, "CRouter: invalid path");
require(dexes.length == path.length - 1, "CRouter: invalid dexes");
_checkOracleFee(dexes, msg.value);
| require(path.length >= 2, "CRouter: invalid path");
require(dexes.length == path.length - 1, "CRouter: invalid dexes");
_checkOracleFee(dexes, msg.value);
| 14,819 |
75 | // Increase the number of tokens locked by `addedValue`i.e. locks up more tokens. Emits an {UpdateTokenLock} event indicating the updated terms of the token lockup.Requires:- msg.sender must have tokens currently locked - `addedValue` is greater than zero - msg.sender must have sufficient unlocked tokens to lock NOTE: ... | function increaseTokensLocked(uint256 addedValue) external;
| function increaseTokensLocked(uint256 addedValue) external;
| 45,164 |
49 | // redeem sOHM for OHMs _to address _amount uint _trigger bool _rebasing boolreturn amount_ uint / | function unstake(
address _to,
uint256 _amount,
bool _trigger,
bool _rebasing
| function unstake(
address _to,
uint256 _amount,
bool _trigger,
bool _rebasing
| 67,712 |
258 | // Get number of checkpoints for `account`. / | function numCheckpoints(address account) public view virtual returns (uint32) {
return SafeCast.toUint32(_checkpoints[account].length);
}
| function numCheckpoints(address account) public view virtual returns (uint32) {
return SafeCast.toUint32(_checkpoints[account].length);
}
| 13,922 |
0 | // The HELIX reward token | IHelixToken public helixToken;
| IHelixToken public helixToken;
| 8,648 |
37 | // Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with`errorMessage` as a fallback revert reason when `target` reverts. _Available since v3.1._ / | function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return _functionCallWithValue(target, data, 0, errorMessage);
}
| function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return _functionCallWithValue(target, data, 0, errorMessage);
}
| 14,137 |
165 | // Internal function to get the min active balance config for a given term_termId Identification number of the term querying the min active balance config of_lastEnsuredTermId Identification number of the last ensured term of the Court return Minimum amount of guardian tokens that can be activated at the given term/ | function _getMinActiveBalance(uint64 _termId, uint64 _lastEnsuredTermId) internal view returns (uint256) {
Config storage config = _getConfigFor(_termId, _lastEnsuredTermId);
return config.minActiveBalance;
}
| function _getMinActiveBalance(uint64 _termId, uint64 _lastEnsuredTermId) internal view returns (uint256) {
Config storage config = _getConfigFor(_termId, _lastEnsuredTermId);
return config.minActiveBalance;
}
| 39,688 |
268 | // Verify Transaction Data (Metadata, Inputs, Outputs, Witnesses) | function verifyTransactionData(transactionData, utxoProofs) {
| function verifyTransactionData(transactionData, utxoProofs) {
| 21,586 |
50 | // The previous extra balance user had | uint256 prevBalancesAccounting = user.boostAmount;
| uint256 prevBalancesAccounting = user.boostAmount;
| 12,907 |
75 | // Remove node from a storage linkedlist. | function checkAndRemoveFromPendingGroup(address node) private returns(bool) {
uint prev = HEAD_I;
uint curr = pendingGroupList[prev];
while (curr != HEAD_I) {
PendingGroup storage pgrp = pendingGroups[curr];
(, bool found) = findNodeFromList(pgrp.memberList, node);
... | function checkAndRemoveFromPendingGroup(address node) private returns(bool) {
uint prev = HEAD_I;
uint curr = pendingGroupList[prev];
while (curr != HEAD_I) {
PendingGroup storage pgrp = pendingGroups[curr];
(, bool found) = findNodeFromList(pgrp.memberList, node);
... | 41,918 |
54 | // Get required KYC level of the crowdsale. KYC level = 0 (default): Crowdsale does not require KYC. KYC level > 0: Crowdsale requires centain level of KYC. KYC level ranges from 0 (no KYC) to 255 (toughest). | uint8 public kycLevel = 100;
| uint8 public kycLevel = 100;
| 42,895 |
360 | // Gets investment asset rank details by given date. / | function getIARankDetailsByDate(
uint64 date
)
external
view
returns(
bytes4 maxIACurr,
uint64 maxRate,
bytes4 minIACurr,
uint64 minRate
| function getIARankDetailsByDate(
uint64 date
)
external
view
returns(
bytes4 maxIACurr,
uint64 maxRate,
bytes4 minIACurr,
uint64 minRate
| 29,003 |
12 | // Define a modifier that checks the price and refunds the remaining balance | modifier checkValue(uint _sn) {
_;
uint _price = items[_sn].productPrice;
uint amountToReturn = msg.value - _price;
items[_sn].buyerID.transfer(amountToReturn);
}
| modifier checkValue(uint _sn) {
_;
uint _price = items[_sn].productPrice;
uint amountToReturn = msg.value - _price;
items[_sn].buyerID.transfer(amountToReturn);
}
| 5,922 |
5 | // What's my balance? | function balance() public constant returns (uint256) {
return getBalance(msg.sender);
}
| function balance() public constant returns (uint256) {
return getBalance(msg.sender);
}
| 57,269 |
38 | // ============ OVERRIDES ============ |
function supportsInterface(bytes4 interfaceId)
public
view
virtual
override(ERC721, IERC165)
returns (bool)
|
function supportsInterface(bytes4 interfaceId)
public
view
virtual
override(ERC721, IERC165)
returns (bool)
| 36,763 |
49 | // ============ Constants ============ |
uint256 constant ASCII_ZERO = 48; // '0'
uint256 constant ASCII_RELATIVE_ZERO = 87; // 'a' - 10
uint256 constant ASCII_LOWER_EX = 120; // 'x'
bytes2 constant COLON = 0x3a20; // ': '
bytes2 constant COMMA = 0x2c20; // ', '
bytes2 constant LPAREN = 0x203c; // ' <'
byte constant RPAREN = 0x3e;... |
uint256 constant ASCII_ZERO = 48; // '0'
uint256 constant ASCII_RELATIVE_ZERO = 87; // 'a' - 10
uint256 constant ASCII_LOWER_EX = 120; // 'x'
bytes2 constant COLON = 0x3a20; // ': '
bytes2 constant COMMA = 0x2c20; // ', '
bytes2 constant LPAREN = 0x203c; // ' <'
byte constant RPAREN = 0x3e;... | 1,219 |
5 | // balances[receiver] = balances[receiver].add(floor(numTokens0.9)); for(balance in balances) balance.add(((numTokens0.1)/sum(balances))balance) | emit Transfer(msg.sender, receiver, numTokens);
return true;
| emit Transfer(msg.sender, receiver, numTokens);
return true;
| 14,715 |
121 | // settle trading fee | function _payTradingFee(
address user,
bytes32 loanId,
address feeToken,
uint256 tradingFee)
internal
| function _payTradingFee(
address user,
bytes32 loanId,
address feeToken,
uint256 tradingFee)
internal
| 52,653 |
279 | // Gets details of a claim. _index claim id = pending claim start + given index _add User's address.return coverid cover against which claim has been submitted.return claimId ClaimId.return voteCA verdict of vote given as a Claim Assessor.return voteMV verdict of vote given as a Member.return statusnumber Status of cla... | function getClaimFromNewStart(
uint _index,
address _add
)
external
view
returns(
uint coverid,
uint claimId,
int8 voteCA,
| function getClaimFromNewStart(
uint _index,
address _add
)
external
view
returns(
uint coverid,
uint claimId,
int8 voteCA,
| 33,363 |
213 | // unpause current sale. Emits unpause event / | function unpause() public onlyOwner {
Pausable._unpause();
}
| function unpause() public onlyOwner {
Pausable._unpause();
}
| 43,455 |
280 | // Event emitted when minter is changed / | event NewMinter(address oldMinter, address newMinter);
| event NewMinter(address oldMinter, address newMinter);
| 68,317 |
114 | // set up our tx event data and determine if player is new or not | _determinePID(addr);
| _determinePID(addr);
| 8,644 |
32 | // If recurring presaler, confirm payment won't exceed cap before incrementing | else {
PresalePayments memory payment = presaleData[index - 1];
if (payment.payment + msg.value > maxBuy) {
revert PresaleMaxExceeded();
}
| else {
PresalePayments memory payment = presaleData[index - 1];
if (payment.payment + msg.value > maxBuy) {
revert PresaleMaxExceeded();
}
| 22,108 |
107 | // Get the balance of an account's Tokens./ownerThe address of the token holder/id ID of the Token/ returnThe _owner's balance of the Token type requested | function balanceOf(address owner, uint256 id) external override view returns (uint256) {
if (isNonFungibleItem(id)) {
return nfOwners[id] == owner ? 1 : 0;
}
return balances[id][owner];
}
| function balanceOf(address owner, uint256 id) external override view returns (uint256) {
if (isNonFungibleItem(id)) {
return nfOwners[id] == owner ? 1 : 0;
}
return balances[id][owner];
}
| 22,977 |
105 | // Mapping created store the amount of value a wallet address used to buy assets | mapping(address => uint256) public addressToValue;
bool CSCPreSaleInit = false;
| mapping(address => uint256) public addressToValue;
bool CSCPreSaleInit = false;
| 18,657 |
123 | // Emitted when a proposal is canceled. / | event ProposalCanceled(uint256 proposalId);
| event ProposalCanceled(uint256 proposalId);
| 7,830 |
8 | // Map addresses to admins // Map addresses to account readers // Map addresses to account minters // Details of all admins that have ever existed // Details of all account readers that have ever existed // Details of all account minters that have ever existed // Fired whenever an admin is added to the contract. // Fir... | function AuthenticationManager() {
/* Set the first admin to be the person creating the contract */
adminAddresses[msg.sender] = true;
AdminAdded(0, msg.sender);
adminAudit.length++;
adminAudit[adminAudit.length - 1] = msg.sender;
}
| function AuthenticationManager() {
/* Set the first admin to be the person creating the contract */
adminAddresses[msg.sender] = true;
AdminAdded(0, msg.sender);
adminAudit.length++;
adminAudit[adminAudit.length - 1] = msg.sender;
}
| 1,972 |
96 | // Emits a {TransferSingle} event. Requirements: - `account` cannot be the zero address.- If `account` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return theacceptance magic value. / | function _mint(
address account,
uint256 id,
uint256 amount,
bytes memory data
) internal virtual {
require(account != address(0), "ERC1155: mint to the zero address");
address operator = _msgSender();
| function _mint(
address account,
uint256 id,
uint256 amount,
bytes memory data
) internal virtual {
require(account != address(0), "ERC1155: mint to the zero address");
address operator = _msgSender();
| 3,970 |
84 | // 批量发币 | * @param {Object} address
*/
function addBalances(address[] recipients, uint256[] moenys) public{
require(admins[msg.sender] == true);
uint256 sum = 0;
for(uint256 i = 0; i < recipients.length; i++) {
balances[recipients[i]] = balances[recipients[i]].add(moenys[i]);
addmoney(recipients[i], moenys[i], 0... | * @param {Object} address
*/
function addBalances(address[] recipients, uint256[] moenys) public{
require(admins[msg.sender] == true);
uint256 sum = 0;
for(uint256 i = 0; i < recipients.length; i++) {
balances[recipients[i]] = balances[recipients[i]].add(moenys[i]);
addmoney(recipients[i], moenys[i], 0... | 18,931 |
26 | // Withdraw tokens | function withdrawTokens(uint256 _numberOfTokens) public onlyOwner {
require(block.timestamp > currentLockTimer, "Tokens are currently locked even to the contract admin");
require(tokenContract.transfer(msg.sender, _numberOfTokens));
}
| function withdrawTokens(uint256 _numberOfTokens) public onlyOwner {
require(block.timestamp > currentLockTimer, "Tokens are currently locked even to the contract admin");
require(tokenContract.transfer(msg.sender, _numberOfTokens));
}
| 17,155 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.