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 |
|---|---|---|---|---|
22 | // The admin/social trader can modify the withdrawal fee/Modify the withdrawal fee represented in percentage with two decimals of precision (xxx.xx%)/_newWithdrawalFee value representing the take profit fee in %; can only go as high as 50.00% (5000) otherwise error OutOfBounds is thrown | function modifyWithdrawalFee(uint16 _newWithdrawalFee) public onlyAdmin outOfBoundsCheck(5000, _newWithdrawalFee) {
withdrawalFee = _newWithdrawalFee;
emit WithdrawalFeeModified(_newWithdrawalFee);
}
| function modifyWithdrawalFee(uint16 _newWithdrawalFee) public onlyAdmin outOfBoundsCheck(5000, _newWithdrawalFee) {
withdrawalFee = _newWithdrawalFee;
emit WithdrawalFeeModified(_newWithdrawalFee);
}
| 13,198 |
2 | // 紀錄此活動票券擁有者(購買者)正在二級市場販售的活動票券數。 | mapping(address => uint256) public tradingTicketsOfOwner;
mapping(uint256 => bool) public usedTickets;
| mapping(address => uint256) public tradingTicketsOfOwner;
mapping(uint256 => bool) public usedTickets;
| 30,224 |
1 | // Checks to make sure IPO exists/_ipoIndex Index of IPO to check | modifier onlyExistingIPO(uint256 _ipoIndex){
require(this.exists(_ipoIndex));
_;
}
| modifier onlyExistingIPO(uint256 _ipoIndex){
require(this.exists(_ipoIndex));
_;
}
| 18,230 |
141 | // allows non-oracles to request a new round / | function requestNewRound()
external
returns (uint80)
| function requestNewRound()
external
returns (uint80)
| 1,512 |
27 | // Thu Nov 15 23:59:59 2018 |
GAMA1Token public token; // GAMA1 token itself
address public wallet; // Wallet of funds
uint256 public weiRaised; // Amount of raised money in wei
uint256 public firstBonus = 10;
uint256 public secondBon... |
GAMA1Token public token; // GAMA1 token itself
address public wallet; // Wallet of funds
uint256 public weiRaised; // Amount of raised money in wei
uint256 public firstBonus = 10;
uint256 public secondBon... | 45,900 |
33 | // supply token Create a reference to the underlying asset contract, like DAI. | Erc20 underlying = Erc20(erc20contract);
| Erc20 underlying = Erc20(erc20contract);
| 75,827 |
127 | // Modifier to ensure contract has not yet expired / | modifier contractNotExpired(){
require(!expired, "Contract is expired");
_;
}
| modifier contractNotExpired(){
require(!expired, "Contract is expired");
_;
}
| 15,784 |
146 | // distribution of per second | uint256 public rewardRate = 0;
uint256 public rewardPerLPToken = 0;
mapping(address => uint256) private rewards;
mapping(address => uint256) private userRewardPerTokenPaid;
| uint256 public rewardRate = 0;
uint256 public rewardPerLPToken = 0;
mapping(address => uint256) private rewards;
mapping(address => uint256) private userRewardPerTokenPaid;
| 14,232 |
70 | // if (feePayableTokedoMaker == 1) | if (_values[i*5+10] == 1) {
| if (_values[i*5+10] == 1) {
| 321 |
6 | // The adress that receives all primary sales value. | address public defaultSaleRecipient;
| address public defaultSaleRecipient;
| 3,520 |
105 | // Open a new Maker vault | contract McdOpen is ActionBase {
/// @inheritdoc ActionBase
function executeAction(
bytes[] memory _callData,
bytes[] memory _subData,
uint8[] memory _paramMapping,
bytes32[] memory _returnValues
) public payable virtual override returns (bytes32) {
(address joinAddr,... | contract McdOpen is ActionBase {
/// @inheritdoc ActionBase
function executeAction(
bytes[] memory _callData,
bytes[] memory _subData,
uint8[] memory _paramMapping,
bytes32[] memory _returnValues
) public payable virtual override returns (bytes32) {
(address joinAddr,... | 42,366 |
4 | // static array | uint[3] memory c = [uint(1) , 2, 3];
assert(c.length == 3);
| uint[3] memory c = [uint(1) , 2, 3];
assert(c.length == 3);
| 8,862 |
288 | // Allows management to update the base tokenURI pathReverts if not called by management_newBaseURI the new base URI to set/ | function setTokenBaseURI(string calldata _newBaseURI) external onlyAdmin {
_baseTokenURI = _newBaseURI;
}
| function setTokenBaseURI(string calldata _newBaseURI) external onlyAdmin {
_baseTokenURI = _newBaseURI;
}
| 62,988 |
25 | // ChainId restriction allows to set the contract to only accept rafflesfrom a preset chainId. This allows the arbiter to restrict about whichchains it will accept formulating an opinion over. / | uint256 public chainIdRestriction;
| uint256 public chainIdRestriction;
| 30,245 |
44 | // is the correct epoch parameter passed ? |
uint256 epochNumber = _getSliceUInt256(4, _data);
if (epochNumber == IStakingHbbft(validatorSetContract.stakingContract()).stakingEpoch() + 1) {
return (CALL, false);
} else {
|
uint256 epochNumber = _getSliceUInt256(4, _data);
if (epochNumber == IStakingHbbft(validatorSetContract.stakingContract()).stakingEpoch() + 1) {
return (CALL, false);
} else {
| 17,572 |
12 | // calculate fee and leftover of swaps | uint256 calculatedFeeAndLeftover = _calcFeeAndLeftoverAndUserAmount(
receivedAmount,
amountOutMin,
fee
);
| uint256 calculatedFeeAndLeftover = _calcFeeAndLeftoverAndUserAmount(
receivedAmount,
amountOutMin,
fee
);
| 18,561 |
26 | // Case 'no': Simple bridge transfer - Send to receiver | relayer.sendTokenTransfer{ value: msgValue }(
| relayer.sendTokenTransfer{ value: msgValue }(
| 14,376 |
10 | // [ERC1400Raw INTERFACE (9/13)] Indicate whether the operator address is an operator of the tokenHolder address. operator Address which may be an operator of tokenHolder. tokenHolder Address of a token holder which may have the operator address as an operator.return 'true' if operator is an operator of 'tokenHolder' a... | function isOperator(address operator, address tokenHolder)
external
override
view
returns (bool)
| function isOperator(address operator, address tokenHolder)
external
override
view
returns (bool)
| 41,400 |
25 | // Calculates the effective premium, denominated in underlyingTokens, to sell `optionToken`s.router The UniswapV2Router02 contract.optionToken The optionToken to get the premium cost of purchasing.quantity The quantity of short option tokens that will be closed. / | function getClosePremium(
IUniswapV2Router02 router,
IOption optionToken,
uint256 quantity
)
internal
view
returns (
| function getClosePremium(
IUniswapV2Router02 router,
IOption optionToken,
uint256 quantity
)
internal
view
returns (
| 19,596 |
8 | // Takes in a list of multiple bips and performs a vote or unvote on all of them/ depending on their status: whether they are currently voted on or not voted on/bip_list Contains the bip proposal ids | function voteUnvoteAll(uint32[] calldata bip_list) external {
require(balanceOfRoots(msg.sender) > 0, "Governance: Must have Stalk.");
uint i = 0;
bool[] memory vote_types = new bool[](bip_list.length);
for (i = 0; i < bip_list.length; i++) {
uint32 bip = bip_lis... | function voteUnvoteAll(uint32[] calldata bip_list) external {
require(balanceOfRoots(msg.sender) > 0, "Governance: Must have Stalk.");
uint i = 0;
bool[] memory vote_types = new bool[](bip_list.length);
for (i = 0; i < bip_list.length; i++) {
uint32 bip = bip_lis... | 8,410 |
6 | // return the name of the token | function name() public pure returns (string) {
return "None";
}
| function name() public pure returns (string) {
return "None";
}
| 26,468 |
5 | // Deploys a wrapper with the given parameters/name The name of the wrapper/symbol The symbol of the wrapper/decimals The decimals of the wrapper/agTokenAddress The address of the agToken being wrapped | function deploy(
string memory name,
string memory symbol,
uint8 decimals,
address agTokenAddress
| function deploy(
string memory name,
string memory symbol,
uint8 decimals,
address agTokenAddress
| 22,448 |
123 | // Emitted when liquidity is minted for a given position/sender The address that minted the liquidity/owner The owner of the position and recipient of any minted liquidity/tickLower The lower tick of the position/tickUpper The upper tick of the position/amount The amount of liquidity minted to the position range/amount... | event Mint(
address sender,
address indexed owner,
int24 indexed tickLower,
int24 indexed tickUpper,
uint128 amount,
uint256 amount0,
uint256 amount1
);
| event Mint(
address sender,
address indexed owner,
int24 indexed tickLower,
int24 indexed tickUpper,
uint128 amount,
uint256 amount0,
uint256 amount1
);
| 7,744 |
136 | // Returns the downcasted uint216 from uint256, reverting onoverflow (when the input is greater than largest uint216). Counterpart to Solidity's `uint216` operator. Requirements: - input must fit into 216 bits _Available since v4.7._ / | function toUint216(uint256 value) internal pure returns (uint216) {
require(value <= type(uint216).max, "SafeCast: value doesn't fit in 216 bits");
return uint216(value);
}
| function toUint216(uint256 value) internal pure returns (uint216) {
require(value <= type(uint216).max, "SafeCast: value doesn't fit in 216 bits");
return uint216(value);
}
| 916 |
8 | // Fix for the ERC20 short address attack. / | modifier onlyPayloadSize(uint size) {
if(msg.data.length < size + 4) {
revert();
}
_;
}
| modifier onlyPayloadSize(uint size) {
if(msg.data.length < size + 4) {
revert();
}
_;
}
| 19,800 |
89 | // returns true if a user can buy new policy of specified PolicyBook | function canBuyNewPolicy(address buyer, address policyBookAddress)
external
view
returns (bool);
| function canBuyNewPolicy(address buyer, address policyBookAddress)
external
view
returns (bool);
| 45,222 |
8 | // Stabilizer definitions | for (uint256 i = 0; i < _stabilizers.length; i++)
stabilizers.push(_stabilizers[i]);
owner = msg.sender;
isTokenLive = false;
support = msg.sender;
TGE = block.timestamp;
isAutoSwappable = true;
| for (uint256 i = 0; i < _stabilizers.length; i++)
stabilizers.push(_stabilizers[i]);
owner = msg.sender;
isTokenLive = false;
support = msg.sender;
TGE = block.timestamp;
isAutoSwappable = true;
| 38,941 |
22 | // mint NFT20 ERC20 | INFT20Pair(_erc20Address).multi721Deposit(
_ids,
REFERRAL // referral
);
| INFT20Pair(_erc20Address).multi721Deposit(
_ids,
REFERRAL // referral
);
| 25,946 |
44 | // Get all Noun parts for the passed `seed`. / | function _getPartsForSeed(INounsSeeder.Seed memory seed) internal view returns (bytes[] memory) {
bytes[] memory _parts = new bytes[](4);
_parts[0] = bodies[seed.body];
_parts[1] = accessories[seed.accessory];
_parts[2] = heads[seed.head];
_parts[3] = glasses[seed.glasses];
... | function _getPartsForSeed(INounsSeeder.Seed memory seed) internal view returns (bytes[] memory) {
bytes[] memory _parts = new bytes[](4);
_parts[0] = bodies[seed.body];
_parts[1] = accessories[seed.accessory];
_parts[2] = heads[seed.head];
_parts[3] = glasses[seed.glasses];
... | 51,594 |
53 | // OfficeHours Management /// | function canCast(uint40 _ts, bool _officeHours) public pure returns (bool) {
if (_officeHours) {
uint256 day = (_ts / 1 days + 3) % 7;
if (day >= 5) { return false; } // Can only be cast on a weekday
uint256 hour = _ts / 1 hours % 24;
if (hour... | function canCast(uint40 _ts, bool _officeHours) public pure returns (bool) {
if (_officeHours) {
uint256 day = (_ts / 1 days + 3) % 7;
if (day >= 5) { return false; } // Can only be cast on a weekday
uint256 hour = _ts / 1 hours % 24;
if (hour... | 73,095 |
96 | // Derive size of offer and consideration data. 2 words (lengths) + 4 (offer data) + 5 (consideration 1) + 5ar | uint256 offerAndConsiderationSize = OrderFulfilled_baseDataSize +
(additionalRecipientsLength * ReceivedItem_size);
| uint256 offerAndConsiderationSize = OrderFulfilled_baseDataSize +
(additionalRecipientsLength * ReceivedItem_size);
| 20,755 |
16 | // Properties for each NFT TokenId | mapping(uint256 => YAGMIProps) public tokens;
| mapping(uint256 => YAGMIProps) public tokens;
| 9,822 |
134 | // we don't claim rewards from current week. | if (_index >= _lastTime || _index >= _thisWeek) break;
uint256 _totalPower = historyBoosts[address(0)][_index];
uint256 _userPower = historyBoosts[_user][_index];
if (_totalPower != 0 && _userPower != 0) {
_amount += (_userPower * weeklyRewards[_token][_in... | if (_index >= _lastTime || _index >= _thisWeek) break;
uint256 _totalPower = historyBoosts[address(0)][_index];
uint256 _userPower = historyBoosts[_user][_index];
if (_totalPower != 0 && _userPower != 0) {
_amount += (_userPower * weeklyRewards[_token][_in... | 12,357 |
874 | // Check address being called is not blacklist | for (uint256 i = 0; i < _blacklist.length; i++) {
require(contractAddress != _blacklist[i], ERROR_BLACKLISTED_CALL);
}
| for (uint256 i = 0; i < _blacklist.length; i++) {
require(contractAddress != _blacklist[i], ERROR_BLACKLISTED_CALL);
}
| 6,002 |
19 | // Query for associated information for a fact. Only callable from provers. account The address to which the fact belongs factSig The unique signature identifying the factreturn exists whether or not a fact with the given signatureis associated with the queried accountreturn version the prover version id that proved th... | function getFact(address account, FactSignature factSig)
| function getFact(address account, FactSignature factSig)
| 24,844 |
36 | // This empty reserved space is put in place to allow future versions to add newvariables without shifting down storage in the inheritance chain. / | uint256[45] private __gap;
| uint256[45] private __gap;
| 19,602 |
116 | // transfer property tokens back to account | doTransferOut(account, amount);
emit Withdraw(account, amount);
return amount;
| doTransferOut(account, amount);
emit Withdraw(account, amount);
return amount;
| 69,430 |
9 | // Erase the participants field, if there was something | cred.participants.length = 0;
| cred.participants.length = 0;
| 47,326 |
19 | // Calculate rewards for param _staker by calculating the time passed since last update in days and mulitplying it to ERC721 Tokens Staked and rewardsPerDay. | function calculateRewards(uint256 _tokenId)
internal
view
returns (uint256 _rewards)
| function calculateRewards(uint256 _tokenId)
internal
view
returns (uint256 _rewards)
| 18,685 |
95 | // Pool Delegate Utility Functions // / | function poolSanityChecks(
IMapleGlobals globals,
address liquidityAsset,
address stakeAsset,
uint256 stakingFee,
uint256 delegateFee
| function poolSanityChecks(
IMapleGlobals globals,
address liquidityAsset,
address stakeAsset,
uint256 stakingFee,
uint256 delegateFee
| 40,467 |
44 | // Cannot create a token without supply | require(_initialSupply != 0);
owner = msg.sender;
name = _name;
symbol = _symbol;
totalSupply = _initialSupply;
decimals = _decimals;
| require(_initialSupply != 0);
owner = msg.sender;
name = _name;
symbol = _symbol;
totalSupply = _initialSupply;
decimals = _decimals;
| 35,441 |
165 | // Constructor/_contractRegistry is the contract registry address/_registryAdmin is the registry admin address | constructor(IContractRegistry _contractRegistry, address _registryAdmin) public {
require(address(_contractRegistry) != address(0), "_contractRegistry cannot be 0");
setContractRegistry(_contractRegistry);
_transferRegistryManagement(_registryAdmin);
}
| constructor(IContractRegistry _contractRegistry, address _registryAdmin) public {
require(address(_contractRegistry) != address(0), "_contractRegistry cannot be 0");
setContractRegistry(_contractRegistry);
_transferRegistryManagement(_registryAdmin);
}
| 18,742 |
324 | // Moves any USDC from Compound back to the Pool, and recognizes interest earned.This is done automatically on drawdown or withdraw, but can be called manually if necessary. Requirements: - The caller must be an admin. / | function sweepFromCompound() public override onlyAdmin whenNotPaused {
_sweepFromCompound();
}
| function sweepFromCompound() public override onlyAdmin whenNotPaused {
_sweepFromCompound();
}
| 14,489 |
48 | // Constant overhead | MIN_GAS_CONSTANT_OVERHEAD;
| MIN_GAS_CONSTANT_OVERHEAD;
| 2,242 |
66 | // Sets the borrower's debt ratio. Will be reverted if the borrower doesn't exist or the total debt ratio is exceeded./In the case where you want to disable the borrower, you need to set its ratio to 0./Thus, the borrower's current debt becomes an outstanding debt, which he must repay to the lender. | function _setBorrowerDebtRatio(address borrower, uint256 borrowerDebtRatio)
internal
| function _setBorrowerDebtRatio(address borrower, uint256 borrowerDebtRatio)
internal
| 15,340 |
119 | // If it's zero no data has ever been pushed so we return zero | if (length == 0) {
return 0;
}
| if (length == 0) {
return 0;
}
| 27,525 |
561 | // Withdraws from funds from the Mochi Vault _shares: Number of shares to withdraw / | function withdraw(uint256 _shares) public notContract {
UserInfo storage user = userInfo[msg.sender];
require(_shares > 0, "Nothing to withdraw");
require(_shares <= user.shares, "Withdraw amount exceeds balance");
uint256 currentAmount = (balanceOf().mul(_shares)).div(totalShares);... | function withdraw(uint256 _shares) public notContract {
UserInfo storage user = userInfo[msg.sender];
require(_shares > 0, "Nothing to withdraw");
require(_shares <= user.shares, "Withdraw amount exceeds balance");
uint256 currentAmount = (balanceOf().mul(_shares)).div(totalShares);... | 9,255 |
2 | // Checks if account is blocklisted _account The address to check / | function isBlocklisted(address _account) external view returns (bool) {
return blocklisted[_account];
}
| function isBlocklisted(address _account) external view returns (bool) {
return blocklisted[_account];
}
| 13,901 |
177 | // Safe ubuntu transfer function, just in case if rounding error causes pool to not have enough UBUNTUs. | function safeubuntuTransfer(address _to, uint256 _amount) internal {
uint256 ubuntuBal = ubuntu.balanceOf(address(this));
if (_amount > ubuntuBal) {
ubuntu.transfer(_to, ubuntuBal);
} else {
ubuntu.transfer(_to, _amount);
}
}
| function safeubuntuTransfer(address _to, uint256 _amount) internal {
uint256 ubuntuBal = ubuntu.balanceOf(address(this));
if (_amount > ubuntuBal) {
ubuntu.transfer(_to, ubuntuBal);
} else {
ubuntu.transfer(_to, _amount);
}
}
| 76,318 |
100 | // Grants the admin role to an address The sender must have the admin role _address EOA or contract receiving the new role / | function addAdminRole(address _address) external {
grantRole(DEFAULT_ADMIN_ROLE, _address);
emit AdminRoleGranted(_address, _msgSender());
}
| function addAdminRole(address _address) external {
grantRole(DEFAULT_ADMIN_ROLE, _address);
emit AdminRoleGranted(_address, _msgSender());
}
| 507 |
1 | // Does subtract in safe manner return result of (_subtrahend - _subtractor) or 0 if overflow occurs / | function sub(uint256 _subtrahend, uint256 _subtractor) internal returns (uint256) {
// overflow check
if (_subtractor > _subtrahend)
return 0;
return _subtrahend - _subtractor;
}
| function sub(uint256 _subtrahend, uint256 _subtractor) internal returns (uint256) {
// overflow check
if (_subtractor > _subtrahend)
return 0;
return _subtrahend - _subtractor;
}
| 49,235 |
94 | // Ensure that consideration array length is equal to the total original consideration items value. | if (orderParameters.consideration.length != orderParameters.totalOriginalConsiderationItems) {
_revertConsiderationLengthNotEqualToTotalOriginal();
}
| if (orderParameters.consideration.length != orderParameters.totalOriginalConsiderationItems) {
_revertConsiderationLengthNotEqualToTotalOriginal();
}
| 17,144 |
19 | // -- Constructor -- |
constructor() public {
Asset_Permitted[0x6B175474E89094C44Da98b954EedeAC495271d0F] = true; // DAI
Asset_Precision[0x6B175474E89094C44Da98b954EedeAC495271d0F] = 1000000000000000000;
Asset_Permitted[0x0000000000000000000000000000000000000000] = true; // ETH Placeholder
Ass... |
constructor() public {
Asset_Permitted[0x6B175474E89094C44Da98b954EedeAC495271d0F] = true; // DAI
Asset_Precision[0x6B175474E89094C44Da98b954EedeAC495271d0F] = 1000000000000000000;
Asset_Permitted[0x0000000000000000000000000000000000000000] = true; // ETH Placeholder
Ass... | 18,905 |
48 | // Refunds are only available if the minimum was not reached | require(totalReceivedWei < receivedWeiMin);
| require(totalReceivedWei < receivedWeiMin);
| 26,224 |
6 | // Disables borrowing on a reserve asset The address of the underlying asset of the reserve / | function disableBorrowingOnReserve(address asset) external onlyPoolAdmin {
DataTypes.ReserveConfigurationMap memory currentConfig = pool.getConfiguration(asset);
currentConfig.setBorrowingEnabled(false);
pool.setConfiguration(asset, currentConfig.data);
emit BorrowingDisabledOnReserve(asset);
}
| function disableBorrowingOnReserve(address asset) external onlyPoolAdmin {
DataTypes.ReserveConfigurationMap memory currentConfig = pool.getConfiguration(asset);
currentConfig.setBorrowingEnabled(false);
pool.setConfiguration(asset, currentConfig.data);
emit BorrowingDisabledOnReserve(asset);
}
| 33,786 |
16 | // 确认迁移地址等于0地址(说明不在迁移过程中,属于交易所营业后的创建流动性操作) | require(migrator == address(0), "Must not have migrator");
liquidity = Math.sqrt(amount0.mul(amount1)).sub(MINIMUM_LIQUIDITY);
_mint(address(0), MINIMUM_LIQUIDITY); // permanently lock the first MINIMUM_LIQUIDITY tokens
| require(migrator == address(0), "Must not have migrator");
liquidity = Math.sqrt(amount0.mul(amount1)).sub(MINIMUM_LIQUIDITY);
_mint(address(0), MINIMUM_LIQUIDITY); // permanently lock the first MINIMUM_LIQUIDITY tokens
| 16,674 |
42 | // The benefit of boosts is multiplicative (quadratic): - More boost tiles gives a higher total blockValue (the sum of the adjacent tiles) - More boost tiles give a higher multiple of that total blockValue that can be used (10% per adjacent tie) Example: A) I boost attack with 1 single tile worth 10 finney-> Total boos... | boost.attackBoost = (boost.attackBoost / 10 * boost.numAttackBoosts);
boost.defendBoost = (boost.defendBoost / 10 * boost.numDefendBoosts);
return (boost.attackBoost, boost.defendBoost);
| boost.attackBoost = (boost.attackBoost / 10 * boost.numAttackBoosts);
boost.defendBoost = (boost.defendBoost / 10 * boost.numDefendBoosts);
return (boost.attackBoost, boost.defendBoost);
| 37,726 |
10 | // Proof verification is performed when there's a non-zero root. | if (root != bytes32(0)) {
_verifyProof(tokenId, root, proof);
} else if (proof.length != 0) {
| if (root != bytes32(0)) {
_verifyProof(tokenId, root, proof);
} else if (proof.length != 0) {
| 26,090 |
29 | // send funding to safe wallet if minimum is reached | function vaultFunds() public onlyOwner {
require(msg.sender == owner); // Allstocks double chack
require(_raised >= tokenCreationMin); // have to sell minimum to move to operational
ethFundDeposit.transfer(address(this).balance); // send the eth to Allstocks
}
| function vaultFunds() public onlyOwner {
require(msg.sender == owner); // Allstocks double chack
require(_raised >= tokenCreationMin); // have to sell minimum to move to operational
ethFundDeposit.transfer(address(this).balance); // send the eth to Allstocks
}
| 48,318 |
327 | // Block number of current sheet | uint height = 0;
| uint height = 0;
| 12,690 |
21 | // Check Token Balance inside Contract / | function tokenBalance() public view returns (uint256){
return Token(tokenAddr).balanceOf(address(this));
}
| function tokenBalance() public view returns (uint256){
return Token(tokenAddr).balanceOf(address(this));
}
| 71,649 |
38 | // add one to generation | device.generation = device.generation.add(1);
emit Play(tokenId, device.generation, amount);
return;
| device.generation = device.generation.add(1);
emit Play(tokenId, device.generation, amount);
return;
| 20,247 |
379 | // Maps addresses to booleans indicating if they are allowed to supply assets (i.e., mint cTokens) | mapping(address => bool) public whitelist;
| mapping(address => bool) public whitelist;
| 66,763 |
54 | // Withdraw ether from this contract (Callable by owner)/ | function withdraw() external onlyOwner {
uint balance = address(this).balance;
msg.sender.transfer(balance);
}
| function withdraw() external onlyOwner {
uint balance = address(this).balance;
msg.sender.transfer(balance);
}
| 18,929 |
14 | // This function will activate the auction. | function activateAuction() public onlyAdmin {
phase = Phase.Commitment;
startPhaseBlock = block.number;
firstOpen = true;// for second auction
}
| function activateAuction() public onlyAdmin {
phase = Phase.Commitment;
startPhaseBlock = block.number;
firstOpen = true;// for second auction
}
| 21,985 |
4 | // The CAKE TOKEN! | RedPillToken public cake;
| RedPillToken public cake;
| 10,812 |
102 | // burn lp tokens, hence locking the liquidity forever | if(BurnLpTokensEnabled)
burnLpTokens();
| if(BurnLpTokensEnabled)
burnLpTokens();
| 57,166 |
28 | // The starting time of TGE/_timestamp The initial timestamp, this timestap should be used for vesting | function setInitialTimestamp(uint256 _timestamp)
external
onlyOwner()
notInitialized()
| function setInitialTimestamp(uint256 _timestamp)
external
onlyOwner()
notInitialized()
| 60,261 |
3 | // If no xHoney exists, mint it 1:1 to the amount put in | if (totalShares == 0 || totalHoney == 0) {
_mint(msg.sender, _amount);
}
| if (totalShares == 0 || totalHoney == 0) {
_mint(msg.sender, _amount);
}
| 34,102 |
19 | // `balances` is the map that tracks the balance of each address, in thiscontract when the balance changes the block number that the changeoccurred is also included in the map | mapping (address => Checkpoint[]) private balances;
| mapping (address => Checkpoint[]) private balances;
| 45,766 |
7 | // CONSTRUCTOR | constructor() {
genesisTs = block.timestamp;
}
| constructor() {
genesisTs = block.timestamp;
}
| 31,130 |
299 | // Get the balance of the strategy before we withdraw from it. | uint256 strategyBalance = getStrategyData[strategy].balance;
| uint256 strategyBalance = getStrategyData[strategy].balance;
| 21,471 |
49 | // Atomically decreases the allowance granted to `spender` by the caller. This is an alternative to {approve} that can be used as a mitigation forproblems described in {IERC20-approve}. Emits an {Approval} event indicating the updated allowance. Requirements: - `spender` cannot be the zero address.- `spender` must have... | function decreaseAllowance(address spender, uint256 subtractedValue) external returns (bool);
| function decreaseAllowance(address spender, uint256 subtractedValue) external returns (bool);
| 3,781 |
175 | // Remove order from vendor&39;s order list _vendor The vendor address _rnid The room night order id / | function removeOrderOfVendor(address _vendor, uint256 _rnid)
public
| function removeOrderOfVendor(address _vendor, uint256 _rnid)
public
| 35,260 |
20 | // mint | address internalAsset = internalAssetToken;
address lendingPoolAddress = _addressesProvider.getLendingPool();
SturdyInternalAsset(internalAsset).mint(address(this), _amount);
IERC20(internalAsset).safeApprove(lendingPoolAddress, 0);
IERC20(internalAsset).safeApprove(lendingPoolAddress, _amount);
... | address internalAsset = internalAssetToken;
address lendingPoolAddress = _addressesProvider.getLendingPool();
SturdyInternalAsset(internalAsset).mint(address(this), _amount);
IERC20(internalAsset).safeApprove(lendingPoolAddress, 0);
IERC20(internalAsset).safeApprove(lendingPoolAddress, _amount);
... | 20,507 |
2 | // ERC1155 - Supply - Admin - Ownable Allows owner of a EIP-1155 contract to change max supply of token IDs. @custom:type eip-2535-facet@custom:category NFTs@custom:peer-dependencies eip165:0xd9b67a26 eip165:0x744f4bd4@custom:provides-interfaces 0x5b2cf486 / | contract ERC1155SupplyOwnable is IERC1155SupplyAdmin, ERC1155SupplyInternal, OwnableInternal {
using ERC1155SupplyStorage for ERC1155SupplyStorage.Layout;
function setMaxSupply(uint256 tokenId, uint256 newValue) public onlyOwner {
_setMaxSupply(tokenId, newValue);
}
function setMaxSupplyBatch(... | contract ERC1155SupplyOwnable is IERC1155SupplyAdmin, ERC1155SupplyInternal, OwnableInternal {
using ERC1155SupplyStorage for ERC1155SupplyStorage.Layout;
function setMaxSupply(uint256 tokenId, uint256 newValue) public onlyOwner {
_setMaxSupply(tokenId, newValue);
}
function setMaxSupplyBatch(... | 7,625 |
113 | // Transfer the creator payout amount to the creator. | SafeTransferLib.safeTransferETH(creatorPayoutAddress, payoutAmount);
| SafeTransferLib.safeTransferETH(creatorPayoutAddress, payoutAmount);
| 37,997 |
15 | // Record the token Id to time of mint mapping | tokenIdToMintTime[newTokenId] = block.timestamp;
| tokenIdToMintTime[newTokenId] = block.timestamp;
| 23,944 |
35 | // Checks if a given address is the current owner of a particular KittyCoin./_claimant the address we are validating against./_tokenId kittencoin id, only valid when > 0 | function _owns(address _claimant, uint256 _tokenId) internal view returns (bool) {
return kittyCoinToOwner[_tokenId] == _claimant;
}
| function _owns(address _claimant, uint256 _tokenId) internal view returns (bool) {
return kittyCoinToOwner[_tokenId] == _claimant;
}
| 51,098 |
111 | // this mutates the method arguments, but costs less gas | if (isPut) {
for (uint256 i = 0; i < n; i++) {
longSupplies[i] = longSupplies[i].mul(strikePrices[i]).div(SCALE);
shortSupplies[i] = shortSupplies[i].mul(strikePrices[i]).div(SCALE);
}
| if (isPut) {
for (uint256 i = 0; i < n; i++) {
longSupplies[i] = longSupplies[i].mul(strikePrices[i]).div(SCALE);
shortSupplies[i] = shortSupplies[i].mul(strikePrices[i]).div(SCALE);
}
| 36,359 |
209 | // Aggregator Status | mapping(uint256 => LiquidationData) internal liquidationData;
mapping(uint256 => ShareData) internal shareData;
uint256 internal currentTerm;
uint64 internal priceUnit;
uint64 internal lastTrancheTime;
uint32 internal startBondGroupId = 1;
int16 internal currentFeeBase;
bool internal isT... | mapping(uint256 => LiquidationData) internal liquidationData;
mapping(uint256 => ShareData) internal shareData;
uint256 internal currentTerm;
uint64 internal priceUnit;
uint64 internal lastTrancheTime;
uint32 internal startBondGroupId = 1;
int16 internal currentFeeBase;
bool internal isT... | 3,535 |
28 | // keccak256("ProxyAdmin"); | bytes32 internal constant KEY_PROXY_ADMIN =
0x96ed0203eb7e975a4cbcaa23951943fa35c5d8288117d50c12b3d48b0fab48d1;
| bytes32 internal constant KEY_PROXY_ADMIN =
0x96ed0203eb7e975a4cbcaa23951943fa35c5d8288117d50c12b3d48b0fab48d1;
| 15,432 |
110 | // https:docs.peri.finance/contracts/source/interfaces/idepot | interface IDepot {
// Views
function fundsWallet() external view returns (address payable);
function maxEthPurchase() external view returns (uint);
function minimumDepositAmount() external view returns (uint);
function pynthsReceivedForEther(uint amount) external view returns (uint);
functio... | interface IDepot {
// Views
function fundsWallet() external view returns (address payable);
function maxEthPurchase() external view returns (uint);
function minimumDepositAmount() external view returns (uint);
function pynthsReceivedForEther(uint amount) external view returns (uint);
functio... | 50,024 |
1,509 | // Constructs the ExpiringMultiParty contract. params struct to define input parameters for construction of Liquidatable. Some paramsare fed directly into the PricelessPositionManager's constructor within the inheritance tree. / | constructor(ConstructorParams memory params)
public
Liquidatable(params)
| constructor(ConstructorParams memory params)
public
Liquidatable(params)
| 21,955 |
69 | // TimedCrowdsale Crowdsale accepting contributions only within a time frame. / | contract TimedCrowdsale is Crowdsale {
using SafeMath for uint256;
uint256 private _openingTime;
uint256 private _closingTime;
/**
* @dev Reverts if not in crowdsale time range.
*/
modifier onlyWhileOpen {
require(isOpen());
_;
}
/**
* @dev Constructor, takes crowdsale opening and clos... | contract TimedCrowdsale is Crowdsale {
using SafeMath for uint256;
uint256 private _openingTime;
uint256 private _closingTime;
/**
* @dev Reverts if not in crowdsale time range.
*/
modifier onlyWhileOpen {
require(isOpen());
_;
}
/**
* @dev Constructor, takes crowdsale opening and clos... | 805 |
262 | // Keep track off fees in dUSD in the open fee pool period. | _recentFeePeriodsStorage(0).feesToDistribute = _recentFeePeriodsStorage(
0
)
.feesToDistribute
.add(amount);
| _recentFeePeriodsStorage(0).feesToDistribute = _recentFeePeriodsStorage(
0
)
.feesToDistribute
.add(amount);
| 9,772 |
106 | // SenderVerifier - verifier contract that payload is signed by omnuum or not/Omnuum Dev Team - <[email protected]> | contract SenderVerifier is EIP712 {
constructor() EIP712(SIGNING_DOMAIN, SIGNATURE_VERSION) {}
string private constant SIGNING_DOMAIN = 'Omnuum';
string private constant SIGNATURE_VERSION = '1';
struct Payload {
address sender; // sender or address who received this payload
string topi... | contract SenderVerifier is EIP712 {
constructor() EIP712(SIGNING_DOMAIN, SIGNATURE_VERSION) {}
string private constant SIGNING_DOMAIN = 'Omnuum';
string private constant SIGNATURE_VERSION = '1';
struct Payload {
address sender; // sender or address who received this payload
string topi... | 60,243 |
16 | // Addresses of all the members of the team | address[] private _team = [
0xAC25FE467B6004fDF3C5131E49dDEe2E68E2BA24
];
| address[] private _team = [
0xAC25FE467B6004fDF3C5131E49dDEe2E68E2BA24
];
| 35,157 |
20 | // depositTax pre-pays tax for the existing CEO. It may also burn any tax debt the CEO may have._amount amount of tax to pre-pay/ | function depositTax(uint256 _amount) external onlyCEO {
require (CEO_state == 1, "no CEO");
if (_amount > 0) {
transfer(address(this), _amount); // place the tax on deposit
CEO_tax_balance = CEO_tax_balance + _amount; // record the balance
... | function depositTax(uint256 _amount) external onlyCEO {
require (CEO_state == 1, "no CEO");
if (_amount > 0) {
transfer(address(this), _amount); // place the tax on deposit
CEO_tax_balance = CEO_tax_balance + _amount; // record the balance
... | 83,383 |
59 | // Settle bet using reveal and uncleHash as entropy sources. | settleBetCommon(bet, reveal, uncleHash);
| settleBetCommon(bet, reveal, uncleHash);
| 38,454 |
9 | // stableDebtToken address | address stableDebtTokenAddress;
| address stableDebtTokenAddress;
| 19,658 |
593 | // Verifies that a transaction, with provided order hash, has been signed/by the given signer./transaction The transaction./transactionHash The hash of the transaction./signature Proof that the hash has been signed by signer./ return isValid True if the signature is valid for the given transaction and signer. | function _isValidTransactionWithHashSignature(
LibZeroExTransaction.ZeroExTransaction memory transaction,
bytes32 transactionHash,
bytes memory signature
)
internal
view
returns (bool isValid);
| function _isValidTransactionWithHashSignature(
LibZeroExTransaction.ZeroExTransaction memory transaction,
bytes32 transactionHash,
bytes memory signature
)
internal
view
returns (bool isValid);
| 2,537 |
2 | // Function to check the amount of tokens that an owner allowed to a spender. owner address The address which owns the funds. spender address The address which will spend the funds.return A uint256 specifying the amount of tokens still available for the spender. / | function allowance(
address owner,
address spender
)
public
view
returns (uint256)
| function allowance(
address owner,
address spender
)
public
view
returns (uint256)
| 4,880 |
2 | // Creates a new Stake Prize Pool as a proxy of the template instance/ return A reference to the new proxied Stake Prize Pool | function create() external returns (StakePrizePool) {
return StakePrizePool(deployMinimal(address(instance), ""));
}
| function create() external returns (StakePrizePool) {
return StakePrizePool(deployMinimal(address(instance), ""));
}
| 31,746 |
30 | // uniswap setup (used in setup only) | address internal uniFactory = 0xc0a47dFe034B400B47bDaD5FecDa2621de6c4d95;
address internal uniETHHEX = 0x05cDe89cCfa0adA8C88D5A23caaa79Ef129E7883;
address public uniETHHXB = address(0);
UniswapExchangeInterface internal uniHEXInterface = UniswapExchangeInterface(uniETHHEX);
UniswapExchangeInterface ... | address internal uniFactory = 0xc0a47dFe034B400B47bDaD5FecDa2621de6c4d95;
address internal uniETHHEX = 0x05cDe89cCfa0adA8C88D5A23caaa79Ef129E7883;
address public uniETHHXB = address(0);
UniswapExchangeInterface internal uniHEXInterface = UniswapExchangeInterface(uniETHHEX);
UniswapExchangeInterface ... | 1,360 |
7 | // initialize the return value with the length | unpacked = string(new bytes(len));
| unpacked = string(new bytes(len));
| 9,778 |
10 | // Utilized by bridge | function multiAddDSource(bytes32[] dsHash, uint256[] multiplier)
external
| function multiAddDSource(bytes32[] dsHash, uint256[] multiplier)
external
| 34,866 |
169 | // return Key at index. / | function getIdentifier(uint256 _index) public view returns (bytes32) {
return orders.keyAtIndex(_index);
}
| function getIdentifier(uint256 _index) public view returns (bytes32) {
return orders.keyAtIndex(_index);
}
| 76,048 |
10 | // Subtract from the sender | balanceOf[_from] -= _value;
| balanceOf[_from] -= _value;
| 559 |
26 | // Redeem ETH/ERC20 and mint Compound Tokens tokenAmt Amount of token To Redeem / | function redeemUnderlying(address erc20, address cErc20, uint tokenAmt) external {
CTokenInterface cToken = CTokenInterface(cErc20);
setApproval(cErc20, 10**50, cErc20);
uint toBurn = cToken.balanceOf(address(this));
uint tokenToReturn = wmul(toBurn, cToken.exchangeRateCurrent());
... | function redeemUnderlying(address erc20, address cErc20, uint tokenAmt) external {
CTokenInterface cToken = CTokenInterface(cErc20);
setApproval(cErc20, 10**50, cErc20);
uint toBurn = cToken.balanceOf(address(this));
uint tokenToReturn = wmul(toBurn, cToken.exchangeRateCurrent());
... | 44,127 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.