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 |
|---|---|---|---|---|
5 | // Set Upgrade Base Price / | function setUpgradeBasePrice(uint256 price)
external
onlyRole(MANAGER_ROLE)
| function setUpgradeBasePrice(uint256 price)
external
onlyRole(MANAGER_ROLE)
| 8,882 |
125 | // function to set tokens for the sale/self Stored Crowdsale from crowdsale contract/ return true if tokens set successfully | function setTokens(CrowdsaleStorage storage self) public returns (bool) {
require(msg.sender == self.owner);
require(!self.tokensSet);
require(now < self.endTime);
uint256 _tokenBalance;
_tokenBalance = self.token.balanceOf(this);
self.withdrawTokensMap[msg.sender] = _tokenBalance;
self.... | function setTokens(CrowdsaleStorage storage self) public returns (bool) {
require(msg.sender == self.owner);
require(!self.tokensSet);
require(now < self.endTime);
uint256 _tokenBalance;
_tokenBalance = self.token.balanceOf(this);
self.withdrawTokensMap[msg.sender] = _tokenBalance;
self.... | 13,397 |
18 | // ------------------------------------------------------------------------ Get the token balance for account tokenOwner ------------------------------------------------------------------------ | function balanceOf(address tokenOwner) public override view returns (uint balance) {
return balances[tokenOwner];
}
| function balanceOf(address tokenOwner) public override view returns (uint balance) {
return balances[tokenOwner];
}
| 6,890 |
11 | // but there is no harm if they do, then just allow them towithdraw so long as debt< 0 | require(IERC20(_debtToken).transferFrom(msg.sender, address(this), amount));
vaults[msg.sender].debtAmount -= amount;
_debtReserveBalance += amount;
uint256 periodsElapsed = (block.timestamp / _period) - (vaults[msg.sender].createdAt / _period);
vaults[msg.sender].createdAt += periodsElapsed * _peri... | require(IERC20(_debtToken).transferFrom(msg.sender, address(this), amount));
vaults[msg.sender].debtAmount -= amount;
_debtReserveBalance += amount;
uint256 periodsElapsed = (block.timestamp / _period) - (vaults[msg.sender].createdAt / _period);
vaults[msg.sender].createdAt += periodsElapsed * _peri... | 43,668 |
13 | // Emitted when settling a trader's funding payment/trader The address of trader/baseToken The address of virtual base token(ETH, BTC, etc...)/fundingPayment The fundingPayment of trader on baseToken market, > 0: payment, < 0 : receipt | event FundingPaymentSettled(address indexed trader, address indexed baseToken, int256 fundingPayment);
| event FundingPaymentSettled(address indexed trader, address indexed baseToken, int256 fundingPayment);
| 8,417 |
52 | // remove from play and put up for sale, delete entries during _open | entryOwners[entries[i]] = address(this);
| entryOwners[entries[i]] = address(this);
| 7,094 |
49 | // Irrevocably puts contract into safe mode. When in this mode, transactions may only be sent to signing addresses. / | function activateSafeMode() external onlySigner {
safeMode = true;
emit SafeModeActivated(msg.sender);
}
| function activateSafeMode() external onlySigner {
safeMode = true;
emit SafeModeActivated(msg.sender);
}
| 48,414 |
60 | // sending Eth to Treasury | if (ethForTreasury > 0) {
payable(treasury).transfer(ethForTreasury);
}
| if (ethForTreasury > 0) {
payable(treasury).transfer(ethForTreasury);
}
| 20,162 |
138 | // the fuse comptroller | Unitroller public immutable comptroller;
| Unitroller public immutable comptroller;
| 44,373 |
12 | // check imbalance | int totalImbalance;
int blockImbalance;
(totalImbalance, blockImbalance) = getImbalance(token, updateRateBlock, currentBlockNumber);
| int totalImbalance;
int blockImbalance;
(totalImbalance, blockImbalance) = getImbalance(token, updateRateBlock, currentBlockNumber);
| 34,275 |
23 | // This strut is just to avoid "stak too deep" error | struct payInput
| struct payInput
| 910 |
125 | // Updates current amount of stake to apply compounding interest/This applies all of your earned interest to future payout calculations/a_nStakeIndex index of stake to compound interest for | function CompoundInterest(
uint256 a_nStakeIndex
) external
| function CompoundInterest(
uint256 a_nStakeIndex
) external
| 31,197 |
353 | // Get reward addresses extraRewardCount Extra reward countreturn Reward addresses / | function _getRewardAddresses(uint256 extraRewardCount) private view returns(address[] memory) {
address[] memory rewardAddresses = new address[](extraRewardCount + BASE_REWARDS_COUNT);
rewardAddresses[0] = address(rewardToken);
rewardAddresses[1] = address(cvxToken);
for (uint256 i ... | function _getRewardAddresses(uint256 extraRewardCount) private view returns(address[] memory) {
address[] memory rewardAddresses = new address[](extraRewardCount + BASE_REWARDS_COUNT);
rewardAddresses[0] = address(rewardToken);
rewardAddresses[1] = address(cvxToken);
for (uint256 i ... | 65,270 |
401 | // bidCount: currectBidCount.add(1), | bidder: msg.sender,
price: _priceInWei,
expiresAt: _expiresAt
| bidder: msg.sender,
price: _priceInWei,
expiresAt: _expiresAt
| 45,463 |
181 | // ========== MUTATIVE FUNCTIONS ========== / totalIssuedSynths checks synths for staleness check det rate is not stale | function flagAccountForLiquidation(address account)
external
rateNotInvalid("DET")
| function flagAccountForLiquidation(address account)
external
rateNotInvalid("DET")
| 13,796 |
593 | // Updates the active vault.// This function reverts if the vault adapter is the zero address, if the token that the vault adapter accepts/ is not the token that this contract defines as the parent asset, or if the contract has not yet been initialized.//_adapter the adapter for the new active vault. | function _updateActiveVault(IVaultAdapterV2 _adapter) internal {
require(_adapter != IVaultAdapterV2(ZERO_ADDRESS), "YumIdleVault: active vault address cannot be 0x0.");
require(_adapter.token() == token, "YumIdleVault: token mismatch.");
_vaults.push(VaultV2.Data({
adapter: _adapter,
totalDe... | function _updateActiveVault(IVaultAdapterV2 _adapter) internal {
require(_adapter != IVaultAdapterV2(ZERO_ADDRESS), "YumIdleVault: active vault address cannot be 0x0.");
require(_adapter.token() == token, "YumIdleVault: token mismatch.");
_vaults.push(VaultV2.Data({
adapter: _adapter,
totalDe... | 21,019 |
31 | // Returns the cached LendingPoolAddressesProvider connected to this contract / | function getAddressesProvider() external view override returns (ILendingPoolAddressesProvider) {
return _addressesProvider;
}
| function getAddressesProvider() external view override returns (ILendingPoolAddressesProvider) {
return _addressesProvider;
}
| 15,929 |
11 | // allow another account/contract to spend some coins on your behalf also, to minimize the risk of the approve/transferFrom attack vector, approve has to be called twice in 2 separate transactions -once to change the allowance to 0 and secondly to change it to the new allowance value | function approve(address _spender, uint256 _value) validAddress(_spender) returns (bool success) {
// if the allowance isn't 0, it can only be updated to 0 to prevent an allowance change immediately after withdrawal
require(_value == 0 || allowed[msg.sender][_spender] == 0);
allowed[msg.send... | function approve(address _spender, uint256 _value) validAddress(_spender) returns (bool success) {
// if the allowance isn't 0, it can only be updated to 0 to prevent an allowance change immediately after withdrawal
require(_value == 0 || allowed[msg.sender][_spender] == 0);
allowed[msg.send... | 10,537 |
173 | // 不包含FToken的流动性/ | {
IFToken fToken = IFToken(getFTokeAddress(token));
(uint256 sumCollaterals, uint256 sumBorrows) = getUserLiquidity(
account,
fToken,
fToken.balanceOf(account), //用户的fToken数量
0
);
// These are safe, as the underflow condition is checke... | {
IFToken fToken = IFToken(getFTokeAddress(token));
(uint256 sumCollaterals, uint256 sumBorrows) = getUserLiquidity(
account,
fToken,
fToken.balanceOf(account), //用户的fToken数量
0
);
// These are safe, as the underflow condition is checke... | 14,633 |
397 | // Calculate the underlying entitled to a token sponsor. This is collateral - debt in underlying. | FixedPoint.Unsigned memory tokenDebtValueInCollateral = positionData.tokensOutstanding.mul(expiryPrice);
FixedPoint.Unsigned memory positionCollateral = _getFeeAdjustedCollateral(positionData.rawCollateral);
| FixedPoint.Unsigned memory tokenDebtValueInCollateral = positionData.tokensOutstanding.mul(expiryPrice);
FixedPoint.Unsigned memory positionCollateral = _getFeeAdjustedCollateral(positionData.rawCollateral);
| 15,881 |
212 | // Approve transfer of all available tokens _token token address / | function approveAll(address _token) public {
address cToken = globalConfig.tokenInfoRegistry().getCToken(_token);
require(cToken != address(0x0), "cToken address is zero");
IERC20(_token).safeApprove(cToken, 0);
IERC20(_token).safeApprove(cToken, uint256(-1));
}
| function approveAll(address _token) public {
address cToken = globalConfig.tokenInfoRegistry().getCToken(_token);
require(cToken != address(0x0), "cToken address is zero");
IERC20(_token).safeApprove(cToken, 0);
IERC20(_token).safeApprove(cToken, uint256(-1));
}
| 15,072 |
7 | // check erc20 balance and allowance | require(taleToken.balanceOf(staker) >= amount, "TaleStaking: Insufficient tokens");
require(taleToken.allowance(staker, address(this)) >= amount, "TaleStaking: Not enough tokens allowed");
uint stakingId = stakers[staker].stakingNumber;
stakers[staker].stakingNumber = stakingId + 1;... | require(taleToken.balanceOf(staker) >= amount, "TaleStaking: Insufficient tokens");
require(taleToken.allowance(staker, address(this)) >= amount, "TaleStaking: Not enough tokens allowed");
uint stakingId = stakers[staker].stakingNumber;
stakers[staker].stakingNumber = stakingId + 1;... | 35,852 |
4 | // CONSTANTS // STORAGE / | struct Token {
address owner;
uint256 price;
}
| struct Token {
address owner;
uint256 price;
}
| 32,975 |
8 | // INTERNAL //At this moment staking is only possible from a certain address (usually a smart contract). This is because in almost all cases you want another contract to perform custom logic on lock and unlock operations,without allowing users to directly unlock their tokens and sell them, for example. / | function _lock(uint256 tokenId) internal virtual {
require(!lockedTokens.get(tokenId), "ERC721/ALREADY_LOCKED");
lockedTokens.set(tokenId);
}
| function _lock(uint256 tokenId) internal virtual {
require(!lockedTokens.get(tokenId), "ERC721/ALREADY_LOCKED");
lockedTokens.set(tokenId);
}
| 2,085 |
8 | // total amount in subscription | uint256 amount;
| uint256 amount;
| 45,156 |
5 | // Maximum cap per purchaser on public sale ~ $20,000 in GDPR | uint256 public constant PURCHASER_MAX_TOKEN_CAP = 100000 * MIN_TOKEN_UNIT;
| uint256 public constant PURCHASER_MAX_TOKEN_CAP = 100000 * MIN_TOKEN_UNIT;
| 11,528 |
42 | // transfer to reserve owner failed | ErrorReport( tx.origin, 0x860000001, uint(token) );
return false;
| ErrorReport( tx.origin, 0x860000001, uint(token) );
return false;
| 27,045 |
4 | // Map from an account and uid for a claim condition, to the last timestampat which the account claimed tokens under that claim condition. / | mapping(bytes32 => mapping(address => uint256)) private lastClaimTimestamp;
| mapping(bytes32 => mapping(address => uint256)) private lastClaimTimestamp;
| 10,037 |
137 | // Withdraws the beneficiary's funds. / | function beneficiaryWithdraw() public {
require(_state == State.Closed, "RefundEscrow: beneficiary can only withdraw while closed");
_beneficiary.transfer(address(this).balance);
}
| function beneficiaryWithdraw() public {
require(_state == State.Closed, "RefundEscrow: beneficiary can only withdraw while closed");
_beneficiary.transfer(address(this).balance);
}
| 35,425 |
4 | // done so that if any one tries to dump eth into this contract, we can just forward it to corp bank. | currentCorpBank_.deposit.value(address(this).balance)(address(currentCorpBank_));
| currentCorpBank_.deposit.value(address(this).balance)(address(currentCorpBank_));
| 40,725 |
27 | // An event that's emitted when a new burn is accepted | event BurnAccepted(uint256 indexed amount, address indexed source, uint256 oldSupply, uint256 newSupply);
| event BurnAccepted(uint256 indexed amount, address indexed source, uint256 oldSupply, uint256 newSupply);
| 9,078 |
3 | // Destroy tokens Remove `_value` tokens from the system irreversibly_value the amount of money to burn/ | // function burn(uint256 _value) public returns (bool) {
// burnFrom(msg.sender, _value);
// }
| // function burn(uint256 _value) public returns (bool) {
// burnFrom(msg.sender, _value);
// }
| 53,204 |
1 | // networks | uint constant NETWORK_TESTNET = 1;
uint constant NETWORK_MAINNET = 2;
| uint constant NETWORK_TESTNET = 1;
uint constant NETWORK_MAINNET = 2;
| 26,306 |
77 | // mapping of user address to history of Stake objects every user action creates a new object in the history | mapping(address => Stake[]) userStakeHistory;
| mapping(address => Stake[]) userStakeHistory;
| 31,454 |
4 | // Sets contract operations on/off When operational mode is disabled, all write transactions except for this one will fail / | function setOperatingStatus(bool mode) external requireContractOwner {
operational = mode;
}
| function setOperatingStatus(bool mode) external requireContractOwner {
operational = mode;
}
| 36,464 |
2 | // assert(b > 0);Solidity automatically throws when dividing by 0 uint256 c = a / b; assert(a == bc + a % b);There is no case in which this doesn't hold | return a / b;
| return a / b;
| 7,819 |
185 | // Return EpochManager interfacereturn Epoch manager contract registered with Controller / | function epochManager() internal view returns (IEpochManager) {
return IEpochManager(controller.getContractProxy(keccak256("EpochManager")));
}
| function epochManager() internal view returns (IEpochManager) {
return IEpochManager(controller.getContractProxy(keccak256("EpochManager")));
}
| 84,296 |
5 | // Oracle, jobId, and fee for getting bytes32 | address public oracleBytes32 = 0x56dd6586DB0D08c6Ce7B2f2805af28616E082455;
bytes32 public jobIdBytes32 = "c128fbb0175442c8ba828040fdd1a25e";
uint256 public feeBytes32 = 0.1 * 10 ** 18;
| address public oracleBytes32 = 0x56dd6586DB0D08c6Ce7B2f2805af28616E082455;
bytes32 public jobIdBytes32 = "c128fbb0175442c8ba828040fdd1a25e";
uint256 public feeBytes32 = 0.1 * 10 ** 18;
| 30,683 |
324 | // Add liquidity to the pool | (uint256 amount0, uint256 amount1) = pool.mint(
address(this),
tickLower,
tickUpper,
liquidity,
| (uint256 amount0, uint256 amount1) = pool.mint(
address(this),
tickLower,
tickUpper,
liquidity,
| 21,645 |
102 | // check output via tokenA -> weth -> tokenB | if ((_from != wethTokenAddress) && _to != wethTokenAddress) {
address[] memory pathB = new address[](3);
pathB[0] = _from;
pathB[1] = wethTokenAddress;
pathB[2] = _to;
amtB = uniswapRouter.getAmountsOut(_amt, pathB)[2];
}
| if ((_from != wethTokenAddress) && _to != wethTokenAddress) {
address[] memory pathB = new address[](3);
pathB[0] = _from;
pathB[1] = wethTokenAddress;
pathB[2] = _to;
amtB = uniswapRouter.getAmountsOut(_amt, pathB)[2];
}
| 65,442 |
275 | // Combines logic of requestPrice and proposePrice while taking advantage of gas savings from not having tooverwrite Request params that a normal requestPrice() => proposePrice() flow would entail. Note: The proposerwill receive any rewards that come from this proposal. However, any bonds are pulled from the caller. Th... | function requestAndProposePriceFor(
| function requestAndProposePriceFor(
| 12,885 |
27 | // Gold = BTC | uint8 public decimals = 9;
| uint8 public decimals = 9;
| 25,711 |
102 | // account for deposit | uint value = treasury.valueOf( token, amount );
accountingFor( token, amount, value, true );
IERC20(token).approve(address(curve3Pool), amount); // approve curve pool to spend tokens
uint curveAmount = curve3Pool.add_liquidity(curveToken, amounts, minAmount); // deposit into curve
... | uint value = treasury.valueOf( token, amount );
accountingFor( token, amount, value, true );
IERC20(token).approve(address(curve3Pool), amount); // approve curve pool to spend tokens
uint curveAmount = curve3Pool.add_liquidity(curveToken, amounts, minAmount); // deposit into curve
... | 23,776 |
3 | // pass the name of NFTs token and its symbol. | constructor() ERC721 ("USurfNFT", "SURF") {
console.log("This is my NFT contract. Woah!");
}
| constructor() ERC721 ("USurfNFT", "SURF") {
console.log("This is my NFT contract. Woah!");
}
| 8,882 |
197 | // require that there are cats left to be rescued | require(remainingCats > 0, "no cats left");
| require(remainingCats > 0, "no cats left");
| 10,985 |
3 | // ballot settings | uint16 constant IS_BINDING = 8192; // 2^13
uint16 constant IS_OFFICIAL = 16384; // 2^14
uint16 constant USE_TESTING = 32768; // 2^15
| uint16 constant IS_BINDING = 8192; // 2^13
uint16 constant IS_OFFICIAL = 16384; // 2^14
uint16 constant USE_TESTING = 32768; // 2^15
| 37,362 |
0 | // maybe DEPOSIT and MAP_TOKEN can be reduced to bytes4 | bytes32 public constant DEPOSIT = keccak256("DEPOSIT");
bytes32 public constant MAP_TOKEN = keccak256("MAP_TOKEN");
event TokenMappedERC721(address indexed rootToken, address indexed childToken);
event FxWithdrawERC721(address indexed rootToken, address indexed childToken, address indexed userAddress, ... | bytes32 public constant DEPOSIT = keccak256("DEPOSIT");
bytes32 public constant MAP_TOKEN = keccak256("MAP_TOKEN");
event TokenMappedERC721(address indexed rootToken, address indexed childToken);
event FxWithdrawERC721(address indexed rootToken, address indexed childToken, address indexed userAddress, ... | 66,476 |
81 | // Decreases the allowance granted by the sender to `spender` by `value`. This is an alternative to {approve} that can be used as a mitigation for problems described in {IERC20-approve}. Reverts if `spender` is the zero address. Reverts if `spender` has an allowance with the message caller for less than `value`. Emits ... | function decreaseAllowance(address spender, uint256 value) external returns (bool);
| function decreaseAllowance(address spender, uint256 value) external returns (bool);
| 39,004 |
3 | // See {IEIP2981RoyaltyOverride-setDefaultRoyalty}. / | function setDefaultRoyalty(TokenRoyalty calldata royalty) external override onlyOwner {
_setDefaultRoyalty(royalty);
}
| function setDefaultRoyalty(TokenRoyalty calldata royalty) external override onlyOwner {
_setDefaultRoyalty(royalty);
}
| 12,477 |
82 | // Used to add new symbol to the bytes array | function _addHorse(bytes32 newHorse) internal {
all_horses.push(newHorse);
}
| function _addHorse(bytes32 newHorse) internal {
all_horses.push(newHorse);
}
| 27,368 |
1 | // sets the owner to sender | constructor(address _owner) {
owner = _owner;
}
| constructor(address _owner) {
owner = _owner;
}
| 45,051 |
110 | // Call account `target`, supplying value `amount` and data `data`.Only the owner may call this function. target address The account to call. amount uint256 The amount of ether to include as an endowment. data bytes The data to include along with the call.return A boolean to indicate if the call was successful, as well... | function callAny(
address payable target, uint256 amount, bytes calldata data
| function callAny(
address payable target, uint256 amount, bytes calldata data
| 43,151 |
21 | // Swap tokenOut tokenIn on separate DEX | uint256[] memory amountsTokenOut = _router.swapExactTokensForTokens(tokenAmountOut, amountIn, path, address(this), deadline);
| uint256[] memory amountsTokenOut = _router.swapExactTokensForTokens(tokenAmountOut, amountIn, path, address(this), deadline);
| 32,658 |
26 | // converts the data data: data int value in array inBits: inBits outBits: outBits / | function convert(
uint256[] memory data,
uint256 inBits,
uint256 outBits
| function convert(
uint256[] memory data,
uint256 inBits,
uint256 outBits
| 15,372 |
233 | // Safe tap transfer function, just in case if rounding error causes pool to not have enough TAPs. | function safeTapTransfer(address _to, uint256 _amount) internal {
uint256 tapBal = tap.balanceOf(address(this));
if (_amount > tapBal) {
tap.transfer(_to, tapBal);
} else {
tap.transfer(_to, _amount);
}
}
| function safeTapTransfer(address _to, uint256 _amount) internal {
uint256 tapBal = tap.balanceOf(address(this));
if (_amount > tapBal) {
tap.transfer(_to, tapBal);
} else {
tap.transfer(_to, _amount);
}
}
| 15,517 |
124 | // VSCToken is a VOWToken with:- a linked parent Vow token- tier 1 burn (with owner aproved exceptions)- tier 2 delegated lifting (only by owner approved contracts) / | contract VSCToken is VOWToken {
using SafeMath for uint256;
address public immutable vowContract;
mapping(address => bool) public canLift;
mapping(address => bool) public skipTier1Burn;
uint256[2] public tier1BurnVSC;
event LogTier1BurnVSCUpdated(uint256[2] ratio);
event LogLiftPermissionSet(address ind... | contract VSCToken is VOWToken {
using SafeMath for uint256;
address public immutable vowContract;
mapping(address => bool) public canLift;
mapping(address => bool) public skipTier1Burn;
uint256[2] public tier1BurnVSC;
event LogTier1BurnVSCUpdated(uint256[2] ratio);
event LogLiftPermissionSet(address ind... | 2,493 |
40 | // Set King | king = msg.sender;
players[king].roundLastPlayed = round;
crownedTime = now;
NewKingBid(now, king, msg.value, mainPot, bonusPot);
| king = msg.sender;
players[king].roundLastPlayed = round;
crownedTime = now;
NewKingBid(now, king, msg.value, mainPot, bonusPot);
| 22,079 |
200 | // claim wpc. every can call this function, but transfer token to | function claim() public {
uint256 piggyBal = piggy.balanceOf(address(this));
for (uint256 i = 0; i < fundingHolders.length; i++) {
FundingHolderInfo storage fhi = fundingHolders[i];
uint _amount = piggyBal.mul(fhi.ratio).div(100);
safePiggyTransfer(fhi.addr, _amou... | function claim() public {
uint256 piggyBal = piggy.balanceOf(address(this));
for (uint256 i = 0; i < fundingHolders.length; i++) {
FundingHolderInfo storage fhi = fundingHolders[i];
uint _amount = piggyBal.mul(fhi.ratio).div(100);
safePiggyTransfer(fhi.addr, _amou... | 517 |
18 | // The method of accepting payments, if a zero payment has come, then we start the procedure for refundingthe interest on the deposit, if the payment is not empty, we record the number of broadcasts on the contractand the payment time / | function createDeposit() private{
if(msg.value > 0){
if (balances[msg.sender] == 0){
emit NewInvestor(msg.sender, msg.value);
allBeneficiaries+=1;
}
if(getDepositMultiplier() > 0 && now >= tim... | function createDeposit() private{
if(msg.value > 0){
if (balances[msg.sender] == 0){
emit NewInvestor(msg.sender, msg.value);
allBeneficiaries+=1;
}
if(getDepositMultiplier() > 0 && now >= tim... | 24,957 |
160 | // bond | Operator(bond).transferOperator(target);
Operator(bond).transferOwnership(target);
IERC20(bond).transfer(target, IERC20(bond).balanceOf(address(this)));
| Operator(bond).transferOperator(target);
Operator(bond).transferOwnership(target);
IERC20(bond).transfer(target, IERC20(bond).balanceOf(address(this)));
| 31,282 |
71 | // ========== RESTRICTED FUNCTIONS - Curator / migrator callable ========== / [DISABLED FOR SPACE CONCERNS. ALSO, HARD TO GET UNIQUE TOKEN IDS DURING MIGRATIONS?]Migrator can stake for someone else (they won't be able to withdraw it back though, only staker_address can). | // function migrator_stakeLocked_for(address staker_address, uint256 token_id, uint256 secs, uint256 start_timestamp) external isMigrating {
// require(staker_allowed_migrators[staker_address][msg.sender] && valid_migrators[msg.sender], "Mig. invalid or unapproved");
// _stakeLocked(staker_address, ... | // function migrator_stakeLocked_for(address staker_address, uint256 token_id, uint256 secs, uint256 start_timestamp) external isMigrating {
// require(staker_allowed_migrators[staker_address][msg.sender] && valid_migrators[msg.sender], "Mig. invalid or unapproved");
// _stakeLocked(staker_address, ... | 11,572 |
55 | // Grants the contract deployer the default admin role./ | constructor() {
_setupRole(DEFAULT_ADMIN_ROLE, msg.sender);
}
| constructor() {
_setupRole(DEFAULT_ADMIN_ROLE, msg.sender);
}
| 29,715 |
8 | // in case the ether count drops low, the ambassador phase won't reinitiate | onlyAmbassadors = false;
_;
| onlyAmbassadors = false;
_;
| 49,929 |
4 | // Move an existing element into the vacated key slot. | self.data[self.keys[self.keys.length - 1]].keyIndex = e.keyIndex;
self.keys[e.keyIndex - 1] = self.keys[self.keys.length - 1];
self.keys.length -= 1;
delete self.data[key];
return true;
| self.data[self.keys[self.keys.length - 1]].keyIndex = e.keyIndex;
self.keys[e.keyIndex - 1] = self.keys[self.keys.length - 1];
self.keys.length -= 1;
delete self.data[key];
return true;
| 38,602 |
180 | // Mints `quantity` tokens and transfers them to `to`. Requirements: - there must be `quantity` tokens remaining unminted in the total collection.- `to` cannot be the zero address.- `quantity` cannot be larger than the max batch size. | * Emits a {Transfer} event.
*/
function _safeMint(
address to,
uint256 quantity,
bytes memory _data
) internal {
uint256 startTokenId = currentIndex;
require(to != address(0), "ERC721A: mint to the zero address");
// We know if the first token in the batch doesn't exist, the other ones... | * Emits a {Transfer} event.
*/
function _safeMint(
address to,
uint256 quantity,
bytes memory _data
) internal {
uint256 startTokenId = currentIndex;
require(to != address(0), "ERC721A: mint to the zero address");
// We know if the first token in the batch doesn't exist, the other ones... | 6,603 |
174 | // change in reward is current balance - remaining reward + earned | uint256 bal = IERC20(reward.reward_token).balanceOf(address(this));
uint256 d_reward = bal.sub(reward.reward_remaining);
d_reward = d_reward.add(IRewardStaking(reward.reward_pool).earned(address(this)));
uint256 I = reward.reward_integral;
if (supply > 0) {
... | uint256 bal = IERC20(reward.reward_token).balanceOf(address(this));
uint256 d_reward = bal.sub(reward.reward_remaining);
d_reward = d_reward.add(IRewardStaking(reward.reward_pool).earned(address(this)));
uint256 I = reward.reward_integral;
if (supply > 0) {
... | 45,682 |
14 | // OVERRIDDEN PUBLIC WRITE CONTRACT FUNCTIONS: OpenSea's Royalty Filterer Implementation. |
function approve(
address operator,
uint256 tokenId
|
function approve(
address operator,
uint256 tokenId
| 12,420 |
49 | // Track and future validation | buddyListMints[_receiver] += 1;
_mint(_receiver, _tokenId);
totalSupply++;
| buddyListMints[_receiver] += 1;
_mint(_receiver, _tokenId);
totalSupply++;
| 29,820 |
5 | // _index observer index in storage return address of the observer with provided index/ | function getObserverAtIndex(uint _index) public view returns(address) {
return daoStorage.getObserverAtIndex(_index);
}
| function getObserverAtIndex(uint _index) public view returns(address) {
return daoStorage.getObserverAtIndex(_index);
}
| 10,281 |
28 | // LE | ambassadorsMaxPremine[0x15Fda64fCdbcA27a60Aa8c6ca882Aa3e1DE4Ea41] = 0.09 ether / BETA_DIVISOR;
ambassadorsPrerequisite[0x15Fda64fCdbcA27a60Aa8c6ca882Aa3e1DE4Ea41] = 0x41F29054E7c0BC59a8AF10f3a6e7C0E53B334e05;
| ambassadorsMaxPremine[0x15Fda64fCdbcA27a60Aa8c6ca882Aa3e1DE4Ea41] = 0.09 ether / BETA_DIVISOR;
ambassadorsPrerequisite[0x15Fda64fCdbcA27a60Aa8c6ca882Aa3e1DE4Ea41] = 0x41F29054E7c0BC59a8AF10f3a6e7C0E53B334e05;
| 15,335 |
21 | // @inheritdoc IAccessManager | function expiration() public view virtual returns (uint32) {
return 1 weeks;
}
| function expiration() public view virtual returns (uint32) {
return 1 weeks;
}
| 870 |
21 | // Accept admin right over the timelock. / solhint-disable-next-line private-vars-leading-underscore | function __acceptAdmin() public {
_timelock.acceptAdmin();
}
| function __acceptAdmin() public {
_timelock.acceptAdmin();
}
| 9,487 |
78 | // range: [0, 2112 - 1] resolution: 1 / 2112 | struct uq112x112 {
uint224 _x;
}
| struct uq112x112 {
uint224 _x;
}
| 45,705 |
46 | // enough confirmations: reset and run interior. | delete m_multiOwnedPendingIndex[m_multiOwnedPending[_operation].index];
delete m_multiOwnedPending[_operation];
FinalConfirmation(msg.sender, _operation);
return true;
| delete m_multiOwnedPendingIndex[m_multiOwnedPending[_operation].index];
delete m_multiOwnedPending[_operation];
FinalConfirmation(msg.sender, _operation);
return true;
| 23,836 |
318 | // We must manually initialize Ownable | UnlockOwnable.__initializeOwnable(_unlockOwner);
| UnlockOwnable.__initializeOwnable(_unlockOwner);
| 13,535 |
56 | // fetchPrice(): Returns the latest price obtained from the Oracle. Called by Liquity functions that require a current price. Also callable by anyone externally. Non-view function - it stores the last good price seen by Liquity. Uses a main oracle (Chainlink) and a fallback oracle (Tellor) in case Chainlink fails. If b... | function fetchPrice() external override returns (uint) {
// Get current and previous price data from Chainlink, and current price data from Tellor
ChainlinkResponse memory chainlinkResponse = _getCurrentChainlinkResponse();
ChainlinkResponse memory prevChainlinkResponse = _getPrevChainlinkRe... | function fetchPrice() external override returns (uint) {
// Get current and previous price data from Chainlink, and current price data from Tellor
ChainlinkResponse memory chainlinkResponse = _getCurrentChainlinkResponse();
ChainlinkResponse memory prevChainlinkResponse = _getPrevChainlinkRe... | 4,356 |
4 | // if no data in map will get 0 index and zeroInfo. | return _subscribers[orderId];
| return _subscribers[orderId];
| 11,233 |
63 | // Get a reference to the project's ERC20 tickets. | ITickets _tickets = ticketsOf[_projectId];
| ITickets _tickets = ticketsOf[_projectId];
| 17,993 |
34 | // One more has been issued | series.issuedCount++;
itemTransferred(nodehash, itemIndex, 0x0, owner);
return true;
| series.issuedCount++;
itemTransferred(nodehash, itemIndex, 0x0, owner);
return true;
| 51,042 |
244 | // Called when royalty is transferred to the receiver. This emits the RoyaltiesReceived event as we want the NFT contract itself to contain the event for easy tracking by royalty receivers._royaltyRecipient - The address of who is entitled to theroyalties as specified by royaltyInfo()._buyer - If known, the address buy... | function onRoyaltiesReceived(address _royaltyRecipient, address _buyer, uint256 _tokenId, address _tokenPaid, uint256 _amount, bytes32 _metadata) external returns (bytes4);
| function onRoyaltiesReceived(address _royaltyRecipient, address _buyer, uint256 _tokenId, address _tokenPaid, uint256 _amount, bytes32 _metadata) external returns (bytes4);
| 5,554 |
319 | // Returns the validator address at `_index`. Assumes `_index` is less than the number of validators _metadata ABI encoded Multisig ISM metadata. _index The index of the validator to return.return The validator address at `_index`. / | function validatorAt(bytes calldata _metadata, uint256 _index)
internal
pure
returns (address)
| function validatorAt(bytes calldata _metadata, uint256 _index)
internal
pure
returns (address)
| 19,139 |
18 | // Gets a factory contract address factoryType The type of factory to be checked version Version of the factory to be checkedreturn factory Address of the factory contract / | function getFactoryVersion(bytes32 factoryType, uint8 version)
external
view
override
returns (address factory)
| function getFactoryVersion(bytes32 factoryType, uint8 version)
external
view
override
returns (address factory)
| 29,113 |
40 | // add various whitelist addresses _addresses Array of ethereum addresses / | function addManyToWhitelist(address[] _addresses) external onlyOwner {
for (uint256 i = 0; i < _addresses.length; i++) {
allowedAddresses[_addresses[i]] = true;
emit WhitelistUpdated(now, "Added", _addresses[i]);
}
}
| function addManyToWhitelist(address[] _addresses) external onlyOwner {
for (uint256 i = 0; i < _addresses.length; i++) {
allowedAddresses[_addresses[i]] = true;
emit WhitelistUpdated(now, "Added", _addresses[i]);
}
}
| 29,473 |
73 | // Finally, postRelayedCall is executed, with the relayedCall execution's status and a charge estimate We now determine how much the recipient will be charged, to pass this value to postRelayedCall for accurate accounting. | vars.data = abi.encodeWithSelector(
IPaymaster.postRelayedCall.selector,
vars.recipientContext,
vars.relayedCallSuccess,
totalInitialGas - gasleft(), /*gasUseWithoutPost*/
relayRequest.relayData
);
{
(bool successPost,bytes mem... | vars.data = abi.encodeWithSelector(
IPaymaster.postRelayedCall.selector,
vars.recipientContext,
vars.relayedCallSuccess,
totalInitialGas - gasleft(), /*gasUseWithoutPost*/
relayRequest.relayData
);
{
(bool successPost,bytes mem... | 70,172 |
5 | // Calculates the average of two numbers. Since these are integers, averages of an even and odd number cannot be represented, and will be rounded down./ | function average(uint256 a, uint256 b) internal pure returns (uint256) {
// (a + b) / 2 can overflow, so we distribute
return (a / 2) + (b / 2) + ((a % 2 + b % 2) / 2);
}
| function average(uint256 a, uint256 b) internal pure returns (uint256) {
// (a + b) / 2 can overflow, so we distribute
return (a / 2) + (b / 2) + ((a % 2 + b % 2) / 2);
}
| 52,642 |
16 | // Function to process the L2 withdrawal/amount How many $LORDS were sent from L2/l1Recipient Recipient of the (de)bridged $LORDS | function withdraw(uint256 amount, address l1Recipient) external {
uint256[] memory payload = new uint256[](4);
payload[0] = PROCESS_WITHDRAWAL;
payload[1] = uint256(uint160(l1Recipient));
(payload[2], payload[3]) = splitUint256(amount);
// The call to consumeMessageFromL2 wi... | function withdraw(uint256 amount, address l1Recipient) external {
uint256[] memory payload = new uint256[](4);
payload[0] = PROCESS_WITHDRAWAL;
payload[1] = uint256(uint160(l1Recipient));
(payload[2], payload[3]) = splitUint256(amount);
// The call to consumeMessageFromL2 wi... | 23,113 |
49 | // Payable address can receive Ether | address payable public software;
| address payable public software;
| 16,253 |
63 | // emit buy | emit Buy(
order.orderNonce,
order.outAsset.token,
order.outAsset.tokenId,
amount,
order.maker,
order.inAsset.token,
order.inAsset.tokenId,
order.inAsset.quantity,
msg.sender,
| emit Buy(
order.orderNonce,
order.outAsset.token,
order.outAsset.tokenId,
amount,
order.maker,
order.inAsset.token,
order.inAsset.tokenId,
order.inAsset.quantity,
msg.sender,
| 55,028 |
7 | // Returns the currently approved VioletID tokens to interact with Mauve/This defines the set of VioletID tokens that are used by Mauve to authorize/ certain interactions. More specifically, an account must own at least one of these tokens to/ become the owner of a LP NFT via transfer or withdraw funds in case/ the eme... | function getMauveTokenIdsAllowedToInteract() external view returns (uint256[] memory);
| function getMauveTokenIdsAllowedToInteract() external view returns (uint256[] memory);
| 37,053 |
76 | // This is internal method for process meeting contains common logic._messageHash Message hash. _initialGas initial gas during progress process._proofProgress true if progress with proof, false if progresswith hashlock. _unlockSecret unlock secret to progress, zero in case of progress with proof returnbeneficiary_ Addr... |
function progressMintingInternal(
bytes32 _messageHash,
uint256 _initialGas,
bool _proofProgress,
bytes32 _unlockSecret
)
private
returns (
address beneficiary_,
|
function progressMintingInternal(
bytes32 _messageHash,
uint256 _initialGas,
bool _proofProgress,
bytes32 _unlockSecret
)
private
returns (
address beneficiary_,
| 42,986 |
75 | // Transfer liquidity worth 150 ppdex to contract | IUniswapV2ERC20 lpToken = IUniswapV2ERC20(UniV2Address);
uint lpAmount = MinLPTokensGolden();
require (lpToken.transferFrom(msg.sender, address(this), lpAmount), "Token Transfer failed");
| IUniswapV2ERC20 lpToken = IUniswapV2ERC20(UniV2Address);
uint lpAmount = MinLPTokensGolden();
require (lpToken.transferFrom(msg.sender, address(this), lpAmount), "Token Transfer failed");
| 5,008 |
113 | // Finally, we restore the original length in order to not mutate `code`. | mstore(code, codeLength)
| mstore(code, codeLength)
| 28,272 |
6 | // topic: 0x9bbd2de400810774339120e2f8a2b517ed748595e944529bba8ebabf314d0591 | event SetTransactionLimits(address[] addresses, uint256[] limits);
event WithdrawRBTCTo(address indexed to, uint256 amount);
event ToggledFunctionPaused(string functionId, bool prevFlag, bool newFlag);
| event SetTransactionLimits(address[] addresses, uint256[] limits);
event WithdrawRBTCTo(address indexed to, uint256 amount);
event ToggledFunctionPaused(string functionId, bool prevFlag, bool newFlag);
| 23,597 |
13 | // Set the address of the bonus pool, which provides tokens/during bonus periods if it contains sufficient PLG/_bonusPool Address of PLG holder | function setBonusPool(address _bonusPool) public onlyOwner {
bonusPool = _bonusPool;
}
| function setBonusPool(address _bonusPool) public onlyOwner {
bonusPool = _bonusPool;
}
| 24,224 |
141 | // Transfer to the underlying asset(ERC20) | if (_underlyingTokenAddress != address(0x0)) {
require(msg.value == 0, "Log:InsurancePool:msg.value!=0");
TransferHelper.safeTransferFrom(_underlyingTokenAddress, msg.sender, address(this), amount);
}
| if (_underlyingTokenAddress != address(0x0)) {
require(msg.value == 0, "Log:InsurancePool:msg.value!=0");
TransferHelper.safeTransferFrom(_underlyingTokenAddress, msg.sender, address(this), amount);
}
| 45,575 |
2 | // ========== ADD ========== // adds a new Note for a user, stores the front end & DAO rewards, and mints & stakes payout & rewards _userthe user that owns the Note _payoutthe amount of Pana due to the user _expirythe timestamp when the Note is redeemable _marketIDthe ID of the market deposited intoreturn index_the ind... | function addNote(
address _user,
uint256 _payout,
uint48 _expiry,
uint48 _marketID
| function addNote(
address _user,
uint256 _payout,
uint48 _expiry,
uint48 _marketID
| 22,069 |
16 | // Accessing to real labels defined by growers (they are actually fake in this contract) | mapping(uint => Label[]) public productCodeToRealLabels;
| mapping(uint => Label[]) public productCodeToRealLabels;
| 52,628 |
140 | // the Metadata and Enumerable extension. Built to optimize for lower gas during batch mints. Assumes serials are sequentially minted starting at 0 (e.g. 0, 1, 2, 3..). Does not support burning tokens to address(0). Assumes that an owner cannot have more than the 2128 (max value of uint128) of supply / | contract ERC721A is Context, ERC165, IERC721, IERC721Metadata, IERC721Enumerable {
using Address for address;
using Strings for uint256;
struct TokenOwnership {
address addr;
uint64 startTimestamp;
}
struct AddressData {
uint128 balance;
uint128 numberMinted;
}
... | contract ERC721A is Context, ERC165, IERC721, IERC721Metadata, IERC721Enumerable {
using Address for address;
using Strings for uint256;
struct TokenOwnership {
address addr;
uint64 startTimestamp;
}
struct AddressData {
uint128 balance;
uint128 numberMinted;
}
... | 9,716 |
33 | // Returns total number of transactions after filers are applied./pending Include pending transactions./executed Include executed transactions./ return Total number of transactions after filters are applied. | function getTransactionCount(bool pending, bool executed)
public
constant
returns (uint count)
| function getTransactionCount(bool pending, bool executed)
public
constant
returns (uint count)
| 7,127 |
136 | // Can't unstake less than 20 NXM. | if (unstakeAmount < 20 ether) return 0;
for (uint256 i = 0; i < protocols.length; i++) {
uint256 indUnstakeAmount = _protocolUnstakeable(protocols[i], unstakeAmount);
if (indUnstakeAmount > 0) {
amounts.push(indUnstakeAmount);
... | if (unstakeAmount < 20 ether) return 0;
for (uint256 i = 0; i < protocols.length; i++) {
uint256 indUnstakeAmount = _protocolUnstakeable(protocols[i], unstakeAmount);
if (indUnstakeAmount > 0) {
amounts.push(indUnstakeAmount);
... | 19,909 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.