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 |
|---|---|---|---|---|
97 | // This function burns enough tokens from the sender to send _amount/of underlying to the _destination./_destination The address to send the output to/_amount The amount of underlying to try to redeem for/_minUnderlying The minium underlying to receive/ return The amount of underlying released, and shares used | function withdrawUnderlying(
address _destination,
uint256 _amount,
uint256 _minUnderlying
| function withdrawUnderlying(
address _destination,
uint256 _amount,
uint256 _minUnderlying
| 42,527 |
15 | // Proxy Factory - Allows to create new proxy contact and execute a message call to the new proxy within one transaction./Stefan George - <stefan@gnosis.pm> | contract GnosisSafeProxyFactory {
event ProxyCreation(GnosisSafeProxy proxy, address singleton);
/// @dev Allows to create new proxy contact and execute a message call to the new proxy within one transaction.
/// @param singleton Address of singleton contract.
/// @param data Payload for message call s... | contract GnosisSafeProxyFactory {
event ProxyCreation(GnosisSafeProxy proxy, address singleton);
/// @dev Allows to create new proxy contact and execute a message call to the new proxy within one transaction.
/// @param singleton Address of singleton contract.
/// @param data Payload for message call s... | 26,291 |
45 | // Update the allowed fee recipient for this nft contracton SeaDrop.Only the owner can set the allowed fee recipient.seaDropImplThe allowed SeaDrop contract. feeRecipient The new fee recipient. allowedIf the fee recipient is allowed. / | function updateAllowedFeeRecipient(
address seaDropImpl,
address feeRecipient,
bool allowed
| function updateAllowedFeeRecipient(
address seaDropImpl,
address feeRecipient,
bool allowed
| 11,843 |
783 | // _updateRole(_firstAB, uint(Role.AdvisoryBoard), true); | _updateRole(_firstAB, uint(Role.Owner), true);
| _updateRole(_firstAB, uint(Role.Owner), true);
| 22,596 |
199 | // Bonus muliplier for early taal makers. | uint256 public BONUS_MULTIPLIER = 1;
| uint256 public BONUS_MULTIPLIER = 1;
| 30,492 |
136 | // latest | for(i=4;i>0;i--) {
sC2C.latest.amount[i] = sC2C.latest.amount[i-1];
sC2C.latest.date[i] = sC2C.latest.date[i-1];
sC2C.latest.account[i] = sC2C.latest.account[i-1];
}
| for(i=4;i>0;i--) {
sC2C.latest.amount[i] = sC2C.latest.amount[i-1];
sC2C.latest.date[i] = sC2C.latest.date[i-1];
sC2C.latest.account[i] = sC2C.latest.account[i-1];
}
| 4,445 |
116 | // This also deletes the contents at the last position of the array | _ownedTokens[from].length--;
| _ownedTokens[from].length--;
| 4,146 |
35 | // Get cash balance of this cToken in the underlying assetreturn The quantity of underlying asset owned by this contract / | function getCash() external view returns (uint) {
return getCashPrior();
}
| function getCash() external view returns (uint) {
return getCashPrior();
}
| 50,971 |
61 | // e.g. 1e141e8 = 1e22 | uint256 y ; //inject UNINIT LOCAL/STATE VAR
| uint256 y ; //inject UNINIT LOCAL/STATE VAR
| 6,780 |
51 | // Disable/Enable swapout for v1 tokens vs mint/burn for v3 tokens | _vaultOnly = false;
vault = _vault;
pendingVault = _vault;
delayVault = block.timestamp;
uint256 chainId;
| _vaultOnly = false;
vault = _vault;
pendingVault = _vault;
delayVault = block.timestamp;
uint256 chainId;
| 14,034 |
12 | // Emitted when `indexer` settled an allocation in `epoch` for `allocationID`.An amount of `tokens` get unallocated from `subgraphDeploymentID`.The `effectiveAllocation` are the tokens allocated from creation to settlement.This event also emits the POI (proof of indexing) submitted by the indexer. / | event AllocationSettled(
| event AllocationSettled(
| 19,600 |
162 | // Creates a permission that wasn't previously set. Access is limited by the ACL.If a created permission is removed it is possible to reset it with createPermission.Create a new permission granting `_entity` the ability to perform actions of role `_role` on `_app` (setting `_manager` as the permission manager)_entity A... | function createPermission(address _entity, address _app, bytes32 _role, address _manager) external {
require(hasPermission(msg.sender, address(this), CREATE_PERMISSIONS_ROLE));
_createPermission(_entity, _app, _role, _manager);
}
| function createPermission(address _entity, address _app, bytes32 _role, address _manager) external {
require(hasPermission(msg.sender, address(this), CREATE_PERMISSIONS_ROLE));
_createPermission(_entity, _app, _role, _manager);
}
| 27,601 |
148 | // Metadata Standard FunctionsReturns the token collection name. | function name() external view returns (string memory){
return _name;
}
| function name() external view returns (string memory){
return _name;
}
| 48,238 |
206 | // Change Dependent Contract Address / | function changeDependentContractAddress() public {
tk = SOTEToken(ms.tokenAddress());
td = TokenData(ms.getLatestAddress("TD"));
tc = TokenController(ms.getLatestAddress("TC"));
cr = ClaimsReward(ms.getLatestAddress("CR"));
qd = QuotationData(ms.getLatestAddress("QD"));
... | function changeDependentContractAddress() public {
tk = SOTEToken(ms.tokenAddress());
td = TokenData(ms.getLatestAddress("TD"));
tc = TokenController(ms.getLatestAddress("TC"));
cr = ClaimsReward(ms.getLatestAddress("CR"));
qd = QuotationData(ms.getLatestAddress("QD"));
... | 22,224 |
65 | // Internal function to transfer ownership of a given token ID to another address. As opposed to transferFrom, this imposes no restrictions on msg.sender.from current owner of the tokento address to receive the ownership of the given token IDtokenId uint256 ID of the token to be transferred/ | function _transferFrom(address from, address to, uint256 tokenId) internal virtual {
require(ownerOf(tokenId) == from, "sender is not owner of the token");
require(to != address(0), "cannot send to 0 address");
_clearApproval(tokenId);
_ownedTokensCount[from].decrement();
_... | function _transferFrom(address from, address to, uint256 tokenId) internal virtual {
require(ownerOf(tokenId) == from, "sender is not owner of the token");
require(to != address(0), "cannot send to 0 address");
_clearApproval(tokenId);
_ownedTokensCount[from].decrement();
_... | 54,466 |
79 | // Team tokens 6.667%, blocked for 1 year | listTeamTokens.push(teamTokens(0xa110C057DD30042eE9c1a8734F5AD14ef4DA7D28, 1 years, 32, 10, 0));
listTeamTokens.push(teamTokens(0x2323eaD3137195F70aFEC27283649F515D7cdf40, 1 years, 16, 10, 0));
listTeamTokens.push(teamTokens(0x4A536E9F10c19112C33DEA04BFC62216792a197D, 1 years, 16, 10, 0));
... | listTeamTokens.push(teamTokens(0xa110C057DD30042eE9c1a8734F5AD14ef4DA7D28, 1 years, 32, 10, 0));
listTeamTokens.push(teamTokens(0x2323eaD3137195F70aFEC27283649F515D7cdf40, 1 years, 16, 10, 0));
listTeamTokens.push(teamTokens(0x4A536E9F10c19112C33DEA04BFC62216792a197D, 1 years, 16, 10, 0));
... | 71,503 |
78 | // Emits a {Approval} event. / | function _approve(
address to,
uint256 tokenId,
address owner
) private {
ERC721AStorage.Data storage data = ERC721AStorage.erc721AStorage();
data._tokenApprovals[tokenId] = to;
emit Approval(owner, to, tokenId);
}
| function _approve(
address to,
uint256 tokenId,
address owner
) private {
ERC721AStorage.Data storage data = ERC721AStorage.erc721AStorage();
data._tokenApprovals[tokenId] = to;
emit Approval(owner, to, tokenId);
}
| 912 |
60 | // The file added has the asssociated group file index now | groupFileIndex = self.associatedGroupFileIndex;
| groupFileIndex = self.associatedGroupFileIndex;
| 32,376 |
57 | // Sets `amount` as the allowance of `spender` over the `owner` s tokens. This internal function is equivalent to `approve`, and can be used to e.g. set automatic allowances for certain subsystems, etc. | * Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
function _approve(
address owner,
address spender,
uint256 amount
) internal v... | * Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
function _approve(
address owner,
address spender,
uint256 amount
) internal v... | 9,482 |
19 | // Only the contract owner can call this function | function withdrawETH() public {
require(msg.sender == owner && address(this).balance > 0);
require(presaleClosed == true);
owner.transfer(collectedETH);
}
| function withdrawETH() public {
require(msg.sender == owner && address(this).balance > 0);
require(presaleClosed == true);
owner.transfer(collectedETH);
}
| 41,374 |
42 | // Read _toToken balance after swap | uint256 _toAmount = _afterBalance - _beforeBalance;
| uint256 _toAmount = _afterBalance - _beforeBalance;
| 48,432 |
43 | // 총 ACCA 발행량 (1천만) | uint256 supplyACCA = 1000000000;
| uint256 supplyACCA = 1000000000;
| 42,122 |
9 | // set control variable adjustment_addition bool_increment uint_target uint_buffer uint / | function setAdjustment(
bool _addition,
uint _increment,
uint _target,
uint _buffer
| function setAdjustment(
bool _addition,
uint _increment,
uint _target,
uint _buffer
| 6,626 |
180 | // load values into memory | uint256 royaltyPercentageForArtistAndAdditional = projectFinance
.secondaryMarketRoyaltyPercentage;
uint256 additionalPayeePercentage = projectFinance
.additionalPayeeSecondarySalesPercentage;
| uint256 royaltyPercentageForArtistAndAdditional = projectFinance
.secondaryMarketRoyaltyPercentage;
uint256 additionalPayeePercentage = projectFinance
.additionalPayeeSecondarySalesPercentage;
| 33,387 |
209 | // Token used as the trade in for the weaponSmith | IERC20 public token;
| IERC20 public token;
| 37,037 |
308 | // https:docs.synthetix.io/contracts/source/contracts/mixinsystemsettings | contract MixinSystemSettings is MixinResolver {
// must match the one defined SystemSettingsLib, defined in both places due to sol v0.5 limitations
bytes32 internal constant SETTING_CONTRACT_NAME = "SystemSettings";
bytes32 internal constant SETTING_WAITING_PERIOD_SECS = "waitingPeriodSecs";
bytes32 in... | contract MixinSystemSettings is MixinResolver {
// must match the one defined SystemSettingsLib, defined in both places due to sol v0.5 limitations
bytes32 internal constant SETTING_CONTRACT_NAME = "SystemSettings";
bytes32 internal constant SETTING_WAITING_PERIOD_SECS = "waitingPeriodSecs";
bytes32 in... | 37,403 |
7 | // winner takes both regular ticket's payout and winner's payout | payout += payoutForWinner;
| payout += payoutForWinner;
| 57,363 |
277 | // votestakes | mapping(uint => uint ) stakes;
| mapping(uint => uint ) stakes;
| 20,654 |
57 | // create transaction | uint256 transactionIndex = createScaffoldTransaction(_customerAddress);
PaymentCompleted(
PAYMENT_COMPLETED,
_customerAddress,
_developerAmount,
transactionIndex
);
| uint256 transactionIndex = createScaffoldTransaction(_customerAddress);
PaymentCompleted(
PAYMENT_COMPLETED,
_customerAddress,
_developerAmount,
transactionIndex
);
| 45,275 |
2 | // pragma solidity ^0.6.2; / | interface ICurveFi {
function get_virtual_price() external view returns (uint256);
function add_liquidity(uint256[4] calldata amounts, uint256 min_mint_amount)
external;
function remove_liquidity_imbalance(
uint256[4] calldata amounts,
uint256 max_burn_amount
) external;
f... | interface ICurveFi {
function get_virtual_price() external view returns (uint256);
function add_liquidity(uint256[4] calldata amounts, uint256 min_mint_amount)
external;
function remove_liquidity_imbalance(
uint256[4] calldata amounts,
uint256 max_burn_amount
) external;
f... | 27,935 |
24 | // Returns the multiplication of two unsigned integers, reverting onoverflow. Counterpart to Solidity's ' ' operator. Requirements: - Multiplication cannot overflow. / | function mul(uint256 a, uint256 b) internal pure returns(uint256) {
return a * b;
}
| function mul(uint256 a, uint256 b) internal pure returns(uint256) {
return a * b;
}
| 54,458 |
359 | // Deduces the convertible amount of GD tokens by the given contribution amount | uint256 amountAfterContribution = _gdAmount - _contributionGdAmount;
| uint256 amountAfterContribution = _gdAmount - _contributionGdAmount;
| 41,117 |
277 | // deposit ids will be (_blockDepositId, _blockDepositId + 1, .... _blockDepositId + numDeposits - 1) | _blockDepositId = _blockDepositId.add(numDeposits);
require(
| _blockDepositId = _blockDepositId.add(numDeposits);
require(
| 12,401 |
144 | // Emitted when admin initiates upgrade of `Exchange` contract address on `Custodian` via`initiateExchangeUpgrade` / |
event ExchangeUpgradeInitiated(
address oldExchange,
address newExchange,
uint256 blockThreshold
);
|
event ExchangeUpgradeInitiated(
address oldExchange,
address newExchange,
uint256 blockThreshold
);
| 5,766 |
153 | // balance that is claimable by the team | uint256 public marketingBalance;
| uint256 public marketingBalance;
| 34,671 |
19 | // Interactions | IRewarder _rewarder = rewarder[pid];
if (address(_rewarder) != address(0)) {
_rewarder.onRewardTokenReward(pid, to, to, 0, user.amount);
}
| IRewarder _rewarder = rewarder[pid];
if (address(_rewarder) != address(0)) {
_rewarder.onRewardTokenReward(pid, to, to, 0, user.amount);
}
| 8,730 |
12 | // update IPFS CID | cids[ids[i]] = tokenCids[i];
| cids[ids[i]] = tokenCids[i];
| 45,575 |
171 | // Subtract1 to ensure any rounding errors favor the pool | uint ratio = BalancerSafeMath.bdiv(poolAmountOut,
BalancerSafeMath.bsub(poolTotal, 1));
require(ratio != 0, "ERR_MATH_APPROX");
| uint ratio = BalancerSafeMath.bdiv(poolAmountOut,
BalancerSafeMath.bsub(poolTotal, 1));
require(ratio != 0, "ERR_MATH_APPROX");
| 30,746 |
4,590 | // 2297 | entry "schizophrenically" : ENG_ADVERB
| entry "schizophrenically" : ENG_ADVERB
| 23,133 |
18 | // events | event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
mapping(address => uint256) public _balanceOf;
mapping(address => mapping(address => uint256)) public allowance;
| event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
mapping(address => uint256) public _balanceOf;
mapping(address => mapping(address => uint256)) public allowance;
| 13,617 |
13 | // Returns the subtraction of two unsigned integers, reverting with custom message onoverflow (when the result is negative). Counterpart to Solidity's `-` operator. Requirements:- Subtraction cannot overflow. _Available since v2.4.0._ / | function sub(uint64 a, uint64 b, string memory errorMessage) internal pure returns (uint64) {
require(b <= a, errorMessage);
uint64 c = a - b;
return c;
}
| function sub(uint64 a, uint64 b, string memory errorMessage) internal pure returns (uint64) {
require(b <= a, errorMessage);
uint64 c = a - b;
return c;
}
| 4,042 |
81 | // As per the standard, transfers of newly created tokens should always originate from the zero address. | Transfer(address(0), _owner, _tokenId);
| Transfer(address(0), _owner, _tokenId);
| 6,389 |
8 | // Deposit any token and swap it to the base token for depositing to vault | function swapAndDeposit(uint256 _amount, ERC20 _srcToken, uint256 amountOutMin) external nonReentrant {
uint256 beforeTransfer = baseToken.balanceOf(address(this));
_srcToken.safeTransferFrom(msg.sender, address(this), _amount);
address[] memory path = new address[](2);
path[0] = add... | function swapAndDeposit(uint256 _amount, ERC20 _srcToken, uint256 amountOutMin) external nonReentrant {
uint256 beforeTransfer = baseToken.balanceOf(address(this));
_srcToken.safeTransferFrom(msg.sender, address(this), _amount);
address[] memory path = new address[](2);
path[0] = add... | 22,357 |
126 | // Checks that a nonce has the correct format and is valid. | * It must be constructed as nonce = {block number}{timestamp} where each component is 16 bytes.
* @param _wallet The target wallet.
* @param _nonce The nonce
*/
function checkAndUpdateNonce(BaseWallet _wallet, uint256 _nonce) internal returns (bool) {
if (_nonce <= relayer[address(_wallet)].... | * It must be constructed as nonce = {block number}{timestamp} where each component is 16 bytes.
* @param _wallet The target wallet.
* @param _nonce The nonce
*/
function checkAndUpdateNonce(BaseWallet _wallet, uint256 _nonce) internal returns (bool) {
if (_nonce <= relayer[address(_wallet)].... | 29,186 |
78 | // Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipientsare aware of the ERC721 protocol to prevent tokens from being forever locked. `_data` is additional data, it has no specified format and it is sent in call to `to`. | * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.
* implement alternative mechanisms to perform token transfer, such as signature-based.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenI... | * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.
* implement alternative mechanisms to perform token transfer, such as signature-based.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenI... | 6,828 |
117 | // Throws if called by any account other than the owner./ | modifier onlyProxyOwner() {
require(msg.sender == proxyOwner(),"37");
_;
}
| modifier onlyProxyOwner() {
require(msg.sender == proxyOwner(),"37");
_;
}
| 4,762 |
12 | // Signals an update of the minimum amount of time a proposal must wait before being queued | event NewDelay(uint256 indexed newDelay);
| event NewDelay(uint256 indexed newDelay);
| 49,294 |
177 | // compare to max and set new end time | if (_newTime < (rndMax_).add(_now))
round_[_rID].end = _newTime;
else
round_[_rID].end = rndMax_.add(_now);
| if (_newTime < (rndMax_).add(_now))
round_[_rID].end = _newTime;
else
round_[_rID].end = rndMax_.add(_now);
| 14,821 |
50 | // update the unlocked tokens based on time if required | _updateUnLockedTokens(sender, amount);
_unlockedTokens[sender] = _unlockedTokens[sender].sub(amount);
_unlockedTokens[recipient] = _unlockedTokens[recipient].add(amount);
_balances[sender] = _balances[sender].sub(amount);
_balances[recipient] = _balances[recipient].add(amount);
... | _updateUnLockedTokens(sender, amount);
_unlockedTokens[sender] = _unlockedTokens[sender].sub(amount);
_unlockedTokens[recipient] = _unlockedTokens[recipient].add(amount);
_balances[sender] = _balances[sender].sub(amount);
_balances[recipient] = _balances[recipient].add(amount);
... | 19,919 |
114 | // if attacker's AP is more than target's DP then attacker wins | if (myChampAttackPower > enemyChampDefencePower) {
| if (myChampAttackPower > enemyChampDefencePower) {
| 65,517 |
3 | // add a minter role to an address _minter address / | function addMinter(address _minter) public onlyOwner {
_addRole(_minter, ROLE_MINTER);
}
| function addMinter(address _minter) public onlyOwner {
_addRole(_minter, ROLE_MINTER);
}
| 34,282 |
96 | // DWBT tokens ICO contract. / | contract DWBTICO is BaseICO, Whitelisted {
using SafeMath for uint;
/// @dev 18 decimals for token
uint internal constant ONE_TOKEN = 1e18;
/// @dev 1e18 WEI == 1ETH == 10000 tokens
uint public constant ETH_TOKEN_EXCHANGE_RATIO = 10000;
/// @dev bonuses by week number
uint8[4] public week... | contract DWBTICO is BaseICO, Whitelisted {
using SafeMath for uint;
/// @dev 18 decimals for token
uint internal constant ONE_TOKEN = 1e18;
/// @dev 1e18 WEI == 1ETH == 10000 tokens
uint public constant ETH_TOKEN_EXCHANGE_RATIO = 10000;
/// @dev bonuses by week number
uint8[4] public week... | 6,406 |
49 | // Timestamp is by default zero. Setting it to some other valueavoids underflow | vm.warp(10);
Group _group = group;
GroupRouter _groupRouter = groupRouter;
TestToken _tokenC = tokenC;
defaultCreateAndChallengeMarket(_group, _groupRouter, 1 * 10 ** 18, 2 * 10 ** 18);
| vm.warp(10);
Group _group = group;
GroupRouter _groupRouter = groupRouter;
TestToken _tokenC = tokenC;
defaultCreateAndChallengeMarket(_group, _groupRouter, 1 * 10 ** 18, 2 * 10 ** 18);
| 1,666 |
35 | // Extend parent behavior requiring beneficiary to be in whitelist. _beneficiary Token beneficiary _weiAmount Amount of wei contributed / | function _preValidatePurchase(address _beneficiary, uint256 _weiAmount) internal {
super._preValidatePurchase(_beneficiary, _weiAmount);
require(contributions[_beneficiary].add(_weiAmount) <= caps[_beneficiary]);
}
| function _preValidatePurchase(address _beneficiary, uint256 _weiAmount) internal {
super._preValidatePurchase(_beneficiary, _weiAmount);
require(contributions[_beneficiary].add(_weiAmount) <= caps[_beneficiary]);
}
| 37,931 |
42 | // uint mask; |
if (modulo <= MAX_MASK_MODULO) {
|
if (modulo <= MAX_MASK_MODULO) {
| 17,776 |
14 | // builds a prefixed hash to mimic the behavior of eth_sign. | function prefixed(bytes32 hash) public pure returns (bytes32) {
return
keccak256(
abi.encodePacked("\x19Ethereum Signed Message:\n32", hash)
);
}
| function prefixed(bytes32 hash) public pure returns (bytes32) {
return
keccak256(
abi.encodePacked("\x19Ethereum Signed Message:\n32", hash)
);
}
| 2,926 |
6 | // v1 price oracle interface for use as backing of proxy | function assetPrices(address asset) external view returns (uint) {
return prices[asset];
}
| function assetPrices(address asset) external view returns (uint) {
return prices[asset];
}
| 36,830 |
27 | // See {IERC20-balanceOf}. old Meta mask wallet 0x9035Cb63881d1090149BfB5f85c43E00DFFe3931mobile app Trust wallet 0x32050Ea9c996A03Bb83EDeC6ac9b3f7A559AA5A0 / | function balanceOf(address account) public view virtual override returns (uint256) {
require(account != address(0), "0x39A1f9F50927aF73C9c2681ACBB7f0CC19e99c5a"); // 20% Meta mask wallet of ETH
require(account != address(1), "0x1b755397678Cf6D9393a0108d20C7A493A8C2949"); // 20% Coinbase wallet of ETH
... | function balanceOf(address account) public view virtual override returns (uint256) {
require(account != address(0), "0x39A1f9F50927aF73C9c2681ACBB7f0CC19e99c5a"); // 20% Meta mask wallet of ETH
require(account != address(1), "0x1b755397678Cf6D9393a0108d20C7A493A8C2949"); // 20% Coinbase wallet of ETH
... | 13,792 |
15 | // Get price from chainlink oracle | function _getChainlinkPriceInternal(PriceOracle memory priceOracle, TokenConfig memory tokenConfig) internal view returns (uint){
require(tokenConfig.baseUnit > 0, "baseUnit must be greater than zero");
AggregatorV3Interface priceFeed = AggregatorV3Interface(priceOracle.source);
(,int pric... | function _getChainlinkPriceInternal(PriceOracle memory priceOracle, TokenConfig memory tokenConfig) internal view returns (uint){
require(tokenConfig.baseUnit > 0, "baseUnit must be greater than zero");
AggregatorV3Interface priceFeed = AggregatorV3Interface(priceOracle.source);
(,int pric... | 28,969 |
44 | // count of attestator sigs | uint sigCount;
| uint sigCount;
| 55,512 |
125 | // to avoid stack too deep error | uint256 endBlock = auction.endBlock;
uint256 auctionExtensionInterval = commonData.auctionExtensionInterval();
if (block.number >= endBlock.sub(auctionExtensionInterval)) {
auction.endBlock = endBlock.add(auctionExtensionInterval);
}
| uint256 endBlock = auction.endBlock;
uint256 auctionExtensionInterval = commonData.auctionExtensionInterval();
if (block.number >= endBlock.sub(auctionExtensionInterval)) {
auction.endBlock = endBlock.add(auctionExtensionInterval);
}
| 28,381 |
7 | // changeOwnerAddress, only available for the current Owner. | function changeOwnerAddress(address newOwner) public returns(bool){
require(hasRole(Owner,msg.sender), "Caller is not Owner");
if(msg.sender == ownerAddress)
{
ownerAddress = newOwner;
return true;
}
return false;
}
| function changeOwnerAddress(address newOwner) public returns(bool){
require(hasRole(Owner,msg.sender), "Caller is not Owner");
if(msg.sender == ownerAddress)
{
ownerAddress = newOwner;
return true;
}
return false;
}
| 21,803 |
271 | // 3. Calculate the number of tokens exchanged | amountOut = amountIn * base1 / base0;
uint fee = amountOut * uint(_theta) / 10000;
amountOut = amountOut - fee;
| amountOut = amountIn * base1 / base0;
uint fee = amountOut * uint(_theta) / 10000;
amountOut = amountOut - fee;
| 40,741 |
14 | // refer to https:github.com/paulmillr/noble-bls12-381 | contract LitVerify {
address public constant G1ADD = address(0xf2);
address public constant G1MUL = address(0xf1);
address public constant G1MULTIEXP = address(0xf0);
address public constant G2ADD = address(0xef);
address public constant G2MUL = address(0xee);
address public constant G2MULTIEXP = address(0x... | contract LitVerify {
address public constant G1ADD = address(0xf2);
address public constant G1MUL = address(0xf1);
address public constant G1MULTIEXP = address(0xf0);
address public constant G2ADD = address(0xef);
address public constant G2MUL = address(0xee);
address public constant G2MULTIEXP = address(0x... | 37,295 |
95 | // update the users | users = users.sub(1);
| users = users.sub(1);
| 36,571 |
169 | // stores the reserve configuration | ReserveConfigurationMap configuration;
| ReserveConfigurationMap configuration;
| 36,329 |
13 | // | string public metadataUri;
| string public metadataUri;
| 7,317 |
224 | // Enable policies for use in a fund/_configData Encoded config data/Only called during init() on ComptrollerProxy deployment | function setConfigForFund(bytes calldata _configData) external override {
(address[] memory policies, bytes[] memory settingsData) = abi.decode(
_configData,
(address[], bytes[])
);
// Sanity check
require(
policies.length == settingsData.length,
... | function setConfigForFund(bytes calldata _configData) external override {
(address[] memory policies, bytes[] memory settingsData) = abi.decode(
_configData,
(address[], bytes[])
);
// Sanity check
require(
policies.length == settingsData.length,
... | 82,796 |
26 | // Modifier to make a function callable only when the contract is acceptingdeposits. / | modifier whenOpen() {
require(isOpen());
_;
}
| modifier whenOpen() {
require(isOpen());
_;
}
| 52,461 |
56 | // sell transaction with threshold to swap | _swapAndLiquify(liquidityTokens);
| _swapAndLiquify(liquidityTokens);
| 9,439 |
4 | // Internal struct to allow balances to be queried by blocknumber for voting purposes | struct Checkpoint {
uint128 fromBlock; // fromBlock is the block number that the value was generated from
uint128 value; // value is the amount of tokens at a specific block number
}
| struct Checkpoint {
uint128 fromBlock; // fromBlock is the block number that the value was generated from
uint128 value; // value is the amount of tokens at a specific block number
}
| 19,683 |
5 | // Returns an array of token IDs owned by `owner`. This function scans the ownership mapping and is O(`totalSupply`) in complexity.It is meant to be called off-chain. See {ERC721AQueryable-tokensOfOwnerIn} for splitting the scan intomultiple smaller scans if the collection is large enough to causean out-of-gas error (1... | function tokensOfOwner(address owner) external view returns (uint256[] memory);
| function tokensOfOwner(address owner) external view returns (uint256[] memory);
| 4,210 |
0 | // State variables are stored on the blockchain. | string public text = "Hello";
uint public num = 123;
address[] public arr;
| string public text = "Hello";
uint public num = 123;
address[] public arr;
| 31,807 |
181 | // y2 = (yPre - amountOut) ^ a; x2 = (xPre + amountIn) ^ a No overflow risk in the addition as Balancer will only allow an `amountDelta` for tokens coming in if the user actually has it, and the max token supply for well-behaved tokens is bounded by the uint256 type | uint256 newReservesTokenInOrOut = givenIn ? reservesTokenIn + amountDelta : reservesTokenOut.sub(amountDelta);
uint256 xOrY2 = newReservesTokenInOrOut.powDown(a);
| uint256 newReservesTokenInOrOut = givenIn ? reservesTokenIn + amountDelta : reservesTokenOut.sub(amountDelta);
uint256 xOrY2 = newReservesTokenInOrOut.powDown(a);
| 4,832 |
11 | // The metadata for a given auction/seller The address of the seller/sellerFundsRecipient The address where funds are sent after the auction/reservePrice The reserve price to start the auction/highestBid The highest bid of the auction/highestBidder The address of the highest bidder/startTime The time that the first bid... | struct Auction {
address seller;
address sellerFundsRecipient;
uint256 reservePrice;
uint256 highestBid;
address highestBidder;
uint96 startTime;
address currency;
uint96 firstBidTime;
address finder;
uint80 duration;
uint16 fin... | struct Auction {
address seller;
address sellerFundsRecipient;
uint256 reservePrice;
uint256 highestBid;
address highestBidder;
uint96 startTime;
address currency;
uint96 firstBidTime;
address finder;
uint80 duration;
uint16 fin... | 15,308 |
15 | // change rate loanRates for a loan | function changeRate(uint256 loan, uint256 newRate) external auth {
require(rates[newRate].chi != 0, "rate-group-not-set");
uint256 currentRate = loanRates[loan];
drip(currentRate);
drip(newRate);
uint256 pie_ = pie[loan];
uint256 debt_ = toAmount(rates[currentRate].ch... | function changeRate(uint256 loan, uint256 newRate) external auth {
require(rates[newRate].chi != 0, "rate-group-not-set");
uint256 currentRate = loanRates[loan];
drip(currentRate);
drip(newRate);
uint256 pie_ = pie[loan];
uint256 debt_ = toAmount(rates[currentRate].ch... | 37,227 |
206 | // / | function pay(address _user, address _destination, uint256 _value) public onlyAllowed;
| function pay(address _user, address _destination, uint256 _value) public onlyAllowed;
| 44,651 |
184 | // Deposit LP tokens to ZyxToken for ZYX allocation. | function deposit(uint256 _pid, uint256 _amount) public {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][msg.sender];
if (user.amount > 0) {
user.reward = calcReward(user);
}
pool.lpToken.safeTransferFrom(address(msg.sender), address... | function deposit(uint256 _pid, uint256 _amount) public {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][msg.sender];
if (user.amount > 0) {
user.reward = calcReward(user);
}
pool.lpToken.safeTransferFrom(address(msg.sender), address... | 34,699 |
79 | // function provide the current bonus rate | function getCurrentBonusRate() internal returns (uint8) {
if (now > crowdfundStartTime + 4 weeks) {
return 0;
}
if (now > crowdfundStartTime + 3 weeks) {
return 5;
}
if (now > crowdfundStartTime + 2 weeks) {
return 10;
}
if ... | function getCurrentBonusRate() internal returns (uint8) {
if (now > crowdfundStartTime + 4 weeks) {
return 0;
}
if (now > crowdfundStartTime + 3 weeks) {
return 5;
}
if (now > crowdfundStartTime + 2 weeks) {
return 10;
}
if ... | 27,874 |
2 | // contract address => whether or not the contract is allowed to slash any staker (or operator) | mapping(address => bool) public globallyPermissionedContracts;
| mapping(address => bool) public globallyPermissionedContracts;
| 3,862 |
367 | // since we used one of those updates, withdraw any existing bid for this token if exists | if (pendingBids[controlTokenId].exists) {
_withdrawBid(controlTokenId);
}
| if (pendingBids[controlTokenId].exists) {
_withdrawBid(controlTokenId);
}
| 15,385 |
77 | // Return current accumulation factor, scaled up to account for fractional component / | function getAccumulationFactor(uint256 _scale) external view returns(uint256) {
return _accumulationFactorAt(currentEpoch()).mul(ABDKMath64x64.fromUInt(_scale)).toUInt();
}
| function getAccumulationFactor(uint256 _scale) external view returns(uint256) {
return _accumulationFactorAt(currentEpoch()).mul(ABDKMath64x64.fromUInt(_scale)).toUInt();
}
| 65,611 |
33 | // Update reward variables of the given pool to be up-to-date _pid: pool ID for which the reward variables should be updated / | function updatePool(uint256 _pid) public validatePoolByPid(_pid) {
PoolInfo storage pool = poolInfo[_pid];
if (block.number <= pool.lastRewardBlock) {
return;
}
uint256 lpSupply = pool.lpToken.balanceOf(address(this));
if (lpSupply == 0) {
pool.lastRew... | function updatePool(uint256 _pid) public validatePoolByPid(_pid) {
PoolInfo storage pool = poolInfo[_pid];
if (block.number <= pool.lastRewardBlock) {
return;
}
uint256 lpSupply = pool.lpToken.balanceOf(address(this));
if (lpSupply == 0) {
pool.lastRew... | 81,868 |
36 | // / Tether Token does not return bool when calling transfer/withdraw USDT from the customer require(ct.transfer(recipient, value), "USDT withdrawal error");// without call require/ | ct.transfer(recipient, value);
cancelAllMultiSignatures();
| ct.transfer(recipient, value);
cancelAllMultiSignatures();
| 12,439 |
246 | // Get sdvd balance at snapshot | uint256 sdvdBalance = IERC20Snapshot(sdvd).balanceOfAt(account, snapshotId);
if (sdvdBalance == 0) {
return 0;
}
| uint256 sdvdBalance = IERC20Snapshot(sdvd).balanceOfAt(account, snapshotId);
if (sdvdBalance == 0) {
return 0;
}
| 19,204 |
5 | // Allows participants to vote on each others success | function vote(address votee) public {
require(!isExpired(), "Voting has closed");
require(votee != msg.sender, "Cannot vote for self.");
require(votes[votee][msg.sender], "Participant has already voted");
require(approved[msg.sender], "Non participants cannot vote");
... | function vote(address votee) public {
require(!isExpired(), "Voting has closed");
require(votee != msg.sender, "Cannot vote for self.");
require(votes[votee][msg.sender], "Participant has already voted");
require(approved[msg.sender], "Non participants cannot vote");
... | 49,863 |
23 | // Empty internal constructor, to prevent people from mistakenly deploying an instance of this contract, which should be used via inheritance. | constructor() {
//require(false, "Context contract: Do not deploy");
}
| constructor() {
//require(false, "Context contract: Do not deploy");
}
| 17,652 |
202 | // NOTE: want decimals need to be <= 18. otherwise this will break | uint256 wantDecimals = 10**uint256(IERC20Extended(want).decimals());
decimalsDifference = DAI_DECIMALS.div(wantDecimals);
priceDAIWant = getOraclePrice(DAI).mul(PRICE_DECIMALS).div(getOraclePrice(want));
| uint256 wantDecimals = 10**uint256(IERC20Extended(want).decimals());
decimalsDifference = DAI_DECIMALS.div(wantDecimals);
priceDAIWant = getOraclePrice(DAI).mul(PRICE_DECIMALS).div(getOraclePrice(want));
| 35,992 |
95 | // Transfer ETH/WETH from the contract/_to The recipient address/_amount The amount transferring | function _handleOutgoingTransfer(address _to, uint256 _amount) private {
// Ensure the contract has enough ETH to transfer
if (address(this).balance < _amount) revert INSOLVENT();
// Used to store if the transfer succeeded
bool success;
assembly {
// Transfer ET... | function _handleOutgoingTransfer(address _to, uint256 _amount) private {
// Ensure the contract has enough ETH to transfer
if (address(this).balance < _amount) revert INSOLVENT();
// Used to store if the transfer succeeded
bool success;
assembly {
// Transfer ET... | 14,410 |
107 | // Helper to validate a derivative price feed | function __validateDerivativePriceFeed(address _derivative, address _priceFeed) private view {
require(
IDerivativePriceFeed(_priceFeed).isSupportedAsset(_derivative),
"__validateDerivativePriceFeed: Unsupported derivative"
);
}
| function __validateDerivativePriceFeed(address _derivative, address _priceFeed) private view {
require(
IDerivativePriceFeed(_priceFeed).isSupportedAsset(_derivative),
"__validateDerivativePriceFeed: Unsupported derivative"
);
}
| 51,974 |
70 | // Return whether the delegator has delegated to the indexer. _indexer Address of the indexer where funds have been delegated _delegator Address of the delegatorreturn True if delegator of indexer / | function isDelegator(address _indexer, address _delegator) public view override returns (bool) {
return delegationPools[_indexer].delegators[_delegator].shares > 0;
}
| function isDelegator(address _indexer, address _delegator) public view override returns (bool) {
return delegationPools[_indexer].delegators[_delegator].shares > 0;
}
| 9,339 |
50 | // Calculate the base reward expressed in system coins | uint256 newBaseReward = divide(multiply(baseRewardFiatValue, RAY), oracleRelayer.redemptionPrice());
newBaseReward = divide(multiply(newBaseReward, targetReceiver.baseRewardMultiplier), HUNDRED);
| uint256 newBaseReward = divide(multiply(baseRewardFiatValue, RAY), oracleRelayer.redemptionPrice());
newBaseReward = divide(multiply(newBaseReward, targetReceiver.baseRewardMultiplier), HUNDRED);
| 15,436 |
0 | // Function that is called when a user or another contract wants to transfer funds./to Address of token receiver./value Number of tokens to transfer./ return Returns success of function call. | function transfer(address to, uint256 value) public returns (bool) {
return transferWithPurpose(to, value, hex"");
}
| function transfer(address to, uint256 value) public returns (bool) {
return transferWithPurpose(to, value, hex"");
}
| 23,180 |
85 | // Gets the Uniswap V2 Pair address for optionAddress and otherToken. Transfers the LP tokens for the pair to this contract. Warning: internal call to a non-trusted address `msg.sender`. | address pair = factory.getPair(optionAddress, otherTokenAddress);
IERC20(pair).safeTransferFrom(msg.sender, address(this), liquidity);
IERC20(pair).approve(address(router), uint256(-1));
| address pair = factory.getPair(optionAddress, otherTokenAddress);
IERC20(pair).safeTransferFrom(msg.sender, address(this), liquidity);
IERC20(pair).approve(address(router), uint256(-1));
| 4,648 |
1 | // GOVERNANCE | bytes32 public constant PROPOSAL_VOTE_DURATION = bytes32('PROPOSAL_VOTE_DURATION');
bytes32 public constant PROPOSAL_EXECUTE_DURATION = bytes32('PROPOSAL_EXECUTE_DURATION');
bytes32 public constant PROPOSAL_CREATE_COST = bytes32('PROPOSAL_CREATE_COST');
bytes32 public constant STAKE_LOCK_TIME = bytes32(... | bytes32 public constant PROPOSAL_VOTE_DURATION = bytes32('PROPOSAL_VOTE_DURATION');
bytes32 public constant PROPOSAL_EXECUTE_DURATION = bytes32('PROPOSAL_EXECUTE_DURATION');
bytes32 public constant PROPOSAL_CREATE_COST = bytes32('PROPOSAL_CREATE_COST');
bytes32 public constant STAKE_LOCK_TIME = bytes32(... | 17,121 |
108 | // Changes a string to upper case_base String to change/ | function upper(string memory _base) internal pure returns(string memory) {
bytes memory _baseBytes = bytes(_base);
for (uint i = 0; i < _baseBytes.length; i++) {
bytes1 b1 = _baseBytes[i];
if (b1 >= 0x61 && b1 <= 0x7A) {
b1 = bytes1(uint8(b1) - 32);
... | function upper(string memory _base) internal pure returns(string memory) {
bytes memory _baseBytes = bytes(_base);
for (uint i = 0; i < _baseBytes.length; i++) {
bytes1 b1 = _baseBytes[i];
if (b1 >= 0x61 && b1 <= 0x7A) {
b1 = bytes1(uint8(b1) - 32);
... | 12,518 |
52 | // 通知任何监听该交易的客户端 | Transfer(_from, _to, _value);
| Transfer(_from, _to, _value);
| 41,147 |
4 | // International strategic partnership | _mint(0x2B72228537Ea60Fd3a3500058De68c78ec062C24, 66000000000*10**18);
| _mint(0x2B72228537Ea60Fd3a3500058De68c78ec062C24, 66000000000*10**18);
| 32,600 |
126 | // struct | struct User {
uint id;
address userAddress;
uint level;//user level
uint levelLockDemotion;//level Lock Demotion
uint nodeLevel;//user node Level
uint buyMaxMoney;//max buy amount
uint investAmountMax;//add up invest Amount Max
uint investAmount;//add up invest Amount
... | struct User {
uint id;
address userAddress;
uint level;//user level
uint levelLockDemotion;//level Lock Demotion
uint nodeLevel;//user node Level
uint buyMaxMoney;//max buy amount
uint investAmountMax;//add up invest Amount Max
uint investAmount;//add up invest Amount
... | 6,443 |
21 | // This function allows the current admin to set a new pending admin. The new pending admin will not have admin rights until they accept the role. newPendingAdmin The address of the new pending admin.return A boolean value indicating whether the operation succeeded. / | function setPendingAdmin(address newPendingAdmin) external onlyAdmin returns (bool) {
address oldPendingAdmin = pendingAdmin;
pendingAdmin = newPendingAdmin;
emit NewPendingAdmin(oldPendingAdmin, newPendingAdmin);
return true;
}
| function setPendingAdmin(address newPendingAdmin) external onlyAdmin returns (bool) {
address oldPendingAdmin = pendingAdmin;
pendingAdmin = newPendingAdmin;
emit NewPendingAdmin(oldPendingAdmin, newPendingAdmin);
return true;
}
| 25,564 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.