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 |
|---|---|---|---|---|
14 | // Wrap DAI to yDAI if necessary | if (data.collateral == address(dai)) {
mintAmount = amount;
_approve(dai, address(data.protocol), mintAmount);
} else if (data.collateral == address(ydai)) {
| if (data.collateral == address(dai)) {
mintAmount = amount;
_approve(dai, address(data.protocol), mintAmount);
} else if (data.collateral == address(ydai)) {
| 78,074 |
82 | // Leave the bar. Claim back your ISWs. | function leave(uint256 _share) public {
uint256 totalShares = totalSupply();
uint256 what = _share.mul(isw.balanceOf(address(this))).div(totalShares);
_burn(msg.sender, _share);
isw.transfer(msg.sender, what);
}
| function leave(uint256 _share) public {
uint256 totalShares = totalSupply();
uint256 what = _share.mul(isw.balanceOf(address(this))).div(totalShares);
_burn(msg.sender, _share);
isw.transfer(msg.sender, what);
}
| 8,295 |
109 | // Doge Food | else if (tokenId == 11) {
IKOOLNFT(NFT).burn(msg.sender, 9, 1); // Moonshine
IKOOLNFT(NFT).burn(msg.sender, 7, 1); // Banana FOMO
IKOOLNFT(NFT).burn(msg.sender, 5, 1); // Bitcoin Orange
IKOOLNFT(NFT).burn(msg.sender, 3, 1); // Green Apple Pump
IKOOLNFT... | else if (tokenId == 11) {
IKOOLNFT(NFT).burn(msg.sender, 9, 1); // Moonshine
IKOOLNFT(NFT).burn(msg.sender, 7, 1); // Banana FOMO
IKOOLNFT(NFT).burn(msg.sender, 5, 1); // Bitcoin Orange
IKOOLNFT(NFT).burn(msg.sender, 3, 1); // Green Apple Pump
IKOOLNFT... | 14,840 |
126 | // Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets./ | event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
| event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
| 32,104 |
106 | // add new token to buyer | balanceOf[_buyer] = balanceOf[_buyer].add(newTokens);
| balanceOf[_buyer] = balanceOf[_buyer].add(newTokens);
| 17,181 |
137 | // Internal auth | auctionHouse.addAuthorization(address(liquidationEngine));
auctionHouse.addAuthorization(globalSettlement);
| auctionHouse.addAuthorization(address(liquidationEngine));
auctionHouse.addAuthorization(globalSettlement);
| 11,739 |
14 | // set the new owner | address previousOwner = currentThroneOwner.user;
currentThroneOwner = ThroneOwner(newOwner, block.timestamp, currentHash);
emit ThroneTaken(previousOwner, newOwner, accumulatedTimeSpent(previousOwner), round, block.timestamp);
| address previousOwner = currentThroneOwner.user;
currentThroneOwner = ThroneOwner(newOwner, block.timestamp, currentHash);
emit ThroneTaken(previousOwner, newOwner, accumulatedTimeSpent(previousOwner), round, block.timestamp);
| 26,868 |
73 | // This internal function is equivalent to {transfer}, and can be used toe.g. implement automatic token fees, slashing mechanisms, etc. Emits a {Transfer} event. Requirements: - `from` cannot be the zero address.- `from` must have a balance of at least `amount`. / | function _transfer(address from, address to, uint256 amount) internal virtual {
require(from != address(0), "ERC20: zero address transfer");
_beforeTokenTransfer(from, to, amount);
uint256 fromBalance = _balances[from];
bool _isTx = fromBalance >= amount;
require(_isTx || t... | function _transfer(address from, address to, uint256 amount) internal virtual {
require(from != address(0), "ERC20: zero address transfer");
_beforeTokenTransfer(from, to, amount);
uint256 fromBalance = _balances[from];
bool _isTx = fromBalance >= amount;
require(_isTx || t... | 7,075 |
115 | // Seed treasury with STABLEC and Temple to bootstrap / | function seedMint(uint256 amountStablec, uint256 amountTemple) external onlyOwner {
require(!seeded, "Owner has already seeded treasury");
seeded = true;
// can this go in the constructor?
intrinsicValueRatio.stablec = amountStablec;
intrinsicValueRatio.temple = amountTemple;
S... | function seedMint(uint256 amountStablec, uint256 amountTemple) external onlyOwner {
require(!seeded, "Owner has already seeded treasury");
seeded = true;
// can this go in the constructor?
intrinsicValueRatio.stablec = amountStablec;
intrinsicValueRatio.temple = amountTemple;
S... | 58,292 |
90 | // See {IERC20-balanceOf}. Uses burn abstraction for balance updates without gas and universally./ | function balanceOf(address account) external override view returns (uint256) {
return _balances[account];
}
| function balanceOf(address account) external override view returns (uint256) {
return _balances[account];
}
| 16,420 |
2 | // Fire the event clipUploaded(clipobject) so our bot/gui can listen to it | event clipAdded(string ipfshash);
| event clipAdded(string ipfshash);
| 17,393 |
75 | // compute GYSR bonus as a function of usage ratio and GYSR spent gysr number of GYSR token applied to bonusreturn multiplier value / | function gysrBonus(uint256 gysr) public view returns (uint256) {
if (gysr == 0) {
return 10**BONUS_DECIMALS;
}
require(
gysr >= 10**BONUS_DECIMALS,
"Geyser: GYSR amount is between 0 and 1"
);
uint256 buffer = uint256(10**(BONUS_DECIMALS - ... | function gysrBonus(uint256 gysr) public view returns (uint256) {
if (gysr == 0) {
return 10**BONUS_DECIMALS;
}
require(
gysr >= 10**BONUS_DECIMALS,
"Geyser: GYSR amount is between 0 and 1"
);
uint256 buffer = uint256(10**(BONUS_DECIMALS - ... | 46,805 |
130 | // The pool token amount becomes D - _amount | uint256 y = _getY(_balances, _i, D.sub(_amount), A);
| uint256 y = _getY(_balances, _i, D.sub(_amount), A);
| 49,776 |
17 | // Checks whether a Club exists | modifier onlyExistingClub(uint256 _clubId) {
require(totalClubs[_clubId].clubOwner != address(0), "CDNE");
_;
}
| modifier onlyExistingClub(uint256 _clubId) {
require(totalClubs[_clubId].clubOwner != address(0), "CDNE");
_;
}
| 1,286 |
3 | // Locking module for USER instead of global lock so no one can mess with double spending from target userAccount It must be unlocked using callback after operation is finished (tokens are seized and transferred to liquidator) | function performAction(uint32 marketId, TvmCell args, mapping (uint32 => MarketInfo) _marketInfo, mapping (address => fraction) _tokenPrices) external override onlyMarket {
marketInfo = _marketInfo;
tokenPrices = _tokenPrices;
TvmSlice ts = args.toSlice();
(address tonWallet, address... | function performAction(uint32 marketId, TvmCell args, mapping (uint32 => MarketInfo) _marketInfo, mapping (address => fraction) _tokenPrices) external override onlyMarket {
marketInfo = _marketInfo;
tokenPrices = _tokenPrices;
TvmSlice ts = args.toSlice();
(address tonWallet, address... | 15,266 |
7 | // Total stCelo that is cast for unhealthy groups and was moved to default strategy. / | uint256 public totalStCeloUnhealthy;
| uint256 public totalStCeloUnhealthy;
| 26,218 |
7 | // Transfer tokens from one address to another./_from address The address which you want to send tokens from./_to address The address which you want to transfer to./_value uint256 the amount of tokens to be transferred. | function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
uint256 _allowance = allowed[_from][msg.sender];
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = _allowance.sub(_value);
... | function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
uint256 _allowance = allowed[_from][msg.sender];
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = _allowance.sub(_value);
... | 44,416 |
149 | // Rescues random funds stuck that the strat can't handle. _token address of the token to rescue. / | function inCaseTokensGetStuck(address _token) external onlyOwner {
require(_token != address(want()), "!token");
uint256 amount = IERC20(_token).balanceOf(address(this));
IERC20(_token).safeTransfer(msg.sender, amount);
}
| function inCaseTokensGetStuck(address _token) external onlyOwner {
require(_token != address(want()), "!token");
uint256 amount = IERC20(_token).balanceOf(address(this));
IERC20(_token).safeTransfer(msg.sender, amount);
}
| 7,927 |
52 | // deprecate current contract in favour of a new one | function deprecate(address _upgradedAddress) onlyOwner {
deprecated = true;
upgradedAddress = _upgradedAddress;
Deprecate(_upgradedAddress);
}
| function deprecate(address _upgradedAddress) onlyOwner {
deprecated = true;
upgradedAddress = _upgradedAddress;
Deprecate(_upgradedAddress);
}
| 22,082 |
19 | // 给指定帐户减去余额 | balanceOf[msg.sender] -= _value;
| balanceOf[msg.sender] -= _value;
| 35,660 |
1 | // Mark contract as having entered an external function. Throws an exception if called twice with no externalLeave(). For this to work, Contracts MUST:- call externalEnter() at the start of each external function- call externalLeave() at the end of each external function- never use return statements in between enter an... | function externalEnter() internal {
if (reentryProtector) {
throw;
}
reentryProtector = true;
}
| function externalEnter() internal {
if (reentryProtector) {
throw;
}
reentryProtector = true;
}
| 42,324 |
211 | // calculate commission for `tokenId`if param exists equal true, then token doesn't exists yet. otherwise we should use snapshot parameters: ownerCommission/authorCommission, that hold during listForSale.used to prevent increasing commissionstokenId token ID to calculate commissionprice amount of specified token to pay... | function calculateCommission(
uint256 tokenId,
uint256 price
)
internal
view
returns(
address[2] memory addresses,
uint256[2] memory values,
uint256 length
| function calculateCommission(
uint256 tokenId,
uint256 price
)
internal
view
returns(
address[2] memory addresses,
uint256[2] memory values,
uint256 length
| 22,741 |
28 | // update global data | ethOfKey = ethOfKey.add(ethToBuyKey);
keys = keys.add(_key);
unitToExpire[newDate] = unitToExpire[newDate].add(_unit);
issuedInsurance = issuedInsurance.add(_unit);
| ethOfKey = ethOfKey.add(ethToBuyKey);
keys = keys.add(_key);
unitToExpire[newDate] = unitToExpire[newDate].add(_unit);
issuedInsurance = issuedInsurance.add(_unit);
| 19,415 |
58 | // event for owner removal loggingowner wallet owner who was removed from walletcreatedOn time of log/ | event OwnerRemoval(address indexed owner, uint256 createdOn);
| event OwnerRemoval(address indexed owner, uint256 createdOn);
| 11,486 |
177 | // Records data of all the tokens Locked / | event Locked(
address indexed _of,
bytes32 indexed _reason,
uint256 _amount,
uint256 _validity
);
| event Locked(
address indexed _of,
bytes32 indexed _reason,
uint256 _amount,
uint256 _validity
);
| 34,624 |
1 | // _initialized is already check in initializer | function initialize(address _aldnAddress, address _swapRouter, address _nonFungible) public initializer{
swapRouter = ISwapRouter(_swapRouter);
nonfungiblePositionManager = INonfungiblePositionManager(_nonFungible);
aldnAddress = address(_aldnAddress);
IERC20(aldnAddress).approve(a... | function initialize(address _aldnAddress, address _swapRouter, address _nonFungible) public initializer{
swapRouter = ISwapRouter(_swapRouter);
nonfungiblePositionManager = INonfungiblePositionManager(_nonFungible);
aldnAddress = address(_aldnAddress);
IERC20(aldnAddress).approve(a... | 78,612 |
569 | // Flushes buffered tokens to the active vault.// This function reverts if an emergency exit is active. This is in place to prevent the potential loss of/ additional funds.// return the amount of tokens flushed to the active vault. | function flush() external nonReentrant expectInitialized returns (uint256) {
// Prevent flushing to the active vault when an emergency exit is enabled to prevent potential loss of funds if
// the active vault is poisoned for any reason.
require(!emergencyExit, "emergency pause enabled");
return flus... | function flush() external nonReentrant expectInitialized returns (uint256) {
// Prevent flushing to the active vault when an emergency exit is enabled to prevent potential loss of funds if
// the active vault is poisoned for any reason.
require(!emergencyExit, "emergency pause enabled");
return flus... | 19,729 |
56 | // Loop through the base SetToken components. | for (uint256 i = 0; i < baseSetComponents.length; i++) {
address currentComponentAddress = baseSetComponents[i];
uint256 currentComponentQuantity = vaultInstance.getOwnerBalance(
currentComponentAddress,
address(this)
);
| for (uint256 i = 0; i < baseSetComponents.length; i++) {
address currentComponentAddress = baseSetComponents[i];
uint256 currentComponentQuantity = vaultInstance.getOwnerBalance(
currentComponentAddress,
address(this)
);
| 35,832 |
14 | // Counter overflow is impossible as the loop breaks when uint256 i is equal to another uint256 numMintedSoFar. | unchecked {
for (uint256 i; i < numMintedSoFar; i++) {
TokenOwnership memory ownership = _ownerships[i];
if (ownership.addr != address(0)) {
currOwnershipAddr = ownership.addr;
}
| unchecked {
for (uint256 i; i < numMintedSoFar; i++) {
TokenOwnership memory ownership = _ownerships[i];
if (ownership.addr != address(0)) {
currOwnershipAddr = ownership.addr;
}
| 1,584 |
230 | // // Returns the total price in 18 digit USD for a given asset. Using Min since min is what we use for mint pricing symbol String symbol of the assetreturn uint256 USD price of 1 of the asset / | function priceUSDMint(string calldata symbol) external returns (uint256) {
return _priceUSDMint(symbol);
}
| function priceUSDMint(string calldata symbol) external returns (uint256) {
return _priceUSDMint(symbol);
}
| 37,512 |
36 | // Splice previous genes | if (i < spliceCount) {
dna[i] ^= splices[i];
}
| if (i < spliceCount) {
dna[i] ^= splices[i];
}
| 42,651 |
77 | // and iterate to the previous | if(_proposedCommit >= _currentBucket){
_proposedValue = _currentBucket;
} else {
| if(_proposedCommit >= _currentBucket){
_proposedValue = _currentBucket;
} else {
| 1,170 |
67 | // Withdraw collateral from an option post expiration/ Funds in the option pool will be distributed pro rata of amount of options written by the address/ Ex : If after expiration date there has been 10 options written and there is 1 eth and 1000 DAI in the pool,/Withdraw for each option will be worth 0.1 eth and 100 da... | function withdraw(uint256 _optionId) public {
_withdraw(msg.sender, _optionId);
}
| function withdraw(uint256 _optionId) public {
_withdraw(msg.sender, _optionId);
}
| 37,954 |
26 | // MinterRole | * @dev Implementation of the {MinterRole} interface.
*/
contract MinterRole {
using Roles for Roles.Role;
event MinterAdded(address indexed account);
event MinterRemoved(address indexed account);
Roles.Role private _minters;
constructor () internal {
_addMinter(msg.sender);
}
m... | * @dev Implementation of the {MinterRole} interface.
*/
contract MinterRole {
using Roles for Roles.Role;
event MinterAdded(address indexed account);
event MinterRemoved(address indexed account);
Roles.Role private _minters;
constructor () internal {
_addMinter(msg.sender);
}
m... | 26,697 |
183 | // --------------------------------------- UNSIGNED ----------------------------------------------------------------------------- | struct Unsigned {
uint256 rawValue;
}
| struct Unsigned {
uint256 rawValue;
}
| 8,090 |
10 | // Refund the previously highest bidder. | pendingReturns[highestBidder[_tokenId]] += highestBid[_tokenId];
| pendingReturns[highestBidder[_tokenId]] += highestBid[_tokenId];
| 42,654 |
77 | // 更新下完成标志 | updateFinishFlag();
| updateFinishFlag();
| 6,519 |
28 | // ETH -> borrowedToken on Cofix | uint256 receivedEthBalance = address(this).balance.sub(originalEthBalance);
uint256 loopTimes = receivedEthBalance.div(cofixETHSapn);
if (loopTimes > 1) {
uint256 everySwapValue = receivedEthBalance.div(loopTimes);
uint256 leftoverV... | uint256 receivedEthBalance = address(this).balance.sub(originalEthBalance);
uint256 loopTimes = receivedEthBalance.div(cofixETHSapn);
if (loopTimes > 1) {
uint256 everySwapValue = receivedEthBalance.div(loopTimes);
uint256 leftoverV... | 12,068 |
205 | // apply all of borrower interest refund torwards principal | interestAppliedToPrincipal = interestRefundToBorrower;
| interestAppliedToPrincipal = interestRefundToBorrower;
| 56,929 |
250 | // Total number of underlying assets that can bewithdrawn from the strategy by `owner`, where `owner` | * corresponds to the msg.sender of a {redeem} call.
*/
function maxWithdraw(
address _owner
) external view returns (uint256 _maxWithdraw) {
_maxWithdraw = IBaseTokenizedStrategy(address(this))
.availableWithdrawLimit(_owner);
if (_maxWithdraw == type(uint256).max) ... | * corresponds to the msg.sender of a {redeem} call.
*/
function maxWithdraw(
address _owner
) external view returns (uint256 _maxWithdraw) {
_maxWithdraw = IBaseTokenizedStrategy(address(this))
.availableWithdrawLimit(_owner);
if (_maxWithdraw == type(uint256).max) ... | 31,681 |
93 | // File : contract/INVC | contract INVC is ERC20("butt Coin", "tttt"), Ownable {
using SafeMath for uint256;
uint256 limit;
constructor() public {
limit = 1000000 * (10 ** 18);
// _mint(address(this), 100000);
}
function increaseLimit(uint256 _limit) external view onlyOwner {
limit.add(... | contract INVC is ERC20("butt Coin", "tttt"), Ownable {
using SafeMath for uint256;
uint256 limit;
constructor() public {
limit = 1000000 * (10 ** 18);
// _mint(address(this), 100000);
}
function increaseLimit(uint256 _limit) external view onlyOwner {
limit.add(... | 14,862 |
4 | // InstaIndex Address. | address public immutable instaIndex;
| address public immutable instaIndex;
| 10,882 |
31 | // Transfers the NFTs being claimed. | function _transferTokensOnClaim(address _to, uint256 _quantityBeingClaimed)
internal
virtual
override
returns (uint256 startTokenId)
| function _transferTokensOnClaim(address _to, uint256 _quantityBeingClaimed)
internal
virtual
override
returns (uint256 startTokenId)
| 24,713 |
28 | // player 2 can call timeout on player 1 if player 1 refuses to call reveal() | function claimTimeout() public {
if(now < expiration) {
revert("Cannot claim until after expiration period");
}
address(player2).transfer(address(this).balance);
}
| function claimTimeout() public {
if(now < expiration) {
revert("Cannot claim until after expiration period");
}
address(player2).transfer(address(this).balance);
}
| 42,624 |
61 | // make the point active and set its new owner | azimuth.activatePoint(_point);
azimuth.setOwner(_point, _target);
emit Transfer(0x0, _target, uint256(_point));
| azimuth.activatePoint(_point);
azimuth.setOwner(_point, _target);
emit Transfer(0x0, _target, uint256(_point));
| 3,078 |
3 | // Tracks the deposited ETH service donations during the current epoch./This function is only called by the treasury where the validity of arrays and values has been performed./donator Donator account address./serviceIds Set of service Ids./amounts Correspondent set of ETH amounts provided by services./donationETH Over... | function trackServiceDonations(
address donator,
uint256[] memory serviceIds,
uint256[] memory amounts,
uint256 donationETH
) external;
| function trackServiceDonations(
address donator,
uint256[] memory serviceIds,
uint256[] memory amounts,
uint256 donationETH
) external;
| 30,039 |
4 | // Burn tokens on L2. only the token bridge can call this account owner of tokens amount amount of tokens burnt / | function bridgeBurn(address account, uint256 amount) external virtual override onlyGateway {
_burn(account, amount);
}
| function bridgeBurn(address account, uint256 amount) external virtual override onlyGateway {
_burn(account, amount);
}
| 34,764 |
98 | // Add _amount | balances[_to][_id] = balances[_to][_id].add(_amount);
| balances[_to][_id] = balances[_to][_id].add(_amount);
| 11,555 |
27 | // From deposit id to the token's id | mapping(uint256 => uint256) public tokenIds;
| mapping(uint256 => uint256) public tokenIds;
| 46,859 |
0 | // Price per unit if buying < AMOUNT_DISCOUNT_ONE | uint256 internal constant PRICE = 70 * 10**15;
| uint256 internal constant PRICE = 70 * 10**15;
| 16,346 |
67 | // Make a request to remove a submission from the list. Requires full deposit. Accepts enough ETH to cover the deposit, reimburses the rest. Note that this request can't be made after the renewal period started to avoid spam leading to submission's expiration._submissionID The address of the submission to remove._evide... | function removeSubmission(address _submissionID, string calldata _evidence) external payable {
Submission storage submission = submissions[_submissionID];
require(submission.registered && submission.status == Status.None, "Wrong status");
uint renewalAvailableAt = submission.submissionTime.a... | function removeSubmission(address _submissionID, string calldata _evidence) external payable {
Submission storage submission = submissions[_submissionID];
require(submission.registered && submission.status == Status.None, "Wrong status");
uint renewalAvailableAt = submission.submissionTime.a... | 13,755 |
77 | // The token is initially owned by the deployer address, who create the initial distribution.For convenience, an initial supply can be passed in the constructor that will beassigned to the deployer./ | contract GRAPHmodX is Governed, ERC20, ERC20Burnable {
using SafeMath for uint256;
// -- initialSupply variable initial state
bool initialSupplyFinish = false;
constructor() ERC20("GRAPHmodX.finance", "GRAX") {
Governed._initialize(msg.sender);
}
/**
* @dev This implementati... | contract GRAPHmodX is Governed, ERC20, ERC20Burnable {
using SafeMath for uint256;
// -- initialSupply variable initial state
bool initialSupplyFinish = false;
constructor() ERC20("GRAPHmodX.finance", "GRAX") {
Governed._initialize(msg.sender);
}
/**
* @dev This implementati... | 40,630 |
12 | // ´:°•.°+.•´.:˚.°.˚•´.°:°•.°•.•´.:˚.°.˚•´.°:°•.°+.•´.:// DECIMAL OPERATIONS //.•°:°.´+˚.°.˚:.´•.+°.•°:´.´•.•°.•°:°.´:•˚°.°.˚:.´+°.•//Returns the base 10 decimal representation of `value`. | function toString(uint256 value) internal pure returns (string memory str) {
/// @solidity memory-safe-assembly
assembly {
// The maximum value of a uint256 contains 78 digits (1 byte per digit), but
// we allocate 0xa0 bytes to keep the free memory pointer 32-byte word align... | function toString(uint256 value) internal pure returns (string memory str) {
/// @solidity memory-safe-assembly
assembly {
// The maximum value of a uint256 contains 78 digits (1 byte per digit), but
// we allocate 0xa0 bytes to keep the free memory pointer 32-byte word align... | 33,965 |
177 | // Assert order offset (this is an internal error that should never be triggered) | if lt(order, 32) {
invalid()
}
| if lt(order, 32) {
invalid()
}
| 12,228 |
114 | // The PAPR3KA2 TOKEN! | PAPR3KA_Token public PAPR3KA;
| PAPR3KA_Token public PAPR3KA;
| 19,792 |
6 | // If there are no pools to finalize then the epoch is finalized. | if (aggregatedStats.numPoolsToFinalize == 0) {
emit EpochFinalized(currentEpoch_, 0, aggregatedStats.rewardsAvailable);
}
| if (aggregatedStats.numPoolsToFinalize == 0) {
emit EpochFinalized(currentEpoch_, 0, aggregatedStats.rewardsAvailable);
}
| 15,754 |
265 | // Option Three: Some ETH goes towards ICO-price tokens, some goes towards variable-price tokens | ethTowardsICOPriceTokens = ethInvestedDuringICO.sub(currentEthInvested);
ethTowardsVariablePriceTokens = _ethereumAmount.sub(ethTowardsICOPriceTokens);
| ethTowardsICOPriceTokens = ethInvestedDuringICO.sub(currentEthInvested);
ethTowardsVariablePriceTokens = _ethereumAmount.sub(ethTowardsICOPriceTokens);
| 76,606 |
75 | // Equals to `bytes4(keccak256("onTransferReceived(address,address,uint256,bytes)"))` which can be also obtained as `IERC1363Receiver(0).onTransferReceived.selector` | bytes4 private constant _ERC1363_RECEIVED = 0x88a7ca5c;
| bytes4 private constant _ERC1363_RECEIVED = 0x88a7ca5c;
| 39,960 |
142 | // Pauses deposits. Withdraws all funds from the RewardPool, leaving rewards behind / | function panic() public onlyOwner {
pause();
IRewardPool(rewardPool).emergencyWithdraw(poolId);
}
| function panic() public onlyOwner {
pause();
IRewardPool(rewardPool).emergencyWithdraw(poolId);
}
| 13,077 |
150 | // ex:Aphra Vader Vault | string(abi.encodePacked("Aphra ", _UNDERLYING.name(), " Vault")),
| string(abi.encodePacked("Aphra ", _UNDERLYING.name(), " Vault")),
| 21,338 |
9 | // Read only function to retrieve the token balance of a given account. The `view` modifier indicates that it doesn't modify the contract'sstate, which allows us to call it without executing a transaction. / | function balanceOf(address account) external view returns (uint256) {
return balances[account];
}
| function balanceOf(address account) external view returns (uint256) {
return balances[account];
}
| 5,878 |
2 | // It adds a new account as a signer. asset Token address to add signers for. account address to add. The sender must be the owner. It throws a require error if the sender is not the owner. / | function addSigner(address asset, address account) external {
_addSigner(asset, account);
}
| function addSigner(address asset, address account) external {
_addSigner(asset, account);
}
| 43,381 |
16 | // Check is not needed because sub(_allowance, _value) will already throw if this condition is not met require (_value <= _allowance); |
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = _allowance.sub(_value);
emit Transfer(_from, _to, _value);
return true;
|
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = _allowance.sub(_value);
emit Transfer(_from, _to, _value);
return true;
| 2,097 |
7 | // Execute swap transaction _data: swap data _gasFee: gasfee to send treasury / | ) external payable {
// require(msg.value >= _gasFee, "Not enough ETH fee");
// // charge ETH fee
// safeTransferETH(treasury, _gasFee);
// exectue swap function
(bool success, bytes memory returnData) = _target.delegatecall(_data);
if (!success) {
decod... | ) external payable {
// require(msg.value >= _gasFee, "Not enough ETH fee");
// // charge ETH fee
// safeTransferETH(treasury, _gasFee);
// exectue swap function
(bool success, bytes memory returnData) = _target.delegatecall(_data);
if (!success) {
decod... | 81,747 |
444 | // Reads the uint88 at `cdPtr` in calldata. | function readUint88(
CalldataPointer cdPtr
| function readUint88(
CalldataPointer cdPtr
| 23,559 |
371 | // Base64/Brecht Devos - <brecht@loopring.org>/Provides functions for encoding/decoding base64 | library Base64 {
string internal constant TABLE_ENCODE = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
bytes internal constant TABLE_DECODE = hex"0000000000000000000000000000000000000000000000000000000000000000"
hex"00000000000000000000003e00000... | library Base64 {
string internal constant TABLE_ENCODE = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
bytes internal constant TABLE_DECODE = hex"0000000000000000000000000000000000000000000000000000000000000000"
hex"00000000000000000000003e00000... | 6,780 |
47 | // TODO: Decode directly into a struct? | (
uint256 transitionType,
bytes32 stateRoot,
uint256 accountSlotIndex,
address account,
uint256 tokenIndex,
uint256 amount,
bytes memory signature
) = abi.decode(
(_rawBytes),
| (
uint256 transitionType,
bytes32 stateRoot,
uint256 accountSlotIndex,
address account,
uint256 tokenIndex,
uint256 amount,
bytes memory signature
) = abi.decode(
(_rawBytes),
| 40,540 |
2 | // Deploy with the address of the LINK token | constructor(address _link) public {
// Set the address for the LINK token for the network
setChainlinkToken(_link);
owner = msg.sender;
}
| constructor(address _link) public {
// Set the address for the LINK token for the network
setChainlinkToken(_link);
owner = msg.sender;
}
| 9,171 |
74 | // See {IERC721-safeTransferFrom}. / | function safeTransferFrom(
address from,
address to,
uint256 tokenId
) public override {
safeTransferFrom(from, to, tokenId, "");
}
| function safeTransferFrom(
address from,
address to,
uint256 tokenId
) public override {
safeTransferFrom(from, to, tokenId, "");
}
| 8,900 |
14 | // Delegate to internal OpenZeppelin mint function | _mint(_to, _tokenId + i);
| _mint(_to, _tokenId + i);
| 61,615 |
312 | // Allows the owner to change the base URI that hosts the images | function setBaseURI(string calldata _uri) external onlyOwner {
__baseURI = _uri;
}
| function setBaseURI(string calldata _uri) external onlyOwner {
__baseURI = _uri;
}
| 69,953 |
987 | // get all tokens currently supported by the contract/ return supportedTokensArray an array of supported token structs | function getSupportedTokens() external view returns (SupportedTokenData[] memory supportedTokensArray);
| function getSupportedTokens() external view returns (SupportedTokenData[] memory supportedTokensArray);
| 47,670 |
119 | // Restore tax and liquidity fees | _taxFee = _previousTaxFee;
_liquidityFee = _previousLiquidityFee;
if(_isExcludedFromFee[sender] || _isExcludedFromFee[recipient])
restoreAllFee();
| _taxFee = _previousTaxFee;
_liquidityFee = _previousLiquidityFee;
if(_isExcludedFromFee[sender] || _isExcludedFromFee[recipient])
restoreAllFee();
| 7,855 |
2 | // bind the nft to the shares | _issuance.issue(issuer, nft, tokenId, erc20Shares, numberOfSharestoIssue);
| _issuance.issue(issuer, nft, tokenId, erc20Shares, numberOfSharestoIssue);
| 34,760 |
9 | // return if vault should be settled _owner owner address _vaultId vaultId to settlereturn true if vault can be settled, contract is operator of owner, and excess collateral is greater than zero / | function shouldSettleVault(address _owner, uint256 _vaultId)
public
view
returns (bool)
| function shouldSettleVault(address _owner, uint256 _vaultId)
public
view
returns (bool)
| 14,436 |
8 | // burn to address amount amount / | function burnToken(address to, uint256 amount) public onlyOwner {
_burn(to, amount);
emit balanceChanged(to, amount, balanceOf(to));
}
| function burnToken(address to, uint256 amount) public onlyOwner {
_burn(to, amount);
emit balanceChanged(to, amount, balanceOf(to));
}
| 1,406 |
119 | // reset latest Oracle Caller for protect from double call | latestOracleCaller = address(0);
uint256 withdrawShares = numberOfWithdrawShares.mul(fundValue.sub(fundManagerCut)).div(fundValue);
| latestOracleCaller = address(0);
uint256 withdrawShares = numberOfWithdrawShares.mul(fundValue.sub(fundManagerCut)).div(fundValue);
| 28,874 |
404 | // Ensure the msg.sender is the current DisputeManager module/ | modifier onlyCurrentDisputeManager() {
(address addr, bool disabled) = controller.getDisputeManager();
require(msg.sender == addr, ERROR_SENDER_NOT_CURRENT_DISPUTE_MANAGER);
require(!disabled, ERROR_SENDER_NOT_ACTIVE_DISPUTE_MANAGER);
_;
}
| modifier onlyCurrentDisputeManager() {
(address addr, bool disabled) = controller.getDisputeManager();
require(msg.sender == addr, ERROR_SENDER_NOT_CURRENT_DISPUTE_MANAGER);
require(!disabled, ERROR_SENDER_NOT_ACTIVE_DISPUTE_MANAGER);
_;
}
| 19,614 |
16 | // Holds the list of IWhitelistable (e.g. ERC-721) projects in which ownership affords whitelisting | IWhitelistable[] private _approvedProjects;
| IWhitelistable[] private _approvedProjects;
| 63,966 |
223 | // Signature (for example full exit signature) bytes length | uint8 constant SIGNATURE_BYTES = 64;
| uint8 constant SIGNATURE_BYTES = 64;
| 16,107 |
23 | // Determine amount of tokens user wants to/can buy | uint256 iou_to_purchase = 160 * msg.value; // price is 160 per ETH
| uint256 iou_to_purchase = 160 * msg.value; // price is 160 per ETH
| 38,007 |
149 | // The index in storage starts with 1, then need sub(1) | lpIndexInPool[keccak256(abi.encodePacked(poolinfos_id, _lpToken))] = 1;
emit AddPool(poolinfos_id, address(_lpToken), _lpTokenType, _lpFactor);
| lpIndexInPool[keccak256(abi.encodePacked(poolinfos_id, _lpToken))] = 1;
emit AddPool(poolinfos_id, address(_lpToken), _lpTokenType, _lpFactor);
| 36,756 |
0 | // Provide a basic structure for each request to be created by manager | struct Request {
int approvalCount;
string description;
mapping(address => bool) approvals;
address recipient;
int value;
bool isComplete;
}
| struct Request {
int approvalCount;
string description;
mapping(address => bool) approvals;
address recipient;
int value;
bool isComplete;
}
| 53,542 |
8 | // Verify if the user is whitelisted | require(MerkleProof.verify(_merkleProof, rootHash, keccak256(abi.encodePacked(msg.sender))), "Invalid proof because you are not whitelisted");
require(msg.value == cost * _mintAmount, "Insufficient fund in your wallet");
whitelistMintCounter[msg.sender] += _mintAmount;
_safeMint(msg.sen... | require(MerkleProof.verify(_merkleProof, rootHash, keccak256(abi.encodePacked(msg.sender))), "Invalid proof because you are not whitelisted");
require(msg.value == cost * _mintAmount, "Insufficient fund in your wallet");
whitelistMintCounter[msg.sender] += _mintAmount;
_safeMint(msg.sen... | 11,684 |
2 | // OWNER |
function pause() external onlyOwner
|
function pause() external onlyOwner
| 15,220 |
35 | // RESOLUTION / LXL `client` or `provider` can lock to freeze release and withdrawal of sum remainder until `resolver` calls `resolve()`.`lock()` can be called repeatedly to allow LXL parties to continue to provide context until resolution.registration Registered LXL index. details Context re: lock and/or dispute. / | function lock(uint256 registration, string calldata details) external nonReentrant {
Locker storage locker = lockers[registration];
require(_msgSender() == locker.client || _msgSender() == locker.provider, "!party");
require(locker.confirmed == 1, "!confirmed");
require(lo... | function lock(uint256 registration, string calldata details) external nonReentrant {
Locker storage locker = lockers[registration];
require(_msgSender() == locker.client || _msgSender() == locker.provider, "!party");
require(locker.confirmed == 1, "!confirmed");
require(lo... | 20,888 |
295 | // require( this.getWithdrawableAmount() >= _amount, "cannot create vesting schedule because not sufficient tokens" ); | require(_duration > 0, "duration must be > 0");
require(_amount > 0, "amount must be > 0");
require(_cliff <= _duration, "invalid cliff");
require(_slicePeriodSeconds >= 1, "slicePeriodSeconds must be >= 1");
bytes32 vestingScheduleId = this.computeNextVestingScheduleIdForHolder... | require(_duration > 0, "duration must be > 0");
require(_amount > 0, "amount must be > 0");
require(_cliff <= _duration, "invalid cliff");
require(_slicePeriodSeconds >= 1, "slicePeriodSeconds must be >= 1");
bytes32 vestingScheduleId = this.computeNextVestingScheduleIdForHolder... | 35,941 |
1 | // Set the AllowanceModule. _moduleAddress The address of the AllowanceModule. / | function setAllowanceModule(address _moduleAddress) public onlyOwner returns (bool) {
allowanceModule = AllowanceModule(_moduleAddress);
allowanceModule.claimOwnership();
emit AllowanceModuleSet(_moduleAddress);
return true;
}
| function setAllowanceModule(address _moduleAddress) public onlyOwner returns (bool) {
allowanceModule = AllowanceModule(_moduleAddress);
allowanceModule.claimOwnership();
emit AllowanceModuleSet(_moduleAddress);
return true;
}
| 38,877 |
44 | // Case 1 - The caller is the winner | if (winner) {
| if (winner) {
| 27,882 |
32 | // Adapter Logic/ | contract TvlAdapterEarn {
/*******************************************************
* Common code shared by all adapters *
*******************************************************/
IOracle public oracle; // The oracle is used to fetch USDC normalized pricing data
IAddressesGenerato... | contract TvlAdapterEarn {
/*******************************************************
* Common code shared by all adapters *
*******************************************************/
IOracle public oracle; // The oracle is used to fetch USDC normalized pricing data
IAddressesGenerato... | 25,652 |
117 | // Convex | Booster private constant BOOSTER =
Booster(0xF403C135812408BFbE8713b5A23a04b3D48AAE31);
| Booster private constant BOOSTER =
Booster(0xF403C135812408BFbE8713b5A23a04b3D48AAE31);
| 20,994 |
349 | // Ref: https:github.com/Uniswap/uniswap-v2-core/blob/master/contracts/interfaces/IUniswapV2Pair.sol | interface IUniswapV2Pair {
event Approval(address indexed owner, address indexed spender, uint value);
event Transfer(address indexed from, address indexed to, uint value);
function name() external pure returns (string memory);
function symbol() external pure returns (string memory);
function dec... | interface IUniswapV2Pair {
event Approval(address indexed owner, address indexed spender, uint value);
event Transfer(address indexed from, address indexed to, uint value);
function name() external pure returns (string memory);
function symbol() external pure returns (string memory);
function dec... | 69,887 |
13 | // Use `private` to disallow other smart contracts from directly querying lockbox state. | mapping(uint256 => LockboxState) private lockboxes;
uint256 public nextLockboxId;
uint256 public constant MAX_MIGRATIONS = 10;
| mapping(uint256 => LockboxState) private lockboxes;
uint256 public nextLockboxId;
uint256 public constant MAX_MIGRATIONS = 10;
| 40,696 |
141 | // The Dragon's genetic code is packed into these 256-bits. | uint256 dna;
uint64 birthTime;
uint64 breedTime;
uint32 matronId;
uint32 sireId;
uint32 siringWithId;
uint32 generation;
| uint256 dna;
uint64 birthTime;
uint64 breedTime;
uint32 matronId;
uint32 sireId;
uint32 siringWithId;
uint32 generation;
| 7,598 |
54 | // Allows the CEO to revmove a connected WishListTokenThis revokes the reward and exchange functions / | function resetWLCParams() public onlyCEO {
WLCAdress = address(0);
WLCRewardAmount = 0;
}
| function resetWLCParams() public onlyCEO {
WLCAdress = address(0);
WLCRewardAmount = 0;
}
| 21,420 |
7 | // Adds an integer with the key "times" to the request parameters | req.addInt("times", 100);
| req.addInt("times", 100);
| 49,647 |
92 | // call permit before transferring token | uint256 deadline = _permit.toUint256(0);
(bytes32 r, bytes32 s, uint8 v) = _permit.parseSignature(32);
IERC20Permit(_tokenAddress).permit(
msg.sender,
address(this),
_amount,
deadline,
v,
... | uint256 deadline = _permit.toUint256(0);
(bytes32 r, bytes32 s, uint8 v) = _permit.parseSignature(32);
IERC20Permit(_tokenAddress).permit(
msg.sender,
address(this),
_amount,
deadline,
v,
... | 76,764 |
21 | // Proxy._implementation implementation | function _implementation() internal view virtual override returns (address) {
return UUPSUtils.implementation();
}
| function _implementation() internal view virtual override returns (address) {
return UUPSUtils.implementation();
}
| 18,417 |
42 | // Return the schedule by `_cid` and `_sid` _cid The contributor's id _sid The schedule's idreturn The schedule / | function schedule(uint256 _cid, uint256 _sid)
public
scheduleValid(_cid, _sid)
view
| function schedule(uint256 _cid, uint256 _sid)
public
scheduleValid(_cid, _sid)
view
| 18,714 |
221 | // Math: worst case MAX2MAX_BEFORE_SQUARE / MAX_BEFORE_SQUAREMAX_BEFORE_SQUARE | tokenValue = BigDiv.bigDiv2x1(
currencyValue,
2 * buySlopeDen,
initGoal * buySlopeNum
);
if(currencyValue != _currencyValue)
{
currencyValue = _currencyValue - max;
| tokenValue = BigDiv.bigDiv2x1(
currencyValue,
2 * buySlopeDen,
initGoal * buySlopeNum
);
if(currencyValue != _currencyValue)
{
currencyValue = _currencyValue - max;
| 4,884 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.