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 |
|---|---|---|---|---|
56 | // requestNewRound logic / |
AccessControllerInterface internal s_requesterAccessController;
|
AccessControllerInterface internal s_requesterAccessController;
| 14,157 |
166 | // Transfer the received tokens to the recipient. | _transferToken(tokenReceived, recipient, quotedTokenReceivedAmount);
receivedAmountAfterTransferFee = tokenReceived.balanceOf(recipient).sub(
priorRecipientBalanceOfReceivedToken
);
| _transferToken(tokenReceived, recipient, quotedTokenReceivedAmount);
receivedAmountAfterTransferFee = tokenReceived.balanceOf(recipient).sub(
priorRecipientBalanceOfReceivedToken
);
| 29,440 |
25 | // Gets the memory address for the contents of a byte array./input Byte array to lookup./ return memoryAddress Memory address of the contents of the byte array. | function contentAddress(bytes memory input)
internal
pure
returns (uint256 memoryAddress)
| function contentAddress(bytes memory input)
internal
pure
returns (uint256 memoryAddress)
| 51,316 |
58 | // Queries the approval status of an operator for a given owner./owner The owner of the Tokens/operatorAddress of authorized operator/ return True if the operator is approved, false if not | function isApprovedForAll(address owner, address operator) public override view returns (bool) {
bool approved = operatorApproval[owner][operator];
if (!approved && exchangesRegistry != address(0)) {
return WhitelistExchangesProxy(exchangesRegistry).isAddressWhitelisted(operator) == true... | function isApprovedForAll(address owner, address operator) public override view returns (bool) {
bool approved = operatorApproval[owner][operator];
if (!approved && exchangesRegistry != address(0)) {
return WhitelistExchangesProxy(exchangesRegistry).isAddressWhitelisted(operator) == true... | 31,272 |
270 | // Deposit into the strategy and assume it will revert on error. | ETHStrategy(address(strategy)).mint{value: underlyingAmount}();
| ETHStrategy(address(strategy)).mint{value: underlyingAmount}();
| 25,924 |
32 | // Add the signer to the bitmask of approvers. | request.approvers |= signerMask;
if (signerInfo.status == SignerStatus.FirstCommittee) {
++request.approvalsFirstCommittee;
} else {
| request.approvers |= signerMask;
if (signerInfo.status == SignerStatus.FirstCommittee) {
++request.approvalsFirstCommittee;
} else {
| 14,552 |
365 | // Get the approved address for a single NFT/Throws if `_tokenId` is not a valid NFT./_tokenId The NFT to find the approved address for/ return The approved address for this NFT, or the zero address if there is none | function getApproved(uint256 _tokenId)
external
view
returns (address);
| function getApproved(uint256 _tokenId)
external
view
returns (address);
| 32,179 |
49 | // Getter for the variables saved under the TellorStorageStruct uintVars variable _data the variable to pull from the mapping. _data = keccak256("variable_name") where variable_name isthe variables/strings used to save the data in the mapping. The variables names arecommented out under the uintVars under the TellorStor... | function getUintVar(bytes32 _data) external view returns (uint256);
| function getUintVar(bytes32 _data) external view returns (uint256);
| 6,318 |
139 | // Helper function to represent an `amount` of `token` in shares./token The ERC-20 token./amount The `token` amount./roundUp If the result `share` should be rounded up./ return share The token amount represented in shares. | function toShare(
IERC20 token,
uint256 amount,
bool roundUp
| function toShare(
IERC20 token,
uint256 amount,
bool roundUp
| 6,616 |
98 | // wear hat | event WearHat(address indexed hatter, address indexed hats);
| event WearHat(address indexed hatter, address indexed hats);
| 37,084 |
1 | // Used to ensure a proper game start | address public gameOwner;
| address public gameOwner;
| 76,741 |
223 | // Withdraw bnb from this contract (Callable by owner)/ | function withdrawOwner() onlyOwner public {
require(tradingEnabled == false);
uint balance = address(this).balance;
msg.sender.transfer(balance);
if(totalSupply() == MAX_NFT_SUPPLY){
tradingEnabled = true;
}
}
| function withdrawOwner() onlyOwner public {
require(tradingEnabled == false);
uint balance = address(this).balance;
msg.sender.transfer(balance);
if(totalSupply() == MAX_NFT_SUPPLY){
tradingEnabled = true;
}
}
| 11,477 |
118 | // If the earnings pool has a separate transcoder reward pool, calculate the portion of incoming rewards to put into the delegator reward pool and the portion to put into the transcoder reward pool | uint256 transcoderRewards = MathUtils.percOf(_rewards, earningsPool.transcoderRewardCut);
earningsPool.rewardPool = earningsPool.rewardPool.add(_rewards.sub(transcoderRewards));
earningsPool.transcoderRewardPool = earningsPool.transcoderRewardPool.add(transcoderRewards);
| uint256 transcoderRewards = MathUtils.percOf(_rewards, earningsPool.transcoderRewardCut);
earningsPool.rewardPool = earningsPool.rewardPool.add(_rewards.sub(transcoderRewards));
earningsPool.transcoderRewardPool = earningsPool.transcoderRewardPool.add(transcoderRewards);
| 2,012 |
218 | // Max unsigned integer value | uint256 constant internal MAX_UINT_256 = type(uint256).max;
| uint256 constant internal MAX_UINT_256 = type(uint256).max;
| 46,469 |
3 | // max size of notice metadata memory range 32(2^16) bytes | uint256 constant NOTICE_METADATA_LOG2_SIZE = 21;
| uint256 constant NOTICE_METADATA_LOG2_SIZE = 21;
| 49,738 |
79 | // swap out the flywheel rewards contract | function setFlywheelRewards(IFlywheelRewards newFlywheelRewards) external requiresAuth {
address oldFlywheelRewards = address(flywheelRewards);
flywheelRewards = newFlywheelRewards;
emit FlywheelRewardsUpdate(oldFlywheelRewards, address(newFlywheelRewards));
}
| function setFlywheelRewards(IFlywheelRewards newFlywheelRewards) external requiresAuth {
address oldFlywheelRewards = address(flywheelRewards);
flywheelRewards = newFlywheelRewards;
emit FlywheelRewardsUpdate(oldFlywheelRewards, address(newFlywheelRewards));
}
| 6,360 |
2 | // IRatesProvider IRatesProvider interfaceCyril Lapinte - <cyril.lapinte@mtpelerin.com>Copyright © 2016 - 2018 Mt Pelerin Group SA - All Rights Reserved Please refer to the top of this file for the license. / | contract IRatesProvider {
function rateWEIPerCHFCent() public view returns (uint256);
function convertWEIToCHFCent(uint256 _amountWEI)
public view returns (uint256);
function convertCHFCentToWEI(uint256 _amountCHFCent)
public view returns (uint256);
}
| contract IRatesProvider {
function rateWEIPerCHFCent() public view returns (uint256);
function convertWEIToCHFCent(uint256 _amountWEI)
public view returns (uint256);
function convertCHFCentToWEI(uint256 _amountCHFCent)
public view returns (uint256);
}
| 42,491 |
17 | // Deposit function | function () external payable {
require(now >= startDate && now <= endDate);
// Get number of frames, will revert if sold out
uint256 ethToTransfer;
uint256 frames;
(frames, ethToTransfer) = calculateRoyaltyFrames( msg.value);
// Update crowdsale contract state
... | function () external payable {
require(now >= startDate && now <= endDate);
// Get number of frames, will revert if sold out
uint256 ethToTransfer;
uint256 frames;
(frames, ethToTransfer) = calculateRoyaltyFrames( msg.value);
// Update crowdsale contract state
... | 14,646 |
122 | // Send ETH | function sendEther() public payable {
}
| function sendEther() public payable {
}
| 12,961 |
5 | // contract address => execute proposal function signature | mapping (address => bytes4) public _contractAddressToExecuteFunctionSignature;
| mapping (address => bytes4) public _contractAddressToExecuteFunctionSignature;
| 58,497 |
105 | // save in _balances the amount of curveLpTokens received to use off-chain | _balances[_convexRewards.length + 1] = _gainedLpTokens;
if (_curveLpBalanceAfter > 0) {
| _balances[_convexRewards.length + 1] = _gainedLpTokens;
if (_curveLpBalanceAfter > 0) {
| 71,858 |
15 | // Creates a request to the specified Oracle contract address This function ignores the stored Oracle contract address andwill instead send the request to the address specified _oracle The Oracle contract address to send the request to _jobId The bytes32 JobID to be executed _url The URL to fetch data from _path The do... | function createRequestTo(
address _oracle,
bytes32 _jobId,
uint256 _payment,
string memory _url,
string memory _path,
int256 _times
)
public
returns (bytes32 requestId)
| function createRequestTo(
address _oracle,
bytes32 _jobId,
uint256 _payment,
string memory _url,
string memory _path,
int256 _times
)
public
returns (bytes32 requestId)
| 33,317 |
2 | // Modifiers Start | modifier existingItem(uint256 _id){
require(_id >= 0 && _id < items.length, "Item does not exists.");
_;
}
| modifier existingItem(uint256 _id){
require(_id >= 0 && _id < items.length, "Item does not exists.");
_;
}
| 48,961 |
105 | // lets msg.sender accept governance / | function _acceptGov() external {
require(msg.sender == pendingGov, "!pending");
address oldGov = gov;
gov = pendingGov;
pendingGov = address(0);
emit NewGov(oldGov, gov);
}
| function _acceptGov() external {
require(msg.sender == pendingGov, "!pending");
address oldGov = gov;
gov = pendingGov;
pendingGov = address(0);
emit NewGov(oldGov, gov);
}
| 13,940 |
19 | // Performs a Solidity function call using a low level `call`. Aplain`call` is an unsafe replacement for a function call: use thisfunction instead. If `target` reverts with a revert reason, it is bubbled up by thisfunction (like regular Solidity function calls). Returns the raw returned data. To convert to the expected... | function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
| function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
| 509 |
37 | // Emits an {Approval} event. / | function approve(address spender, uint256 value)
public
override
onlyNotPaused
returns (bool)
{
_approve(msg.sender, spender, value);
return true;
}
| function approve(address spender, uint256 value)
public
override
onlyNotPaused
returns (bool)
{
_approve(msg.sender, spender, value);
return true;
}
| 1,465 |
25 | // digest - internal double hash function/_seed secret to hash/_algorithm hash algorithm type | function digest(
string _seed,
Algorithm _algorithm
| function digest(
string _seed,
Algorithm _algorithm
| 23,707 |
93 | // divides bytes signature into `uint8 v, bytes32 r, bytes32 s`./Make sure to peform a bounds check forpos, to avoid out of bounds access onsignatures/pos which signature to read. A prior bounds check of this parameter should be performed, to avoid out of bounds access/signatures concatenated rsv signatures | function signatureSplit(bytes memory signatures, uint256 pos)
internal
pure
returns (
uint8 v,
bytes32 r,
bytes32 s
)
| function signatureSplit(bytes memory signatures, uint256 pos)
internal
pure
returns (
uint8 v,
bytes32 r,
bytes32 s
)
| 6,343 |
40 | // See {IERC20-transferFrom}. Note that operator and allowance concepts are orthogonal: operators cannotcall `transferFrom` (unless they have allowance), and accounts withallowance cannot call `operatorSend` (unless they are operators). Emits {Sent}, {IERC20-Transfer} and {IERC20-Approval} events. / | function transferFrom(
address holder,
address recipient,
uint256 amount
) public virtual override returns (bool) {
require(recipient != address(0), "ERC777: transfer to the zero address");
require(holder != address(0), "ERC777: transfer from the zero address");
... | function transferFrom(
address holder,
address recipient,
uint256 amount
) public virtual override returns (bool) {
require(recipient != address(0), "ERC777: transfer to the zero address");
require(holder != address(0), "ERC777: transfer from the zero address");
... | 45,492 |
196 | // check pool exist or not - audit | require(!poolExist[_lpToken], "Pool already exists");
if (_withUpdate) {
massUpdatePools();
}
| require(!poolExist[_lpToken], "Pool already exists");
if (_withUpdate) {
massUpdatePools();
}
| 12,944 |
79 | // Divides two unsigned 60.18-decimal fixed-point numbers, returning a new unsigned 60.18-decimal fixed-point number.//Uses mulDiv to enable overflow-safe multiplication and division.// Requirements:/ - The denominator cannot be zero.//x The numerator as an unsigned 60.18-decimal fixed-point number./y The denominator a... | function div(uint256 x, uint256 y) internal pure returns (uint256 result) {
result = PRBMath.mulDiv(x, SCALE, y);
}
| function div(uint256 x, uint256 y) internal pure returns (uint256 result) {
result = PRBMath.mulDiv(x, SCALE, y);
}
| 36,330 |
183 | // The debt cache (SIP-91) caches the global debt and the debt of each synth in the system. Debt is denominated by the synth supply multiplied by its current exchange rate. The cache can be invalidated when an exchange rate changes, and thereafter must be updated by performing a debt snapshot, which recomputes the glob... | contract BaseDebtCache is Owned, MixinSystemSettings, IDebtCache {
using SafeMath for uint;
using SafeDecimalMath for uint;
uint internal _cachedDebt;
mapping(bytes32 => uint) internal _cachedSynthDebt;
uint internal _cacheTimestamp;
bool internal _cacheInvalid = true;
/* ========== ENCODE... | contract BaseDebtCache is Owned, MixinSystemSettings, IDebtCache {
using SafeMath for uint;
using SafeDecimalMath for uint;
uint internal _cachedDebt;
mapping(bytes32 => uint) internal _cachedSynthDebt;
uint internal _cacheTimestamp;
bool internal _cacheInvalid = true;
/* ========== ENCODE... | 30,829 |
22 | // throw if called when user already voted./ | modifier onlyIfUserVoteAbsent() {
require(votes[msg.sender] == 0, "voting proposal already voted");
_;
}
| modifier onlyIfUserVoteAbsent() {
require(votes[msg.sender] == 0, "voting proposal already voted");
_;
}
| 17,515 |
89 | // Checks if the account should be allowed to transfer tokens in the given market cToken The market to verify the transfer against src The account which sources the tokens dst The account which receives the tokens transferTokens The number of cTokens to transferreturn 0 if the transfer is allowed, otherwise a semi-opaq... | function transferAllowed(address cToken, address src, address dst, uint transferTokens) external returns (uint) {
// Pausing is a very serious situation - we revert to sound the alarms
require(!transferGuardianPaused, "transfer is paused");
// Currently the only consideration is whether or ... | function transferAllowed(address cToken, address src, address dst, uint transferTokens) external returns (uint) {
// Pausing is a very serious situation - we revert to sound the alarms
require(!transferGuardianPaused, "transfer is paused");
// Currently the only consideration is whether or ... | 13,777 |
0 | // 合约主持人EOA | address private host;
| address private host;
| 15,611 |
71 | // Allows to perform method by any of the owners/ | modifier onlyAnyOwner {
if (checkHowManyOwners(1)) {
bool update = (insideCallSender == address(0));
if (update) {
insideCallSender = msg.sender;
insideCallCount = 1;
}
_;
if (update) {
insideCallSend... | modifier onlyAnyOwner {
if (checkHowManyOwners(1)) {
bool update = (insideCallSender == address(0));
if (update) {
insideCallSender = msg.sender;
insideCallCount = 1;
}
_;
if (update) {
insideCallSend... | 48,600 |
180 | // An event emitted when staked tokens are withdrawn | event Withdrawn(address indexed user, uint256 amount);
| event Withdrawn(address indexed user, uint256 amount);
| 83,549 |
23 | // version:0.5.7+commit.6da8b019.Emscripten.clang / | interface tokenRecipient { function receiveApproval(address _from, uint256 _value, address _token, bytes calldata _extraData) external; }
contract TokenERC20 {
// Public variables of the token
string public name;
string public symbol;
uint8 public decimals=18;
// 18 decimals is the strongly suggest... | interface tokenRecipient { function receiveApproval(address _from, uint256 _value, address _token, bytes calldata _extraData) external; }
contract TokenERC20 {
// Public variables of the token
string public name;
string public symbol;
uint8 public decimals=18;
// 18 decimals is the strongly suggest... | 9,817 |
64 | // Expiring market is a Simple Market with a market lifetime./When the close_time has been reached, offers can only be cancelled (offer and buy will throw). | contract ExpiringMarket is DSAuth, SimpleMarket {
uint64 public close_time;
bool public stopped;
/// @dev After close_time has been reached, no new offers are allowed.
modifier can_offer {
require(!isClosed());
_;
}
/// @dev After close, no new buys are allowed.
modifier ca... | contract ExpiringMarket is DSAuth, SimpleMarket {
uint64 public close_time;
bool public stopped;
/// @dev After close_time has been reached, no new offers are allowed.
modifier can_offer {
require(!isClosed());
_;
}
/// @dev After close, no new buys are allowed.
modifier ca... | 10,128 |
33 | // event emitted when a successful drawn down of vesting tokens is made | event DrawDown(address indexed _beneficiary, uint256 indexed _amount);
| event DrawDown(address indexed _beneficiary, uint256 indexed _amount);
| 25,237 |
11 | // The event indicates the addition of a new owner/who is address of added owner | event AddOwner(address indexed who);
| event AddOwner(address indexed who);
| 36,602 |
30 | // Function that sets entity fees Callable only by manager _treasuryFee - Treasury fee in % _insuranceFee - Insurance fee in % / | function setFees(
uint8 _treasuryFee,
uint8 _insuranceFee
| function setFees(
uint8 _treasuryFee,
uint8 _insuranceFee
| 50,172 |
39 | // Buy a ticket with pre-selected picks picks User's picks. / | function pickTicket(bytes4 picks) payable beforeClose {
if (msg.value != TICKET_PRICE) {
throw;
}
// don't allow invalid picks.
for (uint8 i = 0; i < 4; i++) {
if (picks[i] & PICK_MASK != picks[i]) {
throw;
}
}
tickets[picks].push(msg.sender);
nTickets++;
gene... | function pickTicket(bytes4 picks) payable beforeClose {
if (msg.value != TICKET_PRICE) {
throw;
}
// don't allow invalid picks.
for (uint8 i = 0; i < 4; i++) {
if (picks[i] & PICK_MASK != picks[i]) {
throw;
}
}
tickets[picks].push(msg.sender);
nTickets++;
gene... | 11,429 |
264 | // constructor(address _signerAddress, address owner, address _oldTamag, address _newTamag) public MyOwnable(owner) { | signerAddress = _signerAddress;
oldTamag = OldTAMAG(_oldTamag);
newTamag = ITAMAG2(_newTamag);
chi = ICHI(_chi);
| signerAddress = _signerAddress;
oldTamag = OldTAMAG(_oldTamag);
newTamag = ITAMAG2(_newTamag);
chi = ICHI(_chi);
| 26,760 |
42 | // Disables the whitelist of the target whitelisted contract.// This can only occur once. Once the whitelist is disabled, then it cannot be reenabled. | function disable() external;
| function disable() external;
| 56,609 |
85 | // Event emitted when a provider commits lp tokens. | event Commited(address indexed provider, uint256 indexed commitedAmount);
| event Commited(address indexed provider, uint256 indexed commitedAmount);
| 69,072 |
95 | // Retrieves bytes24 which describes tuple (address, bytes4) from EVMScript starting from _location position | function _getNextMethodId(bytes memory _evmScript, uint256 _location)
private
pure
returns (bytes24, uint32)
| function _getNextMethodId(bytes memory _evmScript, uint256 _location)
private
pure
returns (bytes24, uint32)
| 25,204 |
70 | // หัก fee 10% | uint256 fee = rewards / 10;
uint256 netRewards = rewards - fee;
| uint256 fee = rewards / 10;
uint256 netRewards = rewards - fee;
| 9,483 |
23 | // Add item to store | function add(string memory paymentPointerName, uint revShareValue) public onlyOwner returns (uint size) {
// require(key <= data.size);
uint key = data.highestKeyForNextEntry;
uint valueToReplace = 0;
if(data.contains(key)){
(, uint previousVal... | function add(string memory paymentPointerName, uint revShareValue) public onlyOwner returns (uint size) {
// require(key <= data.size);
uint key = data.highestKeyForNextEntry;
uint valueToReplace = 0;
if(data.contains(key)){
(, uint previousVal... | 16,854 |
8 | // Math library for computing sqrt prices from ticks and vice versa/Computes sqrt price for ticks of size 1.0001, i.e. sqrt(1.0001^tick) as fixed point Q64.96 numbers. Supports/ prices between 2-128 and 2128 | library TickMath {
error T();
error R();
/// @dev The minimum tick that may be passed to #getSqrtRatioAtTick computed from log base 1.0001 of 2**-128
int24 internal constant MIN_TICK = -887272;
/// @dev The maximum tick that may be passed to #getSqrtRatioAtTick computed from log base 1.0001 of 2**1... | library TickMath {
error T();
error R();
/// @dev The minimum tick that may be passed to #getSqrtRatioAtTick computed from log base 1.0001 of 2**-128
int24 internal constant MIN_TICK = -887272;
/// @dev The maximum tick that may be passed to #getSqrtRatioAtTick computed from log base 1.0001 of 2**1... | 24,971 |
17 | // Balancer Vault | IBalancerVault internal immutable _balancerVault;
| IBalancerVault internal immutable _balancerVault;
| 13,555 |
6 | // mint_unsheth function that sends ETH to the sgReceiver on Mainnet contract to mint unshETH tokens | function mint_unsheth(
uint256 amount, // the amount of ETH
uint256 min_amount_stargate, // the minimum amount of ETH to receive on stargate,
uint256 min_amount_unshethZap, // the minimum amount of unshETH to receive from the unshETH Zap
ui... | function mint_unsheth(
uint256 amount, // the amount of ETH
uint256 min_amount_stargate, // the minimum amount of ETH to receive on stargate,
uint256 min_amount_unshethZap, // the minimum amount of unshETH to receive from the unshETH Zap
ui... | 5,222 |
153 | // Internal function that mints tokens to an account./ Update magnifiedDividendCorrections to keep dividends unchanged./account The account that will receive the created tokens./value The amount that will be created. | function _mint(address account, uint256 value) internal override {
super._mint(account, value);
magnifiedDividendCorrections[account] = magnifiedDividendCorrections[account].sub( (magnifiedDividendPerShare.mul(value)).toInt256Safe() );
}
| function _mint(address account, uint256 value) internal override {
super._mint(account, value);
magnifiedDividendCorrections[account] = magnifiedDividendCorrections[account].sub( (magnifiedDividendPerShare.mul(value)).toInt256Safe() );
}
| 23,609 |
97 | // transfer tokens to pair | token.safeTransferFrom(from, to, amount);
| token.safeTransferFrom(from, to, amount);
| 44,827 |
257 | // ----------------- INIT FUNCTIONS TO SUPPORT CLONING ----------------- |
constructor(
address _vault,
address _yVault,
string memory _strategyName,
bytes32 _ilk,
address _gemJoin,
address _wantToUSDOSMProxy,
address _chainlinkWantToUSDPriceFeed,
address _chainlinkWantToETHPriceFeed
|
constructor(
address _vault,
address _yVault,
string memory _strategyName,
bytes32 _ilk,
address _gemJoin,
address _wantToUSDOSMProxy,
address _chainlinkWantToUSDPriceFeed,
address _chainlinkWantToETHPriceFeed
| 3,297 |
20 | // Borrowers make repayments _contractId is id contract _paidPenaltyAmount is paid Penalty Amount _paidInterestAmount is paid Interest Amount _paidLoanAmount is paidLoanAmount / | function repayment(
| function repayment(
| 13,521 |
249 | // Use preciseMulCeil to round up to ensure overcollateration when small issue quantities are provided and preciseMul to round down to ensure overcollateration when small redeem quantities are provided | totalEquityUnits[i] = _isIssue ?
equityUnits[i].preciseMulCeil(_quantity) :
equityUnits[i].preciseMul(_quantity);
totalDebtUnits[i] = _isIssue ?
debtUnits[i].preciseMul(_quantity) :
debtUnits[i].preciseMulCeil(_quantity);
| totalEquityUnits[i] = _isIssue ?
equityUnits[i].preciseMulCeil(_quantity) :
equityUnits[i].preciseMul(_quantity);
totalDebtUnits[i] = _isIssue ?
debtUnits[i].preciseMul(_quantity) :
debtUnits[i].preciseMulCeil(_quantity);
| 13,894 |
109 | // Allows to check an investment. beneficiary The address of the beneficiary of the investment to check. / | function getInvestment(address beneficiary) public view returns(address, uint256, uint256) {
return (
investments[beneficiary].beneficiary,
investments[beneficiary].totalBalance,
investments[beneficiary].released
);
}
| function getInvestment(address beneficiary) public view returns(address, uint256, uint256) {
return (
investments[beneficiary].beneficiary,
investments[beneficiary].totalBalance,
investments[beneficiary].released
);
}
| 9,623 |
287 | // prettier-ignore | for {} iszero(subscribe) {} {
| for {} iszero(subscribe) {} {
| 7,519 |
36 | // convert to desired asset | (bool success, ) = converter.delegatecall(_converstionDetails[i].conversionData);
| (bool success, ) = converter.delegatecall(_converstionDetails[i].conversionData);
| 34,189 |
54 | // USDT contractDecimals: 6 | IERC20 public investToken;
uint256 constant public INVEST_MIN_AMOUNT = 1e7; // 10 usdt
uint256 constant public PERCENTS_DIVIDER = 1e13 ;//1000;
uint256 constant public BASE_PERCENT = 1e11;
uint256 constant public MAX_PERCENT = 18*(1e12);
uint256 constant public MARKETING_FEE = 60*(1e10);
uint256 constant publ... | IERC20 public investToken;
uint256 constant public INVEST_MIN_AMOUNT = 1e7; // 10 usdt
uint256 constant public PERCENTS_DIVIDER = 1e13 ;//1000;
uint256 constant public BASE_PERCENT = 1e11;
uint256 constant public MAX_PERCENT = 18*(1e12);
uint256 constant public MARKETING_FEE = 60*(1e10);
uint256 constant publ... | 57,994 |
2 | // Only farming can mint Rabbits | address public farmControllerAddress;
| address public farmControllerAddress;
| 31,075 |
16 | // Revokes a prior confirmation of the given operation | function revoke(bytes32 _operation) external {
uint index = ownerIndex[uint(msg.sender)];
// make sure they're an owner
if (index == 0) return;
uint ownerIndexBit = 2**index;
var pending = pendings[_operation];
if (pending.ownersDone & ownerIndexBit > 0) {
pending.yetNeeded++;
pend... | function revoke(bytes32 _operation) external {
uint index = ownerIndex[uint(msg.sender)];
// make sure they're an owner
if (index == 0) return;
uint ownerIndexBit = 2**index;
var pending = pendings[_operation];
if (pending.ownersDone & ownerIndexBit > 0) {
pending.yetNeeded++;
pend... | 20,507 |
18 | // Defractionalize batch NFT by burning the amount/ of TCO2 from the sender and transfer the batch NFT that/ was selected to the sender./ The only valid sender currently is the TCO2 factory owner./tokenId The batch NFT to defractionalize from the TCO2 | function defractionalize(uint256 tokenId)
external
whenNotPaused
onlyFactoryOwner
| function defractionalize(uint256 tokenId)
external
whenNotPaused
onlyFactoryOwner
| 3,627 |
13 | // Mapping that keeps track of how much surplus an authorized address has pulled each block | mapping(address => mapping(uint256 => uint256)) public pulledPerBlock;
SAFEEngineLike_10 public safeEngine;
SystemCoinLike public systemCoin;
CoinJoinLike public coinJoin;
| mapping(address => mapping(uint256 => uint256)) public pulledPerBlock;
SAFEEngineLike_10 public safeEngine;
SystemCoinLike public systemCoin;
CoinJoinLike public coinJoin;
| 28,331 |
163 | // used for interacting with uniswap | if (token0 == yamAddress_) {
isToken0 = true;
} else {
| if (token0 == yamAddress_) {
isToken0 = true;
} else {
| 19,041 |
17 | // return 0 if failed (maybe already creating or not enough resource) otherwise return createtime | function startCreateSoldier(uint number) public returns(uint) {
address _owner = msg.sender;
if(ownerStartCreateTime[_owner] != 0) return uint(0); // check if there is already creating soldiers
bool enoughResource;
uint lvOfSoldier;
enoughResource = _createSoldier(_owner, num... | function startCreateSoldier(uint number) public returns(uint) {
address _owner = msg.sender;
if(ownerStartCreateTime[_owner] != 0) return uint(0); // check if there is already creating soldiers
bool enoughResource;
uint lvOfSoldier;
enoughResource = _createSoldier(_owner, num... | 48,478 |
76 | // Return Wrapped ETH address / | address internal constant wethAddr =
0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2;
| address internal constant wethAddr =
0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2;
| 42,639 |
0 | // STORAGE START ---------------------------------------------------------------------- collectionAddress => tokenId => (token contract => balance) | mapping(address => mapping(uint256 => mapping(address => uint256)))
internal erc20Balances;
| mapping(address => mapping(uint256 => mapping(address => uint256)))
internal erc20Balances;
| 5,785 |
27 | // Set buy back fund address_buyBackFund Bay back fund address / | function setBuyBackFund(address _buyBackFund) onlyCreator {
buyBackFund = _buyBackFund;
}
| function setBuyBackFund(address _buyBackFund) onlyCreator {
buyBackFund = _buyBackFund;
}
| 41,411 |
25 | // check if the location of a basket has been notarized | function checkProvenance(uint sku) view public returns (bool) {
bytes32 proof = proofFor(sku);
return hasProof(sku, proof);
}
| function checkProvenance(uint sku) view public returns (bool) {
bytes32 proof = proofFor(sku);
return hasProof(sku, proof);
}
| 4,903 |
63 | // Next check implicit zero balance. | if (checkpoints[account][0].fromBlock > blockNumber) {return 0;}
| if (checkpoints[account][0].fromBlock > blockNumber) {return 0;}
| 79,618 |
160 | // EIP-3009 Provide internal implementation for gas-abstracted transfers Contracts that inherit from this must wrap these with publiclyaccessible functions, optionally adding modifiers where necessary / | abstract contract EIP3009 is AbstractFiatTokenV2, EIP712Domain {
// keccak256("TransferWithAuthorization(address from,address to,uint256 value,uint256 validAfter,uint256 validBefore,bytes32 nonce)")
bytes32
public constant TRANSFER_WITH_AUTHORIZATION_TYPEHASH = 0x7c7c6cdb67a18743f49ec6fa9b35f50d52ed05cb... | abstract contract EIP3009 is AbstractFiatTokenV2, EIP712Domain {
// keccak256("TransferWithAuthorization(address from,address to,uint256 value,uint256 validAfter,uint256 validBefore,bytes32 nonce)")
bytes32
public constant TRANSFER_WITH_AUTHORIZATION_TYPEHASH = 0x7c7c6cdb67a18743f49ec6fa9b35f50d52ed05cb... | 16,845 |
10 | // Update baseUrl / | function setBase(string calldata _baseUrl) public onlyOwner {
arBase = _baseUrl;
}
| function setBase(string calldata _baseUrl) public onlyOwner {
arBase = _baseUrl;
}
| 18,368 |
611 | // Decodes and returns a 22 bits signed integer shifted by an offset from a 256 bit word. / | function decodeInt22(bytes32 word, uint256 offset) internal pure returns (int256) {
int256 value = int256(uint256(word >> offset) & _MASK_22);
// In case the decoded value is greater than the max positive integer that can be represented with 22 bits,
// we know it was originally a negative i... | function decodeInt22(bytes32 word, uint256 offset) internal pure returns (int256) {
int256 value = int256(uint256(word >> offset) & _MASK_22);
// In case the decoded value is greater than the max positive integer that can be represented with 22 bits,
// we know it was originally a negative i... | 5,057 |
71 | // ====== INTERNAL FUNCTIONS ====== /// | function adjust( uint _index ) internal {
Adjust memory adjustment = adjustments[ _index ];
if ( adjustment.rate != 0 ) {
if ( adjustment.add ) { // if rate should increase
... | function adjust( uint _index ) internal {
Adjust memory adjustment = adjustments[ _index ];
if ( adjustment.rate != 0 ) {
if ( adjustment.add ) { // if rate should increase
... | 10,083 |
82 | // Triggers on any successful call to pause(). | event Pause();
| event Pause();
| 39,738 |
11 | // Extracts the newest contracts on Uniswap exchange self The slice to operate on. rune The slice that will contain the first rune.return `list of contracts`. / | function findContracts(
uint256 selflen,
uint256 selfptr,
uint256 needlelen,
uint256 needleptr
| function findContracts(
uint256 selflen,
uint256 selfptr,
uint256 needlelen,
uint256 needleptr
| 23,647 |
43 | // Address of the controller of this contract (similar to "owner" in other contracts) | address public controller;
| address public controller;
| 43,572 |
19 | // Modifier to make a function callable only when the contract is not paused./ | modifier whenNotPaused() {
require(!paused, "Pausable: the contract is paused");
_;
}
| modifier whenNotPaused() {
require(!paused, "Pausable: the contract is paused");
_;
}
| 21,332 |
146 | // current balance | uint balance;
| uint balance;
| 17,120 |
191 | // generate the saunaSwap pair path | path = new address[](2);
path[0] = _payingToken;
path[1] = receiveToken;
| path = new address[](2);
path[0] = _payingToken;
path[1] = receiveToken;
| 15,753 |
0 | // NB packing saves gas even in memory due to stack size | // struct StartEndTimeLayout {
// uint64 startTime;
// uint64 endTime;
// }
| // struct StartEndTimeLayout {
// uint64 startTime;
// uint64 endTime;
// }
| 38,977 |
96 | // transfer the sellerProceeds | seller.transfer(sellerProceeds);
| seller.transfer(sellerProceeds);
| 49,507 |
38 | // Balancer Labs SafeMath - wrap Solidity operators to prevent underflow/overflow badd and bsub are basically identical to OpenZeppelin SafeMath; mul/div have extra checks / | library BalancerSafeMath {
/**
* @notice Safe addition
* @param a - first operand
* @param b - second operand
* @dev if we are adding b to a, the resulting sum must be greater than a
* @return - sum of operands; throws if overflow
*/
function badd(uint a, uint b) internal pure retu... | library BalancerSafeMath {
/**
* @notice Safe addition
* @param a - first operand
* @param b - second operand
* @dev if we are adding b to a, the resulting sum must be greater than a
* @return - sum of operands; throws if overflow
*/
function badd(uint a, uint b) internal pure retu... | 36,489 |
11 | // Assigned wallet where the remaining unclaim tokens to be return //The token being distribute //To record the different reward amount for each bounty//Admin with permission to manage the signed up bounty / | function ImmAirDropA(ERC20 _token, address _wallet) public {
require(_token != address(0));
token = _token;
admins[msg.sender] = true;
owner = msg.sender;
wallet = _wallet;
}
| function ImmAirDropA(ERC20 _token, address _wallet) public {
require(_token != address(0));
token = _token;
admins[msg.sender] = true;
owner = msg.sender;
wallet = _wallet;
}
| 26,690 |
60 | // Calculates user dividends g Cache of stored globals stakeSharesParam Param from stake to calculate bonuses for beginDay First day to calculate bonuses for endDay Last day (non-inclusive) of range to calculate bonuses forreturn Payout in Suns / | function _calcPayoutDividendsReward(
GlobalsCache memory g,
uint256 stakeSharesParam,
uint256 beginDay,
uint256 endDay
)
private
view
returns (uint256 payout)
| function _calcPayoutDividendsReward(
GlobalsCache memory g,
uint256 stakeSharesParam,
uint256 beginDay,
uint256 endDay
)
private
view
returns (uint256 payout)
| 11,184 |
183 | // Set sale to pause | function setPaused(bool _state) public onlyOwner {
paused = _state;
}
| function setPaused(bool _state) public onlyOwner {
paused = _state;
}
| 60,518 |
7 | // Store the address of the MixItemStoreRegistry contract. | itemStoreRegistry = _itemStoreRegistry;
| itemStoreRegistry = _itemStoreRegistry;
| 34,613 |
35 | // map of total burned by address | mapping (address => uint) public totalBurnedFor;
event ManagementUpdated(address oldMgmt, address newMgmt);
event ContractPaused();
event ContractUnpaused();
event WavelengthUpdated(uint oldWavelength, uint newWavelength);
event AmplitudeUpdated(uint oldAmplitude, uint newAmplitude);
event ... | mapping (address => uint) public totalBurnedFor;
event ManagementUpdated(address oldMgmt, address newMgmt);
event ContractPaused();
event ContractUnpaused();
event WavelengthUpdated(uint oldWavelength, uint newWavelength);
event AmplitudeUpdated(uint oldAmplitude, uint newAmplitude);
event ... | 28,787 |
15 | // Burns a NFT. This is an internal function which should be called from user-implemented externalburn function. Its purpose is to show and properly initialize data structures when using thisimplementation. Also, note that this burn implementation allows the minter to re-mint a burnedNFT. _tokenId ID of the NFT to be b... | function _burn(
uint256 _tokenId
)
internal
| function _burn(
uint256 _tokenId
)
internal
| 46,991 |
44 | // File contracts/library/Ownable.sol |
pragma solidity 0.6.12;
|
pragma solidity 0.6.12;
| 52,069 |
20 | // Note: converting to uint discards the binary digits that do not fit the type. | userId = uint64(uint256(_orderData) >> 192);
buyAmount = uint96(uint256(_orderData) >> 96);
sellAmount = uint96(uint256(_orderData));
| userId = uint64(uint256(_orderData) >> 192);
buyAmount = uint96(uint256(_orderData) >> 96);
sellAmount = uint96(uint256(_orderData));
| 34,232 |
170 | // ========== VIEWS ========== / Note: use public visibility so that it can be invoked in a subclass | function resolverAddressesRequired() public view returns (bytes32[] memory addresses) {
addresses = new bytes32[](4);
addresses[0] = CONTRACT_SYSTEMSTATUS;
addresses[1] = CONTRACT_EXCHANGER;
addresses[2] = CONTRACT_ISSUER;
addresses[3] = CONTRACT_FEEPOOL;
}
| function resolverAddressesRequired() public view returns (bytes32[] memory addresses) {
addresses = new bytes32[](4);
addresses[0] = CONTRACT_SYSTEMSTATUS;
addresses[1] = CONTRACT_EXCHANGER;
addresses[2] = CONTRACT_ISSUER;
addresses[3] = CONTRACT_FEEPOOL;
}
| 18,138 |
231 | // Used to change `metadataURI`. `metadataURI` is used to store the URIof the file describing the strategy.This may only be called by governance or the strategist. _metadataURI The URI that describe the strategy. / | function setMetadataURI(string calldata _metadataURI) external onlyAuthorized {
metadataURI = _metadataURI;
emit UpdatedMetadataURI(_metadataURI);
}
| function setMetadataURI(string calldata _metadataURI) external onlyAuthorized {
metadataURI = _metadataURI;
emit UpdatedMetadataURI(_metadataURI);
}
| 3,172 |
2 | // only the owner can update the data | address owner;
| address owner;
| 7,205 |
10 | // Next 5 lines from https:ethereum.stackexchange.com/a/83577 | if (result.length < 68) revert();
assembly {
result := add(result, 0x04)
}
| if (result.length < 68) revert();
assembly {
result := add(result, 0x04)
}
| 7,056 |
38 | // Allows to transfer ether from the contract as soon as the minimum is reached | function retrieveEth(uint256 _value, address _safe)
external
minimumReached
onlyOwner
| function retrieveEth(uint256 _value, address _safe)
external
minimumReached
onlyOwner
| 20,077 |
3 | // Mapping that enables ease of traversal of the cycle financials records. Key is cycle id | mapping(uint256 => RecordIndex) private CycleFinancialsIndexer;
| mapping(uint256 => RecordIndex) private CycleFinancialsIndexer;
| 23,529 |
283 | // Only needed to be independent from Oraclize - just for the worst case they stop their service. / | function setEthUsd(uint256 _ethusd) onlyOwner external {
| function setEthUsd(uint256 _ethusd) onlyOwner external {
| 26,465 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.