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 |
|---|---|---|---|---|
16 | // Cancels the stream and transfers the tokens back on a pro rata basis. Throws if the id does not point to a valid stream. Throws if the caller is not the sender or the recipient of the stream. Throws if there is a token transfer failure. sid The id of the stream to cancel.return bool true=success, otherwise false. / | function cancelStream(uint sid)
external
nonReentrant
streamExists(sid)
onlySenderOrRecipient(sid)
returns (bool)
| function cancelStream(uint sid)
external
nonReentrant
streamExists(sid)
onlySenderOrRecipient(sid)
returns (bool)
| 25,298 |
71 | // Remove from balance | function decrementBalance(address _address, uint _amount) internal {
balances[_address] = balances[_address].sub(_amount);
}
| function decrementBalance(address _address, uint _amount) internal {
balances[_address] = balances[_address].sub(_amount);
}
| 24,916 |
4 | // Rebalance events | event RebalanceUpExit(uint256 bptAmountIn, uint256 protocolTokenRepaid, uint256 protocolTokenFee);
event RebalanceDownExit(uint256 bptAmountIn, uint256 quoteTokenRepaid, uint256 quoteTokenFee);
event RebalanceUpJoin(uint256 quoteTokenAmountIn, uint256 bptTokensStaked, uint256 quoteTokenFee);
event Rebal... | event RebalanceUpExit(uint256 bptAmountIn, uint256 protocolTokenRepaid, uint256 protocolTokenFee);
event RebalanceDownExit(uint256 bptAmountIn, uint256 quoteTokenRepaid, uint256 quoteTokenFee);
event RebalanceUpJoin(uint256 quoteTokenAmountIn, uint256 bptTokensStaked, uint256 quoteTokenFee);
event Rebal... | 2,334 |
157 | // We know if the last one in the group exists, all in the group exist, due to serial ordering. | require(_exists(endIndex), "not enough minted yet for this cleanup");
for (uint256 i = oldNextOwnerToSet; i <= endIndex; i++) {
if (_ownerships[i].addr == address(0)) {
TokenOwnership memory ownership = ownershipOf(i);
_ownerships[i] = TokenOwnership(
ownership.addr,
ow... | require(_exists(endIndex), "not enough minted yet for this cleanup");
for (uint256 i = oldNextOwnerToSet; i <= endIndex; i++) {
if (_ownerships[i].addr == address(0)) {
TokenOwnership memory ownership = ownershipOf(i);
_ownerships[i] = TokenOwnership(
ownership.addr,
ow... | 3,401 |
455 | // round 31 | ark(i, q, 17677827682004946431939402157761289497221048154630238117709539216286149983245);
sbox_partial(i, q);
mix(i, q);
| ark(i, q, 17677827682004946431939402157761289497221048154630238117709539216286149983245);
sbox_partial(i, q);
mix(i, q);
| 81,109 |
133 | // public presale purchase |
function allowlistPresalePurchase(uint256 _amount, bytes memory _signature)
public payable virtual
onlyUnsanctioned(msg.sender)
whenNotPaused
nonReentrant
onlyLive
validAllowlistPresalePurchase(msg.sender, _amount)
|
function allowlistPresalePurchase(uint256 _amount, bytes memory _signature)
public payable virtual
onlyUnsanctioned(msg.sender)
whenNotPaused
nonReentrant
onlyLive
validAllowlistPresalePurchase(msg.sender, _amount)
| 22,707 |
7 | // Allows the recipient or manager to initiate withdraw from LiquidPledging to this milestone. An attempt will be made to disburse the payment to the recipient. If there is a delay between withdrawing from LiquidPledging and the funds being sent, then a 2nd call to `disburse(address token)` will need to be made to send... | function mWithdraw(uint[] pledgesAmounts, address[] tokens, bool autoDisburse) onlyManagerOrRecipient canWithdraw external {
liquidPledging.mWithdraw(pledgesAmounts);
if (autoDisburse) {
_mDisburse(tokens);
}
}
| function mWithdraw(uint[] pledgesAmounts, address[] tokens, bool autoDisburse) onlyManagerOrRecipient canWithdraw external {
liquidPledging.mWithdraw(pledgesAmounts);
if (autoDisburse) {
_mDisburse(tokens);
}
}
| 45,122 |
10 | // Checking to make sure the random character we picked exists | require(
bytes(allCharactersEver[characterID].name).length != 0,
ConstantsAF.INVALID_CHARACTER
);
incrementCharacterSupply(characterID);
delete arrayCount;
delete shorterRandomNumber;
return characterID;
| require(
bytes(allCharactersEver[characterID].name).length != 0,
ConstantsAF.INVALID_CHARACTER
);
incrementCharacterSupply(characterID);
delete arrayCount;
delete shorterRandomNumber;
return characterID;
| 41,053 |
90 | // CoTrader platform config | ICoTraderGlobalConfig public cotraderGlobalConfig;
| ICoTraderGlobalConfig public cotraderGlobalConfig;
| 43,451 |
20 | // wizz panda control | function getWizzPandaQuotaOf(uint256 _tp) view external returns(uint256) {
return wizzPandaQuota[_tp];
}
| function getWizzPandaQuotaOf(uint256 _tp) view external returns(uint256) {
return wizzPandaQuota[_tp];
}
| 29,265 |
171 | // check if the scheme is registered | if (_isSchemeRegistered(_scheme) == false) {
return false;
}
| if (_isSchemeRegistered(_scheme) == false) {
return false;
}
| 6,567 |
176 | // Called by mAsset after redeeming tokens. Simply reduce the balance in the vault _bAssetIndexIndex of the bAsset _decreaseAmount Units withdrawn / | function decreaseVaultBalance(
uint8 _bAssetIndex,
address /* _integrator */,
uint256 _decreaseAmount
)
external
onlyMasset
nonReentrant
| function decreaseVaultBalance(
uint8 _bAssetIndex,
address /* _integrator */,
uint256 _decreaseAmount
)
external
onlyMasset
nonReentrant
| 40,889 |
4 | // bool value which shows if the ERC721-contract opened for any user. Default - false | bool public NFTopenForAll;
| bool public NFTopenForAll;
| 6,309 |
35 | // Returns true if the claim period has not ended. | function isActive() external view returns (bool);
| function isActive() external view returns (bool);
| 15,453 |
6 | // burn option token from an address. Can only be called by corresponding margin engine _from account to burn from _amount amount to burn/ | function burn(address _from, address _vault, uint256 _amount) external override {
if (!whitelist.isVault(msg.sender)) revert Unauthorized();
uint256 tokenId = vaultToTokenId(_vault);
uint256 supply = _totalSupply[tokenId];
if (supply < _amount) revert VS_SupplyExceeded();
... | function burn(address _from, address _vault, uint256 _amount) external override {
if (!whitelist.isVault(msg.sender)) revert Unauthorized();
uint256 tokenId = vaultToTokenId(_vault);
uint256 supply = _totalSupply[tokenId];
if (supply < _amount) revert VS_SupplyExceeded();
... | 24,988 |
70 | // Library for swapping on Dex | library Utils {
function swapTokensForEth(
address routerAddress,
uint256 tokenAmount
) internal {
IDexRouter dexRouter = IDexRouter(routerAddress);
// generate the Dex pair path of token -> weth
address[] memory path = new address[](2);
path[0] = address(this);
... | library Utils {
function swapTokensForEth(
address routerAddress,
uint256 tokenAmount
) internal {
IDexRouter dexRouter = IDexRouter(routerAddress);
// generate the Dex pair path of token -> weth
address[] memory path = new address[](2);
path[0] = address(this);
... | 8,837 |
72 | // valid purchase identifies which stage the contract is at (PreState/Token Sale) making sure were inside the contribution period and the user is sending enough Wei for the stage&39;s rules | require(validPurchase());
address sender = msg.sender;
uint256 weiAmountSent = msg.value;
| require(validPurchase());
address sender = msg.sender;
uint256 weiAmountSent = msg.value;
| 42,815 |
23 | // Price > 1.10 | uint256 _premiumAmount = _tombPrice.sub(tombPriceOne).mul(premiumPercent).div(10000);
_rate = tombPriceOne.add(_premiumAmount);
if (maxPremiumRate > 0 && _rate > maxPremiumRate) {
_rate = maxPremiumRate;
}
| uint256 _premiumAmount = _tombPrice.sub(tombPriceOne).mul(premiumPercent).div(10000);
_rate = tombPriceOne.add(_premiumAmount);
if (maxPremiumRate > 0 && _rate > maxPremiumRate) {
_rate = maxPremiumRate;
}
| 18,889 |
11 | // In order to receive ETH transfers | function() external payable {}
/// @notice Distributes a list of _tokens balances in this contract, depending on the distribution
/// @param _tokens list of ERC20 tokens to distribute
function distribute(IERC20[] memory _tokens) public {
for (uint256 i = 0; i < _tokens.length; i++) {
... | function() external payable {}
/// @notice Distributes a list of _tokens balances in this contract, depending on the distribution
/// @param _tokens list of ERC20 tokens to distribute
function distribute(IERC20[] memory _tokens) public {
for (uint256 i = 0; i < _tokens.length; i++) {
... | 32,518 |
571 | // if user lands Rewards Boost case | uint256 dailyRewards = getLastDailyRewards(msg.sender);
console.log("dailyRewards", dailyRewards);
if (casePositions[player.curPos] == CaseType.Rewards120) {
BoostReward storage boostReward = player.boostRewards[0];
boostReward.originReward = dailyRewards.mul(rewards120Ra... | uint256 dailyRewards = getLastDailyRewards(msg.sender);
console.log("dailyRewards", dailyRewards);
if (casePositions[player.curPos] == CaseType.Rewards120) {
BoostReward storage boostReward = player.boostRewards[0];
boostReward.originReward = dailyRewards.mul(rewards120Ra... | 16,552 |
0 | // A collection of helper functions | interface LPStakingHelpers {
function mint(address to, uint256 amount) external;
function owner() external view returns (address);
function addVestingInfo(address user, uint256 amount)
external
returns (bool);
}
| interface LPStakingHelpers {
function mint(address to, uint256 amount) external;
function owner() external view returns (address);
function addVestingInfo(address user, uint256 amount)
external
returns (bool);
}
| 12,635 |
12 | // only a ninja cat owner can attack | require(balanceOf[msg.sender][2] > 0, "You need a ninja cat to attack!");
| require(balanceOf[msg.sender][2] > 0, "You need a ninja cat to attack!");
| 5,000 |
75 | // Calculate the buy amount: exchangeRateadjustedSellAmount | return exchangeRate.multiply(adjustedSellAmount).fromFixed();
| return exchangeRate.multiply(adjustedSellAmount).fromFixed();
| 24,641 |
36 | // Notifies a weight change of a member/Called only by: Elections contract/addr is the committee member address/weight is the updated weight of the committee member | function memberWeightChange(address addr, uint256 weight) external /* onlyElectionsContract onlyWhenActive */;
| function memberWeightChange(address addr, uint256 weight) external /* onlyElectionsContract onlyWhenActive */;
| 18,640 |
28 | // Authorize an operator to manage tokens of the sender (caller's address). operator the operator's address that will be authorized / | function authorizeOperator(address operator) external override {}
/**
* @dev Revoke an operator's rights to manage tokens of the sender (caller's address).
* @param operator the operator's address that will be revoked
*/
function revokeOperator(address operator) external override {}
/**... | function authorizeOperator(address operator) external override {}
/**
* @dev Revoke an operator's rights to manage tokens of the sender (caller's address).
* @param operator the operator's address that will be revoked
*/
function revokeOperator(address operator) external override {}
/**... | 28,069 |
194 | // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since we're implementing it ourselves. | (bool success, bytes memory returndata) = token.call(data);
| (bool success, bytes memory returndata) = token.call(data);
| 1,604 |
10 | // Allows owner to enable a module/module to enable/canModuleMint if the module has to be given the minter role | function enableModule(address module, bool canModuleMint) external;
| function enableModule(address module, bool canModuleMint) external;
| 12,634 |
200 | // Safe Math/ from: https:github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/math/SafeMath.sol Subject to the MIT license. | function add(uint256 a, uint256 b) internal pure returns (uint256)
| function add(uint256 a, uint256 b) internal pure returns (uint256)
| 10,537 |
12 | // Presale Reduced Minting | function mintReducedPresale(uint256 _amount, CosmicVoucher.Voucher calldata v) public payable {
uint256 supply = totalSupply();
require(reducedPresaleActive, "Reduced Private Sale Not Active");
require(claimedVouchers[v.voucherId] + _amount <= 1, "Max 1 During Reduced Presale");
requ... | function mintReducedPresale(uint256 _amount, CosmicVoucher.Voucher calldata v) public payable {
uint256 supply = totalSupply();
require(reducedPresaleActive, "Reduced Private Sale Not Active");
require(claimedVouchers[v.voucherId] + _amount <= 1, "Max 1 During Reduced Presale");
requ... | 63,635 |
2 | // The recipient can close the channel at any time by presenting a signed amount from the sender. The recipient will be sent that amount, and the remainder will go back to the sender | function close(uint amount, bytes memory signature) public {
require(msg.sender == recipient);
require(isValidSignature(amount, signature));
recipient.transfer(amount);
selfdestruct(sender);
}
| function close(uint amount, bytes memory signature) public {
require(msg.sender == recipient);
require(isValidSignature(amount, signature));
recipient.transfer(amount);
selfdestruct(sender);
}
| 381 |
13 | // The NewPlanet event is fired whenever a new planet "pops" in the universe. This obviously/includes any time a planet is created through the fusion method, but it is also called/when a new uni0 planet is created. | event NewPlanet(address owner, uint planetId, uint planet1ID, uint planet2ID, uint univers, uint dna);
event Transfer(address from, address to, uint256 tokenId);
uint fusionTime = 4 days;
uint dnaModulus = 100;
| event NewPlanet(address owner, uint planetId, uint planet1ID, uint planet2ID, uint univers, uint dna);
event Transfer(address from, address to, uint256 tokenId);
uint fusionTime = 4 days;
uint dnaModulus = 100;
| 15,211 |
0 | // Variables | address public owner;
string public carModel;
string public priceDescription = 'You should deposit 2 Ether per day Plus 1 Ether per Day as a Late Secure Payment';
bool public availableForRent = true;
address public rentedBy;
uint256 public rentedFor;
uint256 public rentedAt;
uint public constant pricePerDay = 0... | address public owner;
string public carModel;
string public priceDescription = 'You should deposit 2 Ether per day Plus 1 Ether per Day as a Late Secure Payment';
bool public availableForRent = true;
address public rentedBy;
uint256 public rentedFor;
uint256 public rentedAt;
uint public constant pricePerDay = 0... | 42,030 |
32 | // a vesting duration to release tokens | uint256 private immutable _releaseDuration;
| uint256 private immutable _releaseDuration;
| 75,515 |
623 | // https:docs.synthetix.io/contracts/source/interfaces/iliquidations | interface ILiquidations {
// Views
function isOpenForLiquidation(address account) external view returns (bool);
function getLiquidationDeadlineForAccount(address account) external view returns (uint);
function isLiquidationDeadlinePassed(address account) external view returns (bool);
function liq... | interface ILiquidations {
// Views
function isOpenForLiquidation(address account) external view returns (bool);
function getLiquidationDeadlineForAccount(address account) external view returns (uint);
function isLiquidationDeadlinePassed(address account) external view returns (bool);
function liq... | 29,539 |
2 | // The address of DPlay store DPlay 스토어 주소 | address public dplayStore;
| address public dplayStore;
| 49,086 |
2 | // sets initials supply and the owner / function initialize(string memory name, string memory symbol, uint8 decimals, uint256 amount, bool mintable,address owner) | // public initializer {
// _owner = owner;
// _name = name;
// _symbol = symbol;
// _decimals = decimals;
// _mintable = mintable;
// _mint(owner, amount);
// }
| // public initializer {
// _owner = owner;
// _name = name;
// _symbol = symbol;
// _decimals = decimals;
// _mintable = mintable;
// _mint(owner, amount);
// }
| 31,289 |
30 | // main function which will make the investments | function LetsInvest() public payable returns(uint) {
require (msg.value > 100000000000000);
require (msg.sender != address(0));
uint invest_amt = msg.value;
address payable investor = address(msg.sender);
uint sBTCPortion = SafeMath.div(SafeMath.mul(invest_amt,sBTCPercentage)... | function LetsInvest() public payable returns(uint) {
require (msg.value > 100000000000000);
require (msg.sender != address(0));
uint invest_amt = msg.value;
address payable investor = address(msg.sender);
uint sBTCPortion = SafeMath.div(SafeMath.mul(invest_amt,sBTCPercentage)... | 40,187 |
157 | // set initSelector | _initSelector = initSelector;
| _initSelector = initSelector;
| 32,894 |
11 | // If the stored first owner is set, return it. | if (_storedFirstOwner != address(0)) return _storedFirstOwner;
| if (_storedFirstOwner != address(0)) return _storedFirstOwner;
| 33,518 |
35 | // validate sender | address vaultAddress = vaultList[owner];
if(msg.sender == vaultAddress){
| address vaultAddress = vaultList[owner];
if(msg.sender == vaultAddress){
| 22,284 |
97 | // Subscription data operations Data packing: WORD 1: | publisher | RESERVED | indexId | subId | | 160b| 32b| 32b | 32b | WORD 2: | units | indexValue | | 128b| 128b | |
function _encodeSubscriptionData(
SubscriptionData memory sdata
)
private pure
returns (bytes32[] memory data)
|
function _encodeSubscriptionData(
SubscriptionData memory sdata
)
private pure
returns (bytes32[] memory data)
| 7,968 |
310 | // Fetch set token properties | uint256 naturalUnit = setToken.naturalUnit();
address[] memory components = setToken.getComponents();
uint256[] memory units = setToken.getUnits();
return SetDetails({
naturalUnit: naturalUnit,
components: components,
units: units
});
| uint256 naturalUnit = setToken.naturalUnit();
address[] memory components = setToken.getComponents();
uint256[] memory units = setToken.getUnits();
return SetDetails({
naturalUnit: naturalUnit,
components: components,
units: units
});
| 44,258 |
2 | // ckAddress is contract address of kittyAddress on ETH blockchainwe will create the kittyContract by the address of the kittyInterface / | address ckAddress = 0x06012c8cf97BEaD5deAe237070F9587f8E7A266d;
KittyInterface kittyContract = KittyInterface(ckAddress);
| address ckAddress = 0x06012c8cf97BEaD5deAe237070F9587f8E7A266d;
KittyInterface kittyContract = KittyInterface(ckAddress);
| 41,429 |
2 | // If the user tries to allocate more than maximum allocation amount dont allow | if ((previous_deposit + amount) > max_allowed_base) {
amount = max_allowed_base - previous_deposit;
}
| if ((previous_deposit + amount) > max_allowed_base) {
amount = max_allowed_base - previous_deposit;
}
| 7,112 |
4 | // Interface of the IERC20 standard as defined in the EIP. / | interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @de... | interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @de... | 6,376 |
25 | // The total funds that have been allocated to the reserve | uint256 public reserveTotalSupply;
| uint256 public reserveTotalSupply;
| 14,341 |
65 | // 当已借款高出借款上限时,无法继续借款 | if (vars.borrowLimitMan <= vars.borrowValueMan) {
return (0, cash);
}
| if (vars.borrowLimitMan <= vars.borrowValueMan) {
return (0, cash);
}
| 35,410 |
15 | // mint the token | _mint(_to, membershipCounter);
| _mint(_to, membershipCounter);
| 26,329 |
21 | // Update buffer length if we extended it | if gt(newCapacity, mload(bufptr)) {
mstore(bufptr, newCapacity)
}
| if gt(newCapacity, mload(bufptr)) {
mstore(bufptr, newCapacity)
}
| 32,030 |
38 | // check if the given account is not frozen | function isUnfrozenAccount(address _addr) private view returns (bool is_unfrozen_account) {
return frozenAccount[_addr] == false;
}
| function isUnfrozenAccount(address _addr) private view returns (bool is_unfrozen_account) {
return frozenAccount[_addr] == false;
}
| 39,870 |
524 | // Withdraws staked waTokens from the transmuter// This function reverts if you try to draw more tokens than you deposited// amount the amount of waTokens to unstake | function unstake(uint256 amount) public updateAccount(msg.sender) {
// by calling this function before transmuting you forfeit your gained allocation
address sender = msg.sender;
require(depositedWaTokens[sender] >= amount, "MigratableLinkTransmuterV2: unstake amount exceeds deposited amount... | function unstake(uint256 amount) public updateAccount(msg.sender) {
// by calling this function before transmuting you forfeit your gained allocation
address sender = msg.sender;
require(depositedWaTokens[sender] >= amount, "MigratableLinkTransmuterV2: unstake amount exceeds deposited amount... | 36,814 |
26 | // TODO: change this out with the final charity wallet address | address private _charityWallet = 0xf81ba5bc55840CC8C28B1978E8870a4eD4779d8D;
| address private _charityWallet = 0xf81ba5bc55840CC8C28B1978E8870a4eD4779d8D;
| 51,497 |
10 | // =================================/=================================/================================= | struct Transaction {
address destination;
uint value;
bytes data;
bool executed;
}
| struct Transaction {
address destination;
uint value;
bytes data;
bool executed;
}
| 33,084 |
147 | // Writes an address into a specific position in a byte array./b Byte array to insert address into./index Index in byte array of address./input Address to put into byte array. | function writeAddress(
bytes memory b,
uint256 index,
address input
)
internal
pure
| function writeAddress(
bytes memory b,
uint256 index,
address input
)
internal
pure
| 9,242 |
5 | // A method to remove a member from the whitelist _member The member to remove as a member. / | function removeMember(address _member)
public
onlyOwner
| function removeMember(address _member)
public
onlyOwner
| 37,658 |
86 | // Ante V0.5 Ante Pool smart contract/Deploys an Ante Pool and connects with the Ante Test, manages pools and interactions with users | contract AntePool is IAntePool {
using SafeMath for uint256;
using FullMath for uint256;
using Address for address;
using IterableAddressSetUtils for IterableAddressSetUtils.IterableAddressSet;
/// @notice Info related to a single user
struct UserInfo {
// How much ETH this user deposit... | contract AntePool is IAntePool {
using SafeMath for uint256;
using FullMath for uint256;
using Address for address;
using IterableAddressSetUtils for IterableAddressSetUtils.IterableAddressSet;
/// @notice Info related to a single user
struct UserInfo {
// How much ETH this user deposit... | 1,219 |
73 | // transfer to requested user | baseToken.transfer(_investor, nRemaining);
| baseToken.transfer(_investor, nRemaining);
| 17,142 |
1 | // At least we try to make front-running harder to do. | require(msg.sender == tx.origin, "do not convert from contract");
ISakeSwapPair pair = ISakeSwapPair(factory.getPair(token0, token1));
pair.transfer(address(pair), pair.balanceOf(address(this)));
(uint256 _amount0, uint256 _amount1) = pair.burn(address(this));
(uint256 amount0, u... | require(msg.sender == tx.origin, "do not convert from contract");
ISakeSwapPair pair = ISakeSwapPair(factory.getPair(token0, token1));
pair.transfer(address(pair), pair.balanceOf(address(this)));
(uint256 _amount0, uint256 _amount1) = pair.burn(address(this));
(uint256 amount0, u... | 16,369 |
1 | // set owner as mintAgent. | setMintAgent(msg.sender, true);
| setMintAgent(msg.sender, true);
| 14,728 |
28 | // ----------------------------------------------------------------------- Views to check if a withdrawal address or mint tx IDis already known. ----------------------------------------------------------------------- | function isWithdrawalAddress(address _addr) public view returns (bool) {
return _isWithdrawalAddress(_addr);
}
| function isWithdrawalAddress(address _addr) public view returns (bool) {
return _isWithdrawalAddress(_addr);
}
| 4,990 |
89 | // Writes | function updateStartingTaxes(uint[] memory _startingTaxes) public onlyOwner {
startingTaxes = _startingTaxes;
emit UpdatedStartingTaxes(startingTaxes);
}
| function updateStartingTaxes(uint[] memory _startingTaxes) public onlyOwner {
startingTaxes = _startingTaxes;
emit UpdatedStartingTaxes(startingTaxes);
}
| 26,756 |
7 | // Emit post | emit PostCreated(numPosts, _content, 0, msg.sender);
| emit PostCreated(numPosts, _content, 0, msg.sender);
| 47,002 |
151 | // Have gUsers[1] try to add gUsers[2] again as a member | addAUserWithImpersonateWithRevert(gUsers[2], AccessType.Member, gUsers[1], "Not authorized to grant");
assertEq(dao.getUserCount(), 3);
| addAUserWithImpersonateWithRevert(gUsers[2], AccessType.Member, gUsers[1], "Not authorized to grant");
assertEq(dao.getUserCount(), 3);
| 22,538 |
107 | // @nonce calls by HegicPutOptions to unlock the premiums after an option's expiraton to Provider amount Amount of premiums that should be unlocked //@nonce calls by HegicCallOptions to send funds to liquidity providers after an option's expiration to Provider amount Funds that should be sent / | function send(uint id, address payable to, uint256 amount) external override {
require(options[msg.sender], "HegicERCPool::setLockupPeriod: not option");
LockedLiquidity storage ll = lockedLiquidity[id];
require(ll.locked, "LockedLiquidity with such id has already unlocked");
require... | function send(uint id, address payable to, uint256 amount) external override {
require(options[msg.sender], "HegicERCPool::setLockupPeriod: not option");
LockedLiquidity storage ll = lockedLiquidity[id];
require(ll.locked, "LockedLiquidity with such id has already unlocked");
require... | 46,569 |
50 | // if the user has not alreay withdrawn the tokens | if(_withdrawnBalance < user.value)
{
| if(_withdrawnBalance < user.value)
{
| 28,251 |
0 | // Your functions go here / | function MyFunction1() {}
function MyFunction2() {}
/**
* Below is for our CV!
* */
function getAddress() public constant returns(string) {
return "http://www.example.org";
}
| function MyFunction1() {}
function MyFunction2() {}
/**
* Below is for our CV!
* */
function getAddress() public constant returns(string) {
return "http://www.example.org";
}
| 30,397 |
26 | // Read only function to see the 2 children of a node in Team Matrixreturn 2 branches / | function viewUserReferralMatrix2(address _user) public view returns(address[] memory) {
return users[_user].referralMatrix2;
}
| function viewUserReferralMatrix2(address _user) public view returns(address[] memory) {
return users[_user].referralMatrix2;
}
| 34,599 |
502 | // Validates borrow and reverts on rejection. May emit logs. cToken Asset whose underlying is being borrowed borrower The address borrowing the underlying borrowAmount The amount of the underlying asset requested to borrow / | function borrowVerify(address cToken, address borrower, uint borrowAmount) external {
// Shh - currently unused
cToken;
borrower;
borrowAmount;
// Shh - we don't ever want this hook to be marked pure
if (false) {
maxAssets = maxAssets;
}
}
| function borrowVerify(address cToken, address borrower, uint borrowAmount) external {
// Shh - currently unused
cToken;
borrower;
borrowAmount;
// Shh - we don't ever want this hook to be marked pure
if (false) {
maxAssets = maxAssets;
}
}
| 6,349 |
215 | // Deposit | execute(
safe,
address(lendingPool),
abi.encodeWithSelector(
lendingPool.deposit.selector,
address(usdc),
usdcBalance,
address(safe)
)
);
| execute(
safe,
address(lendingPool),
abi.encodeWithSelector(
lendingPool.deposit.selector,
address(usdc),
usdcBalance,
address(safe)
)
);
| 8,092 |
3 | // gets called after business logic, may induce state transition | function mAdavanceLogicState(ETOState oldState)
internal
constant
returns (ETOState);
| function mAdavanceLogicState(ETOState oldState)
internal
constant
returns (ETOState);
| 30,886 |
153 | // See {IERC721Metadata-name}. / | function name() public view virtual override returns (string memory) {
return _name;
}
| function name() public view virtual override returns (string memory) {
return _name;
}
| 2,140 |
195 | // Enforcing a _minSharesQuantity also validates `_investmentAmount > 0` and guarantees the function cannot succeed while minting 0 shares | require(_minSharesQuantity > 0, "__buyShares: _minSharesQuantity must be >0");
address vaultProxyCopy = getVaultProxy();
require(
!_hasSharesActionTimelock || !__hasPendingMigrationOrReconfiguration(vaultProxyCopy),
"__buyShares: Pending migration or reconfiguration"
... | require(_minSharesQuantity > 0, "__buyShares: _minSharesQuantity must be >0");
address vaultProxyCopy = getVaultProxy();
require(
!_hasSharesActionTimelock || !__hasPendingMigrationOrReconfiguration(vaultProxyCopy),
"__buyShares: Pending migration or reconfiguration"
... | 31,827 |
9 | // Contract module which provides a basic access control mechanism, wherethere is an account (an owner) that can be granted exclusive access tospecific functions. By default, the owner account will be the one that deploys the contract. This | * can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
contract Ownable is Context {
address private _owner;
event OwnershipTransferred... | * can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
contract Ownable is Context {
address private _owner;
event OwnershipTransferred... | 6,058 |
23 | // modifier to allow actions only when the contract IS paused / | modifier whenNotPaused() {
require(!paused, "NOT PAUSED");
_;
}
| modifier whenNotPaused() {
require(!paused, "NOT PAUSED");
_;
}
| 48,805 |
38 | // Changes the admin of the proxy. | * Emits an {AdminChanged} event.
*/
function _changeAdmin(address newAdmin) internal {
emit AdminChanged(_getAdmin(), newAdmin);
_setAdmin(newAdmin);
}
| * Emits an {AdminChanged} event.
*/
function _changeAdmin(address newAdmin) internal {
emit AdminChanged(_getAdmin(), newAdmin);
_setAdmin(newAdmin);
}
| 8,893 |
5,194 | // 2599 | entry "texturewise" : ENG_ADVERB
| entry "texturewise" : ENG_ADVERB
| 23,435 |
122 | // Sets asset spending allowance for a specified spender. Can only be called by asset proxy._spender holder address to set allowance to. _value amount to allow. _symbol asset symbol. _sender approve initiator address. return success. / | function proxyApprove(address _spender, uint _value, bytes32 _symbol, address _sender) onlyProxy(_symbol) public returns (uint) {
return _approve(_createHolderId(_spender), _value, _symbol, _createHolderId(_sender));
}
| function proxyApprove(address _spender, uint _value, bytes32 _symbol, address _sender) onlyProxy(_symbol) public returns (uint) {
return _approve(_createHolderId(_spender), _value, _symbol, _createHolderId(_sender));
}
| 6,915 |
53 | // Track original fees to bypass fees for charity account | uint256 private ORIG_TAX_FEE;
uint256 private ORIG_BURN_FEE;
uint256 private ORIG_CHARITY_FEE;
| uint256 private ORIG_TAX_FEE;
uint256 private ORIG_BURN_FEE;
uint256 private ORIG_CHARITY_FEE;
| 10,868 |
33 | // Computes owner's cut of a sale./_price - Sale price of NFT. | function _computeFee(uint128 _price) internal view returns (uint128) {
// NOTE: We don't use SafeMath (or similar) in this function because
// all of our entry functions carefully cap the maximum values for
// currency (at 128-bits), and ownerFee <= 10000 (see the require()
// sta... | function _computeFee(uint128 _price) internal view returns (uint128) {
// NOTE: We don't use SafeMath (or similar) in this function because
// all of our entry functions carefully cap the maximum values for
// currency (at 128-bits), and ownerFee <= 10000 (see the require()
// sta... | 35,722 |
2 | // Maintain a memory counter for the current write location in the temp bytes array by adding the 32 bytes for the array length to the starting location. | let mc := add(tempBytes, 0x20)
| let mc := add(tempBytes, 0x20)
| 19,716 |
14 | // transfers all NFTs in the box | Box memory yourBox = boxList[boxID];
ERC721[] memory nftAddresses;
address[] memory mystNFTminting;
for (uint256 i = 0; i < yourBox.nfts.length; i++) {
if (yourBox.nfts[i].parentContract == address(0)) {
break;
}
| Box memory yourBox = boxList[boxID];
ERC721[] memory nftAddresses;
address[] memory mystNFTminting;
for (uint256 i = 0; i < yourBox.nfts.length; i++) {
if (yourBox.nfts[i].parentContract == address(0)) {
break;
}
| 41,884 |
98 | // no cheating! | _referredBy != _customerAddress &&
| _referredBy != _customerAddress &&
| 6,692 |
32 | // Freezable This trait allows to freeze the transactions in a Token / | contract Freezable is HasOwner {
bool public frozen = false;
/**
* @dev Modifier makes methods callable only when the contract is not frozen.
*/
modifier requireNotFrozen() {
require(!frozen);
_;
}
/**
* @dev Allows the owner to "freeze" the contract.
*/
fun... | contract Freezable is HasOwner {
bool public frozen = false;
/**
* @dev Modifier makes methods callable only when the contract is not frozen.
*/
modifier requireNotFrozen() {
require(!frozen);
_;
}
/**
* @dev Allows the owner to "freeze" the contract.
*/
fun... | 18,611 |
6 | // add a new contribution record to the project's contributor list | ListOfCampaigns[_campaignID].contributors[uint24(ListOfCampaigns[_campaignID].totalContributors)] = newContributor;
ListOfCampaigns[_campaignID].totalContributors += 1;
| ListOfCampaigns[_campaignID].contributors[uint24(ListOfCampaigns[_campaignID].totalContributors)] = newContributor;
ListOfCampaigns[_campaignID].totalContributors += 1;
| 45,499 |
196 | // Withdraw LP tokens from Sommelier. | function withdraw(uint256 _pid, uint256 _amount) public {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][msg.sender];
require(user.amount >= _amount, "withdraw: not good");
updatePool(_pid);
uint256 pending = user.amount.mul(pool.acciK... | function withdraw(uint256 _pid, uint256 _amount) public {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][msg.sender];
require(user.amount >= _amount, "withdraw: not good");
updatePool(_pid);
uint256 pending = user.amount.mul(pool.acciK... | 46,084 |
177 | // Update total stake | totalStaked[listing.owner] = totalStaked[listing.owner].add(_amount);
require(token.transferFrom(msg.sender, this, _amount));
emit _Deposit(_listingHash, _amount, listing.unstakedDeposit);
| totalStaked[listing.owner] = totalStaked[listing.owner].add(_amount);
require(token.transferFrom(msg.sender, this, _amount));
emit _Deposit(_listingHash, _amount, listing.unstakedDeposit);
| 11,835 |
47 | // src/priceProvider.sol/ pragma solidity ^0.5.12; // import "./IERC20.sol"; // import "./safeMath.sol"; // import "./safeERC20.sol"; / | interface SpotLike {
function poke(bytes32 ilk) external;
}
| interface SpotLike {
function poke(bytes32 ilk) external;
}
| 17,026 |
55 | // Return creditAccount | _accountFactory.returnCreditAccount(creditAccount); // T:[CM-21]
| _accountFactory.returnCreditAccount(creditAccount); // T:[CM-21]
| 6,947 |
100 | // getEscapeRequest(): returns _point's current escape requestthe returned escape request is only valid as long as isEscaping()returns true | function getEscapeRequest(uint32 _point)
view
external
returns (uint32 escape)
| function getEscapeRequest(uint32 _point)
view
external
returns (uint32 escape)
| 14,300 |
510 | // Calculates part of the matched fill results for a given situation using the fill strategy that only/awards profit denominated in the left maker asset./leftOrder The left order in the order matching situation./rightOrder The right order in the order matching situation./leftMakerAssetAmountRemaining The amount of the ... | function _calculateMatchedFillResults(
LibOrder.Order memory leftOrder,
LibOrder.Order memory rightOrder,
uint256 leftMakerAssetAmountRemaining,
uint256 leftTakerAssetAmountRemaining,
uint256 rightMakerAssetAmountRemaining,
uint256 rightTakerAssetAmountRemaining
)... | function _calculateMatchedFillResults(
LibOrder.Order memory leftOrder,
LibOrder.Order memory rightOrder,
uint256 leftMakerAssetAmountRemaining,
uint256 leftTakerAssetAmountRemaining,
uint256 rightMakerAssetAmountRemaining,
uint256 rightTakerAssetAmountRemaining
)... | 35,942 |
27 | // Withdrawal fee 0% - 0% to treasury - 0% to dev fund | uint256 public withdrawalTreasuryFee = 0;
uint256 public constant withdrawalTreasuryMax = 100000;
uint256 public withdrawalDevFundFee = 0;
uint256 public constant withdrawalDevFundMax = 100000;
| uint256 public withdrawalTreasuryFee = 0;
uint256 public constant withdrawalTreasuryMax = 100000;
uint256 public withdrawalDevFundFee = 0;
uint256 public constant withdrawalDevFundMax = 100000;
| 21,069 |
66 | // Allows the user to withdraw his claimable balance from the contract / | function withdraw() public nonReentrant returns(bool){
User storage us = user[msg.sender];
require(us.active == true,'Invalid User');
require(us.freebal > 0,'No bal');
bundle_address.transfer(msg.sender,us.freebal);
us.freebal = 0;
return true;
}
| function withdraw() public nonReentrant returns(bool){
User storage us = user[msg.sender];
require(us.active == true,'Invalid User');
require(us.freebal > 0,'No bal');
bundle_address.transfer(msg.sender,us.freebal);
us.freebal = 0;
return true;
}
| 12,349 |
46 | // skip holder from getting any rewards | if (_isExcludedFromRewards[holderAddress]) {
continue;
}
| if (_isExcludedFromRewards[holderAddress]) {
continue;
}
| 7,804 |
136 | // Redemption spread has been updated./collateralToken Collateral token that the spread was set for./redemptionSpread The new redemption spread. | event RedemptionSpreadUpdated(IERC20 collateralToken, uint256 redemptionSpread);
| event RedemptionSpreadUpdated(IERC20 collateralToken, uint256 redemptionSpread);
| 35,817 |
38 | // Ensure individual and global consistency when decrementing collateral balances. Returns the change to the position. We elect to return the amount that the global collateral is decreased by, rather than the individual position's collateral, because we need to maintain the invariant that the global collateral is alway... | function _decrementCollateralBalances(DepositBoxData storage depositBoxData, FixedPoint.Unsigned memory collateralAmount)
internal
returns (FixedPoint.Unsigned memory)
| function _decrementCollateralBalances(DepositBoxData storage depositBoxData, FixedPoint.Unsigned memory collateralAmount)
internal
returns (FixedPoint.Unsigned memory)
| 37,128 |
2 | // Returns the name of the protocol the Ante Test is testing/This overrides the auto-generated getter for protocolName as a public var/ return The name of the protocol in string format | function protocolName() external view returns (string memory);
| function protocolName() external view returns (string memory);
| 1,222 |
12 | // global mint function used in early access and public saleamount the amount of tokens to mint/ | function mint(uint256 amount) private {
require(amount > 0, "Need to request at least 1 NFT");
require(purchaseTxs[msg.sender] + amount <= maxPerTx, "Wallet mint limit");
for(uint256 i = 0; i < amount; i++){
(uint256[] memory availableIds, uint256 count) = getAvailableId... | function mint(uint256 amount) private {
require(amount > 0, "Need to request at least 1 NFT");
require(purchaseTxs[msg.sender] + amount <= maxPerTx, "Wallet mint limit");
for(uint256 i = 0; i < amount; i++){
(uint256[] memory availableIds, uint256 count) = getAvailableId... | 51,933 |
324 | // Returns the integer division of two unsigned integers, reverting 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 (consuming all remaining gas... | function div(uint256 a, uint256 b) internal pure returns (uint256) {
require(b > 0, "SafeMath: division by zero");
return a / b;
}
| function div(uint256 a, uint256 b) internal pure returns (uint256) {
require(b > 0, "SafeMath: division by zero");
return a / b;
}
| 74,134 |
13 | // Checks the balance of a given account account address to check the balance credited by the contractreturn amount as uint256 as the balance credited to the account and available for withdrawal / | function balance(address account) public view returns(uint256 amount) {
return _balances[account];
}
| function balance(address account) public view returns(uint256 amount) {
return _balances[account];
}
| 17,718 |
258 | // Gets the amount of xSushi in existence | uint256 totalShares = totalSupply(); // 获取存在的xsushi的数量
| uint256 totalShares = totalSupply(); // 获取存在的xsushi的数量
| 25,752 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.