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 |
|---|---|---|---|---|
279 | // Swap WETH for Sushi | pair.swap(amount0Out, amount1Out, bar, new bytes(0));
| pair.swap(amount0Out, amount1Out, bar, new bytes(0));
| 25,766 |
21 | // Fix for the ERC20 short address attack/ | modifier onlyPayloadSize(uint size) {
if(msg.data.length < size + 4) {
doThrow("Short address attack!");
}
_;
}
| modifier onlyPayloadSize(uint size) {
if(msg.data.length < size + 4) {
doThrow("Short address attack!");
}
_;
}
| 27,458 |
19 | // Semantic version./ @custom:semver 1.7.0 | string public constant version = "1.7.0";
| string public constant version = "1.7.0";
| 24,818 |
6 | // The interface for Graviton oracle router/Forwards data about crosschain locking/unlocking events to balance keepers/Artemij Artamonov - <array.clean@gmail.com>/Anton Davydov - <fetsorn@gmail.com> | interface IOracleRouterV2 {
/// @notice User that can grant access permissions and perform privileged actions
function owner() external view returns (address);
/// @notice Transfers ownership of the contract to a new account (`_owner`).
/// @dev Can only be called by the current owner.
function set... | interface IOracleRouterV2 {
/// @notice User that can grant access permissions and perform privileged actions
function owner() external view returns (address);
/// @notice Transfers ownership of the contract to a new account (`_owner`).
/// @dev Can only be called by the current owner.
function set... | 15,684 |
297 | // Max balance doesn't apply to the token manager itself | if (_receiver == address(this)) {
return true;
}
| if (_receiver == address(this)) {
return true;
}
| 7,339 |
5 | // Creates `amount` new tokens for `to`. | * See {ERC20-_mint}.
*
* Requirements:
*
* - the caller must have the `MINTER_ROLE`.
*/
function mint(
address to,
uint256 amount
) public {
require(isMinter(_msgSender()), "Transaction signer is not a minter");
_mint(to, amount);
}
| * See {ERC20-_mint}.
*
* Requirements:
*
* - the caller must have the `MINTER_ROLE`.
*/
function mint(
address to,
uint256 amount
) public {
require(isMinter(_msgSender()), "Transaction signer is not a minter");
_mint(to, amount);
}
| 21,543 |
3 | // Function to receive Ether. msg.data must be empty | receive() external payable {}
// Fallback function is called when msg.data is not empty
fallback() external payable {
emit Paid(msg.sender, msg.value);
}
| receive() external payable {}
// Fallback function is called when msg.data is not empty
fallback() external payable {
emit Paid(msg.sender, msg.value);
}
| 20,948 |
37 | // To supply medicines from distributor to retailer | function Retail(uint256 _medicineID) public {
require(_medicineID > 0 && _medicineID <= medicineCtr);
uint256 _id = findRET(msg.sender);
require(_id > 0);
require(MedicineStock[_medicineID].stage == STAGE.Distribution);
MedicineStock[_medicineID].RETid = _id;
Medicine... | function Retail(uint256 _medicineID) public {
require(_medicineID > 0 && _medicineID <= medicineCtr);
uint256 _id = findRET(msg.sender);
require(_id > 0);
require(MedicineStock[_medicineID].stage == STAGE.Distribution);
MedicineStock[_medicineID].RETid = _id;
Medicine... | 914 |
6 | // mapping of user addresses to fee discount | mapping (address => uint256) discounts;
| mapping (address => uint256) discounts;
| 43,205 |
1 | // for mainnet currency, such as ETH, BNB etc, we hard coded its contract address as 0x0 | address public constant mainnetTokenAddress = address(0x0);
| address public constant mainnetTokenAddress = address(0x0);
| 11,534 |
10 | // The encoding specified in the EIP is very generic, and such a generic implementation in Solidity is not feasible,thus this contract does not implement the encoding itself. Protocols need to implement the type-specific encodingthey need in their contracts using a combination of `abi.encode` and `keccak256`. | * This contract implements the EIP 712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding
* scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA
* ({_hashTypedDataV4}).
*
* The implementation of the domain separator was designed to be as ef... | * This contract implements the EIP 712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding
* scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA
* ({_hashTypedDataV4}).
*
* The implementation of the domain separator was designed to be as ef... | 18,658 |
41 | // : Creates a Bequest _owner: To be owner of Bequest _referral: Referral code, if any / | function _createBequest(address _owner, string calldata _referral) internal {
require(!isOwner(_owner), "Already owner");
uint256 creationFee = getCreationFee(_referral);
require(msg.value >= creationFee, "Invalid fee");
if (bytes(_referral).length != 0) {
Referral storage referralDetails = re... | function _createBequest(address _owner, string calldata _referral) internal {
require(!isOwner(_owner), "Already owner");
uint256 creationFee = getCreationFee(_referral);
require(msg.value >= creationFee, "Invalid fee");
if (bytes(_referral).length != 0) {
Referral storage referralDetails = re... | 28,187 |
55 | // User-triggered (!) fund migrations in case contract got updated Similar to withdraw but we use a successor account instead As we don't store user tokens list on chain, it has to be passed from the outside | function migrateFunds(address[] _tokens) {
// Get the latest successor in the chain
require(successor != address(0));
TokenStore newExchange = TokenStore(successor);
for (uint16 n = 0; n < 20; n++) { // We will look past 20 contracts in the future
address nextSuccessor = newExchange.successor(... | function migrateFunds(address[] _tokens) {
// Get the latest successor in the chain
require(successor != address(0));
TokenStore newExchange = TokenStore(successor);
for (uint16 n = 0; n < 20; n++) { // We will look past 20 contracts in the future
address nextSuccessor = newExchange.successor(... | 31,060 |
155 | // EIP712 type data. solhint-disable-next-line | bytes32 constant EIP712_DOMAIN_TYPEHASH = keccak256("EIP712Domain(string name,string version)");
| bytes32 constant EIP712_DOMAIN_TYPEHASH = keccak256("EIP712Domain(string name,string version)");
| 34,239 |
57 | // trophyId to trophyName | mapping (uint256 => bytes32) public trophies;
| mapping (uint256 => bytes32) public trophies;
| 30,675 |
3 | // note: do not use a require statment because that will TranchedPool kill execution | if (_interestPaymentAmount > 0) {
_allocateRewards(_interestPaymentAmount);
}
| if (_interestPaymentAmount > 0) {
_allocateRewards(_interestPaymentAmount);
}
| 40,591 |
7 | // "SPDX-License-Identifier: UNLICENSED "/ SafeMath Math operations with safety checks that throw on error / | library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws... | library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws... | 26,041 |
13 | // Set the vault struct's properties | contractsCache.vaultManager.setVaultStatus(msg.sender, 1);
contractsCache.vaultManager.increaseVaultColl(msg.sender, vars.netColl);
contractsCache.vaultManager.increaseVaultDebt(msg.sender, vars.compositeDebt);
contractsCache.vaultManager.updateVaultRewardSnapshots(msg.sender);
... | contractsCache.vaultManager.setVaultStatus(msg.sender, 1);
contractsCache.vaultManager.increaseVaultColl(msg.sender, vars.netColl);
contractsCache.vaultManager.increaseVaultDebt(msg.sender, vars.compositeDebt);
contractsCache.vaultManager.updateVaultRewardSnapshots(msg.sender);
... | 31,256 |
74 | // https:explorer.optimism.io/address/0x1228c7D8BBc5bC53DB181bD7B1fcE765aa83bF8A | address public constant new_FuturesMarketLINK_contract = 0x1228c7D8BBc5bC53DB181bD7B1fcE765aa83bF8A;
| address public constant new_FuturesMarketLINK_contract = 0x1228c7D8BBc5bC53DB181bD7B1fcE765aa83bF8A;
| 22,575 |
8 | // cannot be settled | require(
id != 0 && gameMatch[id].settled == false
, "INVALID_GAME_ID");
gameMatch[id] = GameMatch({
settled: false,
date: block.timestamp,
visitorTeam: visitorTeamId,
homeTeam: teamId,
venue: venueId
| require(
id != 0 && gameMatch[id].settled == false
, "INVALID_GAME_ID");
gameMatch[id] = GameMatch({
settled: false,
date: block.timestamp,
visitorTeam: visitorTeamId,
homeTeam: teamId,
venue: venueId
| 9,281 |
31 | // Set that we have revealed the final base token URI, and lock the reveal so that the token URI is permanent | function freezeMetadata() public {
require(hasRole(DEFAULT_ADMIN_ROLE, msg.sender), "Only an admin can finalize the metadata");
require(metadataIsFrozen != true, "Can no longer set the metadata once it has been frozen");
metadataIsFrozen = true;
}
| function freezeMetadata() public {
require(hasRole(DEFAULT_ADMIN_ROLE, msg.sender), "Only an admin can finalize the metadata");
require(metadataIsFrozen != true, "Can no longer set the metadata once it has been frozen");
metadataIsFrozen = true;
}
| 5,523 |
306 | // try to do transfer and mint a heart | uint256 heartId = GameDataLib.transferButterfly(data, tokenId, from, to, currentTimestamp);
ERC721Manager.mint(erc721Data, from, heartId);
| uint256 heartId = GameDataLib.transferButterfly(data, tokenId, from, to, currentTimestamp);
ERC721Manager.mint(erc721Data, from, heartId);
| 32,105 |
26 | // Call to the signed zone controller to update the zone API endpoint. | _SIGNED_ZONE_CONTROLLER.updateAPIEndpoint(zone, newApiEndpoint);
| _SIGNED_ZONE_CONTROLLER.updateAPIEndpoint(zone, newApiEndpoint);
| 19,301 |
242 | // Order details are exposed through directly accessing this mapping, or through the getter functions below for each of the order&39;s fields. | mapping(bytes32 => Order) public orders;
event LogFeeUpdated(uint256 previousFee, uint256 nextFee);
event LogDarknodeRegistryUpdated(DarknodeRegistry previousDarknodeRegistry, DarknodeRegistry nextDarknodeRegistry);
| mapping(bytes32 => Order) public orders;
event LogFeeUpdated(uint256 previousFee, uint256 nextFee);
event LogDarknodeRegistryUpdated(DarknodeRegistry previousDarknodeRegistry, DarknodeRegistry nextDarknodeRegistry);
| 32,819 |
126 | // Standard transferFrom overridden to have a chance to thaw sender's tokens._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 return true iff operation was successfully completed / | function transferFrom(address _from, address _to, uint256 _value)
public
payloadSizeIs(3 * 32)
returns (bool)
| function transferFrom(address _from, address _to, uint256 _value)
public
payloadSizeIs(3 * 32)
returns (bool)
| 35,843 |
24 | // external NFT: copy token info from externSeqIdMap | info1 = externSeqIdMap[wd.seqId];
| info1 = externSeqIdMap[wd.seqId];
| 35,860 |
19 | // Increases the level of the item by one. This function will revert if the player does not have enough tokens. _itemId The item which should be upgraded. / | function upgradeItem(uint _itemId) external onlyOwnerOfItem(_itemId)
onlyUnequippedItem(_itemId)
| function upgradeItem(uint _itemId) external onlyOwnerOfItem(_itemId)
onlyUnequippedItem(_itemId)
| 52,546 |
23 | // calculate the transaction fee - 1/40 = 2.5% fee | uint256 fee = SafeMath.div(previousHolderShare, 40);
owner.transfer(fee);
| uint256 fee = SafeMath.div(previousHolderShare, 40);
owner.transfer(fee);
| 59,256 |
41 | // Checks if a list of modules are registered. _modules The list of modules address.return true if all the modules are registered. / | function isRegisteredModule(address[] _modules) external view returns (bool) {
for(uint i = 0; i < _modules.length; i++) {
if (!modules[_modules[i]].exists) {
return false;
}
}
return true;
}
| function isRegisteredModule(address[] _modules) external view returns (bool) {
for(uint i = 0; i < _modules.length; i++) {
if (!modules[_modules[i]].exists) {
return false;
}
}
return true;
}
| 2,378 |
47 | // BurnableStandard ERC20 token / | contract Burnable is StandardToken {
using SafeMath for uint;
/* This notifies clients about the amount burnt */
event Burn(address indexed from, uint256 value);
function burn(uint256 _value) public returns (bool success) {
require(balances[msg.sender] >= _value);
// Check if the sende... | contract Burnable is StandardToken {
using SafeMath for uint;
/* This notifies clients about the amount burnt */
event Burn(address indexed from, uint256 value);
function burn(uint256 _value) public returns (bool success) {
require(balances[msg.sender] >= _value);
// Check if the sende... | 42,006 |
4 | // get product id from underlying, strike and collateral address function will still return even if some of the assets are not registered engineIdengine id underlyingIdunderlying id strikeIdstrike id collateralIdcollateral id / | function getProductId(uint8 engineId, uint8 underlyingId, uint8 strikeId, uint8 collateralId)
internal
pure
returns (uint32 id)
| function getProductId(uint8 engineId, uint8 underlyingId, uint8 strikeId, uint8 collateralId)
internal
pure
returns (uint32 id)
| 25,732 |
87 | // funder info | if(orders[msg.sender].paymentEther == 0) {
indexedFunders[funderCount] = msg.sender;
funderCount = funderCount.add(1);
orders[msg.sender].state = eOrderstate.NONE;
}
| if(orders[msg.sender].paymentEther == 0) {
indexedFunders[funderCount] = msg.sender;
funderCount = funderCount.add(1);
orders[msg.sender].state = eOrderstate.NONE;
}
| 29,851 |
178 | // HIPPO tokens created per block. | uint256 public hippoPerBlock;
| uint256 public hippoPerBlock;
| 33,793 |
142 | // the id of nft token | uint256 nftTokenId;
| uint256 nftTokenId;
| 23,421 |
101 | // BurgerToken with Governance. | contract BurgerToken is ERC20("burger.money", "BURGER"), Ownable {
/// @notice Creates `_amount` token to `_to`. Must only be called by the owner (MasterChef).
function mint(address _to, uint256 _amount) public onlyOwner {
_mint(_to, _amount);
}
} | contract BurgerToken is ERC20("burger.money", "BURGER"), Ownable {
/// @notice Creates `_amount` token to `_to`. Must only be called by the owner (MasterChef).
function mint(address _to, uint256 _amount) public onlyOwner {
_mint(_to, _amount);
}
} | 85,173 |
104 | // the creator of the contract is also the initial COO | cooAddress = msg.sender;
| cooAddress = msg.sender;
| 30,786 |
24 | // Withdraws from an account's balance, sending it back to the caller.Relay Managers call this to retrieve their revenue, and `Paymasters` can also use it to reduce their funding.Emits a `Withdrawn` event. / | function withdraw(address payable dest, uint256 amount) external;
| function withdraw(address payable dest, uint256 amount) external;
| 11,752 |
6 | // Custom data types | struct TriggeredLimit{ address first; address[] sameBlock; uint block; }
struct TriggeredLimitId{ address trader; uint pairIndex; uint index; StorageInterfaceV5.LimitOrder order; }
enum OpenLimitOrderType{ LEGACY, REVERSAL, MOMENTUM }
// State
uint public currentOrder; ... | struct TriggeredLimit{ address first; address[] sameBlock; uint block; }
struct TriggeredLimitId{ address trader; uint pairIndex; uint index; StorageInterfaceV5.LimitOrder order; }
enum OpenLimitOrderType{ LEGACY, REVERSAL, MOMENTUM }
// State
uint public currentOrder; ... | 16,963 |
5 | // @custom:salt EndPoint | contract EndPoint {
address public immutable factory_;
address public owner;
uint256 public i;
event addedOne(uint256 indexed i);
event addedTwo(uint256 indexed i);
event UpgradeLock(bool indexed lock);
constructor(address f) {
factory_ = f;
}
function addOne() public {
... | contract EndPoint {
address public immutable factory_;
address public owner;
uint256 public i;
event addedOne(uint256 indexed i);
event addedTwo(uint256 indexed i);
event UpgradeLock(bool indexed lock);
constructor(address f) {
factory_ = f;
}
function addOne() public {
... | 2,745 |
60 | // Max, min and sum of debt per underlying and collateral. | function debt(bytes6 baseId, bytes6 ilkId) external view returns (DataTypes.Debt memory);
| function debt(bytes6 baseId, bytes6 ilkId) external view returns (DataTypes.Debt memory);
| 16,311 |
2 | // with rounding of last digit | uint256 _quotient = (( _numerator.div(denominator)) + 5) / 10;
return ( _quotient);
| uint256 _quotient = (( _numerator.div(denominator)) + 5) / 10;
return ( _quotient);
| 40,719 |
85 | // Project's owner can widthdraw contract's balance | function widthdraw(address to, uint amount) public onlyOwner {
to.transfer(amount);
}
| function widthdraw(address to, uint amount) public onlyOwner {
to.transfer(amount);
}
| 36,641 |
61 | // Function called by _adjustPosition()/guessedBorrow First guess to the borrow amount to maximise revenue/It computes the optimal collateral ratio and adjusts deposits/borrows accordingly | function _adjustPosition(uint256 guessedBorrow) internal override {
uint256 _debtOutstanding = poolManager.debtOutstanding();
uint256 wantBalance = _balanceOfWant();
// deposit available want as collateral
if (wantBalance > _debtOutstanding && wantBalance - _debtOutstanding > minWan... | function _adjustPosition(uint256 guessedBorrow) internal override {
uint256 _debtOutstanding = poolManager.debtOutstanding();
uint256 wantBalance = _balanceOfWant();
// deposit available want as collateral
if (wantBalance > _debtOutstanding && wantBalance - _debtOutstanding > minWan... | 19,807 |
12 | // allows the requester to cancel their adoption request / | function cancelAdoptionRequest(bytes5 catId) {
AdoptionRequest storage existingRequest = adoptionRequests[catId];
require(existingRequest.exists);
require(existingRequest.requester == msg.sender);
uint price = existingRequest.price;
adoptionRequests[catId] = AdoptionRequest(false, catId, 0x0, 0)... | function cancelAdoptionRequest(bytes5 catId) {
AdoptionRequest storage existingRequest = adoptionRequests[catId];
require(existingRequest.exists);
require(existingRequest.requester == msg.sender);
uint price = existingRequest.price;
adoptionRequests[catId] = AdoptionRequest(false, catId, 0x0, 0)... | 35,688 |
40 | // find amount to buy. | uint256 loopIndex = 1;
uint256 actualBuyAmtFinal = 0;
for (uint256 actualBuyAmt = buyAmt; actualBuyAmt <= maxSpent; actualBuyAmt += buyAmt){
if (actualBuyAmt > bal){
break;
}
| uint256 loopIndex = 1;
uint256 actualBuyAmtFinal = 0;
for (uint256 actualBuyAmt = buyAmt; actualBuyAmt <= maxSpent; actualBuyAmt += buyAmt){
if (actualBuyAmt > bal){
break;
}
| 26,336 |
82 | // if the account is blacklisted from transacting | mapping (address => bool) public isBlacklisted;
| mapping (address => bool) public isBlacklisted;
| 16,496 |
20 | // Buyer withdraws offer. IPFS hash contains reason for withdrawl. | function withdrawOffer(uint listingID, uint offerID, bytes32 _ipfsHash) public {
Offer storage offer = offers[listingID][offerID];
require(
msg.sender == offer.buyer,
"Restricted to buyer"
);
require(offer.status == 1, "status != created");
refundBuyer... | function withdrawOffer(uint listingID, uint offerID, bytes32 _ipfsHash) public {
Offer storage offer = offers[listingID][offerID];
require(
msg.sender == offer.buyer,
"Restricted to buyer"
);
require(offer.status == 1, "status != created");
refundBuyer... | 35,652 |
332 | // Get the current value of the linear growth limiter.// return The current value. | function get(LinearGrowthLimiter storage self) internal view returns (uint256) {
uint256 elapsed = block.number - self.lastBlock;
if (elapsed == 0) {
return self.lastValue;
}
uint256 delta = elapsed * self.rate / FIXED_POINT_SCALAR;
uint256 value = self.lastValue ... | function get(LinearGrowthLimiter storage self) internal view returns (uint256) {
uint256 elapsed = block.number - self.lastBlock;
if (elapsed == 0) {
return self.lastValue;
}
uint256 delta = elapsed * self.rate / FIXED_POINT_SCALAR;
uint256 value = self.lastValue ... | 69,087 |
123 | // owner of booster can set reward hook | require(IDeposit(operator).owner() == msg.sender, "!owner");
rewardHook = _hook;
| require(IDeposit(operator).owner() == msg.sender, "!owner");
rewardHook = _hook;
| 66,689 |
24 | // Events / | event BidSubmission(address indexed sender, uint256 amount);
| event BidSubmission(address indexed sender, uint256 amount);
| 2,543 |
135 | // sets approval for contracts that require access to assets held by this contract / | function setApprovals() external {
(address[] memory tokenAddresses, ) = setBasicIssuanceModule.getRequiredComponentUnitsForIssue(setToken, 1e18);
for (uint256 i; i < tokenAddresses.length; i++) {
IERC20 curveLpToken = curvePoolTokenPairs[tokenAddresses[i]].crvLPToken;
CurveMetapool curveMetapool... | function setApprovals() external {
(address[] memory tokenAddresses, ) = setBasicIssuanceModule.getRequiredComponentUnitsForIssue(setToken, 1e18);
for (uint256 i; i < tokenAddresses.length; i++) {
IERC20 curveLpToken = curvePoolTokenPairs[tokenAddresses[i]].crvLPToken;
CurveMetapool curveMetapool... | 19,372 |
46 | // 管理员冻结发布者和商品 | function setauctionother(uint auctids) public onlyOwner{
auctionlist storage c = auctionlisting[auctids];
btyc.freezeAccount(c.adduser, true);
c.ifend = true;
c.ifsend = 3;
}
| function setauctionother(uint auctids) public onlyOwner{
auctionlist storage c = auctionlisting[auctids];
btyc.freezeAccount(c.adduser, true);
c.ifend = true;
c.ifsend = 3;
}
| 20,530 |
41 | // called by any participants / | function getSecretSharingDatas(
bytes32 taskId,
uint64 round,
address[] calldata senders,
address receiver
)
public
view
roundExists(taskId, round)
roundcmmtExists(taskId, round)
| function getSecretSharingDatas(
bytes32 taskId,
uint64 round,
address[] calldata senders,
address receiver
)
public
view
roundExists(taskId, round)
roundcmmtExists(taskId, round)
| 41,671 |
30 | // Treasury Config, provided at setup, for finding the treasury address. | address treasuryConfig;
| address treasuryConfig;
| 38,091 |
55 | // conversion ratio for token1 and token2 1:10 ratio will be:ratio1 = 1ratio2 = 10 | uint256 public ratio1;
uint256 public ratio2;
mapping(address => Record[]) public ledger;
event StakeStart(address indexed user, uint256 value, uint256 index);
event StakeEnd(address indexed user, uint256 value, uint256 penalty, uint256 interest, uint256 index);
constructor(
| uint256 public ratio1;
uint256 public ratio2;
mapping(address => Record[]) public ledger;
event StakeStart(address indexed user, uint256 value, uint256 index);
event StakeEnd(address indexed user, uint256 value, uint256 penalty, uint256 interest, uint256 index);
constructor(
| 30,894 |
21 | // Cannot withdraw more than currently staked This condition can happen if while tokens are locked for withdrawal a slash condition happens In that case the total staked tokens could be below the amount to be withdrawn | if (stake.tokensLocked > stake.tokensStaked) {
return stake.tokensStaked;
}
| if (stake.tokensLocked > stake.tokensStaked) {
return stake.tokensStaked;
}
| 42,447 |
0 | // Last maxWeightPerSecond setting of PowerIndexPool. //Last wrapperMode setting of PowerIndexPool. //Timestamp, when possible to call finishReplace. / | ) public PowerIndexPoolController(_pool, _poolWrapper, _wrapperFactory, _weightsStrategy) {}
function _bindNewToken(
address _piToken,
uint256 _balance,
uint256 _denormalizedWeight
) internal override {
_initiateReplace(_denormalizedWeight);
pool.bind(address(_piToken), _balance, _denormaliz... | ) public PowerIndexPoolController(_pool, _poolWrapper, _wrapperFactory, _weightsStrategy) {}
function _bindNewToken(
address _piToken,
uint256 _balance,
uint256 _denormalizedWeight
) internal override {
_initiateReplace(_denormalizedWeight);
pool.bind(address(_piToken), _balance, _denormaliz... | 43,224 |
47 | // ========== MUTATIVE FUNCTIONS ========== //Claims rewards from the locker and notify an amount to the LGV4/_amount amount to notify after the claim | function claimAndNotify(uint256 _amount) external {
require(locker != address(0), "locker not set");
ILocker(locker).claimRewards(tokenReward, address(this));
_notifyReward(tokenReward, _amount);
}
| function claimAndNotify(uint256 _amount) external {
require(locker != address(0), "locker not set");
ILocker(locker).claimRewards(tokenReward, address(this));
_notifyReward(tokenReward, _amount);
}
| 38,174 |
311 | // Returns the protocolFeeMultiplier | function protocolFeeMultiplier()
external
view
returns (uint256);
| function protocolFeeMultiplier()
external
view
returns (uint256);
| 9,340 |
133 | // Value is returned in ray (1027) | return spotter.par();
| return spotter.par();
| 76,922 |
73 | // Converts an unsigned uint256 into a signed int256. Requirements: - input must be less than or equal to maxInt256. _Available since v3.0._ / | function toInt256(uint256 value) internal pure returns (int256) {
// Note: Unsafe cast below is okay because `type(int256).max` is guaranteed to be positive
require(value <= uint256(type(int256).max), "SafeCast: value doesn't fit in an int256");
return int256(value);
}
| function toInt256(uint256 value) internal pure returns (int256) {
// Note: Unsafe cast below is okay because `type(int256).max` is guaranteed to be positive
require(value <= uint256(type(int256).max), "SafeCast: value doesn't fit in an int256");
return int256(value);
}
| 26,516 |
65 | // NOTE: It is an intended substraction separation to correctly round dates | uint _daysLong = (_date / 1 days) - (_lastTransferDate / 1 days);
uint _bmcDays = _transferPeriod.user2bmcDays[_userKey];
return _bmcDays.add(_transferPeriod.user2balance[_userKey] * _daysLong);
| uint _daysLong = (_date / 1 days) - (_lastTransferDate / 1 days);
uint _bmcDays = _transferPeriod.user2bmcDays[_userKey];
return _bmcDays.add(_transferPeriod.user2balance[_userKey] * _daysLong);
| 76,326 |
18 | // StableSwap strategy for Gondola DAIe/USDTe / | contract GondolaStrategyForPoolDAIeUSDTe is YakStrategy {
using SafeMath for uint;
IGondolaChef public stakingContract;
IGondolaPool public poolContract;
address private constant WAVAX = 0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7;
address private constant USDTe = 0xc7198437980c041c805A1EDcbA50c1Ce5db95118;
... | contract GondolaStrategyForPoolDAIeUSDTe is YakStrategy {
using SafeMath for uint;
IGondolaChef public stakingContract;
IGondolaPool public poolContract;
address private constant WAVAX = 0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7;
address private constant USDTe = 0xc7198437980c041c805A1EDcbA50c1Ce5db95118;
... | 10,832 |
9 | // Revert or return depending on whether or not the call was successful. | switch delegatecallSuccess
case 0 {
revert(returnDataPosition, returnDataSize)
}
| switch delegatecallSuccess
case 0 {
revert(returnDataPosition, returnDataSize)
}
| 22,160 |
3 | // The Stars token | IERC20 public stars;
| IERC20 public stars;
| 18,326 |
1 | // A fixed integer used to evaluate fees as a fraction of trade execution 1/FEE_DENOMINATOR //The number of bytes a single auction element is serialized into //maximum number of tokens that can be listed for exchange / solhint-disable-next-line var-name-mixedcase | uint256 public MAX_TOKENS;
| uint256 public MAX_TOKENS;
| 19,750 |
0 | // SPDX-License-Identifier: Unlicensed | interface IERC20 {
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
... | interface IERC20 {
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
... | 8,080 |
136 | // Emitted when validator stakes in '_stakeFor()' in StakeManager./signer validator address./validatorId unique integer to identify a validator./nonce to synchronize the events in heimdal./activationEpoch validator's first epoch as proposer./amount staking amount./total total staking amount./signerPubkey public key of ... | event Staked(
address indexed signer,
uint256 indexed validatorId,
uint256 nonce,
uint256 indexed activationEpoch,
uint256 amount,
uint256 total,
bytes signerPubkey
);
| event Staked(
address indexed signer,
uint256 indexed validatorId,
uint256 nonce,
uint256 indexed activationEpoch,
uint256 amount,
uint256 total,
bytes signerPubkey
);
| 52,188 |
17 | // todo delete that just for test | transfer(address(router), tokenAmount);
| transfer(address(router), tokenAmount);
| 2,698 |
71 | // interface | import {IController} from "../interfaces/IController.sol";
import {IWPowerPerp} from "../interfaces/IWPowerPerp.sol";
import {IOracle} from "../interfaces/IOracle.sol";
import {IWETH9} from "../interfaces/IWETH9.sol";
import {IUniswapV3Pool} from "@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol";
import {ICont... | import {IController} from "../interfaces/IController.sol";
import {IWPowerPerp} from "../interfaces/IWPowerPerp.sol";
import {IOracle} from "../interfaces/IOracle.sol";
import {IWETH9} from "../interfaces/IWETH9.sol";
import {IUniswapV3Pool} from "@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol";
import {ICont... | 28,699 |
198 | // WBTC | 0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599,
| 0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599,
| 41,581 |
0 | // Libraries |
using Address for address;
using Strings for uint256;
|
using Address for address;
using Strings for uint256;
| 46,572 |
166 | // refund remain eth | if (msg.value > costForMinting) {
Address.sendValue(payable(msg.sender), msg.value - costForMinting);
}
| if (msg.value > costForMinting) {
Address.sendValue(payable(msg.sender), msg.value - costForMinting);
}
| 49,211 |
113 | // DATA TYPES //The main Artwork struct. Every art in CryptoArtworks is represented by a copy/of this structure, so great care was taken to ensure that it fits neatly into/exactly two 256-bit words. Note that the order of the members in this structure/is important because of the byte-packing rules used by Ethereum./Ref... | struct Artwork {
// The timestamp from the block when this artwork came into existence.
uint64 birthTime;
// The name of the artwork
string name;
string author;
//sometimes artists produce a series of paintings with the same name
//in order to separate them f... | struct Artwork {
// The timestamp from the block when this artwork came into existence.
uint64 birthTime;
// The name of the artwork
string name;
string author;
//sometimes artists produce a series of paintings with the same name
//in order to separate them f... | 39,318 |
1 | // MINTING LIMITS / | function max(uint256 a, uint256 b) private pure returns (uint256) {
return a >= b ? a : b;
}
| function max(uint256 a, uint256 b) private pure returns (uint256) {
return a >= b ? a : b;
}
| 11,035 |
36 | // maximum cap to be sold on ICO | uint256 public constant maxCap = 1500000000e18;
| uint256 public constant maxCap = 1500000000e18;
| 35,263 |
27 | // Subtract 256 bit number from 512 bit number. | prod1 := sub(prod1, gt(remainder, prod0))
prod0 := sub(prod0, remainder)
| prod1 := sub(prod1, gt(remainder, prod0))
prod0 := sub(prod0, remainder)
| 15,391 |
7 | // require(msg.sender == owner); when real, need this reauire | gamePhase = 0;
result = 0;
hostPlayer = 0x0;
guestPlayer = 0x0;
hostHand = 0;
guestHand = 0;
betAmount = 0;
hostClientHash = "0x";
guestClientHash = "0x";
hostEthHash = "0x";
| gamePhase = 0;
result = 0;
hostPlayer = 0x0;
guestPlayer = 0x0;
hostHand = 0;
guestHand = 0;
betAmount = 0;
hostClientHash = "0x";
guestClientHash = "0x";
hostEthHash = "0x";
| 39,388 |
8 | // Vault address | address public vaultAddress;
| address public vaultAddress;
| 45,609 |
7 | // Buy numberOfSharesToBuy shares and send them to recipient, paying with the base currency (allowance must be set) For currencies that support the ERC-677, one can also send them directly to the Market, triggering a buy. | function buy(address recipient, uint256 numberOfSharesToBuy) public virtual returns (uint256);
| function buy(address recipient, uint256 numberOfSharesToBuy) public virtual returns (uint256);
| 51,719 |
139 | // Transfers collateral tokens to a new Asset Pool which previously/ was approved by the governance. Upgrade does not have to obey/ withdrawal delay./ Old underwriter tokens are burned in favor of new tokens minted/ in a new Asset Pool. New tokens are sent directly to the/ underwriter from a new Asset Pool./covAmount A... | function upgradeToNewAssetPool(uint256 covAmount, address _newAssetPool)
external
| function upgradeToNewAssetPool(uint256 covAmount, address _newAssetPool)
external
| 43,790 |
73 | // DAI | if (balances[0] < balances[1] && balances[0] < balances[2]) {
return (dai, 0);
}
| if (balances[0] < balances[1] && balances[0] < balances[2]) {
return (dai, 0);
}
| 59,131 |
463 | // set up administrative roles | _setRoleAdmin(ROLE_ADMIN, ROLE_ADMIN);
| _setRoleAdmin(ROLE_ADMIN, ROLE_ADMIN);
| 65,104 |
198 | // reserveBoys- Reserves lostboys for owner- Used for giveaways/etc | function reserveBoys(uint256 quantity) public onlyOwner {
for(uint i = 0; i < quantity; i++) {
uint mintIndex = totalSupply();
if (mintIndex < MAX_LOSTBOYS) {
_safeMint(msg.sender, mintIndex);
}
}
}
| function reserveBoys(uint256 quantity) public onlyOwner {
for(uint i = 0; i < quantity; i++) {
uint mintIndex = totalSupply();
if (mintIndex < MAX_LOSTBOYS) {
_safeMint(msg.sender, mintIndex);
}
}
}
| 45,039 |
17 | // Get a node's pending withdrawal address | function getNodePendingWithdrawalAddress(address _nodeAddress) override public view returns (address) {
return rocketStorage.getNodePendingWithdrawalAddress(_nodeAddress);
}
| function getNodePendingWithdrawalAddress(address _nodeAddress) override public view returns (address) {
return rocketStorage.getNodePendingWithdrawalAddress(_nodeAddress);
}
| 34,707 |
6 | // transfer batch of tokens between given addresses, checking for ERC1155Receiver implementation if applicable from sender of tokens to receiver of tokens ids list of token IDs amounts list of quantities of tokens to transfer data data payload / | function safeBatchTransferFrom(
| function safeBatchTransferFrom(
| 9,940 |
22 | // set rare multiplier: Multiplier for rare nft set | @param multiplier {uint64}
note: starts at 100 for 1:1 with normal
*/
function setRareMultiplier(uint64 multiplier) external onlyOwner {
multipliers.rare = multiplier;
}
| @param multiplier {uint64}
note: starts at 100 for 1:1 with normal
*/
function setRareMultiplier(uint64 multiplier) external onlyOwner {
multipliers.rare = multiplier;
}
| 25,326 |
211 | // res += valcoefficients[23]. | res := addmod(res,
mulmod(val, /*coefficients[23]*/ mload(0x820), PRIME),
PRIME)
| res := addmod(res,
mulmod(val, /*coefficients[23]*/ mload(0x820), PRIME),
PRIME)
| 21,561 |
44 | // A collection of supported contracts. These are typically ERC-721, with the addition of the tokensOfOwner function./These contracts can be deactivated but cannot be re-activated.Reactivating can be done by adding the same/ contract through addSupportedContract | SupportedContractDetails[] public supportedContracts;
| SupportedContractDetails[] public supportedContracts;
| 44,241 |
108 | // Group Access Manager// Base implementation/ This contract serves as group manager | contract GroupsAccessManager is Object, GroupsAccessManagerEmitter {
uint constant USER_MANAGER_SCOPE = 111000;
uint constant USER_MANAGER_MEMBER_ALREADY_EXIST = USER_MANAGER_SCOPE + 1;
uint constant USER_MANAGER_GROUP_ALREADY_EXIST = USER_MANAGER_SCOPE + 2;
uint constant USER_MANAGER_OBJECT_ALREADY_SE... | contract GroupsAccessManager is Object, GroupsAccessManagerEmitter {
uint constant USER_MANAGER_SCOPE = 111000;
uint constant USER_MANAGER_MEMBER_ALREADY_EXIST = USER_MANAGER_SCOPE + 1;
uint constant USER_MANAGER_GROUP_ALREADY_EXIST = USER_MANAGER_SCOPE + 2;
uint constant USER_MANAGER_OBJECT_ALREADY_SE... | 19,299 |
2 | // withdraws available balance to WalllaW DAO. | function withdrawToWallaW() external returns (bool) {
uint256 units = (block.timestamp - lastCall);
uint256 amt = units * perSec;
lastCall = block.timestamp;
unitsLeft -= units;
emit WalllaWWithdrew(msg.sender, amt);
return Wtoken.transfer(WalllaWDAO, amt);
}
| function withdrawToWallaW() external returns (bool) {
uint256 units = (block.timestamp - lastCall);
uint256 amt = units * perSec;
lastCall = block.timestamp;
unitsLeft -= units;
emit WalllaWWithdrew(msg.sender, amt);
return Wtoken.transfer(WalllaWDAO, amt);
}
| 14,813 |
148 | // Perform a call to invoke {IERC721Receiver-onERC721Received} on `to`./ Reverts if the target does not support the function correctly. | function _checkOnERC721Received(address from, address to, uint256 id, bytes memory data)
private
{
| function _checkOnERC721Received(address from, address to, uint256 id, bytes memory data)
private
{
| 24,624 |
6 | // get event name by tokenID | function getEventName(uint256 tokenId) public view returns (string memory) {
return _eventName[tokenId];
}
| function getEventName(uint256 tokenId) public view returns (string memory) {
return _eventName[tokenId];
}
| 21,263 |
168 | // IRariGovernanceTokenDistributor IRariGovernanceTokenDistributor is a simple interface for RariGovernanceTokenDistributor used by RariFundManager and RariFundToken. / | interface IRariGovernanceTokenDistributor {
/**
* @notice Enum for the Rari pools to which distributions are rewarded.
*/
enum RariPool {
Stable,
Yield,
Ethereum
}
/**
* @notice Boolean indicating if this contract is disabled.
*/
function disabled() exter... | interface IRariGovernanceTokenDistributor {
/**
* @notice Enum for the Rari pools to which distributions are rewarded.
*/
enum RariPool {
Stable,
Yield,
Ethereum
}
/**
* @notice Boolean indicating if this contract is disabled.
*/
function disabled() exter... | 35,695 |
11 | // Withdraw ether to owner account | function withdrawAll() onlyOwner public {
owner.transfer(address(this).balance);
}
| function withdrawAll() onlyOwner public {
owner.transfer(address(this).balance);
}
| 43,411 |
1 | // Total staked tokens | uint256 public totalStakedTokens;
| uint256 public totalStakedTokens;
| 44,404 |
11 | // =========================================================..._ | _ _|_|` __ _ __| _ _|_ _. |_)|(_| |~|~(_)| | | |(_|(_| | (_| . platform data=|======================================================= | mapping (address => FMAPDatasets.Player) public players_;
mapping (address => mapping (uint256 => FMAPDatasets.OfferInfo)) public playerOfferOrders_; // player => player offer count => offerInfo.
mapping (address => mapping (uint256 => uint256)) public playerAcceptOrders_; // player => count => orderId. pla... | mapping (address => FMAPDatasets.Player) public players_;
mapping (address => mapping (uint256 => FMAPDatasets.OfferInfo)) public playerOfferOrders_; // player => player offer count => offerInfo.
mapping (address => mapping (uint256 => uint256)) public playerAcceptOrders_; // player => count => orderId. pla... | 2,608 |
100 | // When you stake say 1000 TUSD for a day that will be your maximum if you stake the next time 300 TUSD your maximum will stay the same if you stake 2000 at once it will increase to 2000 TUSD | mapping(bytes32 => uint256) public numberOfParticipants;
mapping(address => uint256) public depositBlockStarts;
uint256 public constant oneDayInBlocks = 6500;
uint256 public yeldToRewardPerDay = 100e18; // 100 YELD per day per 1 million stablecoins padded with 18 zeroes to have that flexibility
uint256 public... | mapping(bytes32 => uint256) public numberOfParticipants;
mapping(address => uint256) public depositBlockStarts;
uint256 public constant oneDayInBlocks = 6500;
uint256 public yeldToRewardPerDay = 100e18; // 100 YELD per day per 1 million stablecoins padded with 18 zeroes to have that flexibility
uint256 public... | 20,400 |
170 | // transfers LP from the owners wallet to holdersmust approve this contract, on pair contract before calling | function ManualLiquidityDistribution(uint256 amount) public onlyOwner {
bool success = IERC20(pair).transferFrom(
msg.sender,
address(dividendTracker),
amount
);
if (success) {
dividendTracker.distributeLPDividends(amount);
}
}
| function ManualLiquidityDistribution(uint256 amount) public onlyOwner {
bool success = IERC20(pair).transferFrom(
msg.sender,
address(dividendTracker),
amount
);
if (success) {
dividendTracker.distributeLPDividends(amount);
}
}
| 26,654 |
317 | // Creates tokens by creating a new position or by augmenting an existing position. Pulls `collateralAmount` into the sponsor's position and mints `numTokens` of `tokenCurrency`. Reverts if minting these tokens would put the position's collateralization ratio below theglobal collateralization ratio. This contract must ... | function create(FixedPoint.Unsigned memory collateralAmount, FixedPoint.Unsigned memory numTokens)
public
onlyPreExpiration()
fees()
nonReentrant()
| function create(FixedPoint.Unsigned memory collateralAmount, FixedPoint.Unsigned memory numTokens)
public
onlyPreExpiration()
fees()
nonReentrant()
| 8,091 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.