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 |
|---|---|---|---|---|
13 | // uint256 tot_value = 2(pow-1); |
current_index = id_owner;
while (current_index != 0){
uint256 amount = div(mul(valueShareFee, 2**(pow-1)), total_sum);
totalShareFee = add(amount, totalShareFee);
ItemList[current_index].owner.transfer(amount);... |
current_index = id_owner;
while (current_index != 0){
uint256 amount = div(mul(valueShareFee, 2**(pow-1)), total_sum);
totalShareFee = add(amount, totalShareFee);
ItemList[current_index].owner.transfer(amount);... | 66,869 |
287 | // Calculate by how much the token balance has to increase to match the invariantRatio | uint256 balanceRatio = invariantRatio.powUp(FixedPoint.ONE.divUp(normalizedWeight));
uint256 amountInWithoutFee = balance.mulUp(balanceRatio.sub(FixedPoint.ONE));
| uint256 balanceRatio = invariantRatio.powUp(FixedPoint.ONE.divUp(normalizedWeight));
uint256 amountInWithoutFee = balance.mulUp(balanceRatio.sub(FixedPoint.ONE));
| 1,661 |
151 | // Set this to a block to disable the ability to continue accruing tokens past that block number. | function setExpiration(uint256 _expiration) public onlyOwner() {
expiration = block.number + _expiration;
}
| function setExpiration(uint256 _expiration) public onlyOwner() {
expiration = block.number + _expiration;
}
| 36,728 |
45 | // Recent report is too recent. | uint256 reportTimestampPast = providerReports[providerAddress][index_past].timestamp;
if (reportTimestampPast < minValidTimestamp) {
| uint256 reportTimestampPast = providerReports[providerAddress][index_past].timestamp;
if (reportTimestampPast < minValidTimestamp) {
| 25,315 |
3 | // nftid to rarity points | mapping(uint256 => uint256) public rarity;
mapping(uint256 => uint256) public challengesUsed;
| mapping(uint256 => uint256) public rarity;
mapping(uint256 => uint256) public challengesUsed;
| 19,459 |
2 | // The tick that the account has had their deposit associated in | uint256 occupiedTick;
| uint256 occupiedTick;
| 30,149 |
21 | // Event emitted when complementaryEthPerOrder has been set | event ComplementaryEthPerOrderSet();
| event ComplementaryEthPerOrderSet();
| 47,019 |
469 | // Percentage of the total trading fee that goes to the reserve | function getReserveFeeShare(CashGroupParameters memory cashGroup)
internal
pure
returns (int256)
| function getReserveFeeShare(CashGroupParameters memory cashGroup)
internal
pure
returns (int256)
| 64,981 |
524 | // Move the ether to the Active Pool, and mint the LUSDAmount to the borrower | _activePoolAddColl(contractsCache.stableCollActivePool, vars.stableCollAmount);
_withdrawLUSD(contractsCache.stableCollActivePool, contractsCache.LUSDToken, msg.sender, _LUSDAmount, vars.netDebt);
emit TroveUpdated(msg.sender, vars.netDebt, vars.stableCollAmount, BorrowerOperation.openTrove);
... | _activePoolAddColl(contractsCache.stableCollActivePool, vars.stableCollAmount);
_withdrawLUSD(contractsCache.stableCollActivePool, contractsCache.LUSDToken, msg.sender, _LUSDAmount, vars.netDebt);
emit TroveUpdated(msg.sender, vars.netDebt, vars.stableCollAmount, BorrowerOperation.openTrove);
... | 54,943 |
267 | // Set the fee currency for the given reference currency at given block number/fromBlockNumber Block number from which the update applies/referenceCurrencyCt The address of the concerned reference currency contract (address(0) == ETH)/referenceCurrencyId The ID of the concerned reference currency (0 for ETH and ERC20)/... | function setFeeCurrency(uint256 fromBlockNumber, address referenceCurrencyCt, uint256 referenceCurrencyId,
address feeCurrencyCt, uint256 feeCurrencyId)
public
onlyOperator
onlyDelayedBlockNumber(fromBlockNumber)
| function setFeeCurrency(uint256 fromBlockNumber, address referenceCurrencyCt, uint256 referenceCurrencyId,
address feeCurrencyCt, uint256 feeCurrencyId)
public
onlyOperator
onlyDelayedBlockNumber(fromBlockNumber)
| 21,938 |
12 | // Allow the creator of the game to send balanceparamaddresstoSendAddress to receive its earnings / | function sendEarnings(address toSend) {
| function sendEarnings(address toSend) {
| 28,839 |
6 | // The last user can send an amount of whatever they like, but will only get as many until all minted. | if (totalSupply() < MAX_SUPPLY) {
_safeMint(msg.sender, totalSupply());
}
| if (totalSupply() < MAX_SUPPLY) {
_safeMint(msg.sender, totalSupply());
}
| 41,409 |
559 | // Errors //A sample Raffle ContractAli MahdaviThis contract performs raffles for a lottery and keeps track of the tiering system.This contract implements Chainlink VRF Version 2. / | abstract contract Raffle is VRFConsumerBaseV2 {
using SafeMath for uint256;
enum RaffleState {
OPEN,
CALCULATING
}
/*solhint-disable var-name-mixedcase*/
/* State variables */
// Chainlink VRF Variables
VRFCoordinatorV2Interface private immutable i_vrfCoordinator;
uint64 ... | abstract contract Raffle is VRFConsumerBaseV2 {
using SafeMath for uint256;
enum RaffleState {
OPEN,
CALCULATING
}
/*solhint-disable var-name-mixedcase*/
/* State variables */
// Chainlink VRF Variables
VRFCoordinatorV2Interface private immutable i_vrfCoordinator;
uint64 ... | 30,715 |
17 | // Get the price of the swapped token from Chainlink | int256 swappedTokenPrice = getLatestPrice(_returnBaseToken);
| int256 swappedTokenPrice = getLatestPrice(_returnBaseToken);
| 20,428 |
20 | // Maximum token supply. Reduced to `type(uint96).max` (2^96^ - 1) to fit COMP interface. / | function _maxSupply() internal view virtual override returns (uint224) {
return type(uint96).max;
}
| function _maxSupply() internal view virtual override returns (uint224) {
return type(uint96).max;
}
| 36,505 |
210 | // Allows token owner or approved to burn token tokenId_ token ID / | function burn(uint256 tokenId_) public virtual {
require(
_isApprovedOrOwner(_msgSender(), tokenId_),
"Not owner nor approved"
);
address owner = ownerOf(tokenId_);
_beforeTokenTransfer(owner, address(0), tokenId_);
_approve(address(0), tokenId_);
... | function burn(uint256 tokenId_) public virtual {
require(
_isApprovedOrOwner(_msgSender(), tokenId_),
"Not owner nor approved"
);
address owner = ownerOf(tokenId_);
_beforeTokenTransfer(owner, address(0), tokenId_);
_approve(address(0), tokenId_);
... | 33,801 |
23 | // Authorize contract to call the functions of this contract/ | function authorizeContract
(
address contractAddress
)
external
requireContractOwner
| function authorizeContract
(
address contractAddress
)
external
requireContractOwner
| 21,634 |
9 | // extract identify storage value from proof | bytes32 identify_storage = IBSCBridge(BSC_BRIDGE_PRECOMPILE).verify_single_storage_proof(
lane,
proof.accountProof,
bytes32(LANE_IDENTIFY_SLOT),
proof.laneIDProof
);
| bytes32 identify_storage = IBSCBridge(BSC_BRIDGE_PRECOMPILE).verify_single_storage_proof(
lane,
proof.accountProof,
bytes32(LANE_IDENTIFY_SLOT),
proof.laneIDProof
);
| 32,947 |
173 | // total_target_token_in_round[_round + 1] = total_target_token_in_round[_round]; | info.total_target_token_next_round = info.total_target_token;
| info.total_target_token_next_round = info.total_target_token;
| 29,380 |
74 | // Whitelist a new investor addr address / | function whitelistInvestor(address addr) public notEnded {
require((msg.sender == registrar || msg.sender == owner) && !limited());
if (!investors[addr].whitelisted && addr != address(0)) {
investors[addr].whitelisted = true;
numInvestors++;
}
}
| function whitelistInvestor(address addr) public notEnded {
require((msg.sender == registrar || msg.sender == owner) && !limited());
if (!investors[addr].whitelisted && addr != address(0)) {
investors[addr].whitelisted = true;
numInvestors++;
}
}
| 22,538 |
38 | // pool doesn&39;t have enough tokens | tokensToBuy = tokenPools[stage];
| tokensToBuy = tokenPools[stage];
| 58,480 |
2 | // sets initials supply and the owner / function initialize(string memory name, string memory symbol, uint8 decimals, uint256 amount, bool mintable,address owner) | // public initializer {
// _owner = owner;
// _name = name;
// _symbol = symbol;
// _decimals = decimals;
// _mintable = mintable;
// _mint(owner, amount);
// }
| // public initializer {
// _owner = owner;
// _name = name;
// _symbol = symbol;
// _decimals = decimals;
// _mintable = mintable;
// _mint(owner, amount);
// }
| 18,754 |
12 | // Guarantee the same behavior as in a regular Solidity division. | return a / b;
| return a / b;
| 1,277 |
110 | // console.log("Playing position:", position); , positionIndex, gameInfo.moves); | performMove(gameInfo, positionIndex);
if (gameInfo.moves < 4) { // No chance of winning just yet
uint256 openSlot = uint8(seed % (9 - gameInfo.moves));
| performMove(gameInfo, positionIndex);
if (gameInfo.moves < 4) { // No chance of winning just yet
uint256 openSlot = uint8(seed % (9 - gameInfo.moves));
| 52,575 |
2 | // mint filda for supplies to action pools | function setFildaDepositPool(address _actionPoolFilda, uint256 _piddeposit) public onlyOwner {
actionPoolFilda = _actionPoolFilda;
poolDepositId = _piddeposit;
emit SetFildaDepositPool(_actionPoolFilda, _piddeposit);
}
| function setFildaDepositPool(address _actionPoolFilda, uint256 _piddeposit) public onlyOwner {
actionPoolFilda = _actionPoolFilda;
poolDepositId = _piddeposit;
emit SetFildaDepositPool(_actionPoolFilda, _piddeposit);
}
| 27,261 |
4 | // Reserve extra slots (to a total of 50) in the storage layout for future upgrades. | uint256[48] private __gap;
| uint256[48] private __gap;
| 10,938 |
1 | // Uint256 encoded Token Metadata | mapping(uint256 => uint256) _metadata;
mapping(address => bool) _admin;
| mapping(uint256 => uint256) _metadata;
mapping(address => bool) _admin;
| 11,427 |
91 | // Represents a point substitution | struct Substitution {
uint matchingX;
uint matchingY;
uint replacementX;
uint replacementY;
}
| struct Substitution {
uint matchingX;
uint matchingY;
uint replacementX;
uint replacementY;
}
| 32,973 |
177 | // if its repay, we are using regular flash loan and payback the premiums | if (isRepay) {
repay(exData, market, gasCost, proxy, rateMode, fee);
address token = exData.srcAddr;
if (token == ETH_ADDR || token == WETH_ADDRESS) {
| if (isRepay) {
repay(exData, market, gasCost, proxy, rateMode, fee);
address token = exData.srcAddr;
if (token == ETH_ADDR || token == WETH_ADDRESS) {
| 81,142 |
133 | // Deploy all capital in pool (funnel 100% of pooled base assets into best adapter) | function deploy_all_capital() external override {
require(block.timestamp >= last_deploy + (deploy_interval), "deploy call too soon" );
last_deploy = block.timestamp;
// DAI/Compound
ISaffronPool pool = ISaffronPool(pools[0]);
IERC20 base_asset = IERC20(pool.get_base_asset_address());
if (bas... | function deploy_all_capital() external override {
require(block.timestamp >= last_deploy + (deploy_interval), "deploy call too soon" );
last_deploy = block.timestamp;
// DAI/Compound
ISaffronPool pool = ISaffronPool(pools[0]);
IERC20 base_asset = IERC20(pool.get_base_asset_address());
if (bas... | 17,699 |
81 | // Validate transfer with TransferManager module if it exists TransferManager module has a key of 2function (no change in the state). _from sender of transfer _to receiver of transfer _value value of transfer _data data to indicate validationreturn bool / | function _executeTransfer(
address _from,
address _to,
uint256 _value,
bytes memory _data
)
internal
checkGranularity(_value)
returns(bool)
| function _executeTransfer(
address _from,
address _to,
uint256 _value,
bytes memory _data
)
internal
checkGranularity(_value)
returns(bool)
| 34,209 |
4 | // CONTROL FUNCTIONS | function updateWhitelistMerkleRoot(bytes32 _newMerkleRoot)
external
onlyOwner
| function updateWhitelistMerkleRoot(bytes32 _newMerkleRoot)
external
onlyOwner
| 42,080 |
44 | // 释放 | if (users[i].Umark == "buy") {
balancepro[mad][address(pad)] = add(balancepro[mad][address(pad)],vol);
pros[pro].serv = add(pros[pro].serv,free);
pros[pro].volume = add(pros[pro].volume,uoa);
succeed[uad] +=1;
succeed[mad] +=1... | if (users[i].Umark == "buy") {
balancepro[mad][address(pad)] = add(balancepro[mad][address(pad)],vol);
pros[pro].serv = add(pros[pro].serv,free);
pros[pro].volume = add(pros[pro].volume,uoa);
succeed[uad] +=1;
succeed[mad] +=1... | 2,289 |
68 | // input ptr | let dataPtr := data
let endPtr := add(dataPtr, mload(data))
| let dataPtr := data
let endPtr := add(dataPtr, mload(data))
| 38,258 |
132 | // Moneta | IMoneta public immutable moneta;
| IMoneta public immutable moneta;
| 48,505 |
167 | // Uniswap swap paths | address[] public mis_usdt_path;
address[] public usdt_token1_path;
constructor(
address _token1,
address _rewards,
address _lp,
address _governance,
address _strategist,
address _controller,
| address[] public mis_usdt_path;
address[] public usdt_token1_path;
constructor(
address _token1,
address _rewards,
address _lp,
address _governance,
address _strategist,
address _controller,
| 37,262 |
24 | // delete the last selector | l.facetFunctionSelectors[_facetAddress].functionSelectors.pop();
delete l.selectorToFacetAndPosition[_selector];
| l.facetFunctionSelectors[_facetAddress].functionSelectors.pop();
delete l.selectorToFacetAndPosition[_selector];
| 26,886 |
8 | // Initialize inherited contracts, most base-like -> most derived. | __ERC2771Context_init(_trustedForwarders);
__ERC721A_init(_name, _symbol);
__SignatureMintERC721_init();
_setupContractURI(_contractURI);
_setupOwner(_defaultAdmin);
_setupRole(DEFAULT_ADMIN_ROLE, _defaultAdmin);
_setupRole(MINTER_ROLE, _defaultAdmin);
_... | __ERC2771Context_init(_trustedForwarders);
__ERC721A_init(_name, _symbol);
__SignatureMintERC721_init();
_setupContractURI(_contractURI);
_setupOwner(_defaultAdmin);
_setupRole(DEFAULT_ADMIN_ROLE, _defaultAdmin);
_setupRole(MINTER_ROLE, _defaultAdmin);
_... | 36,502 |
62 | // Recover the signer address from the digest and signature. | address recoveredSigner = _recoverSigner(digest, signature);
| address recoveredSigner = _recoverSigner(digest, signature);
| 13,600 |
71 | // Call the token and store if it succeeded or not. We use 68 because the calldata length is 4 + 322. | callStatus := call(gas(), token, 0, freeMemoryPointer, 68, 0, 0)
| callStatus := call(gas(), token, 0, freeMemoryPointer, 68, 0, 0)
| 35,570 |
85 | // pizza.mint(address(this), pizzaReward); | pool.accPizzaPerShare = pool.accPizzaPerShare.add(pizzaReward.mul(1e18).div(lpSupply));
user.reward = user.amount.mul((pool.accPizzaPerShare).sub(user.userRewardPerTokenPaid)).div(1e18).add(user.reward);
user.userRewardPerTokenPaid = pool.accPizzaPerShare;
pool.lastRewardTime = block.timest... | pool.accPizzaPerShare = pool.accPizzaPerShare.add(pizzaReward.mul(1e18).div(lpSupply));
user.reward = user.amount.mul((pool.accPizzaPerShare).sub(user.userRewardPerTokenPaid)).div(1e18).add(user.reward);
user.userRewardPerTokenPaid = pool.accPizzaPerShare;
pool.lastRewardTime = block.timest... | 33,724 |
322 | // Mapping from owner to list of owned convert lot IDs | mapping (address => bytes32[]) internal ownedConvertLots;
| mapping (address => bytes32[]) internal ownedConvertLots;
| 32,524 |
197 | // https:docs.synthetix.io/contracts/source/libraries/math | library Math {
using LowGasSafeMath for uint256;
using SafeDecimalMath for uint256;
/**
* @dev Uses "exponentiation by squaring" algorithm where cost is 0(logN)
* vs 0(N) for naive repeated multiplication.
* Calculates x^n with x as fixed-point and n as regular unsigned int.
* Calculate... | library Math {
using LowGasSafeMath for uint256;
using SafeDecimalMath for uint256;
/**
* @dev Uses "exponentiation by squaring" algorithm where cost is 0(logN)
* vs 0(N) for naive repeated multiplication.
* Calculates x^n with x as fixed-point and n as regular unsigned int.
* Calculate... | 78,831 |
88 | // Add a new lp to the pool._lpToken - address of ERC-20 LP token _newPoints - share in the total amount of rewards DO NOT add the same LP token more than once. Rewards will be messed up if you do. Can only be called by the current owner./ | function addNewPool(IERC20 _lpToken, uint256 _newPoints) public onlyOwner {
totalPoints = totalPoints.add(_newPoints);
poolInfo.push(PoolInfo({lpToken: _lpToken, allocPointAmount: _newPoints, blockCreation:block.number}));
emit AddNewPool(address(_lpToken), _newPoints);
}
| function addNewPool(IERC20 _lpToken, uint256 _newPoints) public onlyOwner {
totalPoints = totalPoints.add(_newPoints);
poolInfo.push(PoolInfo({lpToken: _lpToken, allocPointAmount: _newPoints, blockCreation:block.number}));
emit AddNewPool(address(_lpToken), _newPoints);
}
| 3,073 |
192 | // start snapshotId from which to start generating values, used to prevent cloning from incompatible schemes/start must be for the same day or 0, required for token cloning | constructor(uint256 start) internal {
// 0 is invalid value as we are past unix epoch
if (start > 0) {
uint256 base = dayBase(uint128(block.timestamp));
// must be within current day base
require(start >= base);
// dayBase + 2**128 will not overflow as... | constructor(uint256 start) internal {
// 0 is invalid value as we are past unix epoch
if (start > 0) {
uint256 base = dayBase(uint128(block.timestamp));
// must be within current day base
require(start >= base);
// dayBase + 2**128 will not overflow as... | 27,858 |
3 | // NFT Address -> NFT Token ID -> Listing | mapping(address => mapping(uint256 => Listing)) private listings;
| mapping(address => mapping(uint256 => Listing)) private listings;
| 23,160 |
31 | // Allows anyone to execute a confirmed transaction./transactionId Transaction ID. | function executeTransaction(uint transactionId)
public
ownerExists(msg.sender)
confirmed(transactionId, msg.sender)
notExecuted(transactionId)
| function executeTransaction(uint transactionId)
public
ownerExists(msg.sender)
confirmed(transactionId, msg.sender)
notExecuted(transactionId)
| 323 |
249 | // The ProtocolFeesCollector is a singleton, so it simply uses its own address to disambiguate action identifiers. | Authentication(bytes32(uint256(address(this))))
| Authentication(bytes32(uint256(address(this))))
| 4,974 |
26 | // If your resolveEarnings are worth less than 1 szabo, abort. | if (value_ < 0.000001 ether)
revert();
| if (value_ < 0.000001 ether)
revert();
| 32,879 |
100 | // Lock the user's tokens _of user's address. / | function lockForGovernanceVote(address _of, uint256 _period)
public
onlyOperator
| function lockForGovernanceVote(address _of, uint256 _period)
public
onlyOperator
| 28,547 |
361 | // The total mintable supply. | uint256 internal _maxMintableSupply = 10000;
| uint256 internal _maxMintableSupply = 10000;
| 36,482 |
5 | // Throws if called by any account other than the Owner. / | modifier onlyOwner() {
require(msg.sender == owner, "caller is not the owner");
_;
}
| modifier onlyOwner() {
require(msg.sender == owner, "caller is not the owner");
_;
}
| 26,680 |
186 | // Methods to remove minters from whitelist Requirements: - the caller must have admin role. / |
function revokeMinters(address[] memory _minters)
public
onlyRole(DEFAULT_ADMIN_ROLE)
|
function revokeMinters(address[] memory _minters)
public
onlyRole(DEFAULT_ADMIN_ROLE)
| 29,325 |
1 | // creates a new Arbitrum xDomain Forwarder contract l1OwnerAddr the L1 owner address that will be allowed to call the forward fn Empty constructor required due to inheriting from abstract contract CrossDomainForwarder / | constructor(address l1OwnerAddr) CrossDomainOwnable(l1OwnerAddr) {}
/**
* @notice versions:
*
* - ArbitrumCrossDomainForwarder 0.1.0: initial release
* - ArbitrumCrossDomainForwarder 1.0.0: Use OZ Address, CrossDomainOwnable
*
* @inheritdoc TypeAndVersionInterface
*/
function typeAndVersion(... | constructor(address l1OwnerAddr) CrossDomainOwnable(l1OwnerAddr) {}
/**
* @notice versions:
*
* - ArbitrumCrossDomainForwarder 0.1.0: initial release
* - ArbitrumCrossDomainForwarder 1.0.0: Use OZ Address, CrossDomainOwnable
*
* @inheritdoc TypeAndVersionInterface
*/
function typeAndVersion(... | 26,150 |
0 | // nuhmero mahximo de my_money disponiveis no ICO | uint public max_my_money = 100000;
| uint public max_my_money = 100000;
| 13,879 |
3 | // Ownable contract | contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor() public {
owner = msg.sender;
}
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
function transferOwnership(a... | contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor() public {
owner = msg.sender;
}
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
function transferOwnership(a... | 33,530 |
150 | // can deposit reward token directly require(depositToken != trustedRewardTokenAddress, "Cannot deposit reward token!"); |
require(depositToken != trustedDepositTokenAddress, "Cannot deposit LP directly!");
require(depositToken != address(0), "Deposit token cannot be 0!");
require(amountToStake > 0, "Invalid amount to Stake!");
IERC20(depositToken).safeTransferFrom(msg.sender, address(this), amoun... |
require(depositToken != trustedDepositTokenAddress, "Cannot deposit LP directly!");
require(depositToken != address(0), "Deposit token cannot be 0!");
require(amountToStake > 0, "Invalid amount to Stake!");
IERC20(depositToken).safeTransferFrom(msg.sender, address(this), amoun... | 33,406 |
9 | // Address of the GasPriceOracle predeploy. Includes fee information/ and helpers for computing the L1 portion of the transaction fee. | address internal constant GAS_PRICE_ORACLE = 0x420000000000000000000000000000000000000F;
| address internal constant GAS_PRICE_ORACLE = 0x420000000000000000000000000000000000000F;
| 10,997 |
24 | // Make division exact by subtracting the remainder from [prod1 prod0]. | uint256 remainder;
| uint256 remainder;
| 27,622 |
105 | // adds a new animal type to the gamemax. number of animal types: 100the cost may not be lower than costs[0]/ | function addAnimalType(uint128 cost, uint8 fee){
if(!(msg.sender==owner)||cost<costs[0]||costs.length>=100) throw;
costs.push(cost);
fees.push(fee);
values.push(cost/100*fee);
probabilityFactors.push(uint8(cost/costs[0]));
}
| function addAnimalType(uint128 cost, uint8 fee){
if(!(msg.sender==owner)||cost<costs[0]||costs.length>=100) throw;
costs.push(cost);
fees.push(fee);
values.push(cost/100*fee);
probabilityFactors.push(uint8(cost/costs[0]));
}
| 3,051 |
200 | // Store and declare the subtract in the core | requestCore.updateExpectedAmount(_requestId, i, -_subtractAmounts[i].toInt256Safe());
| requestCore.updateExpectedAmount(_requestId, i, -_subtractAmounts[i].toInt256Safe());
| 68,730 |
71 | // strategyburnt/supply = withdrawal | uint256 baseCached_ = baseCached;
uint256 burnt = _balanceOf[address(this)];
baseObtained = (baseCached_ * burnt) / _totalSupply;
baseCached = baseCached_ - baseObtained;
_burn(address(this), burnt);
base.safeTransfer(to, baseObtained);
emit Trade(address(this),... | uint256 baseCached_ = baseCached;
uint256 burnt = _balanceOf[address(this)];
baseObtained = (baseCached_ * burnt) / _totalSupply;
baseCached = baseCached_ - baseObtained;
_burn(address(this), burnt);
base.safeTransfer(to, baseObtained);
emit Trade(address(this),... | 23,573 |
134 | // Initialize and perform the first pass without check. | let temp := value
| let temp := value
| 9,117 |
24 | // Returns the uri of the given token id objectId the id of the token whose uri you want to know/ | function uri(uint256 objectId) external view returns (string memory);
| function uri(uint256 objectId) external view returns (string memory);
| 23,311 |
103 | // memberAddr The member address to look upreturn The delegate key address for memberAddr at the second last checkpoint number / | function getPreviousDelegateKey(address memberAddr)
public
view
returns (address)
| function getPreviousDelegateKey(address memberAddr)
public
view
returns (address)
| 62,491 |
4 | // return minimum amount of funds to be raised in wei. / | function goal() public view returns (uint256) {
return _goal;
}
| function goal() public view returns (uint256) {
return _goal;
}
| 18,705 |
5 | // Current stage / | enum Stages {
Deployed,
SetUp,
StartScheduled,
PreIcoStarted,
IcoStarted,
Ended
}
| enum Stages {
Deployed,
SetUp,
StartScheduled,
PreIcoStarted,
IcoStarted,
Ended
}
| 45,146 |
3 | // key lists | mapping(uint256 => frozen_uri) private id_to_uri;
mapping(uint256 => uint256) private id_to_dna;
mapping(address => approvalReg) private _whiteList;
| mapping(uint256 => frozen_uri) private id_to_uri;
mapping(uint256 => uint256) private id_to_dna;
mapping(address => approvalReg) private _whiteList;
| 16,805 |
56 | // 계약 잠금계약이 잠기면 컨트랙트의 거래가 중단된 상태가 되며,거래가 중단된 상태에서는 Owner와 Delegator를 포함한 모든 Holder는 거래를 할 수 없게 된다.모든 거래가 중단된 상태에서 모든 Holder의 상태가 변경되지 않게 만든 후에토큰 -> 코인 전환 절차를 진행하기 위함이다.단, 이 상태에서는 Exchange Contract를 Owner가 직접 Delegator로 임명하여Holder의 요청을 처리하도록 하며, 이때는 토큰 -> 코인 교환회수를 위한 exchange(), withdraw() 함수 실행만 허용이 된다. //Contract lock... | function lock() external onlyOwner returns (bool) {
isLock = true;
return isLock;
}
| function lock() external onlyOwner returns (bool) {
isLock = true;
return isLock;
}
| 16,931 |
207 | // Update the given pool's VALUE allocation point. Can only be called by the owner. | function set(uint256 _pid, uint256 _allocPoint, bool _withUpdate) public onlyOwner {
if (_withUpdate) {
massUpdatePools();
}
PoolInfo storage pool = poolInfo[_pid];
if (pool.isStarted) {
totalAllocPoint = totalAllocPoint.sub(pool.allocPoint).add(_allocPoint);
... | function set(uint256 _pid, uint256 _allocPoint, bool _withUpdate) public onlyOwner {
if (_withUpdate) {
massUpdatePools();
}
PoolInfo storage pool = poolInfo[_pid];
if (pool.isStarted) {
totalAllocPoint = totalAllocPoint.sub(pool.allocPoint).add(_allocPoint);
... | 15,441 |
19 | // Get a token's URI/_tokenId Token ID/ return uri_ URI of the token | function tokenURI(uint256 _tokenId) public view override returns (string memory uri_) {
if (isExtensionManagerSet()) {
return extensionManager.tokenURI(_tokenId);
}
return super.tokenURI(_tokenId);
}
| function tokenURI(uint256 _tokenId) public view override returns (string memory uri_) {
if (isExtensionManagerSet()) {
return extensionManager.tokenURI(_tokenId);
}
return super.tokenURI(_tokenId);
}
| 57,816 |
24 | // Internal pure function to validate calldata offsets for dynamic types in BasicOrderParameters and other parameters. This ensures that functions using the calldata object normally will be using the same data as the assembly functions and that values that are bound to a given range are within that range. Note that no ... | function _assertValidBasicOrderParameters() internal pure {
// Declare a boolean designating basic order parameter offset validity.
bool validOffsets;
// Utilize assembly in order to read offset data directly from calldata.
assembly {
/*
* Checks:
... | function _assertValidBasicOrderParameters() internal pure {
// Declare a boolean designating basic order parameter offset validity.
bool validOffsets;
// Utilize assembly in order to read offset data directly from calldata.
assembly {
/*
* Checks:
... | 14,751 |
14 | // Admin booleans for emergencies, migrations, and overrides | bool public bypassEmissionFactor;
bool public migrationsOn; // Used for migrations. Prevents new stakes, but allows LP and reward withdrawals
bool public stakesUnlocked; // Release locked stakes in case of system migration or emergency
bool public stakingPaused;
bool public withdrawalsPaused;
bo... | bool public bypassEmissionFactor;
bool public migrationsOn; // Used for migrations. Prevents new stakes, but allows LP and reward withdrawals
bool public stakesUnlocked; // Release locked stakes in case of system migration or emergency
bool public stakingPaused;
bool public withdrawalsPaused;
bo... | 24,673 |
510 | // Reads the bytes25 at `mPtr` in memory. | function readBytes25(
MemoryPointer mPtr
| function readBytes25(
MemoryPointer mPtr
| 33,672 |
104 | // Testing function to corroborate finals data from oraclize call return the 4 (four) final teams ids/ | function getBracketDataFinals() external view returns(uint8[4] a){
a = bracketsResults.finalsTeamsIds;
}
| function getBracketDataFinals() external view returns(uint8[4] a){
a = bracketsResults.finalsTeamsIds;
}
| 23,985 |
24 | // Function to add an authorized viewer | function addAuthorizedViewer(address viewer) public onlyOwner {
authorizedViewers[viewer] = true;
}
| function addAuthorizedViewer(address viewer) public onlyOwner {
authorizedViewers[viewer] = true;
}
| 9,654 |
29 | // add an address to the whitelist addr addressreturn true if the address was added to the whitelist, false if the address was already in the whitelist / | function addAddressToWhitelist(address addr)
onlyOwner
public
| function addAddressToWhitelist(address addr)
onlyOwner
public
| 48,058 |
47 | // Throws if called by any account other than the owner. / | modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
| modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
| 8,074 |
57 | // The maximum `quantity` that can be minted with `_mintERC2309`. This limit is to prevent overflows on the address data entries. For a limit of 5000, a total of 3.689e15 calls to `_mintERC2309` is required to cause an overflow, which is unrealistic. | uint256 private constant MAX_MINT_ERC2309_QUANTITY_LIMIT = 5000;
| uint256 private constant MAX_MINT_ERC2309_QUANTITY_LIMIT = 5000;
| 365 |
8 | // Cancel pending change/_id Id of contract | function cancelContractChange(bytes32 _id) public onlyOwner {
require(entries[_id].exists, ERR_ENTRY_NON_EXISTANT);
require(entries[_id].inChange, ERR_ENTRY_NOT_IN_CHANGE);
address oldContractAddr = pendingAddresses[_id];
pendingAddresses[_id] = address(0);
entries[_id].inC... | function cancelContractChange(bytes32 _id) public onlyOwner {
require(entries[_id].exists, ERR_ENTRY_NON_EXISTANT);
require(entries[_id].inChange, ERR_ENTRY_NOT_IN_CHANGE);
address oldContractAddr = pendingAddresses[_id];
pendingAddresses[_id] = address(0);
entries[_id].inC... | 15,158 |
200 | // lib/uma/packages/core/contracts/oracle/interfaces/StoreInterface.sol/ pragma solidity ^0.8.0; // import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; // import "../../common/implementation/FixedPoint.sol"; // Interface that allows financial contracts to pay oracle fees for their use of the system. / | interface StoreInterface {
/**
* @notice Pays Oracle fees in ETH to the store.
* @dev To be used by contracts whose margin currency is ETH.
*/
function payOracleFees() external payable;
/**
* @notice Pays oracle fees in the margin currency, erc20Address, to the store.
* @dev To be ... | interface StoreInterface {
/**
* @notice Pays Oracle fees in ETH to the store.
* @dev To be used by contracts whose margin currency is ETH.
*/
function payOracleFees() external payable;
/**
* @notice Pays oracle fees in the margin currency, erc20Address, to the store.
* @dev To be ... | 29,243 |
0 | // Verify verifies whether a piece of data was signed correctly. | function verify(bytes memory data, bytes memory signature, address signer) internal pure returns (bool) {
bytes32 prefixedHash = ECDSA.toEthSignedMessageHash(keccak256(data));
address recoveredAddr = ECDSA.recover(prefixedHash, signature);
require(recoveredAddr != address(0));
return... | function verify(bytes memory data, bytes memory signature, address signer) internal pure returns (bool) {
bytes32 prefixedHash = ECDSA.toEthSignedMessageHash(keccak256(data));
address recoveredAddr = ECDSA.recover(prefixedHash, signature);
require(recoveredAddr != address(0));
return... | 33,710 |
3 | // Adds the specified address to the list of administrators./ _address The address to add to the administrator list. | function addAdmin(address _address) external onlyAdmin {
require(_address != address(0));
require(!admins[_address]);
//The owner is already an admin and cannot be added.
require(_address != owner);
admins[_address] = true;
emit AdminAdded(_address);
}
| function addAdmin(address _address) external onlyAdmin {
require(_address != address(0));
require(!admins[_address]);
//The owner is already an admin and cannot be added.
require(_address != owner);
admins[_address] = true;
emit AdminAdded(_address);
}
| 28,163 |
157 | // allocate the memory for a new 32-byte string | _symbol = new string(10 + 1 + 4);
assembly {
mstore(add(_symbol, 0x20), mload(add(_name, 0x20)))
}
| _symbol = new string(10 + 1 + 4);
assembly {
mstore(add(_symbol, 0x20), mload(add(_name, 0x20)))
}
| 13,926 |
18 | // The current contract status. | enum Status { Deployed, Active, Expired }
Status public status;
/// @notice The owner of the locked tokens (usually Governance).
address public lockedTokenOwner;
/// @notice The owner of the unlocked tokens (usually MultiSig).
address public unlockedTokenOwner;
/// @notice The emergency transfer wallet/contract... | enum Status { Deployed, Active, Expired }
Status public status;
/// @notice The owner of the locked tokens (usually Governance).
address public lockedTokenOwner;
/// @notice The owner of the unlocked tokens (usually MultiSig).
address public unlockedTokenOwner;
/// @notice The emergency transfer wallet/contract... | 49,250 |
34 | // Burns a specific amount of tokens from the target address and decrements allowance _from address The address which you want to send tokens from _value uint256 The amount of token to be burned / | function burnFrom(address _from, uint256 _value) public {
require(_value <= allowed[_from][msg.sender]);
// this function needs to emit an event with the updated approval.
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
_burn(_from, _value);
}
| function burnFrom(address _from, uint256 _value) public {
require(_value <= allowed[_from][msg.sender]);
// this function needs to emit an event with the updated approval.
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
_burn(_from, _value);
}
| 68,857 |
7 | // return the sum of two points of G1 | function pointAdd(G1Point memory p1, G1Point memory p2)
internal view returns (G1Point memory r)
| function pointAdd(G1Point memory p1, G1Point memory p2)
internal view returns (G1Point memory r)
| 13,191 |
33 | // Propertiesuint256 public totalSupply; | uint256 public crowdSaleAllowance; // the number of tokens available for crowdsales
uint256 public adminAllowance; // the number of tokens available for the administrator
address public crowdSaleAddr; // the address of a crowdsale currently selling this token
address public admin... | uint256 public crowdSaleAllowance; // the number of tokens available for crowdsales
uint256 public adminAllowance; // the number of tokens available for the administrator
address public crowdSaleAddr; // the address of a crowdsale currently selling this token
address public admin... | 42,074 |
83 | // return canCompleteAward returns true if the function is supported AND can be completed | function canCompleteAward(address self) internal view returns (bool canCompleteAward){
if(supportsFunction(self, PeriodicPrizeStrategyInterface.canCompleteAward.selector)){
return PeriodicPrizeStrategyInterface(self).canCompleteAward();
}
return false;
}
| function canCompleteAward(address self) internal view returns (bool canCompleteAward){
if(supportsFunction(self, PeriodicPrizeStrategyInterface.canCompleteAward.selector)){
return PeriodicPrizeStrategyInterface(self).canCompleteAward();
}
return false;
}
| 80,994 |
20 | // return true if `msg.sender` is the owner of the contract. / | function isOwner() public view returns(bool) {
return msg.sender == _owner;
}
| function isOwner() public view returns(bool) {
return msg.sender == _owner;
}
| 51,138 |
356 | // Mapping from token id to sha256 hash of metadata | mapping(uint256 => bytes32) public tokenMetadataHashes;
| mapping(uint256 => bytes32) public tokenMetadataHashes;
| 4,936 |
4 | // locks ETH in pre-existing vault && returns DAI to sender | function depositEthAndWithdraw(bytes memory _callArgs)
private
| function depositEthAndWithdraw(bytes memory _callArgs)
private
| 17,608 |
76 | // Sets the values for `name`, `symbol`, and `decimals`. All three ofthese values are immutable: they can only be set once duringconstruction. / | function initialize(string memory name, string memory symbol, uint8 decimals) public initializer {
_name = name;
_symbol = symbol;
_decimals = decimals;
}
| function initialize(string memory name, string memory symbol, uint8 decimals) public initializer {
_name = name;
_symbol = symbol;
_decimals = decimals;
}
| 468 |
3 | // If no xeTaco exists, mint it 1:1 to the amount put in | if (totalShares == 0 || totaleTaco == 0) {
_mint(msg.sender, _amount);
}
| if (totalShares == 0 || totaleTaco == 0) {
_mint(msg.sender, _amount);
}
| 79,351 |
34 | // Deposit new want into position | harvestData.lpDeposited = IERC20Upgradeable(want).balanceOf(address(this));
if (harvestData.lpDeposited > 0) {
_deposit(harvestData.lpDeposited);
_postDeposit();
}
| harvestData.lpDeposited = IERC20Upgradeable(want).balanceOf(address(this));
if (harvestData.lpDeposited > 0) {
_deposit(harvestData.lpDeposited);
_postDeposit();
}
| 16,112 |
30 | // sale token liquidity | uint256 tokenLiquidity = baseLiquidity.mul(PRESALE_INFO.LISTING_RATE).div(10 ** uint256(PRESALE_INFO.B_TOKEN.decimals()));
TransferHelper.safeApprove(address(PRESALE_INFO.S_TOKEN), address(PRESALE_LOCK_FORWARDER), tokenLiquidity);
PRESALE_LOCK_FORWARDER.lockLiquidity(PRESALE_INFO.B_TOKEN, PRESALE_INFO.... | uint256 tokenLiquidity = baseLiquidity.mul(PRESALE_INFO.LISTING_RATE).div(10 ** uint256(PRESALE_INFO.B_TOKEN.decimals()));
TransferHelper.safeApprove(address(PRESALE_INFO.S_TOKEN), address(PRESALE_LOCK_FORWARDER), tokenLiquidity);
PRESALE_LOCK_FORWARDER.lockLiquidity(PRESALE_INFO.B_TOKEN, PRESALE_INFO.... | 33,482 |
15 | // equal Return player's Ether | returnFund(msg.value);
emit Draw(msg.sender, _playerHand, hostHand, msg.value);
return;
| returnFund(msg.value);
emit Draw(msg.sender, _playerHand, hostHand, msg.value);
return;
| 30,100 |
3 | // Claims CRV, CVX and extra rewards from Convex on behalf of a Conic pool./_curvePool Curve pool from which LP tokens have been deposited on Convex./_conicPool Conic pool for which rewards will be claimed. | function claimEarnings(address _curvePool, address _conicPool) external {
_claimConvexReward(_curvePool, _conicPool);
}
| function claimEarnings(address _curvePool, address _conicPool) external {
_claimConvexReward(_curvePool, _conicPool);
}
| 48,937 |
192 | // Creates new tokens starting with token ID specified and assigns an ownership `_to` for these tokensToken IDs to be minted: [_tokenId, _tokenId + n)n must be greater or equal 2: `n > 1`Checks if `_to` is a smart contract (code size > 0). If so, it calls `onERC721Received` on `_to` and throws if the return value is no... | function safeMintBatch(address _to, uint256 _tokenId, uint256 n) external;
| function safeMintBatch(address _to, uint256 _tokenId, uint256 n) external;
| 15,108 |
18 | // onlyAdmin is enforced by `revokeRole`. / | function revokeAdmin(address account) public {
revokeRole(DEFAULT_ADMIN_ROLE, account);
}
| function revokeAdmin(address account) public {
revokeRole(DEFAULT_ADMIN_ROLE, account);
}
| 9,670 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.