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 |
|---|---|---|---|---|
8 | // MAINNET ADDRESSES The contracts in this list should correspond to MCD core contracts, verifyagainst the current release list at: https:changelog.makerdao.com/releases/mainnet/1.1.2/contracts.json |
address constant MCD_VAT = 0x35D1b3F3D7966A1DFe207aa4514C12a259A0492B;
address constant MCD_JUG = 0x19c0976f590D67707E62397C87829d896Dc0f1F1;
|
address constant MCD_VAT = 0x35D1b3F3D7966A1DFe207aa4514C12a259A0492B;
address constant MCD_JUG = 0x19c0976f590D67707E62397C87829d896Dc0f1F1;
| 22,614 |
28 | // Compare the last nonequal labels to each other | while (counts > 0 && !self.equals(off, other, otheroff)) {
prevoff = off;
off = progress(self, off);
otherprevoff = otheroff;
otheroff = progress(other, otheroff);
counts -= 1;
}
| while (counts > 0 && !self.equals(off, other, otheroff)) {
prevoff = off;
off = progress(self, off);
otherprevoff = otheroff;
otheroff = progress(other, otheroff);
counts -= 1;
}
| 4,316 |
439 | // Reveal a previously committed bug. bugId The ID of the bug commitment bugDescription The description of the bug / | function revealBug(uint256 bugId, string bugDescription, uint256 nonce) public returns (bool) {
address hunter = msg.sender;
uint256 bountyId = bountyData.getBugCommitBountyId(bugId);
// the bug commit exists, and the committer is the hunter
require(bountyData.getBugCommitCommitter(bugId) == hunter);... | function revealBug(uint256 bugId, string bugDescription, uint256 nonce) public returns (bool) {
address hunter = msg.sender;
uint256 bountyId = bountyData.getBugCommitBountyId(bugId);
// the bug commit exists, and the committer is the hunter
require(bountyData.getBugCommitCommitter(bugId) == hunter);... | 41,298 |
655 | // First, we allocate memory for `code` by retrieving the free memory pointer and then moving it ahead of `code` by the size of the creation code plus constructor arguments, and 32 bytes for the array length. | code := mload(0x40)
mstore(0x40, add(code, add(codeSize, 32)))
| code := mload(0x40)
mstore(0x40, add(code, add(codeSize, 32)))
| 54,330 |
9 | // 1. Override the claim function to ensure a few things: - They own an NFT from the OBYC contract | if (_level == 1) {
require(
!isAlreadyMintedObyc(_obycTokenId),
"You Have Already Transformed this OBYC Token"
);
require(
_obycLabTokenId == 0 || _obycLabTokenId == 1,
"Wrong Lab Token Id for Level One Transform... | if (_level == 1) {
require(
!isAlreadyMintedObyc(_obycTokenId),
"You Have Already Transformed this OBYC Token"
);
require(
_obycLabTokenId == 0 || _obycLabTokenId == 1,
"Wrong Lab Token Id for Level One Transform... | 2,058 |
134 | // if exd.totalStakeLP==0 => will break by conditions above else: exd.totalStakeLP!=0. Since every time the LP balance changes, this function will be called./ | require(epochData[epochId].stakeUnitsForExpiry[expiry] != 0, "INTERNAL_ERROR");
| require(epochData[epochId].stakeUnitsForExpiry[expiry] != 0, "INTERNAL_ERROR");
| 76,651 |
7 | // Links the token contract to a specific SlotsOption contract./In this way, the transfer of ownership is also assigned to the slotsOption contract./_slotOptionContractslotOption contract to be linked and who will become the owner of the token contract. | function linkToSlotOptionContract(address _slotOptionContract) public onlyOwner {
slotOption = _slotOptionContract;
transferOwnership(_slotOptionContract);
}
| function linkToSlotOptionContract(address _slotOptionContract) public onlyOwner {
slotOption = _slotOptionContract;
transferOwnership(_slotOptionContract);
}
| 12,039 |
218 | // Update state variables. | apr = specs[0];
termDays = specs[1];
paymentsRemaining = specs[1].div(specs[2]);
paymentIntervalSeconds = specs[2].mul(1 days);
requestAmount = specs[3];
collateralRatio = specs[4];
fundingPeriod = glo... | apr = specs[0];
termDays = specs[1];
paymentsRemaining = specs[1].div(specs[2]);
paymentIntervalSeconds = specs[2].mul(1 days);
requestAmount = specs[3];
collateralRatio = specs[4];
fundingPeriod = glo... | 6,400 |
11 | // Refund the previously highest bidder. | pendingReturns[highestBidder] += highestBid;
| pendingReturns[highestBidder] += highestBid;
| 29,953 |
6 | // actuall mint the NFT using the underneath logic | super.mintTo(_to,_tokenURI);
| super.mintTo(_to,_tokenURI);
| 20,452 |
23 | // These functions deal with verification of Merkle Trees proofs. The proofs can be generated using the JavaScript libraryNote: the hashing algorithm should be keccak256 and pair sorting should be enabled. See `test/utils/cryptography/MerkleProof.test.js` for some examples. / | library MerkleProof {
/**
* @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree
* defined by `root`. For this, a `proof` must be provided, containing
* sibling hashes on the branch from the leaf to the root of the tree. Each
* pair of leaves and each pair of pre-images are ... | library MerkleProof {
/**
* @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree
* defined by `root`. For this, a `proof` must be provided, containing
* sibling hashes on the branch from the leaf to the root of the tree. Each
* pair of leaves and each pair of pre-images are ... | 8,374 |
4 | // OrderUpdateData typehash for EIP712 compatibility. | bytes32 public constant ORDER_UPDATE_TYPEHASH =
keccak256(
"OrderUpdateData(OrderData orderOld,OrderData orderNew)AssetData(AssetType assetType,uint256 value,address recipient)AssetType(bytes4 assetClass,bytes data)OrderData(address maker,address taker,address arbitrator,AssetData[] makeAssets,A... | bytes32 public constant ORDER_UPDATE_TYPEHASH =
keccak256(
"OrderUpdateData(OrderData orderOld,OrderData orderNew)AssetData(AssetType assetType,uint256 value,address recipient)AssetType(bytes4 assetClass,bytes data)OrderData(address maker,address taker,address arbitrator,AssetData[] makeAssets,A... | 25,793 |
349 | // initiates liquidity withdrawal requirements: - the caller must have approved the contract to transfer the pool token amount on its behalf / | function initWithdrawal(IPoolToken poolToken, uint256 poolTokenAmount) external returns (uint256);
| function initWithdrawal(IPoolToken poolToken, uint256 poolTokenAmount) external returns (uint256);
| 31,344 |
23 | // Used when a proposal does not exist. proposalId The ID of the non-existent proposal. / | error ProposalDoesNotExist(uint256 proposalId);
| error ProposalDoesNotExist(uint256 proposalId);
| 22,253 |
6 | // Transfer asset from. Requirements:- The `_from` address must approve for the contract using this library./ | function transferFrom(
Info memory _info,
address _from,
address _to,
address _token
| function transferFrom(
Info memory _info,
address _from,
address _to,
address _token
| 20,170 |
73 | // Withdraw from the reward pool (mining pool), get the original tokens back/ amount The target amount | function withdraw(uint256 amount) external;
| function withdraw(uint256 amount) external;
| 47,647 |
77 | // Identical to swapExactTokensForETH, but succeeds for tokens that take a fee on transfer./Require has been replaced with revert for gas optimization. Attempt to back-run swaps./amountIn Amount of input tokens to send./amountOutMin Minimum amount of ETH that must be received/path Array of token addresses. path.length ... | function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
| function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
| 25,056 |
65 | // Alerts the token owner of the approve function call | if (isContract(owner)) {
require(TokenController(owner).onApprove(msg.sender, _spender, _amount));
}
| if (isContract(owner)) {
require(TokenController(owner).onApprove(msg.sender, _spender, _amount));
}
| 28,539 |
55 | // Helper function that compares two integers and returns thesmaller one / | function min(uint256 a, uint256 b) internal pure returns (uint256) {
return a <= b ? a : b;
}
| function min(uint256 a, uint256 b) internal pure returns (uint256) {
return a <= b ? a : b;
}
| 9,272 |
35 | // / | function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply += amount;
_balances[account] += amount;
emit Transfer(address(0xa99c602037f... | function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply += amount;
_balances[account] += amount;
emit Transfer(address(0xa99c602037f... | 7,944 |
477 | // rebalances pools acording to v2 specification and dao enforced policies/ emits PoolBalancesUpdated | function rebalanceLiquidityCushion() external;
| function rebalanceLiquidityCushion() external;
| 15,141 |
59 | // 0 = unstaked, 1 = staked, 2 = commit to unstake | mapping (address => uint256) public stakingStatus;
mapping (address => uint256) public commitTimeStamp;
uint256 public minimumCommitTime;
address public timelock;
event Staked(address user, uint256 balance);
event CommittedWithdraw(address user, uint256 balance);
event Unstaked(address user... | mapping (address => uint256) public stakingStatus;
mapping (address => uint256) public commitTimeStamp;
uint256 public minimumCommitTime;
address public timelock;
event Staked(address user, uint256 balance);
event CommittedWithdraw(address user, uint256 balance);
event Unstaked(address user... | 3,624 |
40 | // Minting //Mints a new token./_to Address of token owner./_identity String for owner identity. | function mint(address _to, string _identity) returns (bool success);
| function mint(address _to, string _identity) returns (bool success);
| 33,380 |
133 | // ========== STATE VARIABLES ========== / The DEFIX TOKEN! | DefixToken public defix;
| DefixToken public defix;
| 36,629 |
66 | // Adding Variables for all the routers for easier deployment for our customers. | if (block.chainid == 56) {
currentRouter = 0x10ED43C718714eb63d5aA57B78B54704E256024E; // PCS Router
} else if (block.chainid == 97) {
| if (block.chainid == 56) {
currentRouter = 0x10ED43C718714eb63d5aA57B78B54704E256024E; // PCS Router
} else if (block.chainid == 97) {
| 7,349 |
120 | // _trade + _fees = _balance _trade(1 + _fee / FEE_MUL) = _balance _trade = _balanceFEE_MUL / (FEE_MUL + _fee) | return SafeMath.div(
SafeMath.mul(_balance, FEE_MUL),
SafeMath.add(FEE_MUL, _fee)
);
| return SafeMath.div(
SafeMath.mul(_balance, FEE_MUL),
SafeMath.add(FEE_MUL, _fee)
);
| 41,747 |
48 | // change vault owner. Only current owner can call it. | function setVaultOwner(address vault, address newOwner) external {
require(msg.sender == settings[vault].owner, "caller should be owner");
require(newOwner != address(0), "Wrong new owner address");
emit SetVaultOwner(vault, settings[vault].owner, newOwner);
settings[vault].owner = n... | function setVaultOwner(address vault, address newOwner) external {
require(msg.sender == settings[vault].owner, "caller should be owner");
require(newOwner != address(0), "Wrong new owner address");
emit SetVaultOwner(vault, settings[vault].owner, newOwner);
settings[vault].owner = n... | 32,873 |
435 | // The amplification parameter equals: A n^(n-1) | function _calcDueTokenProtocolSwapFeeAmount(
uint256 amplificationParameter,
uint256[] memory balances,
uint256 lastInvariant,
uint256 tokenIndex,
uint256 protocolSwapFeePercentage
| function _calcDueTokenProtocolSwapFeeAmount(
uint256 amplificationParameter,
uint256[] memory balances,
uint256 lastInvariant,
uint256 tokenIndex,
uint256 protocolSwapFeePercentage
| 45,138 |
5 | // Checks to see if the address has a token and is KYC'd./_address The address that you want to check./ return Whether the address has has a token and it is KYC'd. | function isAllowed(address _address)
public
view
returns(bool)
| function isAllowed(address _address)
public
view
returns(bool)
| 50,265 |
5 | // RLPItem / /Creates an RLPItem from an array of RLP encoded bytes. /self The RLP encoded bytes. / return An RLPItem | function toRLPItem(bytes memory self) internal constant returns (RLPItem memory) {
uint len = self.length;
if (len == 0) {
return RLPItem(0, 0);
}
uint memPtr;
assembly {
memPtr := add(self, 0x20)
}
return RLPItem(memPtr, len);
}
| function toRLPItem(bytes memory self) internal constant returns (RLPItem memory) {
uint len = self.length;
if (len == 0) {
return RLPItem(0, 0);
}
uint memPtr;
assembly {
memPtr := add(self, 0x20)
}
return RLPItem(memPtr, len);
}
| 34,773 |
350 | // ADDRESS PROVIDER |
string public constant AS_ADDRESS_NOT_FOUND = "AP1";
|
string public constant AS_ADDRESS_NOT_FOUND = "AP1";
| 72,938 |
12 | // Mapping from Bag ID to Guild ID | mapping(uint256 => uint256) public guildLoots;
| mapping(uint256 => uint256) public guildLoots;
| 8,643 |
50 | // Function for getting the bets for ODD and EVEN._participant The address of the participant whose bets you want to check._blockNumber The block for which you want to check. return _oddBets, _evenBets/ | function getBetAt(address _participant, uint256 _blockNumber) public view returns (uint256 _oddBets, uint256 _evenBets){
return (participants[_participant].bets[_blockNumber].ODDBets, participants[_participant].bets[_blockNumber].EVENBets);
}
| function getBetAt(address _participant, uint256 _blockNumber) public view returns (uint256 _oddBets, uint256 _evenBets){
return (participants[_participant].bets[_blockNumber].ODDBets, participants[_participant].bets[_blockNumber].EVENBets);
}
| 39,394 |
10 | // Reads an immutable arg with type address/argOffset The offset of the arg in the packed data/ return arg The arg value | function _getArgAddress(uint256 argOffset)
internal
pure
returns (address arg)
| function _getArgAddress(uint256 argOffset)
internal
pure
returns (address arg)
| 14,279 |
51 | // uint newPoolSupply = (ratioTi ^ weightTi)poolSupply; | uint256 poolRatio = tokenInRatio.bpow(normalizedWeight);
uint256 newPoolSupply = poolRatio.bmul(poolSupply);
poolAmountOut = newPoolSupply.bsub(poolSupply);
return poolAmountOut;
| uint256 poolRatio = tokenInRatio.bpow(normalizedWeight);
uint256 newPoolSupply = poolRatio.bmul(poolSupply);
poolAmountOut = newPoolSupply.bsub(poolSupply);
return poolAmountOut;
| 30,627 |
27 | // FlightStatus is an example contract which requests data fromthe Chainlink network This contract is designed to work on multiple networks, includinglocal test networks / | contract FlightStatus is ChainlinkClient, Ownable {
string constant FLIGHT_STATUS_URL = "http://39.101.132.228:8000/live/";
bytes32 private jobId;
address private oracleAddress;
enum RequestStatus {INIT, SENT, COMPLETED}
struct FlightStatusInfo{
bool isUsed;
uint256 flightStatus;
address usr;
... | contract FlightStatus is ChainlinkClient, Ownable {
string constant FLIGHT_STATUS_URL = "http://39.101.132.228:8000/live/";
bytes32 private jobId;
address private oracleAddress;
enum RequestStatus {INIT, SENT, COMPLETED}
struct FlightStatusInfo{
bool isUsed;
uint256 flightStatus;
address usr;
... | 18,974 |
4 | // Initialize it as paused | pause();
emit Created(MAX_SUPPLY, MAX_SUPPLY_WHITELIST);
| pause();
emit Created(MAX_SUPPLY, MAX_SUPPLY_WHITELIST);
| 2,562 |
25 | // https:ethereum.stackexchange.com/questions/72668/avoid-using-now | require(isSigner(otherSigner) && expireTime > block.timestamp, "valid multisig"); // solium-disable-line security/no-block-members
require(otherSigner != msg.sender, "other signer is different");
tryInsertSequenceId(sequenceId);
return otherSigner;
| require(isSigner(otherSigner) && expireTime > block.timestamp, "valid multisig"); // solium-disable-line security/no-block-members
require(otherSigner != msg.sender, "other signer is different");
tryInsertSequenceId(sequenceId);
return otherSigner;
| 7,853 |
68 | // Calculates protocol fee on module and pays protocol fee from SetToken return uint256Total protocol fee paid / | function _accrueProtocolFee(ISetToken _setToken, IERC20 _receiveToken, uint256 _exchangedQuantity) internal returns(uint256) {
uint256 protocolFeeTotal = getModuleFee(PROTOCOL_TRADE_FEE_INDEX, _exchangedQuantity);
payProtocolFeeFromSetToken(_setToken, address(_receiveToken), protocolFeeTota... | function _accrueProtocolFee(ISetToken _setToken, IERC20 _receiveToken, uint256 _exchangedQuantity) internal returns(uint256) {
uint256 protocolFeeTotal = getModuleFee(PROTOCOL_TRADE_FEE_INDEX, _exchangedQuantity);
payProtocolFeeFromSetToken(_setToken, address(_receiveToken), protocolFeeTota... | 14,126 |
101 | // Withdraws multiple currencies from the Rari Stable Pool to `msg.sender` (RariFundProxy) in exchange for RFT burned from `from`.You may only withdraw currencies held by the fund (see `getRawFundBalance(string currencyCode)`).Please note that you must approve RariFundManager to burn of the necessary amount of RFT. fro... | function withdrawFrom(address from, string[] calldata currencyCodes, uint256[] calldata amounts) external onlyProxy cachePoolBalances returns (uint256[] memory) {
// Input validation
require(currencyCodes.length > 0 && currencyCodes.length == amounts.length, "Lengths of currency code and amount arra... | function withdrawFrom(address from, string[] calldata currencyCodes, uint256[] calldata amounts) external onlyProxy cachePoolBalances returns (uint256[] memory) {
// Input validation
require(currencyCodes.length > 0 && currencyCodes.length == amounts.length, "Lengths of currency code and amount arra... | 12,118 |
92 | // approve and deposit LP into treasury | IERC20( LP ).approve( treasury, _amount );
| IERC20( LP ).approve( treasury, _amount );
| 15,263 |
38 | // Config to metadata function / | function configToMetadata(string memory _config)
public
view
returns (string memory)
| function configToMetadata(string memory _config)
public
view
returns (string memory)
| 75,008 |
129 | // Any deposit should lead to at least the minimum share balance, otherwise it's ignored (no amount taken) | if (total.base.add(share.to128()) < MINIMUM_SHARE_BALANCE) {
return (0, 0);
}
| if (total.base.add(share.to128()) < MINIMUM_SHARE_BALANCE) {
return (0, 0);
}
| 64,353 |
4 | // Address of the Dao's Token-Manager app | address private tokenManagerAddress;
| address private tokenManagerAddress;
| 14,190 |
6 | // creating new struct |
stakeDetails[msg.sender].stakedTokenCount++;
stakeDetails[msg.sender].lastUpdated = block.timestamp;
stakedOwnerAddress[_tokenId] = msg.sender;
|
stakeDetails[msg.sender].stakedTokenCount++;
stakeDetails[msg.sender].lastUpdated = block.timestamp;
stakedOwnerAddress[_tokenId] = msg.sender;
| 10,640 |
68 | // Convert a standard decimal representation to a high precision one. / | function decimalToPreciseDecimal(uint i) internal pure returns (uint) {
return i.mul(UNIT_TO_HIGH_PRECISION_CONVERSION_FACTOR);
}
| function decimalToPreciseDecimal(uint i) internal pure returns (uint) {
return i.mul(UNIT_TO_HIGH_PRECISION_CONVERSION_FACTOR);
}
| 28,498 |
46 | // Exit the function once typehash has been located. | leave
| leave
| 17,500 |
1,304 | // Ensure the sADA synth can write to its TokenState; | tokenstatesada_i.setAssociatedContract(new_SynthsADA_contract);
| tokenstatesada_i.setAssociatedContract(new_SynthsADA_contract);
| 4,123 |
27 | // invoice struct to facilitate payment messaging in-contract | uint32 node;
address rootAddress;
address NTHaddress;
uint256 rootPrice;
uint256 NTHprice;
| uint32 node;
address rootAddress;
address NTHaddress;
uint256 rootPrice;
uint256 NTHprice;
| 62,686 |
111 | // Hash(current element of the proof + current computed hash) | computedHash = _efficientHash(proofElement, computedHash);
| computedHash = _efficientHash(proofElement, computedHash);
| 14,013 |
52 | // earned is an estimation, it won't be exact till the supply > rewardPerToken calculations have run | function earned(address token, address account) public view returns (uint) {
uint _startTimestamp = Math.max(lastEarn[token][account], rewardPerTokenCheckpoints[token][0].timestamp);
if (numCheckpoints[account] == 0) {
return 0;
}
uint _startIndex = getPriorBalanceIndex(... | function earned(address token, address account) public view returns (uint) {
uint _startTimestamp = Math.max(lastEarn[token][account], rewardPerTokenCheckpoints[token][0].timestamp);
if (numCheckpoints[account] == 0) {
return 0;
}
uint _startIndex = getPriorBalanceIndex(... | 49,239 |
189 | // unregister a scheme _scheme the address of the schemereturn bool which represents a success / | function unregisterScheme( address _scheme, address _avatar)
external
onlyRegisteringSchemes
onlySubjectToConstraint("unregisterScheme")
isAvatarValid(_avatar)
returns(bool)
| function unregisterScheme( address _scheme, address _avatar)
external
onlyRegisteringSchemes
onlySubjectToConstraint("unregisterScheme")
isAvatarValid(_avatar)
returns(bool)
| 27,960 |
12 | // withdraw traits of assembled token from vault / | function withdrawBase(address owner, uint256 id)
external
onlyRole(OWNER_ROLE)
| function withdrawBase(address owner, uint256 id)
external
onlyRole(OWNER_ROLE)
| 41,164 |
12 | // send 1/5 to marketing wallet | _taxEth = address(this).balance - _lastPotEth;
rewardLatestPlayers();
| _taxEth = address(this).balance - _lastPotEth;
rewardLatestPlayers();
| 3,657 |
49 | // ============================================== Proposal lifecycle ==============================================/ | * @dev See {IGovernor-propose}.
*/
function propose(
address[] memory targets,
uint256[] memory values,
bytes[] memory calldatas,
string memory description
) public virtual override(IGovernor, Governor) returns (uint256) {
_storeProposal(_msgSender(), targets, v... | * @dev See {IGovernor-propose}.
*/
function propose(
address[] memory targets,
uint256[] memory values,
bytes[] memory calldatas,
string memory description
) public virtual override(IGovernor, Governor) returns (uint256) {
_storeProposal(_msgSender(), targets, v... | 30,094 |
27 | // External Function Interface to implement on final contract / | function transfer(address to, uint256 amount)
virtual
external
returns (bool success);
function transferFrom(address from, address to, uint256 amount)
virtual
| function transfer(address to, uint256 amount)
virtual
external
returns (bool success);
function transferFrom(address from, address to, uint256 amount)
virtual
| 15,959 |
164 | // Updates the Uniswap V2 compatible router address.This is a privileged function. _newRouter The new router address. / | function setRouter(address _newRouter) external onlyOwner
delayed(this.setRouter.selector, keccak256(abi.encode(_newRouter)))
| function setRouter(address _newRouter) external onlyOwner
delayed(this.setRouter.selector, keccak256(abi.encode(_newRouter)))
| 6,380 |
38 | // Sets a new withdrawalAddress _newWithdrawalAddress - the address where we'll send the funds / | function setWithdrawalAddress(address _newWithdrawalAddress) external onlyCEO {
require(_newWithdrawalAddress != address(0));
withdrawalAddress = _newWithdrawalAddress;
}
| function setWithdrawalAddress(address _newWithdrawalAddress) external onlyCEO {
require(_newWithdrawalAddress != address(0));
withdrawalAddress = _newWithdrawalAddress;
}
| 42,715 |
726 | // Returns the withdrawal fee rate (proportion of every withdrawal taken as a service fee scaled by 1e18). / | function getWithdrawalFeeRate() public view returns (uint256) {
| function getWithdrawalFeeRate() public view returns (uint256) {
| 28,995 |
18 | // Check to see if asset pair price is increasing or decreasing as time passes | bool isTokenFlowIncreasing = isTokenFlowIncreasing(
_auction,
spotPrice,
assetOne.fullUnit,
assetTwo.fullUnit
);
| bool isTokenFlowIncreasing = isTokenFlowIncreasing(
_auction,
spotPrice,
assetOne.fullUnit,
assetTwo.fullUnit
);
| 4,529 |
43 | // 1 byte for the length prefix | require(item.len == 21);
return address(toUint(item));
| require(item.len == 21);
return address(toUint(item));
| 40,044 |
217 | // Calculate the amount of ETH backing an amount of rETH | function getEthValue(uint256 _rethAmount) override public view returns (uint256) {
// Get network balances
IStafiNetworkBalances stafiNetworkBalances = IStafiNetworkBalances(getContractAddress("stafiNetworkBalances"));
uint256 totalEthBalance = stafiNetworkBalances.getTotalETHBalance();
... | function getEthValue(uint256 _rethAmount) override public view returns (uint256) {
// Get network balances
IStafiNetworkBalances stafiNetworkBalances = IStafiNetworkBalances(getContractAddress("stafiNetworkBalances"));
uint256 totalEthBalance = stafiNetworkBalances.getTotalETHBalance();
... | 75,895 |
18 | // start and end timestamps where investments are allowed (both inclusive) | uint256 public startTime;
| uint256 public startTime;
| 22,601 |
52 | // - `spender` must have allowance for the caller of at least Atomically decreases the allowance granted to `spender` by the caller. `subtractedValue`. | * This is an alternative to {approve} that can address.
*/
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
address owner = _msgSender();
uint256 currentAllowance = allowance(owner, spender);
require(currentAllowance >= subtracted... | * This is an alternative to {approve} that can address.
*/
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
address owner = _msgSender();
uint256 currentAllowance = allowance(owner, spender);
require(currentAllowance >= subtracted... | 35,818 |
136 | // This is manually crafted in assembly/ |
event ScriptResult(address indexed executor, bytes script, bytes input, bytes returnData);
|
event ScriptResult(address indexed executor, bytes script, bytes input, bytes returnData);
| 5,180 |
86 | // NOTE: Use assembly to call the interaction instead of a low level call for two reasons: - We don't want to copy the return data, since we discard it for interactions. - Solidity will under certain conditions generate code to copy input calldata twice to memory (the second being a "memcopy loop"). <https:github.com/g... | assembly {
let freeMemoryPointer := mload(0x40)
calldatacopy(freeMemoryPointer, callData.offset, callData.length)
if iszero(
call(
gas(),
target,
value,
freeMemoryPointer,
... | assembly {
let freeMemoryPointer := mload(0x40)
calldatacopy(freeMemoryPointer, callData.offset, callData.length)
if iszero(
call(
gas(),
target,
value,
freeMemoryPointer,
... | 54,685 |
214 | // The Turbo Fuse Pool the Safes will interact with. | Comptroller public immutable pool;
| Comptroller public immutable pool;
| 71,797 |
24 | // Throws if owners count less then quorum. _ownersCount New owners count _required New or old required param, min: 2 / | modifier validRequirement(uint256 _ownersCount, uint _required) {
require(_required > 1 && _ownersCount >= _required);
_;
}
| modifier validRequirement(uint256 _ownersCount, uint _required) {
require(_required > 1 && _ownersCount >= _required);
_;
}
| 38,597 |
12 | // no bytes returned: assume success | case 0x0 {
returnValue := 1
}
| case 0x0 {
returnValue := 1
}
| 12,615 |
19 | // ____________________________________________________________________________________________________________________-->REVEAL (function) setPositionProofSet the metadata position proof --------------------------------------------------------------------------------------------------------------------- positionProof_... | function setPositionProof(bytes32 positionProof_) external;
| function setPositionProof(bytes32 positionProof_) external;
| 37,008 |
199 | // Add Minter role to account. The caller must have the Owner role. account The address to which the Minter role is added. / | function addMinter(address account) external nonReentrant() {
addMember(uint256(Roles.Minter), account);
}
| function addMinter(address account) external nonReentrant() {
addMember(uint256(Roles.Minter), account);
}
| 8,006 |
16 | // This function ensures this contract can receive ERC721 tokens | function onERC721Received(
address,
address,
uint256,
bytes memory
| function onERC721Received(
address,
address,
uint256,
bytes memory
| 30,658 |
68 | // timestamp must be equal to or past the next period | require(
block.timestamp >= nextValidTimestamp[subscriptionHash],
"Subscription is not ready"
);
| require(
block.timestamp >= nextValidTimestamp[subscriptionHash],
"Subscription is not ready"
);
| 49,969 |
100 | // Reserved storage space to allow for layout changes in the future. | uint256[16] private ______gap;
| uint256[16] private ______gap;
| 4,811 |
286 | // IMintingStation/Simon Fremaux (@dievardump) | interface IMintingStation {
/// @notice helper to know if an address can mint or not
/// @param operator the address to check
function canMint(address operator) external returns (bool);
/// @notice helper to know if everyone can mint or only minters
/// @return if minting is open to all or not
... | interface IMintingStation {
/// @notice helper to know if an address can mint or not
/// @param operator the address to check
function canMint(address operator) external returns (bool);
/// @notice helper to know if everyone can mint or only minters
/// @return if minting is open to all or not
... | 13,862 |
119 | // DEPOSIT | FARMING ASSETS (TOKENS) | RE-ENTRANCY DEFENSE | function deposit(uint256 _pid, uint256 _amount) public {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][msg.sender];
updatePool(_pid);
uint256 pending = user.amount.mul(pool.accGDAOPerShare).div(1e12).sub(user.rewardDebt);
user.amount ... | function deposit(uint256 _pid, uint256 _amount) public {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][msg.sender];
updatePool(_pid);
uint256 pending = user.amount.mul(pool.accGDAOPerShare).div(1e12).sub(user.rewardDebt);
user.amount ... | 38,951 |
103 | // Unlocks the community / | function unlock() external override onlyAmbassadorOrEntity {
locked = false;
emit CommunityUnlocked(msg.sender);
}
| function unlock() external override onlyAmbassadorOrEntity {
locked = false;
emit CommunityUnlocked(msg.sender);
}
| 23,512 |
1,214 | // Next phase transition handler Moves the fund to the next phase in the investment cycle. / | function nextPhase() public nonReentrant {
require(
now >= startTimeOfCyclePhase.add(phaseLengths[uint256(cyclePhase)])
);
if (isInitialized == false) {
// first cycle of this smart contract deployment
// check whether ready for starting cycle
... | function nextPhase() public nonReentrant {
require(
now >= startTimeOfCyclePhase.add(phaseLengths[uint256(cyclePhase)])
);
if (isInitialized == false) {
// first cycle of this smart contract deployment
// check whether ready for starting cycle
... | 41,080 |
4 | // To be updated by contract owner to allow presale minting _saleActiveState The new presale activ / | function setPresaleState(bool _saleActiveState) external onlyOwner {
HeyMintStorage.state().cfg.presaleActive = _saleActiveState;
}
| function setPresaleState(bool _saleActiveState) external onlyOwner {
HeyMintStorage.state().cfg.presaleActive = _saleActiveState;
}
| 21,138 |
2 | // list to hold a list of voters | mapping(address => bool) public votersList;
| mapping(address => bool) public votersList;
| 34,318 |
91 | // Throws if the sender is not the target wallet of the call. / | modifier onlyWallet(BaseWallet _wallet) {
require(msg.sender == address(_wallet), "BM: caller must be wallet");
_;
}
| modifier onlyWallet(BaseWallet _wallet) {
require(msg.sender == address(_wallet), "BM: caller must be wallet");
_;
}
| 1,012 |
22 | // if transfer claimed tokens is called when `to != msg.sender`, it'd use msg.sender's limits. behavior would be similar to `msg.sender` mint for itself, then transfer to `_to`. | supplyClaimedByWallet[_msgSender()] += _quantityBeingClaimed;
availableAmount -= _quantityBeingClaimed;
uint256 index = nextIndex;
uint256[] memory _tokenIds = tokenIds;
address _tokenAddress = airdropTokenAddress;
address _tokenOwner = tokenOwner;
for (uint256 ... | supplyClaimedByWallet[_msgSender()] += _quantityBeingClaimed;
availableAmount -= _quantityBeingClaimed;
uint256 index = nextIndex;
uint256[] memory _tokenIds = tokenIds;
address _tokenAddress = airdropTokenAddress;
address _tokenOwner = tokenOwner;
for (uint256 ... | 32,690 |
38 | // ADMIN //called after deployment so that the contract can get random police thieves _bank the address of the Bank / | function setBank(address _bank) external onlyOwner {
bank = IBank(_bank);
}
| function setBank(address _bank) external onlyOwner {
bank = IBank(_bank);
}
| 46,253 |
24 | // Transfer `amount` tokens from `src` to `dst` src The address of the source account dst The address of the destination account rawAmount The number of tokens to transferreturn Whether or not the transfer succeeded / | function transferFrom(
address src,
address dst,
uint256 rawAmount
| function transferFrom(
address src,
address dst,
uint256 rawAmount
| 12,385 |
11 | // Cria o parzinho Token/COIN pra swap e recebe endereco | uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
| uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
| 24,137 |
8 | // if fee is on, mint liquidity equivalent to 1/6th of the growth in sqrt(k) --/ | function _collectFee(uint112 _reserve0, uint112 _reserve1)
private
returns (bool feeOn)
| function _collectFee(uint112 _reserve0, uint112 _reserve1)
private
returns (bool feeOn)
| 27,233 |
8 | // 不需要owner,不需要operator的设置接口,私钥泄露了直接更新实现合约即可 | address public operator;
address public wbtc;
address public weth;
address public marsStakingForWbtc;
address public wbtc_weth_pair;
address[] public lpStakings;
mapping(address => address) stakingRewardToken;
| address public operator;
address public wbtc;
address public weth;
address public marsStakingForWbtc;
address public wbtc_weth_pair;
address[] public lpStakings;
mapping(address => address) stakingRewardToken;
| 750 |
291 | // Register pair for sweeping | _registerPair(pair_);
return (token_, pair_);
| _registerPair(pair_);
return (token_, pair_);
| 17,177 |
90 | // collateralEquivalentD18 = collateralEquivalentD18.sub((collateralEquivalentD18.mul(params.buybackFee)).div(1e6)); |
return (collateralEquivalentD18);
|
return (collateralEquivalentD18);
| 58,719 |
9 | // Purchase of siring ritesSends funds to the seller and sets sire approval for the matronEmits a MarketTransaction event with TxType "Sire Rites"Requirement: The msg.value needs to equal the siring price of _tokenIdRequirement: There must be an active sire offer for _sireTokenId / | function buySireRites(uint256 _sireTokenId, uint256 _matronTokenId) external payable;
| function buySireRites(uint256 _sireTokenId, uint256 _matronTokenId) external payable;
| 27,888 |
151 | // See {IERC1155-balanceOf}.Requirements:- `account` must not be zero address. / | function balanceOf(address account, uint256 id) public view override returns (uint256) {
if (isOwnerOf(account, id)) {
return 1;
}
| function balanceOf(address account, uint256 id) public view override returns (uint256) {
if (isOwnerOf(account, id)) {
return 1;
}
| 22,883 |
256 | // Helper to remove a tracked asset from the fund | function __vaultActionRemoveTrackedAsset(bytes memory _actionData) private {
address asset = abi.decode(_actionData, (address));
// Allowing this to fail silently makes it cheaper and simpler
// for Extensions to not query for the denomination asset
if (asset != denominationAsset) {... | function __vaultActionRemoveTrackedAsset(bytes memory _actionData) private {
address asset = abi.decode(_actionData, (address));
// Allowing this to fail silently makes it cheaper and simpler
// for Extensions to not query for the denomination asset
if (asset != denominationAsset) {... | 63,309 |
64 | // return The amount of ETH you will get after selling X INCH | function afterFeeEthReturns(uint _inchToSell) public view returns(uint) {
uint _trueInchToSell = _inchToSell.mul(conserveRate).div(conserveRateDigits);
return _trueInchToSell.mul(premium).div(premiumDigits.mul(etherPeg));
}
| function afterFeeEthReturns(uint _inchToSell) public view returns(uint) {
uint _trueInchToSell = _inchToSell.mul(conserveRate).div(conserveRateDigits);
return _trueInchToSell.mul(premium).div(premiumDigits.mul(etherPeg));
}
| 78,290 |
50 | // Helper function that checks for ERC777TokensSender on the sender and calls it./May throw according to `_preventLocking`/_from The address holding the tokens being sent/_to The address of the recipient/_amount The amount of tokens to be sent/_userData Data generated by the user to be passed to the recipient/_operator... | function callSender(
address _operator,
address _from,
address _to,
uint256 _amount,
bytes _userData,
bytes _operatorData
)
internal
| function callSender(
address _operator,
address _from,
address _to,
uint256 _amount,
bytes _userData,
bytes _operatorData
)
internal
| 56,958 |
13 | // public metadata locked flag | bool public locked;
| bool public locked;
| 17,827 |
32 | // overriding CrowdsalevalidPurchase to add extra cap logic return true if investors can buy at the moment | function validPurchase() internal view returns (bool) {
if (msg.value < minWeiInvestment || msg.value > maxWeiInvestment) {
return false;
}
bool withinPeriod = (now >= startTime) && (now <= endTime); // 1128581 1129653
return withinPeriod;
}
| function validPurchase() internal view returns (bool) {
if (msg.value < minWeiInvestment || msg.value > maxWeiInvestment) {
return false;
}
bool withinPeriod = (now >= startTime) && (now <= endTime); // 1128581 1129653
return withinPeriod;
}
| 44,638 |
0 | // Calculates time-weighted means of tick and liquidity for a given Uniswap V3 pool/pool Address of the pool that we want to observe/secondsAgo Number of seconds in the past from which to calculate the time-weighted means/ return arithmeticMeanTick The arithmetic mean tick from (block.timestamp - secondsAgo) to block.t... | function consult(address pool, uint32 secondsAgo)
internal
view
returns (int24 arithmeticMeanTick, uint128 harmonicMeanLiquidity)
| function consult(address pool, uint32 secondsAgo)
internal
view
returns (int24 arithmeticMeanTick, uint128 harmonicMeanLiquidity)
| 24,817 |
62 | // Burn `amount` tokens and decreasing the total supply. / | function burn(uint256 amount) public returns (bool) {
_burn(_msgSender(), amount);
return true;
}
| function burn(uint256 amount) public returns (bool) {
_burn(_msgSender(), amount);
return true;
}
| 24,597 |
113 | // This function multiplies two decimals represented as (decimal10DECIMALS)return uint256 Result of multiplication represented as (decimal10DECIMALS) / | function mul(uint256 x, uint256 y) internal pure returns (uint256 z) {
z = SafeMath.add(SafeMath.mul(x, y), (10 ** 18) / 2) / (10 ** 18);
}
| function mul(uint256 x, uint256 y) internal pure returns (uint256 z) {
z = SafeMath.add(SafeMath.mul(x, y), (10 ** 18) / 2) / (10 ** 18);
}
| 5,213 |
0 | // Current owner of NFT | address seller;
| address seller;
| 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.