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 |
|---|---|---|---|---|
2 | // Add to token to cToken mapping. Add to token to cToken mapping. _cTokens list of cToken addresses to be added to the mapping./ | function addTokenToCToken(address[] memory _cTokens) public {
for (uint i = 0; i < _cTokens.length; i++) {
(bool isMarket_,,) = troller.markets(_cTokens[i]);
require(isMarket_, "unvalid-ctoken");
address token_ = CTokenInterface(_cTokens[i]).underlying();
requ... | function addTokenToCToken(address[] memory _cTokens) public {
for (uint i = 0; i < _cTokens.length; i++) {
(bool isMarket_,,) = troller.markets(_cTokens[i]);
require(isMarket_, "unvalid-ctoken");
address token_ = CTokenInterface(_cTokens[i]).underlying();
requ... | 34,467 |
11 | // string memory json = string( abi.encodePacked( '{"name": "pepe", "description": "PEPOS is a collection of fractional Pepos tokens with unique background colors.", "image": "', imageURI, '"}' ) ); |
string memory json = string(
abi.encodePacked(
"{",
'"name": "',
name,
'",',
'"description": "PEPOS is a collection of fractional Pepos tokens with unique background colors.",',
'"image": "',
... |
string memory json = string(
abi.encodePacked(
"{",
'"name": "',
name,
'",',
'"description": "PEPOS is a collection of fractional Pepos tokens with unique background colors.",',
'"image": "',
... | 12,380 |
90 | // mint | function mint(address account, uint256 powah) external returns (uint256);
function mintBatch(address account, uint256 amount, uint256[] calldata powahArr) external returns (uint256[] memory);
function burn(address account, uint256 id) external;
function burnBatch(address account, uint256[] calldata ids)... | function mint(address account, uint256 powah) external returns (uint256);
function mintBatch(address account, uint256 amount, uint256[] calldata powahArr) external returns (uint256[] memory);
function burn(address account, uint256 id) external;
function burnBatch(address account, uint256[] calldata ids)... | 30,359 |
24 | // Ensure the challenge period has ended | require(startChallengePeriod + challengePeriodLength < now, "challenge period has not ended");
| require(startChallengePeriod + challengePeriodLength < now, "challenge period has not ended");
| 31,639 |
78 | // stakes a certain amount of tokens for an address, transfering this user beneficiary address amount number of tokens to stake / | function stakeFor(
| function stakeFor(
| 38,082 |
15 | // At most 8 iterations | while (n > 1) {
n >>= 1;
res += 1;
}
| while (n > 1) {
n >>= 1;
res += 1;
}
| 56,343 |
23 | // Set the status to be `SETUP` if there are more leafs to execute in this tree. Note that it's not possible for there to be zero leafs since we would have reverted earlier in this function. | authStates[_authRoot] = AuthState({
status: AuthStatus.SETUP,
leafsExecuted: 1,
numLeafs: numLeafs
});
| authStates[_authRoot] = AuthState({
status: AuthStatus.SETUP,
leafsExecuted: 1,
numLeafs: numLeafs
});
| 46,579 |
30 | // ID struct for ID info | uint256 trustLevel; //admin only
bytes32 URI; //caller address match
string userName; //admin only///caller address match can set
| uint256 trustLevel; //admin only
bytes32 URI; //caller address match
string userName; //admin only///caller address match can set
| 32,758 |
195 | // Update the rewardsPerTokenStored | for (uint256 i = 0; i < rewardsPerTokenStored.length; i++){
rewardsPerTokenStored[i] = rewards_per_token[i];
}
| for (uint256 i = 0; i < rewardsPerTokenStored.length; i++){
rewardsPerTokenStored[i] = rewards_per_token[i];
}
| 17,843 |
246 | // fix of potentially broken withdrawals for future unbonding foundation validators have no slashing enabled and thus we can return default exchange rate because without slashing rate will stay constant | return precision;
| return precision;
| 22,742 |
69 | // See {IPongoProposal-balanceOf}. / | function balanceOf(address owner) public view returns (uint256) {
require(owner != address(0), "ERC721: balance query for the zero address");
return _balances[owner];
}
| function balanceOf(address owner) public view returns (uint256) {
require(owner != address(0), "ERC721: balance query for the zero address");
return _balances[owner];
}
| 74,276 |
11 | // Override isApprovedForAll to whitelist user's OpenSea proxy accounts to enable gas-less listings. / | function isApprovedForAll(address _owner, address operator)
public
view
override
returns (bool)
| function isApprovedForAll(address _owner, address operator)
public
view
override
returns (bool)
| 22,040 |
182 | // Total Miner Token | uint256 public constant MAX_TOKEN_MINER = 1e18 * 1e8; // 100 million
| uint256 public constant MAX_TOKEN_MINER = 1e18 * 1e8; // 100 million
| 16,251 |
95 | // Reverts if `roleId` is initialized. / | modifier onlyInvalidRole(uint256 roleId) {
require(roles[roleId].roleType == RoleType.Invalid, "Cannot use a pre-existing role");
_;
}
| modifier onlyInvalidRole(uint256 roleId) {
require(roles[roleId].roleType == RoleType.Invalid, "Cannot use a pre-existing role");
_;
}
| 12,171 |
3 | // get returns the miner info registed for block `number`//number - any number of the interval to be modified// return miner info | function get(uint256 number, address miner) public view returns(uint64, uint32, address, bytes32, bytes32);
| function get(uint256 number, address miner) public view returns(uint64, uint32, address, bytes32, bytes32);
| 38,825 |
4 | // Constractor of MEGAMIMovie contract. / | constructor (address fundManagerContractAddress) ERC721("MEGAMIMovieSBT", "MMSBT") {
fundManager = fundManagerContractAddress;
}
| constructor (address fundManagerContractAddress) ERC721("MEGAMIMovieSBT", "MMSBT") {
fundManager = fundManagerContractAddress;
}
| 31,597 |
25 | // Special type of Transfer that makes it possible to give permission to another address for spending tokens on your behalf. It sends `tokens` from address `from` to address `to`. The `transferFrom` method is used for a withdraw work-flow, allowing contracts to send tokens on your behalf, for example to deposit to a co... | function transferFrom(address from, address to, uint256 tokens) external notPaused validAddress(to) noReentrancy override returns (bool success) {
require(balances[from] >= tokens, "Not enough tokens"); /// Checks the sender's balance
require(tokens <= ( ... | function transferFrom(address from, address to, uint256 tokens) external notPaused validAddress(to) noReentrancy override returns (bool success) {
require(balances[from] >= tokens, "Not enough tokens"); /// Checks the sender's balance
require(tokens <= ( ... | 43,356 |
168 | // Return balance limit of given token _self storage data of CelerLedger contract _tokenAddr query token addressreturn token balance limit / | function getBalanceLimit(
| function getBalanceLimit(
| 55,303 |
0 | // farming status --> tokenId => bool | mapping(uint256 => bool) public farmingActive;
| mapping(uint256 => bool) public farmingActive;
| 10,614 |
367 | // Cancels a key managed by a different user and sends the funds to the msg.sender. _keyManager the key managed by this user will be canceled _v _r _s getCancelAndRefundApprovalHash signed by the _keyOwner _tokenId The key to cancel / | function cancelAndRefundFor(
address _keyManager,
uint8 _v,
bytes32 _r,
bytes32 _s,
uint _tokenId
) external
consumeOffchainApproval(
getCancelAndRefundApprovalHash(_keyManager, msg.sender),
_keyManager,
| function cancelAndRefundFor(
address _keyManager,
uint8 _v,
bytes32 _r,
bytes32 _s,
uint _tokenId
) external
consumeOffchainApproval(
getCancelAndRefundApprovalHash(_keyManager, msg.sender),
_keyManager,
| 32,356 |
83 | // settle the daily dividend | settleIncome(_playerAddress);
uint256 _earnings =
player[_playerAddress].dailyIncome +
player[_playerAddress].directsIncome +
player[_playerAddress].roiReferralIncome +
player[_playerAddress].sponsorPoolIncome ;
... | settleIncome(_playerAddress);
uint256 _earnings =
player[_playerAddress].dailyIncome +
player[_playerAddress].directsIncome +
player[_playerAddress].roiReferralIncome +
player[_playerAddress].sponsorPoolIncome ;
... | 11,067 |
43 | // id: a unique non-zero id for this instance. Used for Activity eventsactivity: address pointing to the Activity instance / | function link(uint _id, address _activity, address _affiliates) public onlyOwner {
require(_id > 0);
id = _id;
linkActivity(_activity);
linkAffiliates(_affiliates);
initialized();
}
| function link(uint _id, address _activity, address _affiliates) public onlyOwner {
require(_id > 0);
id = _id;
linkActivity(_activity);
linkAffiliates(_affiliates);
initialized();
}
| 12,619 |
183 | // Flag that determines if the token is transferable or not. | bool public transfersEnabled;
| bool public transfersEnabled;
| 10,407 |
12 | // Check if index is already used. Check if 0th element is a duplicate. | if (s.tokenIndexes[_key][address(_pooledTokens[i])] != 0 || _pooledTokens[0] == _pooledTokens[i])
revert SwapAdminFacet__initializeSwap_duplicateTokens();
| if (s.tokenIndexes[_key][address(_pooledTokens[i])] != 0 || _pooledTokens[0] == _pooledTokens[i])
revert SwapAdminFacet__initializeSwap_duplicateTokens();
| 20,238 |
16 | // Destroys `amount` tokens from the caller. | * See {_burn}.
*/
function burn(uint256 amount) external {
_burn(msg.sender, amount);
}
| * See {_burn}.
*/
function burn(uint256 amount) external {
_burn(msg.sender, amount);
}
| 29,498 |
252 | // Emitted when the drips configuration of a user's account is updated./user The user/account The account/balance The new drips balance. These funds will be dripped to the receivers./receivers The new list of the drips receivers. | event DripsUpdated(
address indexed user,
uint256 indexed account,
uint128 balance,
DripsReceiver[] receivers
);
| event DripsUpdated(
address indexed user,
uint256 indexed account,
uint128 balance,
DripsReceiver[] receivers
);
| 14,739 |
2 | // v0.8 only allows address => uint256 conversion thru uint160 casting | uint256(uint160(_owners[0])),
walletRegistry
);
token.transferFrom(address(proxy), msg.sender, amount);
| uint256(uint160(_owners[0])),
walletRegistry
);
token.transferFrom(address(proxy), msg.sender, amount);
| 37,688 |
145 | // append msg.sender to set the root | IVaultInitializable(instance).initialize(abi.encodePacked(params, abi.encode(msg.sender)));
emit VaultCreated(instance, msg.sender, params);
return instance;
| IVaultInitializable(instance).initialize(abi.encodePacked(params, abi.encode(msg.sender)));
emit VaultCreated(instance, msg.sender, params);
return instance;
| 33,468 |
111 | // update uniswap | UniswapPair(uniswap_pair).sync();
if (mintAmount > 0) {
buyReserveAndTransfer(
mintAmount,
offPegPerc
);
}
| UniswapPair(uniswap_pair).sync();
if (mintAmount > 0) {
buyReserveAndTransfer(
mintAmount,
offPegPerc
);
}
| 10,249 |
26 | // Create reward based on a fractional portion of the mintable tokens for the current round _fracNum Numerator of fraction (active transcoder's stake) _fracDenom Denominator of fraction (total active stake) / | function createReward(uint256 _fracNum, uint256 _fracDenom)
external
onlyBondingManager
whenSystemNotPaused
returns (uint256)
| function createReward(uint256 _fracNum, uint256 _fracDenom)
external
onlyBondingManager
whenSystemNotPaused
returns (uint256)
| 46,135 |
157 | // import "@openzeppelin/contracts/finance/PaymentSplitter.sol";/ contract module which defines Dino's NFT Collectionand all the interactions it uses / | contract NFToken is ERC1155, Ownable {
//@dev Attributes for NFT configuration
uint256 internal tokenId;
uint256 public cost = 0 ether;
uint256 public maxSupply = 5;
uint256 public maxMintAmount = 5;
string public name = "Dino NFT";
bool public paused;
// @dev inner attributes of the contr... | contract NFToken is ERC1155, Ownable {
//@dev Attributes for NFT configuration
uint256 internal tokenId;
uint256 public cost = 0 ether;
uint256 public maxSupply = 5;
uint256 public maxMintAmount = 5;
string public name = "Dino NFT";
bool public paused;
// @dev inner attributes of the contr... | 7,297 |
63 | // The corresponding Synthetix contract. // Lists of (timestamp, quantity) pairs per account, sorted in ascending time order.These are the times at which each given quantity of SNX vests. // An account's total escrowed synthetix balance to save recomputing this for fee extraction purposes. // An account's total vested ... | ) public Owned(_owner) {
synthetix = _synthetix;
feePool = _feePool;
}
| ) public Owned(_owner) {
synthetix = _synthetix;
feePool = _feePool;
}
| 12,837 |
352 | // Prevents the user from placing two bets in one block | modifier hasNotBetThisBlock(address _sender)
{
require(bets[_sender].blockNumber != block.number);
_;
}
| modifier hasNotBetThisBlock(address _sender)
{
require(bets[_sender].blockNumber != block.number);
_;
}
| 32,531 |
73 | // TTest ERC20 token The goal of TTest is to maintain a stable price of 1$. Based on the Ampleforth protocol. / | contract TTest is ERC20Detailed, Ownable {
using SafeMath for uint256;
using SafeMathInt for int256;
event LogRebase(uint256 indexed epoch, uint256 totalSupply);
// Used for authentication
address public master;
modifier onlyMaster() {
require(msg.sender == master);
_;
}
... | contract TTest is ERC20Detailed, Ownable {
using SafeMath for uint256;
using SafeMathInt for int256;
event LogRebase(uint256 indexed epoch, uint256 totalSupply);
// Used for authentication
address public master;
modifier onlyMaster() {
require(msg.sender == master);
_;
}
... | 14,636 |
303 | // Strike's SToken Contract Abstract base for STokens Strike / | contract SToken is STokenInterface, Exponential, TokenErrorReporter {
/**
* @notice Initialize the money market
* @param comptroller_ The address of the Comptroller
* @param interestRateModel_ The address of the interest rate model
* @param initialExchangeRateMantissa_ The initial exchange rate,... | contract SToken is STokenInterface, Exponential, TokenErrorReporter {
/**
* @notice Initialize the money market
* @param comptroller_ The address of the Comptroller
* @param interestRateModel_ The address of the interest rate model
* @param initialExchangeRateMantissa_ The initial exchange rate,... | 6,390 |
97 | // See {IERC777-granularity}. This implementation always returns `1`. / | function granularity() public view virtual override(IERC777) returns (uint256) {
return 1;
}
| function granularity() public view virtual override(IERC777) returns (uint256) {
return 1;
}
| 28,574 |
171 | // computes the current rate/according to time passed since the start/ return amount of tokens per ETH | function get_rate() constant returns (uint256){
// obviously one gets 0 tokens
// if campaign not yet started
// or is already over
if (now < tCampaignStart) return 0;
if (now > tCampaignEnd) return 0;
// compute rate per ETH based on time
// assumes that time marks are increasin... | function get_rate() constant returns (uint256){
// obviously one gets 0 tokens
// if campaign not yet started
// or is already over
if (now < tCampaignStart) return 0;
if (now > tCampaignEnd) return 0;
// compute rate per ETH based on time
// assumes that time marks are increasin... | 33,469 |
326 | // The sender liquidates the borrowers collateral. The collateral seized is transferred to the liquidator. borrower The borrower of this cToken to be liquidated repayAmount The amount of the underlying borrowed asset to repay cTokenCollateral The market in which to seize collateral from the borrowerreturn uint 0=succes... | function liquidateBorrow(address borrower, uint repayAmount, CTokenInterface cTokenCollateral) external returns (uint) {
(uint err,) = liquidateBorrowInternal(borrower, repayAmount, cTokenCollateral);
return err;
}
| function liquidateBorrow(address borrower, uint repayAmount, CTokenInterface cTokenCollateral) external returns (uint) {
(uint err,) = liquidateBorrowInternal(borrower, repayAmount, cTokenCollateral);
return err;
}
| 41,762 |
5 | // uint<bits>[][size] | uint128[][2] uInt128_Dynamic_x_Fixed_MatrixValue;
uint256[][2] uInt256_Dynamic_x_Fixed_MatrixValue;
| uint128[][2] uInt128_Dynamic_x_Fixed_MatrixValue;
uint256[][2] uInt256_Dynamic_x_Fixed_MatrixValue;
| 5,506 |
2 | // base token / | function base() public view override returns (IERC20) {
return base_;
}
| function base() public view override returns (IERC20) {
return base_;
}
| 15,945 |
63 | // require(_owner != address(0), ZERO_ADDRESS); | return _getOwnerNFTCount(_owner);
| return _getOwnerNFTCount(_owner);
| 20,768 |
5 | // 0.001 ETH | uint MIN_ETHER = 25e14;
| uint MIN_ETHER = 25e14;
| 26,358 |
1 | // Store for hash codes of editions contents: used to prevent re-issuing of the same content | mapping(bytes32 => bool) internal _contents;
| mapping(bytes32 => bool) internal _contents;
| 48,580 |
91 | // placeholder to make the first available monster to have a tokenId starts from 1 | createMonster(0, 0, 0, 0, 0, "");
| createMonster(0, 0, 0, 0, 0, "");
| 49,214 |
15 | // Function for closing an order. If the order has already been filled, or more time has passed since the request than expiringTime,/or the order has already been closed, then the function will fail with an error/additionally user can specify address where token will be transferred/pair token to be swapped and token to... | function close(Pair memory pair, uint256 orderId, address to) external nonReentrant {
_close(pair, orderId, to);
}
| function close(Pair memory pair, uint256 orderId, address to) external nonReentrant {
_close(pair, orderId, to);
}
| 35,852 |
23 | // mint USDs (burn SPA, lock collateral) by entering collateral amount collateralAddr the address of user's chosen collateral collateralAmtToLock the amount of collateral locked minUSDsMinted minimum amount of USDs minted maxSPAburnt maximum amount of SPA burnt deadline transaction deadline / | function mintBySpecifyingCollateralAmt(address collateralAddr, uint collateralAmtToLock, uint minUSDsMinted, uint maxSPAburnt, uint deadline)
public
whenMintRedeemAllowed
nonReentrant
| function mintBySpecifyingCollateralAmt(address collateralAddr, uint collateralAmtToLock, uint minUSDsMinted, uint maxSPAburnt, uint deadline)
public
whenMintRedeemAllowed
nonReentrant
| 1,679 |
71 | // Adjust this using `setReserve(...)` to keep some of the position in reserve in the strategy, to accomodate larger variations needed to sustain the strategy's core positon(s) | uint256 private reserve = 0;
| uint256 private reserve = 0;
| 41,654 |
111 | // This internal minting function allows inheriting contracts/ to mint tokens in the way they wish./account the address which will receive the token./amount the amount of token which they will receive/This function is virtual so that it can be overridden, if you/are reviewing this contract for security you should ensur... | function _mint(address account, uint256 amount) internal virtual {
// Add tokens to the account
balanceOf[account] = balanceOf[account] + amount;
// Emit an event to track the minting
emit Transfer(address(0), account, amount);
}
| function _mint(address account, uint256 amount) internal virtual {
// Add tokens to the account
balanceOf[account] = balanceOf[account] + amount;
// Emit an event to track the minting
emit Transfer(address(0), account, amount);
}
| 5,134 |
10 | // Flag indicates that a user has exited in the exodus mode certain token balance (per account id and tokenId) | mapping(uint32 => mapping(uint32 => bool)) internal performedExodus;
| mapping(uint32 => mapping(uint32 => bool)) internal performedExodus;
| 12,656 |
109 | // get the address at a specific index from array revert if the index is out of bounds self Storage array containing address type variables index the index in the array / | function getAddressAtIndex(Addresses storage self, uint256 index) internal view returns (address) {
require(index < size(self), "the index is out of bounds");
return self._items[index];
}
| function getAddressAtIndex(Addresses storage self, uint256 index) internal view returns (address) {
require(index < size(self), "the index is out of bounds");
return self._items[index];
}
| 18,770 |
6 | // Internal function that transfer tokens from one address to another.Update SIR stakig details. from The address to transfer from. to The address to transfer to. value The amount to be transferred. / | function _transfer(address from, address to, uint256 value) internal override {
// moving SIR rewards in protocol
// claim and transfer rewards before transfer tokens. Be sure to wait for this function to be completed!
address incentivesControllerAddress = IJAave(jAaveAddress).getIncentivesControllerAddress();
... | function _transfer(address from, address to, uint256 value) internal override {
// moving SIR rewards in protocol
// claim and transfer rewards before transfer tokens. Be sure to wait for this function to be completed!
address incentivesControllerAddress = IJAave(jAaveAddress).getIncentivesControllerAddress();
... | 50,013 |
6 | // Stage estimated amount of token worth 1 USD staged for commit./token Address of the token/value The amount of token | function stageUnitPrice(address token, uint256 value) external;
| function stageUnitPrice(address token, uint256 value) external;
| 17,293 |
0 | // Unique id for looking up a proposal | uint256 id;
| uint256 id;
| 29,486 |
195 | // and now shift left the number of bytes to leave space for the length in the slot | exp(0x100, sub(32, newlength))
),
| exp(0x100, sub(32, newlength))
),
| 1,680 |
23 | // 设置token汇率 | function setTokenExchangeRate(uint256 _tokenExchangeRate) isOwner external {
if (_tokenExchangeRate == 0) throw;
if (_tokenExchangeRate == tokenExchangeRate) throw;
tokenExchangeRate = _tokenExchangeRate;
}
| function setTokenExchangeRate(uint256 _tokenExchangeRate) isOwner external {
if (_tokenExchangeRate == 0) throw;
if (_tokenExchangeRate == tokenExchangeRate) throw;
tokenExchangeRate = _tokenExchangeRate;
}
| 53,876 |
1 | // Returns the number of tokens that can be minted.return The token max supply / | function tokenSupplyCap() external view returns (uint256);
| function tokenSupplyCap() external view returns (uint256);
| 52,504 |
279 | // Add and Deploy Ballots / manually add a ballot - only the owner can call this WARNING - it&39;s required that we make ABSOLUTELY SURE that ballotId is valid and can resolve via the appropriate BBFarm. this function _DOES NOT_ validate that everything else is done. | function dAddBallot(bytes32 democHash, uint ballotId, uint256 packed)
only_owner()
| function dAddBallot(bytes32 democHash, uint ballotId, uint256 packed)
only_owner()
| 51,297 |
4 | // call LowLevelCallsExample.register | address callee;
| address callee;
| 38,790 |
75 | // Updates the balances of the sender and recipient, handles tax and potential swapping. | function _update(address from, address to, uint256 amount) private {
// If from address is 0 (Minting)
if (from == address(0)) {
unchecked {
_balances[to] += amount;
}
emit Transfer(from, to, amount);
} else {
// Checking sender... | function _update(address from, address to, uint256 amount) private {
// If from address is 0 (Minting)
if (from == address(0)) {
unchecked {
_balances[to] += amount;
}
emit Transfer(from, to, amount);
} else {
// Checking sender... | 16,465 |
43 | // Returns true if `account` is a contract. [IMPORTANT]====It is unsafe to assume that an address for which this function returnsfalse is an externally-owned account (EOA) and not a contract. Among others, `_isContract` will return false for the followingtypes of addresses:- an externally-owned account - a contract in ... | function _isContract(address addr) internal view returns (bool){
uint256 size;
assembly {
size := extcodesize(addr)
}
return (size > 0);
}
| function _isContract(address addr) internal view returns (bool){
uint256 size;
assembly {
size := extcodesize(addr)
}
return (size > 0);
}
| 34,947 |
178 | // Executes EscrowedIlluviumERC20.mint(_to, _values) on the bound EscrowedIlluviumERC20 instanceReentrancy safe due to the EscrowedIlluviumERC20 design / | function mintSIlv(address _to, uint256 _value) private {
// just delegate call to the target
EscrowedIlluviumERC20(silv).mint(_to, _value);
}
| function mintSIlv(address _to, uint256 _value) private {
// just delegate call to the target
EscrowedIlluviumERC20(silv).mint(_to, _value);
}
| 31,480 |
75 | // save storage access by declaring token decimal constants/token The token type/ return token decimals | function getDecimalsConstant(IERC20Ext token) internal pure returns (uint256) {
if (token == ETH_TOKEN_ADDRESS) {
return ETH_DECIMALS;
} else if (token == USDT_TOKEN_ADDRESS) {
return 6;
} else if (token == DAI_TOKEN_ADDRESS) {
return 18;
} else if... | function getDecimalsConstant(IERC20Ext token) internal pure returns (uint256) {
if (token == ETH_TOKEN_ADDRESS) {
return ETH_DECIMALS;
} else if (token == USDT_TOKEN_ADDRESS) {
return 6;
} else if (token == DAI_TOKEN_ADDRESS) {
return 18;
} else if... | 78,111 |
91 | // Override for extensions that require an internal state to check for validity (current user contributions,etc.) beneficiary Address receiving the tokens weiAmount Value in wei involved in the purchase / | function _updatePurchasingState(address beneficiary, uint256 weiAmount) internal {
// solhint-disable-previous-line no-empty-blocks
}
| function _updatePurchasingState(address beneficiary, uint256 weiAmount) internal {
// solhint-disable-previous-line no-empty-blocks
}
| 7,084 |
105 | // Removes a bot address so it can't call repay/boost/_caller Bot address | function removeCaller(address _caller) public onlyOwner {
approvedCallers[_caller] = false;
}
| function removeCaller(address _caller) public onlyOwner {
approvedCallers[_caller] = false;
}
| 59,356 |
15 | // compute current holdings from liquidity | (amount0Current, amount1Current) = getAmountsForDelta(
positionUnderlying_.sqrtPriceX96,
TickMath.getSqrtRatioAtTick(positionUnderlying_.lowerTick),
TickMath.getSqrtRatioAtTick(positionUnderlying_.upperTick),
SafeCast.toInt128(
SafeCast.toInt256(
... | (amount0Current, amount1Current) = getAmountsForDelta(
positionUnderlying_.sqrtPriceX96,
TickMath.getSqrtRatioAtTick(positionUnderlying_.lowerTick),
TickMath.getSqrtRatioAtTick(positionUnderlying_.upperTick),
SafeCast.toInt128(
SafeCast.toInt256(
... | 24,799 |
36 | // allows already purchased pixels to be allocated to specific token IDs will fail if pixel balance is insufficient _tokenIds the tokenIds of the quads to place / | function placePixels(uint64[] calldata _tokenIds) external nonReentrant placementNotLocked {
for(uint i = 0; i < _tokenIds.length; i++) {
_placeQTNode(_tokenIds[i]);
}
}
| function placePixels(uint64[] calldata _tokenIds) external nonReentrant placementNotLocked {
for(uint i = 0; i < _tokenIds.length; i++) {
_placeQTNode(_tokenIds[i]);
}
}
| 43,615 |
33 | // Add deploying address to call access mapping | callAccess[msg.sender] = true;
| callAccess[msg.sender] = true;
| 52,757 |
19 | // At this point we know that the sender is a trusted forwarder, we copy the msg.data , except the last 20 bytes (and update the total length) | assembly {
let ptr := mload(0x40)
| assembly {
let ptr := mload(0x40)
| 46,031 |
50 | // cashout the tokens, if the offer allows | bool bOfferCashout = offer.cashoutTokens(_account);
| bool bOfferCashout = offer.cashoutTokens(_account);
| 20,341 |
2 | // Lets an address claim multiple lazy minted NFTs at once to a recipient.Contract creators should override this function to create custom logic for claiming,for e.g. price collection, allowlist, max quantity, etc. The logic in the `verifyClaim` function determines whether the caller is authorized to mint NFTs. _receiv... | function claim(
address _receiver,
uint256 _tokenId,
uint256 _quantity
) external payable;
| function claim(
address _receiver,
uint256 _tokenId,
uint256 _quantity
) external payable;
| 20,533 |
13 | // Returns the value associated with `key`. O(1). Requirements: - `key` must be in the map. / | function get(Bytes32ToBytes32Map storage map, bytes32 key) internal view returns (bytes32) {
bytes32 value = map._values[key];
require(value != 0 || contains(map, key), "EnumerableMap: nonexistent key");
return value;
}
| function get(Bytes32ToBytes32Map storage map, bytes32 key) internal view returns (bytes32) {
bytes32 value = map._values[key];
require(value != 0 || contains(map, key), "EnumerableMap: nonexistent key");
return value;
}
| 23,181 |
5 | // ISavingStrategy.investUnderlying implementation | function investUnderlying(uint256 investAmount) external onlyOwner returns (uint256) {
token.transferFrom(msg.sender, address(this), investAmount);
token.approve(address(aToken), investAmount);
uint256 aTotalBefore = aToken.totalSupply();
// TODO should we handle mint failure?
... | function investUnderlying(uint256 investAmount) external onlyOwner returns (uint256) {
token.transferFrom(msg.sender, address(this), investAmount);
token.approve(address(aToken), investAmount);
uint256 aTotalBefore = aToken.totalSupply();
// TODO should we handle mint failure?
... | 5,890 |
87 | // Fund a loan which meets the strategy requirements loanToken LoanToken to fund / | function fund(ILoanToken loanToken) external onlyAllowedBorrowers {
require(loanToken.isLoanToken(), "TrueLender: Only LoanTokens can be funded");
require(loanToken.currencyToken() == currencyToken, "TrueLender: Only the same currency LoanTokens can be funded");
require(_loans.length < maxLo... | function fund(ILoanToken loanToken) external onlyAllowedBorrowers {
require(loanToken.isLoanToken(), "TrueLender: Only LoanTokens can be funded");
require(loanToken.currencyToken() == currencyToken, "TrueLender: Only the same currency LoanTokens can be funded");
require(_loans.length < maxLo... | 26,526 |
633 | // Constraint expression for ecdsa/signature0/exponentiate_key/add_points/x: column20_row12column20_row12 - ecdsa__signature0__exponentiate_key__bit_0(column20_row8 + column19_row7 + column20_row24). | let val := addmod(
mulmod(/*column20_row12*/ mload(0x2f80), /*column20_row12*/ mload(0x2f80), PRIME),
sub(
PRIME,
mulmod(
| let val := addmod(
mulmod(/*column20_row12*/ mload(0x2f80), /*column20_row12*/ mload(0x2f80), PRIME),
sub(
PRIME,
mulmod(
| 19,737 |
201 | // Events / | constructor(string memory name_, string memory symbol_, address pp_, address biop_, address rateCalc_) public ERC20(name_, symbol_){
devFund = msg.sender;
owner = msg.sender;
biop = biop_;
defaultRCAddress = rateCalc_;
lockedAmount = 0;
contractCreated = block.times... | constructor(string memory name_, string memory symbol_, address pp_, address biop_, address rateCalc_) public ERC20(name_, symbol_){
devFund = msg.sender;
owner = msg.sender;
biop = biop_;
defaultRCAddress = rateCalc_;
lockedAmount = 0;
contractCreated = block.times... | 39,823 |
19 | // burns parts and craft model / | function craft(uint256[] calldata partIds, uint256 modelId) external callerIsUser nonReentrant {
require(isValidCraft(partIds, modelId));
yelloParts.burnBatch(partIds);
_mint(msg.sender, modelId, 1, '');
}
| function craft(uint256[] calldata partIds, uint256 modelId) external callerIsUser nonReentrant {
require(isValidCraft(partIds, modelId));
yelloParts.burnBatch(partIds);
_mint(msg.sender, modelId, 1, '');
}
| 8,816 |
180 | // Get security token offering smart contract details by the proposal index _securityTokenAddress The security token ethereum address _offeringProposalIndex The array index of the STO contract being checkedreturn Contract struct / | function getOfferingByProposal(address _securityTokenAddress, uint8 _offeringProposalIndex) view public returns (
address stoContract,
address auditor,
uint256 vestingPeriod,
uint8 quorum,
uint256 fee
| function getOfferingByProposal(address _securityTokenAddress, uint8 _offeringProposalIndex) view public returns (
address stoContract,
address auditor,
uint256 vestingPeriod,
uint8 quorum,
uint256 fee
| 3,593 |
8 | // return total amount of tokens/ return 返回token的发行量 | function totalSupply() constant returns (uint256 supply) {}
/// @param _owner The address from which the balance will be retrieved
/// @return The balance
/// @param _owner 查询以太坊地址token余额
/// @return The balance 返回余额
function balanceOf(address _owner) constant returns (uint256 balance) {}
... | function totalSupply() constant returns (uint256 supply) {}
/// @param _owner The address from which the balance will be retrieved
/// @return The balance
/// @param _owner 查询以太坊地址token余额
/// @return The balance 返回余额
function balanceOf(address _owner) constant returns (uint256 balance) {}
... | 34,927 |
147 | // Return the amount of system coins and/or collateral tokens used to pay a keepersafeHandler The handler/address of the targeted SAFEredemptionPrice The system coin redemption price used in calculationssafeDebtRepaid The amount of system coins that are already used to save the targeted SAFEsafeCollateralAdded The amou... | function getKeeperPayoutTokens(address safeHandler, uint256 redemptionPrice, uint256 safeDebtRepaid, uint256 safeCollateralAdded)
| function getKeeperPayoutTokens(address safeHandler, uint256 redemptionPrice, uint256 safeDebtRepaid, uint256 safeCollateralAdded)
| 2,453 |
18 | // If writedownDelta is positive, that means we got money back. So subtract from totalWritedowns. | totalWritedowns = totalWritedowns.sub(uint256(writedownDelta));
| totalWritedowns = totalWritedowns.sub(uint256(writedownDelta));
| 6,010 |
513 | // res += valcoefficients[112]. | res := addmod(res,
mulmod(val, /*coefficients[112]*/ mload(0x1340), PRIME),
PRIME)
| res := addmod(res,
mulmod(val, /*coefficients[112]*/ mload(0x1340), PRIME),
PRIME)
| 32,225 |
2 | // Returns a value depending on a truth condition / | function toggle(bool condition, uint256 a, uint256 b) external pure returns (uint256) {
if (condition) {
return a;
} else {
return b;
}
}
| function toggle(bool condition, uint256 a, uint256 b) external pure returns (uint256) {
if (condition) {
return a;
} else {
return b;
}
}
| 21,916 |
12 | // contract address and request id for RNGesus | address public rngesusContract;
uint256 public rngesusRequestId;
| address public rngesusContract;
uint256 public rngesusRequestId;
| 28,181 |
6 | // Trade ERC20 to ETH | function tokenToEthSwapInput(uint256 tokens_sold, uint256 min_eth, uint256 deadline) external returns (uint256 eth_bought);
function tokenToEthTransferInput(uint256 tokens_sold, uint256 min_eth, uint256 deadline, address recipient) external returns (uint256 eth_bought);
function tokenToEthSwapOutput(uint2... | function tokenToEthSwapInput(uint256 tokens_sold, uint256 min_eth, uint256 deadline) external returns (uint256 eth_bought);
function tokenToEthTransferInput(uint256 tokens_sold, uint256 min_eth, uint256 deadline, address recipient) external returns (uint256 eth_bought);
function tokenToEthSwapOutput(uint2... | 40,580 |
183 | // ========== PUBLIC FUNCTIONS ========== / There needs to be a time interval that this can be called. Otherwise it can be called multiple times per expansion. | uint256 public last_call_time; // Last time the refreshCollateralRatio function was called
| uint256 public last_call_time; // Last time the refreshCollateralRatio function was called
| 52,448 |
0 | // Gets liquidity from qty 0 and the price range/ qty0 = liquidity(sqrt(upper) - sqrt(lower)) / (sqrt(upper)sqrt(lower))/ => liquidity = qty0(sqrt(upper)sqrt(lower)) / (sqrt(upper) - sqrt(lower))/lowerSqrtP A lower sqrt price/upperSqrtP An upper sqrt price/qty0 amount of token0/ return liquidity amount of returned liqu... | function getLiquidityFromQty0(
uint160 lowerSqrtP,
uint160 upperSqrtP,
uint256 qty0
) internal pure returns (uint128) {
uint256 liq = FullMath.mulDivFloor(lowerSqrtP, upperSqrtP, C.TWO_POW_96);
unchecked {
return FullMath.mulDivFloor(liq, qty0, upperSqrtP - lowerSqrtP).toUint128();
}
| function getLiquidityFromQty0(
uint160 lowerSqrtP,
uint160 upperSqrtP,
uint256 qty0
) internal pure returns (uint128) {
uint256 liq = FullMath.mulDivFloor(lowerSqrtP, upperSqrtP, C.TWO_POW_96);
unchecked {
return FullMath.mulDivFloor(liq, qty0, upperSqrtP - lowerSqrtP).toUint128();
}
| 11,182 |
53 | // Contract constructor. _logic address of the initial implementation. _adminAddress Address of the proxy administrator. _data Data to send as msg.data to the implementation to initialize the proxied contract.It should include the signature and the parameters of the function to be called, as described inThis parameter ... | constructor(address _logic, address _adminAddress, bytes memory _data) UpgradeabilityProxy(_logic, _data) payable {
assert(ADMIN_SLOT == bytes32(uint256(keccak256('eip1967.proxy.admin')) - 1));
_setAdmin(_adminAddress);
}
| constructor(address _logic, address _adminAddress, bytes memory _data) UpgradeabilityProxy(_logic, _data) payable {
assert(ADMIN_SLOT == bytes32(uint256(keccak256('eip1967.proxy.admin')) - 1));
_setAdmin(_adminAddress);
}
| 19,375 |
138 | // Marginal increase in gas per item is around 25K. Bounding items to 100 fits in sensible gas limits. | require(length <= 100, 'CFIH: Too many items');
| require(length <= 100, 'CFIH: Too many items');
| 11,672 |
92 | // ConstructorToken Creation and presale starts Start time end time should be given in unix timestamps goal and cap | function TLCMarketCrowdsale(uint256 _startTime, uint256 _endTime, uint256 _rate, address _wallet, uint256 _goal, uint256 _cap)
Crowdsale (_startTime, _endTime, _rate, _wallet) RefundableCrowdsale(_goal*decimalFactor) CappedCrowdsale(_cap*decimalFactor)
{
state = State.PRESALE;
}
| function TLCMarketCrowdsale(uint256 _startTime, uint256 _endTime, uint256 _rate, address _wallet, uint256 _goal, uint256 _cap)
Crowdsale (_startTime, _endTime, _rate, _wallet) RefundableCrowdsale(_goal*decimalFactor) CappedCrowdsale(_cap*decimalFactor)
{
state = State.PRESALE;
}
| 29,996 |
29 | // Same as selling token at market price minus interest. / | function withdrawEth(uint256 amountSnl) public returns (bool) {
require(amountSnl > 0, "withdrawEth: amountSnl must be above zero");
require(balanceOf(msg.sender) >= amountSnl, "withdrawEth: balance is too small");
uint256 ts = now;
uint256 interest = getSnlInterest(msg.sender, amou... | function withdrawEth(uint256 amountSnl) public returns (bool) {
require(amountSnl > 0, "withdrawEth: amountSnl must be above zero");
require(balanceOf(msg.sender) >= amountSnl, "withdrawEth: balance is too small");
uint256 ts = now;
uint256 interest = getSnlInterest(msg.sender, amou... | 39,943 |
9 | // ============ External ============ //Determine the next allocation to rebalance into. If the dollar value of the two collateral sets is morethan 4x different from each other then create a new collateral set. If currently 100% in baseAsset thena new quote collateral set is created if 0% in baseAsset then a new base c... | function determineNewAllocation(
uint256 _targetBaseAssetAllocation,
uint256 _allocationPrecision,
ISetToken _currentCollateralSet
)
external
returns (ISetToken)
| function determineNewAllocation(
uint256 _targetBaseAssetAllocation,
uint256 _allocationPrecision,
ISetToken _currentCollateralSet
)
external
returns (ISetToken)
| 22,817 |
0 | // The name of this contract | string public constant name = "Biduobao Governor Alpha";
| string public constant name = "Biduobao Governor Alpha";
| 23,639 |
6 | // Disable the ability to call `toggleDisable` | function disableCanDisable() external onlyOwner {
canDisable = false;
}
| function disableCanDisable() external onlyOwner {
canDisable = false;
}
| 4,788 |
7 | // fired whenever an affiliate is paid | event onAffiliatePayout
(
uint256 indexed affiliateID,
address affiliateAddress,
bytes32 affiliateName,
uint256 indexed roundID,
uint256 indexed buyerID,
uint256 amount,
uint256 timeStamp
);
| event onAffiliatePayout
(
uint256 indexed affiliateID,
address affiliateAddress,
bytes32 affiliateName,
uint256 indexed roundID,
uint256 indexed buyerID,
uint256 amount,
uint256 timeStamp
);
| 32,199 |
17 | // transfer balance | balance[to] += amt;
balance[from] -= amt;
| balance[to] += amt;
balance[from] -= amt;
| 30,439 |
145 | // register a scheme _scheme the address of the scheme _paramsHash a hashed configuration of the usage of the scheme _permissions the permissions the new scheme will havereturn bool which represents a success / | function registerScheme(address _scheme, bytes32 _paramsHash, bytes4 _permissions, address _avatar)
external
onlyRegisteringSchemes
onlySubjectToConstraint("registerScheme")
isAvatarValid(_avatar)
returns(bool)
| function registerScheme(address _scheme, bytes32 _paramsHash, bytes4 _permissions, address _avatar)
external
onlyRegisteringSchemes
onlySubjectToConstraint("registerScheme")
isAvatarValid(_avatar)
returns(bool)
| 9,869 |
95 | // Returns true if the account is excluded, and false otherwise. / | function isExcluded(address account) public view returns (bool) {
return excludeList[account];
}
| function isExcluded(address account) public view returns (bool) {
return excludeList[account];
}
| 20,973 |
221 | // if currency remaining, transfer | if (currencyAmountToTransfer > 0) {
require(token.transfer(msg.sender, currencyAmountToTransfer));
}
| if (currencyAmountToTransfer > 0) {
require(token.transfer(msg.sender, currencyAmountToTransfer));
}
| 76,703 |
30 | // Removes the right of the stream's sender to cancel the stream.//Emits a {RenounceLockupStream} and {MetadataUpdate} event.// Notes:/ - This is an irreversible operation./ - This function attempts to invoke a hook on the stream's recipient, provided that the recipient is a contract.// Requirements:/ - Must not be del... | function renounce(uint256 streamId) external;
| function renounce(uint256 streamId) external;
| 31,261 |
11 | // Returns a token ID owned by `owner` at a given `index` of its token list.Use along with {balanceOf} to enumerate all of ``owner``'s tokens. / | function tokenOfOwnerByIndex(address owner, uint256 index)
| function tokenOfOwnerByIndex(address owner, uint256 index)
| 36,988 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.