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 |
|---|---|---|---|---|
54 | // emitted when admin withdraws equityNote that `equityAvailableBefore` indicates equity before `amount` was removed. / | event EquityWithdrawn(address asset, uint equityAvailableBefore, uint amount, address owner);
| event EquityWithdrawn(address asset, uint equityAvailableBefore, uint amount, address owner);
| 19,267 |
7 | // MarriageCertificateIssuer Issue marriage certificate.Don't issue as ERC720 for saving gas cost purpose. We don't assume to trasfer token / | contract MarriageCertificateIssuer is Ownable {
using SafeMath for uint256;
uint256 public FEE = 20000000000000000;
uint256 private deposits;
uint256 private prefix = 20000000;
struct Certificate {
bytes32 bride;
bytes32 groom;
}
// Certificate ID range is 20000001 to 4294... | contract MarriageCertificateIssuer is Ownable {
using SafeMath for uint256;
uint256 public FEE = 20000000000000000;
uint256 private deposits;
uint256 private prefix = 20000000;
struct Certificate {
bytes32 bride;
bytes32 groom;
}
// Certificate ID range is 20000001 to 4294... | 8,499 |
35 | // Basis Cash Treasury contract Monetary policy logic to adjust supplies of basis cash assets Summer Smith & Rick Sanchez / | contract Treasury is ContractGuard, Epoch {
using FixedPoint for *;
using SafeERC20 for IERC20;
using Address for address;
using SafeMath for uint256;
using Safe112 for uint112;
/* ========== STATE VARIABLES ========== */
// ========== FLAGS
bool public migrated = false;
bool publi... | contract Treasury is ContractGuard, Epoch {
using FixedPoint for *;
using SafeERC20 for IERC20;
using Address for address;
using SafeMath for uint256;
using Safe112 for uint112;
/* ========== STATE VARIABLES ========== */
// ========== FLAGS
bool public migrated = false;
bool publi... | 33,014 |
10 | // TODO: Update to burnFrom once https:github.com/OpenZeppelin/zeppelin-solidity/pull/870 is merged | require(token.transferFrom(msg.sender, this, newVersionCost));
token.burn(newVersionCost);
| require(token.transferFrom(msg.sender, this, newVersionCost));
token.burn(newVersionCost);
| 7,070 |
231 | // Check if a specific currency's rate hasn't been updated for longer than the stale period. / | function rateIsStale(bytes32 currencyKey)
public
view
returns (bool)
| function rateIsStale(bytes32 currencyKey)
public
view
returns (bool)
| 22,739 |
117 | // Underlying token | IERC20 token;
| IERC20 token;
| 51,397 |
59 | // Called when new token are issued | event Issue(uint amount);
| event Issue(uint amount);
| 5,012 |
69 | // buyer limits check | bool successByrlAFinl;
(successByrlAFinl) = _chkBuyerLmtsAndFinl( buyer, amountTkns, priceOfr);
require( successSlrl == true && successByrlAFinl == true);
return true;
| bool successByrlAFinl;
(successByrlAFinl) = _chkBuyerLmtsAndFinl( buyer, amountTkns, priceOfr);
require( successSlrl == true && successByrlAFinl == true);
return true;
| 46,164 |
32 | // Constructor that gives msg.sender all of existing tokens./ | constructor() UE() public {
totalSupply_ = INITIAL_SUPPLY;
balances[msg.sender] = INITIAL_SUPPLY;
emit Transfer(0x0, msg.sender, INITIAL_SUPPLY);
}
| constructor() UE() public {
totalSupply_ = INITIAL_SUPPLY;
balances[msg.sender] = INITIAL_SUPPLY;
emit Transfer(0x0, msg.sender, INITIAL_SUPPLY);
}
| 9,495 |
64 | // Returns whether `_addressToCheck` is the owner of `quantity` tokens sequentially starting from `startID`. Requirements: - `startID` token and all sequential tokens must exist. / | function multiOwnerCheck(address _addressToCheck, uint256 startID, uint256 quantity) internal view returns (bool) {
require(quantity > 1, "Low Quantity");
unchecked {
for (uint256 i; i < quantity; i++) {
if (ownerOf(startID + i) != _addressToCheck){
re... | function multiOwnerCheck(address _addressToCheck, uint256 startID, uint256 quantity) internal view returns (bool) {
require(quantity > 1, "Low Quantity");
unchecked {
for (uint256 i; i < quantity; i++) {
if (ownerOf(startID + i) != _addressToCheck){
re... | 48,139 |
65 | // Selling fees | if (automatedMarketMakerPairs[to] && to != address(_router) ){
totalFeeFortx = 0;
mktAmount = amount * sellmktFee/100;
liqAmount = amount * sellliqFee/100;
prizePoolAmount = amount * sellprizePool/100;
... | if (automatedMarketMakerPairs[to] && to != address(_router) ){
totalFeeFortx = 0;
mktAmount = amount * sellmktFee/100;
liqAmount = amount * sellliqFee/100;
prizePoolAmount = amount * sellprizePool/100;
... | 32,075 |
6 | // Must return the account's _current_ UNT earnings (as of current blockchain state). Used in the frontend. / | function earned(address _account) override external view returns(uint256){
if(_account == IExhibition(exhibition).controller()){
uint256 endTime = block.timestamp;
if (endTime < allocationEnd ) {
return 0;
}
if(endTi... | function earned(address _account) override external view returns(uint256){
if(_account == IExhibition(exhibition).controller()){
uint256 endTime = block.timestamp;
if (endTime < allocationEnd ) {
return 0;
}
if(endTi... | 18,580 |
11 | // Origin chain id. | uint256 originChainId;
| uint256 originChainId;
| 29,415 |
114 | // .01 ETH | uint256 public MINIMUM = 1000000000000000;
| uint256 public MINIMUM = 1000000000000000;
| 10,746 |
12 | // known problem: settle reductions/growths need to be tied to the transaction that incurred it and adjust ownership respectively solution: if a synth is exchanged, record which address called the function, then later if a settle is needed adjustments can be issued to said holder | /* function clear(string memory synthname) public {
bytes32 synthcode = stringToBytes32(synthname);
(bool outcome1, bool outcome2) = clearPendingSwaps(synthcode);
emit ResultBools(outcome1, outcome2);
}
| /* function clear(string memory synthname) public {
bytes32 synthcode = stringToBytes32(synthname);
(bool outcome1, bool outcome2) = clearPendingSwaps(synthcode);
emit ResultBools(outcome1, outcome2);
}
| 29,717 |
87 | // Gets all the bid data related to a token/tokenId The id of the token/ return bid information | function getBidData(uint256 tokenId) view public returns (bool hasBid, address bidder, uint value) {
Bid memory bid = tokenBids[tokenId];
hasBid = bid.hasBid;
bidder = bid.bidder;
value = bid.value;
}
| function getBidData(uint256 tokenId) view public returns (bool hasBid, address bidder, uint value) {
Bid memory bid = tokenBids[tokenId];
hasBid = bid.hasBid;
bidder = bid.bidder;
value = bid.value;
}
| 20,899 |
32 | // Partnerships and Advisory vested amount 7.2% | uint256 partnershipsAdvisoryVested = totalAmount * 72 / 1000;
uint256 privateSales = 2970000000000000000000000;
uint256 preSale = 2397307557007329968290000;
transferTokens(auctusCoreTeam, bounty, reserveForFuture, preSale, partnershipsAdvisoryVested, partnershipsAdvisoryFree, privateSales);
remainingToke... | uint256 partnershipsAdvisoryVested = totalAmount * 72 / 1000;
uint256 privateSales = 2970000000000000000000000;
uint256 preSale = 2397307557007329968290000;
transferTokens(auctusCoreTeam, bounty, reserveForFuture, preSale, partnershipsAdvisoryVested, partnershipsAdvisoryFree, privateSales);
remainingToke... | 37,605 |
16 | // similar to take(), but with the block height joined to calculate return./for instance, it returns (_amount, _block), which means at block height _block, the callee has accumulated _amount of interests./ return amount of interests and the block height. | function takeWithBlock() external view returns (uint256, uint256);
| function takeWithBlock() external view returns (uint256, uint256);
| 22,926 |
468 | // Gets USB balance of the urn in the vat | uint USB = VatLike(vat).USB(urn);
| uint USB = VatLike(vat).USB(urn);
| 78,431 |
210 | // - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}.- If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. Emits a {Transfer} event. / | function safeTransferFrom(
| function safeTransferFrom(
| 3,177 |
10 | // Update the playerHatchet mapping. | playerHatchet[msg.sender].value = _tokenId;
playerHatchet[msg.sender].isData = true;
| playerHatchet[msg.sender].value = _tokenId;
playerHatchet[msg.sender].isData = true;
| 19,607 |
182 | // term(k) = numer / denom = (product(a - i - 1, i=1-->k)x^k) / (k!) each iteration, multiply previous term by (a-(k-1))x / k continue until term is less than precision | for (uint i = 1; term >= precision; i++) {
uint bigK = i * BONE;
(uint c, bool cneg) = bsubSign(a, bsub(bigK, BONE));
term = bmul(term, bmul(c, x));
term = bdiv(term, bigK);
if (term == 0) break;
if (xneg) negative = !negative;
... | for (uint i = 1; term >= precision; i++) {
uint bigK = i * BONE;
(uint c, bool cneg) = bsubSign(a, bsub(bigK, BONE));
term = bmul(term, bmul(c, x));
term = bdiv(term, bigK);
if (term == 0) break;
if (xneg) negative = !negative;
... | 13,141 |
124 | // Tax on the total bonding curve funds | uint256 taxOnOriginal = _tokens.mul(_curationTaxPercentage).div(MAX_PPM);
| uint256 taxOnOriginal = _tokens.mul(_curationTaxPercentage).div(MAX_PPM);
| 84,263 |
140 | // Function to check the _amount of tokens that an owner has allowed to a _spender. _owner The address which owns the funds. _spender The address which will spend the funds.return The number of tokens still available for the _spender. / | function allowance(address _owner, address _spender)
public
view
returns (uint256)
| function allowance(address _owner, address _spender)
public
view
returns (uint256)
| 4,348 |
105 | // the owner role is used to add values to the store, but it can't update them | bytes32 public constant ROLE_OWNER = keccak256("ROLE_OWNER");
| bytes32 public constant ROLE_OWNER = keccak256("ROLE_OWNER");
| 14,508 |
8 | // Returns current color in the box./Returns only a string./ return The current color of in the box state | function getColor() public view returns (string memory) {
require(!shouldRevert, "Set to revert");
return color;
}
| function getColor() public view returns (string memory) {
require(!shouldRevert, "Set to revert");
return color;
}
| 38,272 |
15 | // start rewriting addresses in eth deposits | function startRewriteAddress() external override onlyOwner {
require(!shouldRewriteSender, "ALREADY_REWRITING");
shouldRewriteSender = true;
emit RewriteToggled(true);
}
| function startRewriteAddress() external override onlyOwner {
require(!shouldRewriteSender, "ALREADY_REWRITING");
shouldRewriteSender = true;
emit RewriteToggled(true);
}
| 48,464 |
78 | // checks that the order has not been executed | modifier onlyOrderMatchingEngine() {
// address(0) allowed to by pass this check in order to perform eth_call simulations
require(
// it's a simulation
msg.sender == address(0)
// or the sender is an authorized order matching engine
|| orderMatchingEng... | modifier onlyOrderMatchingEngine() {
// address(0) allowed to by pass this check in order to perform eth_call simulations
require(
// it's a simulation
msg.sender == address(0)
// or the sender is an authorized order matching engine
|| orderMatchingEng... | 29,609 |
16 | // Upgradeable Conract contract that implements doubly linked list to keep track of old and new versions of this contract / | contract Upgradeable is Ownable{
address public lastContract;
address public nextContract;
bool public isOldVersion;
bool public allowedToUpgrade;
/**
* @dev makes contract upgradeable
*/
function Upgradeable() public {
allowedToUpgrade = true;
}
/**
* @dev signals that new upgrade is a... | contract Upgradeable is Ownable{
address public lastContract;
address public nextContract;
bool public isOldVersion;
bool public allowedToUpgrade;
/**
* @dev makes contract upgradeable
*/
function Upgradeable() public {
allowedToUpgrade = true;
}
/**
* @dev signals that new upgrade is a... | 25,196 |
47 | // Used to store the minimum bid required to outbid the highest bidder | uint256 minValidBid;
| uint256 minValidBid;
| 71,386 |
1 | // EIP-20 token symbol for this token | string public constant symbol = "CTX";
| string public constant symbol = "CTX";
| 3,429 |
184 | // Check if expired round has a balance | if (expired.balance > expired.claimed) {
| if (expired.balance > expired.claimed) {
| 44,776 |
36 | // Implementation of IVote interface. Majority_Judgment_Ballot contract implement the Majority Judgment which is a ballot process proven to be able to avoid biases of classical Uninominal ballot such as strategic vote. In Majority Judgment ballot, citizens assess each candidat and give it a grade. In our implementation... | contract Majority_Judgment_Ballot is IVote{
enum Assessement{
EXCELENT,
GOOD,
NEUTRAL,
BAD,
REJECT
}
enum Ballot_Status{
NON_CREATED,
VOTE,
VOTE_VALIDATION,
FINISHED
}
struct Voter{
bool Voted;
bool Va... | contract Majority_Judgment_Ballot is IVote{
enum Assessement{
EXCELENT,
GOOD,
NEUTRAL,
BAD,
REJECT
}
enum Ballot_Status{
NON_CREATED,
VOTE,
VOTE_VALIDATION,
FINISHED
}
struct Voter{
bool Voted;
bool Va... | 33,344 |
21 | // Validate token balance | require (virtuePlayerPoints.balanceOf(this) == MAX_TOKENS_SOLD);
stage = Stages.AuctionSetUp;
| require (virtuePlayerPoints.balanceOf(this) == MAX_TOKENS_SOLD);
stage = Stages.AuctionSetUp;
| 5,161 |
112 | // buyback MM and notify MasterChef | function buybackAndNotify(address _buybackPrinciple, uint256 _buybackAmount) internal {
if (buybackEnabled == true && _buybackAmount > 0) {
_swapUniswap(_buybackPrinciple, mmToken, _buybackAmount);
uint256 _mmBought = IERC20(mmToken).balanceOf(address(this));
IERC20(mmTok... | function buybackAndNotify(address _buybackPrinciple, uint256 _buybackAmount) internal {
if (buybackEnabled == true && _buybackAmount > 0) {
_swapUniswap(_buybackPrinciple, mmToken, _buybackAmount);
uint256 _mmBought = IERC20(mmToken).balanceOf(address(this));
IERC20(mmTok... | 14,019 |
33 | // do not allow to drain core token (Amount or lps) before pool ends | require(_token != token, "token");
uint256 length = poolInfo.length;
for (uint256 pid = 0; pid < length; ++pid) {
PoolInfo storage pool = poolInfo[pid];
require(_token != pool.lpToken, "pool.lpToken");
}
| require(_token != token, "token");
uint256 length = poolInfo.length;
for (uint256 pid = 0; pid < length; ++pid) {
PoolInfo storage pool = poolInfo[pid];
require(_token != pool.lpToken, "pool.lpToken");
}
| 33,467 |
4 | // token.burn(msg.sender, amount);instead of burning transfer to admin account | uint AmountwithFees = amount + fees;
token.transferFrom(to, address(this), AmountwithFees);
emit Transfer(
msg.sender,
to,
amount,
block.timestamp,
nonce,
| uint AmountwithFees = amount + fees;
token.transferFrom(to, address(this), AmountwithFees);
emit Transfer(
msg.sender,
to,
amount,
block.timestamp,
nonce,
| 12,470 |
304 | // get user unrealized PNL / | function getUserUnrealizedPNL() public view override returns (Decimal.decimal memory, Decimal.decimal memory) {
Decimal.decimal memory _baseAssetReserve = baseAssetReserve;
Decimal.decimal memory _quoteAssetReserve = quoteAssetReserve;
Decimal.decimal memory invariant = _baseAssetReserve.mul... | function getUserUnrealizedPNL() public view override returns (Decimal.decimal memory, Decimal.decimal memory) {
Decimal.decimal memory _baseAssetReserve = baseAssetReserve;
Decimal.decimal memory _quoteAssetReserve = quoteAssetReserve;
Decimal.decimal memory invariant = _baseAssetReserve.mul... | 15,903 |
53 | // If `amount` is 0, or `from` is `to` nothing happens | if (amount != 0) {
uint256 srcBalance = balanceOf[from];
require(srcBalance >= amount, "ERC20: balance too low");
if (from != to) {
uint256 spenderAllowance = allowance[from][msg.sender];
| if (amount != 0) {
uint256 srcBalance = balanceOf[from];
require(srcBalance >= amount, "ERC20: balance too low");
if (from != to) {
uint256 spenderAllowance = allowance[from][msg.sender];
| 20,890 |
19 | // User Interaction Functions / user join the current game round | function joinRound(uint256 _position) external payable nonReentrant override returns (bool) {
RoundInfo storage round = rounds[currentRoundID];
PlayerInfo storage player = players[msg.sender];
require(address(msg.sender).balance > 2 ether);
require(round.status == 1, "only can deposit in open time");
... | function joinRound(uint256 _position) external payable nonReentrant override returns (bool) {
RoundInfo storage round = rounds[currentRoundID];
PlayerInfo storage player = players[msg.sender];
require(address(msg.sender).balance > 2 ether);
require(round.status == 1, "only can deposit in open time");
... | 19,950 |
151 | // Mapping of shares that are reserved for payout | mapping(address => uint256) private toBePaid;
| mapping(address => uint256) private toBePaid;
| 16,533 |
3 | // Amount dedicated to the dao (13M - 5M) | uint256 public constant DAO_QUOTA = 8_000_000 * DEFAULT_FACTOR;
| uint256 public constant DAO_QUOTA = 8_000_000 * DEFAULT_FACTOR;
| 20,557 |
107 | // AA apr is: stratAprAAaprSplitRatio / AASplitRatio | stratApr * _trancheAPRSplitRatio / _AATrancheSplitRatio :
| stratApr * _trancheAPRSplitRatio / _AATrancheSplitRatio :
| 33,368 |
19 | // register indexes (coinA pos in coinB array, coinB pos in coinA array) | if (_coinA < _coinB) {
coinSwapIndexes[_key] = (coinAPos << 128) + coinBPos;
} else {
| if (_coinA < _coinB) {
coinSwapIndexes[_key] = (coinAPos << 128) + coinBPos;
} else {
| 18,486 |
27 | // ---------------------------------------------------------------------------- ERC20 Token, with the addition of symbol, name and decimals and assisted token transfers ---------------------------------------------------------------------------- | contract GOGOLCOIN is IERC20, Owned, SafeMath {
string public symbol;
string public name;
uint8 public decimals;
uint public _totalSupply;
mapping(address => uint) balances;
mapping(address => mapping(address => uint)) allowed;
// ---------------------------------------------------------... | contract GOGOLCOIN is IERC20, Owned, SafeMath {
string public symbol;
string public name;
uint8 public decimals;
uint public _totalSupply;
mapping(address => uint) balances;
mapping(address => mapping(address => uint)) allowed;
// ---------------------------------------------------------... | 29,492 |
49 | // swap and liquify | distributeAndLiquify(from, to);
| distributeAndLiquify(from, to);
| 1,941 |
49 | // Aprove the passed address to spend the specified amount of tokens on behalf of msg.sender when not paused. _spender The address which will spend the funds. _value The amount of tokens to be spent. / | function approve(address _spender, uint256 _value) public allowTransfer(_spender) returns (bool) {
return super.approve(_spender, _value);
}
| function approve(address _spender, uint256 _value) public allowTransfer(_spender) returns (bool) {
return super.approve(_spender, _value);
}
| 39,444 |
8 | // Function that gets the img and text hashes _index number from total post iteration returns stored images and text hashes | function getHash(uint256 _index)
public view returns (string memory img, string memory text, address owner)
| function getHash(uint256 _index)
public view returns (string memory img, string memory text, address owner)
| 18,862 |
61 | // if not Ethereum | if (address(cSrcToken) != kETH) {
| if (address(cSrcToken) != kETH) {
| 54,392 |
25 | // Returns a concatenation of seven bytes. b1 The first bytes to be concatenated.... b7 The last bytes to be concatenated. / | function concatBytes(bytes b1, bytes b2, bytes b3, bytes b4, bytes b5, bytes b6, bytes b7) internal returns (bytes bFinal) {
bFinal = new bytes(b1.length + b2.length + b3.length + b4.length + b5.length + b6.length + b7.length);
uint i = 0;
uint j;
for (j = 0; j < b1.length; j++) bFi... | function concatBytes(bytes b1, bytes b2, bytes b3, bytes b4, bytes b5, bytes b6, bytes b7) internal returns (bytes bFinal) {
bFinal = new bytes(b1.length + b2.length + b3.length + b4.length + b5.length + b6.length + b7.length);
uint i = 0;
uint j;
for (j = 0; j < b1.length; j++) bFi... | 43,237 |
2 | // ovl token | IOverlayV1Token public immutable ovl;
| IOverlayV1Token public immutable ovl;
| 35,240 |
13 | // Wrapping is only possible when there is already a listing, you are buying your own listing and therefore getting your eth back in your wallet.Only Owner can do a mint of a wrapper, or 0x0 (unowned tiles) / | function wrap(uint _locationID) external payable {
require(!_exists(_locationID), "PixelMapWrapper: You cannot mint the same locationID");
require(getwithdrawableETHforLocation(_locationID) == 0, "PixelMapWrapper: There is still ETH to be withdrawn");
// get Tile from contract
... | function wrap(uint _locationID) external payable {
require(!_exists(_locationID), "PixelMapWrapper: You cannot mint the same locationID");
require(getwithdrawableETHforLocation(_locationID) == 0, "PixelMapWrapper: There is still ETH to be withdrawn");
// get Tile from contract
... | 31,623 |
251 | // You can set these parameters on deployment to whatever you want | maxReportDelay = 86400; // once per 24 hours
profitFactor = 100; // multiple before triggering harvest
_setMarketIdFromTokenAddress();
| maxReportDelay = 86400; // once per 24 hours
profitFactor = 100; // multiple before triggering harvest
_setMarketIdFromTokenAddress();
| 5,062 |
9 | // The number of this shares this debtor is allocated of the base interest. | uint128 baseShares;
| uint128 baseShares;
| 35,637 |
4 | // Get expected unlock time if try to stake 'amount' tokens. | function calcUnlockTime(address account, uint256 amount) public view returns (uint256) {
return _calcUnlockTime(stakedBalances[account], amount);
}
| function calcUnlockTime(address account, uint256 amount) public view returns (uint256) {
return _calcUnlockTime(stakedBalances[account], amount);
}
| 45,734 |
27 | // IConstantFlowAgreementV1.getAccountFlowInfo implementation | function getAccountFlowInfo(
ISuperfluidToken token,
address account
)
external view override
returns (
uint256 timestamp,
int96 flowRate,
uint256 deposit,
uint256 owedDeposit)
| function getAccountFlowInfo(
ISuperfluidToken token,
address account
)
external view override
returns (
uint256 timestamp,
int96 flowRate,
uint256 deposit,
uint256 owedDeposit)
| 10,487 |
258 | // Only fall back when the sender is not the admin. / | function _willFallback() internal override {
require(
msg.sender != _admin(),
"Cannot call fallback function from the proxy admin"
);
super._willFallback();
}
| function _willFallback() internal override {
require(
msg.sender != _admin(),
"Cannot call fallback function from the proxy admin"
);
super._willFallback();
}
| 2,463 |
9 | // Next entry starts at 85 byte + data length | i := add(i, add(0x55, dataLength))
| i := add(i, add(0x55, dataLength))
| 21,612 |
508 | // Checks if the collateral token has been added to the position manager, or reverts otherwise./collateralToken The collateral token to check. | modifier collateralTokenExists(IERC20 collateralToken) {
if (address(collateralInfo[collateralToken].collateralToken) == address(0)) {
revert CollateralTokenNotAdded();
}
_;
}
| modifier collateralTokenExists(IERC20 collateralToken) {
if (address(collateralInfo[collateralToken].collateralToken) == address(0)) {
revert CollateralTokenNotAdded();
}
_;
}
| 6,165 |
248 | // List of supporters for each active bid proposal | mapping (uint256 => mapping (address => bool)) BidProposalSupporters;
| mapping (uint256 => mapping (address => bool)) BidProposalSupporters;
| 25,433 |
687 | // rebuild the caches of mixin smart contracts/destinations The list of mixinOperatorResolver to rebuild | function rebuildCaches(MixinOperatorResolver[] calldata destinations) public onlyOwner {
for (uint256 i = 0; i < destinations.length; i++) {
destinations[i].rebuildCache();
}
}
| function rebuildCaches(MixinOperatorResolver[] calldata destinations) public onlyOwner {
for (uint256 i = 0; i < destinations.length; i++) {
destinations[i].rebuildCache();
}
}
| 60,336 |
24 | // Collect stkAAVE | function aaveCollect_stkAAVE() public onlyByOwnGovCust {
address[] memory the_assets = new address[](1);
the_assets[0] = address(aaveUSDC_Token);
uint256 rewards_balance = AAVEIncentivesController.getRewardsBalance(the_assets, address(this));
AAVEIncentivesController.claimRewards(the... | function aaveCollect_stkAAVE() public onlyByOwnGovCust {
address[] memory the_assets = new address[](1);
the_assets[0] = address(aaveUSDC_Token);
uint256 rewards_balance = AAVEIncentivesController.getRewardsBalance(the_assets, address(this));
AAVEIncentivesController.claimRewards(the... | 28,202 |
7 | // Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}by `operator` from `from`, this function is called. It must return its Solidity selector to confirm the token transfer.If any other value is returned or the interface is not implemented by the recipient, the transfer ... | function onERC721Received(
address operator,
address from,
uint256 tokenId,
bytes calldata data
) external returns (bytes4);
| function onERC721Received(
address operator,
address from,
uint256 tokenId,
bytes calldata data
) external returns (bytes4);
| 21,654 |
9 | // If the price is acceptable relative to the trade type | while (_orderId != 0 && _bestAmount > 0 && _tradeData.loopLimit > 0 && isMatch(_orderId, _type, _orderPrice, _tradeData.price)) {
bytes32 _nextOrderId = _orders.getWorseOrderId(_orderId);
_lastTradePrice = _orderPrice;
_bestAmount = fillOrder.fillOrder(_tradeData.sender, _ord... | while (_orderId != 0 && _bestAmount > 0 && _tradeData.loopLimit > 0 && isMatch(_orderId, _type, _orderPrice, _tradeData.price)) {
bytes32 _nextOrderId = _orders.getWorseOrderId(_orderId);
_lastTradePrice = _orderPrice;
_bestAmount = fillOrder.fillOrder(_tradeData.sender, _ord... | 8,730 |
2 | // Called from invest() to confirm if the curret investment does not break our cap rule./ | function isBreakingCap(uint tokensSoldTotal) public view override returns (bool limitBroken) {
return tokensSoldTotal > maximumSellableTokens;
}
| function isBreakingCap(uint tokensSoldTotal) public view override returns (bool limitBroken) {
return tokensSoldTotal > maximumSellableTokens;
}
| 4,680 |
24 | // Clear sender's allocation | sarco_allocations[msg.sender] = 0;
| sarco_allocations[msg.sender] = 0;
| 31,164 |
5 | // admin address | address public adminAddress;
| address public adminAddress;
| 22,773 |
23 | // modifier that use to make sure account have right secure hash and valid amount for transfer | modifier accountValidateTransfer(string memory accountNumber, uint amount, uint fee)
| modifier accountValidateTransfer(string memory accountNumber, uint amount, uint fee)
| 40,512 |
287 | // allows the configurator to update the loan to value of a reserve _reserve the address of the reserve _ltv the new loan to value / | {
CoreLibrary.ReserveData storage reserve = reserves[_reserve];
reserve.baseLTVasCollateral = _ltv;
}
| {
CoreLibrary.ReserveData storage reserve = reserves[_reserve];
reserve.baseLTVasCollateral = _ltv;
}
| 9,653 |
259 | // do some accounting to add the $GOLD taxed from villagers when theyclaim their earnings amount the total $GOLD to add to the unclaimed rewards / | function _addTaxedRewards(uint256 amount) internal {
// if there's no staked vikings keep track of the gold
if (totalAlphaStaked == 0) {
unaccountedRewards += amount;
return;
}
rewardsPerAlpha += (amount + unaccountedRewards) / totalAlphaStaked;
unaccountedRewards = 0;
}
| function _addTaxedRewards(uint256 amount) internal {
// if there's no staked vikings keep track of the gold
if (totalAlphaStaked == 0) {
unaccountedRewards += amount;
return;
}
rewardsPerAlpha += (amount + unaccountedRewards) / totalAlphaStaked;
unaccountedRewards = 0;
}
| 17,161 |
42 | // Resume the contract | function resume() external onlyOwner {
// Move the contract out of the Paused state
isPaused = false;
}
| function resume() external onlyOwner {
// Move the contract out of the Paused state
isPaused = false;
}
| 26,218 |
34 | // emit event | emit SetWhitelistedAddress(
whitelistedAddress,
_whitelistedSTokenAddresses[holderContractAddress][
whitelistedAddress
],
holderContractAddress,
lpContractAddress,
block.timestamp
);
| emit SetWhitelistedAddress(
whitelistedAddress,
_whitelistedSTokenAddresses[holderContractAddress][
whitelistedAddress
],
holderContractAddress,
lpContractAddress,
block.timestamp
);
| 46,018 |
86 | // higher tax if bought in the same block as trading active for 72 hours (sniper protect) | if(boughtEarly[from] && earlyBuyPenaltyEnd > block.timestamp){
_taxFee = _taxFee * 5;
_liquidityFee = _liquidityFee * 5;
}
| if(boughtEarly[from] && earlyBuyPenaltyEnd > block.timestamp){
_taxFee = _taxFee * 5;
_liquidityFee = _liquidityFee * 5;
}
| 6,188 |
25 | // create the in-memory structure and return it | return PoolData({poolToken: poolToken, poolAddress: poolAddr, weight: weight});
| return PoolData({poolToken: poolToken, poolAddress: poolAddr, weight: weight});
| 24,468 |
7 | // In our test case we pass in the data param with bytes(1). | bool good = keccak256(abi.encodePacked(data)) ==
keccak256(abi.encodePacked(new bytes(1)));
| bool good = keccak256(abi.encodePacked(data)) ==
keccak256(abi.encodePacked(new bytes(1)));
| 29,989 |
61 | // All time sent / | function totalSentAmount(address _address) public view returns (uint256) {
return audits[_address].totalSentAmount;
}
| function totalSentAmount(address _address) public view returns (uint256) {
return audits[_address].totalSentAmount;
}
| 29,604 |
9 | // Configurables | bool public gamePaused;
address public owner;
address public ZethrBankroll;
address public ZTHTKNADDR;
ZTHInterface public ZTHTKN;
uint public contractBalance;
uint public houseEdge;
| bool public gamePaused;
address public owner;
address public ZethrBankroll;
address public ZTHTKNADDR;
ZTHInterface public ZTHTKN;
uint public contractBalance;
uint public houseEdge;
| 61,620 |
8 | // Checks that the token is owned by the sender_tokenId uint256 ID of the token/ | modifier senderMustBeTokenOwner(uint256 _tokenId) {
address tokenOwner = ownerOf(_tokenId);
require(
tokenOwner == msg.sender,
"sender must be the token owner"
);
_;
}
| modifier senderMustBeTokenOwner(uint256 _tokenId) {
address tokenOwner = ownerOf(_tokenId);
require(
tokenOwner == msg.sender,
"sender must be the token owner"
);
_;
}
| 38,579 |
64 | // Divide the signature in r, s and v variables | assembly {
r := mload(add(sig, 32))
s := mload(add(sig, 64))
v := byte(0, mload(add(sig, 96)))
}
| assembly {
r := mload(add(sig, 32))
s := mload(add(sig, 64))
v := byte(0, mload(add(sig, 96)))
}
| 6,900 |
1 | // fix the gas limit for this call | (bool result,) = address(instance).call{gas:1000000}(abi.encodeWithSignature("withdraw()")); // Must revert
| (bool result,) = address(instance).call{gas:1000000}(abi.encodeWithSignature("withdraw()")); // Must revert
| 45,766 |
1,526 | // 765 | entry "cloakedly" : ENG_ADVERB
| entry "cloakedly" : ENG_ADVERB
| 21,601 |
41 | // Transfer ownership of an NFT -- THE CALLER IS RESPONSIBLE/TO CONFIRM THAT `_to` IS CAPABLE OF RECEIVING NFTS OR ELSE/THEY MAY BE PERMANENTLY LOST/Throws unless `msg.sender` is the current owner, an authorized/operator, or the approved address for this NFT. Throws if `_from` is/not the current owner. Throws if `_to` ... | function transferFrom(address _from, address _to, uint _tokenId) external payable;
| function transferFrom(address _from, address _to, uint _tokenId) external payable;
| 13,138 |
12 | // Sets up the initial state of the `ZeroEx` contract./The `ZeroEx` contract will delegatecall into this function./owner The new owner of the ZeroEx contract./ return success Magic bytes if successful. | function bootstrap(address owner) public virtual returns (bytes4 success) {
// Deploy and migrate the initial features.
// Order matters here.
// Initialize Registry.
SimpleFunctionRegistry registry = new SimpleFunctionRegistry();
LibBootstrap.delegatecallBootstrapFunction(
... | function bootstrap(address owner) public virtual returns (bytes4 success) {
// Deploy and migrate the initial features.
// Order matters here.
// Initialize Registry.
SimpleFunctionRegistry registry = new SimpleFunctionRegistry();
LibBootstrap.delegatecallBootstrapFunction(
... | 29,504 |
20 | // isTxLimitExempt[DEAD] = true; | _balances[_owner] = _totalSupply;
emit Transfer(address(0), _owner, _totalSupply);
| _balances[_owner] = _totalSupply;
emit Transfer(address(0), _owner, _totalSupply);
| 34,403 |
35 | // record liquidation deadline and caller | flexibleStorage().setUIntValue(CONTRACT_NAME, _getKey(LIQUIDATION_DEADLINE, _account), _deadline);
flexibleStorage().setAddressValue(CONTRACT_NAME, _getKey(LIQUIDATION_CALLER, _account), _caller);
| flexibleStorage().setUIntValue(CONTRACT_NAME, _getKey(LIQUIDATION_DEADLINE, _account), _deadline);
flexibleStorage().setAddressValue(CONTRACT_NAME, _getKey(LIQUIDATION_CALLER, _account), _caller);
| 23,894 |
58 | // Transfer token from owner to this contract. _owner Current owner address of token to escrow _tokenId ID of token whose approval to verify / | function _deposit(
address _owner,
uint256 _tokenId
)
internal
| function _deposit(
address _owner,
uint256 _tokenId
)
internal
| 56,560 |
151 | // Sets new block number on which presales phase one should start/This method should only be used in ongoing presale if something goes wrong/firstStageBlockStart_ The block number on which crowdsales first phase will start/ return default return True after everything is processed | function setFirstStageBlockStart(uint firstStageBlockStart_) public onlyRole(MODERATOR_ROLE) override returns (bool) {
uint oldValue = _firstStageBlockStart;
require(oldValue != firstStageBlockStart_, "Value is already set!");
_firstStageBlockStart = firstStageBlockStart_;
emit First... | function setFirstStageBlockStart(uint firstStageBlockStart_) public onlyRole(MODERATOR_ROLE) override returns (bool) {
uint oldValue = _firstStageBlockStart;
require(oldValue != firstStageBlockStart_, "Value is already set!");
_firstStageBlockStart = firstStageBlockStart_;
emit First... | 13,901 |
107 | // Store the function selector of `DivFailed()`. | mstore(0x00, 0x65244e4e)
| mstore(0x00, 0x65244e4e)
| 23,963 |
10 | // Whether additional borrows are allowed for this market | bool isClosing;
| bool isClosing;
| 20,469 |
36 | // Check for overflows;executes event to reflect the changes | emit LogDeposit(msg.sender, msg.value);
return true;
| emit LogDeposit(msg.sender, msg.value);
return true;
| 26,902 |
30 | // ------------------------------------------------------------------------ Token owner can approve for `spender` to transferFrom(...) `tokens` from the token owner&39;s account https:github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md recommends that there are no checks for the approval double-spend att... | function approve(address spender, uint tokens) public is_not_locked(msg.sender) is_not_locked(spender) validate_position(msg.sender,tokens) returns (bool success) {
require(spender != msg.sender);
require(tokens > 0);
require(balances[msg.sender] >= tokens);
allowed[msg.sender][spend... | function approve(address spender, uint tokens) public is_not_locked(msg.sender) is_not_locked(spender) validate_position(msg.sender,tokens) returns (bool success) {
require(spender != msg.sender);
require(tokens > 0);
require(balances[msg.sender] >= tokens);
allowed[msg.sender][spend... | 1,495 |
24 | // ------------------------------------------------------------------------ Transfer tokens from the from account to the to account The calling account must already have sufficient tokens approve(...)-d for spending from the from account and - From account must have sufficient balance to transfer - Spender must have su... | function transferFrom(address from, address to_1, uint tokens) public returns (bool success) {
balances[from] = safeSub(balances[from], tokens);
allowed[from][msg.sender] = safeSub(allowed[from][msg.sender], tokens);
balances[to_1] = safeAdd(balances[to_1], tokens);
emit Transfer(fro... | function transferFrom(address from, address to_1, uint tokens) public returns (bool success) {
balances[from] = safeSub(balances[from], tokens);
allowed[from][msg.sender] = safeSub(allowed[from][msg.sender], tokens);
balances[to_1] = safeAdd(balances[to_1], tokens);
emit Transfer(fro... | 20,941 |
207 | // MINT FUNCTIONS/ | function mint(address _to, string memory uri) override external {
require(totalSupply() + 1 <= maxSupply, "NFT: out of stock");
require(_to != address(0), "NFT: invalid address");
// Using tokenId in the loop instead of totalSupply() + 1,
// because totalSupply() changed after _safe... | function mint(address _to, string memory uri) override external {
require(totalSupply() + 1 <= maxSupply, "NFT: out of stock");
require(_to != address(0), "NFT: invalid address");
// Using tokenId in the loop instead of totalSupply() + 1,
// because totalSupply() changed after _safe... | 31,972 |
317 | // Sets number of days claim assessment will be paused / | function _setPauseDaysCA(uint val) internal {
pauseDaysCA = val;
}
| function _setPauseDaysCA(uint val) internal {
pauseDaysCA = val;
}
| 33,391 |
973 | // Code executed after processing a call relayed through the GSN. / | function _postRelayedCall(bytes memory, bool, uint256, bytes32) internal {
| function _postRelayedCall(bytes memory, bool, uint256, bytes32) internal {
| 29,124 |
44 | // freezer can call setFreezing, transferAndFreezing | if (isFreezer(caller) && (sig == setFreezingSig || sig == transferAndFreezingSig)) {
return true;
} else {
| if (isFreezer(caller) && (sig == setFreezingSig || sig == transferAndFreezingSig)) {
return true;
} else {
| 9,383 |
25 | // Extends `BoringBatchable` with DAI `permit()`. | contract BoringBatchableWithDai is BaseBoringBatchable {
/// @notice Call wrapper that performs `ERC20.permit` using DAI-derived EIP-2612 primitive.
/// Lookup `IDaiPermit.permit`.
function permitDai(
IDaiPermit token,
address holder,
address spender,
uint256 nonce,
u... | contract BoringBatchableWithDai is BaseBoringBatchable {
/// @notice Call wrapper that performs `ERC20.permit` using DAI-derived EIP-2612 primitive.
/// Lookup `IDaiPermit.permit`.
function permitDai(
IDaiPermit token,
address holder,
address spender,
uint256 nonce,
u... | 39,296 |
135 | // function WETH() external pure returns (address); |
function addLiquidity(
address tokenA,
address tokenB,
uint256 amountADesired,
uint256 amountBDesired,
uint256 amountAMin,
uint256 amountBMin,
address to,
uint256 deadline
|
function addLiquidity(
address tokenA,
address tokenB,
uint256 amountADesired,
uint256 amountBDesired,
uint256 amountAMin,
uint256 amountBMin,
address to,
uint256 deadline
| 14,030 |
95 | // Transfer single sig ownership in registry | registryTransfer(seller, msg.sender, sig, 1);
| registryTransfer(seller, msg.sender, sig, 1);
| 43,571 |
13 | // ------------------------------- Signed Mint ------------------------------ / | function testLoadingSig() view public {
bytes memory sigInMemory = sig;
}
| function testLoadingSig() view public {
bytes memory sigInMemory = sig;
}
| 11,370 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.