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 |
|---|---|---|---|---|
23 | // You can't change crowdsale contract when migration is in progress. | require(currentState != State.Migrating);
crowdsaleManager = _mgr;
| require(currentState != State.Migrating);
crowdsaleManager = _mgr;
| 39,444 |
87 | // max nft count without being an NST is 16384 color must be < 49153 | require(nftTokenCount < 0x4000);
require(TransferrableToken(_token).supportsInterface(0x80ac58cd) == true, "Not an ERC721 token");
color = NFT_FIRST_COLOR + nftTokenCount; // NFT color namespace starts from 2^15 + 1
nftTokenCount += 1;
| require(nftTokenCount < 0x4000);
require(TransferrableToken(_token).supportsInterface(0x80ac58cd) == true, "Not an ERC721 token");
color = NFT_FIRST_COLOR + nftTokenCount; // NFT color namespace starts from 2^15 + 1
nftTokenCount += 1;
| 10,066 |
6 | // Gnosis Protocol v2 Trade Library./Gnosis Developers | library GPv2Trade {
using GPv2Order for GPv2Order.Data;
using GPv2Order for bytes;
/// @dev A struct representing a trade to be executed as part a batch
/// settlement.
struct Data {
uint256 sellTokenIndex;
uint256 buyTokenIndex;
address receiver;
uint256 sellAmount;... | library GPv2Trade {
using GPv2Order for GPv2Order.Data;
using GPv2Order for bytes;
/// @dev A struct representing a trade to be executed as part a batch
/// settlement.
struct Data {
uint256 sellTokenIndex;
uint256 buyTokenIndex;
address receiver;
uint256 sellAmount;... | 30,132 |
9 | // Bare amount | uint256 bareAmount = DFX.balanceOf(_voter);
uint256 votePower = getAmountFromSLP(_stakedSlpAmount) + getAmountFromSLP(pool2StakedAmount) + getAmountFromSLP(slpAmount) + bareAmount;
return votePower;
| uint256 bareAmount = DFX.balanceOf(_voter);
uint256 votePower = getAmountFromSLP(_stakedSlpAmount) + getAmountFromSLP(pool2StakedAmount) + getAmountFromSLP(slpAmount) + bareAmount;
return votePower;
| 72,519 |
60 | // grant only maxAmount rewards | fullReward = maxAmount;
| fullReward = maxAmount;
| 23,588 |
317 | // 4. Get the latest cumulative rate. F_n+1 = F_n + F_last | uint latestCumulative = lastRate.add(rate.multiplyDecimal(timeDelta));
| uint latestCumulative = lastRate.add(rate.multiplyDecimal(timeDelta));
| 18,243 |
248 | // burn tokens/ | function burn(address _wallet, uint _amount) public onlyOwner{
_burn(_wallet, _amount);
}
| function burn(address _wallet, uint _amount) public onlyOwner{
_burn(_wallet, _amount);
}
| 40,460 |
77 | // console.log('fee: %s from %s on %s', fee, amount, address(token)); | require(fee < amount, 'Fee exceeds amount');
if (ETHER_ERC20 == token) {
feeWalletAddress.transfer(fee);
} else {
| require(fee < amount, 'Fee exceeds amount');
if (ETHER_ERC20 == token) {
feeWalletAddress.transfer(fee);
} else {
| 15,007 |
8 | // Sets `_tokenURI` as the tokenURI of `tokenId`. | * Emits {MetadataUpdate}.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function _setTokenURI(uint256 tokenId, string memory _tokenURI) internal virtual {
if (!_exists(tokenId)) {
revert("ERC721: URI set of nonexistent token");
}
_tokenURIs[tokenId] = _tokenURI;
... | * Emits {MetadataUpdate}.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function _setTokenURI(uint256 tokenId, string memory _tokenURI) internal virtual {
if (!_exists(tokenId)) {
revert("ERC721: URI set of nonexistent token");
}
_tokenURIs[tokenId] = _tokenURI;
... | 16,800 |
48 | // Recall that ``N'' was not accounted for in the loop because we didn't look at index 0, so we draw it here. `x` is `32` for the same reason outlined in the previous comment. `y` is `173` because the character starts 3 lines below the first (`351 = 153`), and we have the same 20px overhead as before, so `153 + 20 = 17... | 'N</pre></foreignObject><foreignObject x="32" y="173" width="53'
'6" height="204"><pre',
hyphenGuy.inverted
? ""
: string.concat(
' class="',
string(
abi.en... | 'N</pre></foreignObject><foreignObject x="32" y="173" width="53'
'6" height="204"><pre',
hyphenGuy.inverted
? ""
: string.concat(
' class="',
string(
abi.en... | 11,976 |
59 | // Sets {storeAddress} to a value./ | function setStoreAddress(address storeAddress) external onlyOwner returns (bool) {
require(storeAddress != address(0), 'Should not be zero address');
require(storeAddress != address(this), 'Should not be token address');
_storeAddress = storeAddress;
return true;
}
| function setStoreAddress(address storeAddress) external onlyOwner returns (bool) {
require(storeAddress != address(0), 'Should not be zero address');
require(storeAddress != address(this), 'Should not be token address');
_storeAddress = storeAddress;
return true;
}
| 32,984 |
167 | // SashimiToken with Governance. | contract SashimiToken is ERC20("PokeToken", "POKE"), 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);
_moveDelegates(address(0), _delegates[_to], _amount);
... | contract SashimiToken is ERC20("PokeToken", "POKE"), 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);
_moveDelegates(address(0), _delegates[_to], _amount);
... | 17,365 |
313 | // Gets the user's borrow balance with the latest `borrowIndex`. / | function borrowBalanceCurrent(address _account)
| function borrowBalanceCurrent(address _account)
| 52,238 |
38 | // centralBanker의 권한을 넘겨 줄 수 있다. 단, superOwner만 실행할 수 있다.newBanker centralBanker는 일종의 중앙은행으로 거래가 불가능하다.지급 준비율과 통화량에 따라 묶여있는 금액이 결정되어진다. 돈을 꺼내기 위해서는 감사를 거쳐서 owner쪽으로 인출이 가능하다. / | function transferBankOwnership(address newBanker) public onlySuperOwner {
emit TMTG_RoleTransferred(Role.centralBanker, centralBanker, newBanker);
centralBanker = newBanker;
}
| function transferBankOwnership(address newBanker) public onlySuperOwner {
emit TMTG_RoleTransferred(Role.centralBanker, centralBanker, newBanker);
centralBanker = newBanker;
}
| 29,915 |
44 | // Registers an already deployed pool instance within the factoryCan be executed by the pool factory owner onlypoolAddr address of the already deployed pool instance / | function registerPool(address poolAddr) public onlyOwner {
// read pool information from the pool smart contract
// via the pool interface (IPool)
address poolToken = IPool(poolAddr).poolToken();
bool isFlashPool = IPool(poolAddr).isFlashPool();
uint32 weight = IPool(poolAddr).weight();
// en... | function registerPool(address poolAddr) public onlyOwner {
// read pool information from the pool smart contract
// via the pool interface (IPool)
address poolToken = IPool(poolAddr).poolToken();
bool isFlashPool = IPool(poolAddr).isFlashPool();
uint32 weight = IPool(poolAddr).weight();
// en... | 50,408 |
181 | // Internal function used to reduce bytecode size | _validateOnlyModule();
_;
| _validateOnlyModule();
_;
| 73,419 |
64 | // Returns the amount of tokens owned by an account (`owner`). / | function balanceOf(address owner) external view returns (uint256);
| function balanceOf(address owner) external view returns (uint256);
| 28,012 |
25 | // sales status id | uint8 private _tokensale_status;
address public currency_token_address;
TetherToken_interface private _currency_token;
address public project_token_address;
ProjectToken_interface private _project_token;
uint256 private _token_price;
| uint8 private _tokensale_status;
address public currency_token_address;
TetherToken_interface private _currency_token;
address public project_token_address;
ProjectToken_interface private _project_token;
uint256 private _token_price;
| 10,938 |
31 | // Update auditor&39;s states | auditors[msg.sender].stakedInAudit[_id] = true;
auditors[msg.sender].stakedAudits.push(_id);
emit AuditorStaked(_id, msg.sender, msg.value);
| auditors[msg.sender].stakedInAudit[_id] = true;
auditors[msg.sender].stakedAudits.push(_id);
emit AuditorStaked(_id, msg.sender, msg.value);
| 11,364 |
3 | // 获取最新的恒定乘积中两种资产的数量 | function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast);
| function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast);
| 13,644 |
122 | // Ideally, we would compare the requested Wizard index against the reserved range directly. However, it's a bit wasteful to spend storage on a reserved range variable when we can combine some known true facts instead: - nextWizardIndex is initialized to reservedRange + 1 when the Series was opend - nextWizardIndex is ... | require((currentId & indexMask) < nextWizardIndex, "Wizards not in reserved range");
_createWizard(currentId, owner, powers[i], affinities[i]);
| require((currentId & indexMask) < nextWizardIndex, "Wizards not in reserved range");
_createWizard(currentId, owner, powers[i], affinities[i]);
| 18,141 |
43 | // Make a copy of the latest generation so we can update it | uint8[4] memory newGeneration = genesis.generations[
genesis.generations.length - 1
];
| uint8[4] memory newGeneration = genesis.generations[
genesis.generations.length - 1
];
| 50,108 |
10 | // effects | routerContract.swapExactTokensForAVAX(
amountInUSDC,
amountOutMin,
path,
receiver,
block.timestamp
);
return payment;
| routerContract.swapExactTokensForAVAX(
amountInUSDC,
amountOutMin,
path,
receiver,
block.timestamp
);
return payment;
| 6,427 |
8 | // Mint card and keep it in contract | rmu.mint(address(this), _nftIds[0], 1, "");
emit RaffleAdded(raffles.length.sub(1));
| rmu.mint(address(this), _nftIds[0], 1, "");
emit RaffleAdded(raffles.length.sub(1));
| 15,825 |
39 | // Provides information about the current execution context, including thesender of the transaction and its data. While these are generally availablevia msg.sender and msg.data, they should not be accessed in such a directmanner, since when dealing with GSN meta-transactions the account sending andpaying for execution ... | contract Context {
// Empty internal constructor, to prevent people from mistakenly deploying
// an instance of this contract, which should be used via inheritance.
constructor() {}
function _msgSender() internal view returns (address payable) {
return payable(msg.sender);
}
function ... | contract Context {
// Empty internal constructor, to prevent people from mistakenly deploying
// an instance of this contract, which should be used via inheritance.
constructor() {}
function _msgSender() internal view returns (address payable) {
return payable(msg.sender);
}
function ... | 53,281 |
55 | // Branch - storemanGroup unregistration | StoremanGroup storage _r = mapStoremanGroup[recipient];
| StoremanGroup storage _r = mapStoremanGroup[recipient];
| 43,174 |
196 | // Variant with withdrawal fee and verification of max loss. Used in withdraw functions. /Migrate functions use the variant from BaseWrapper without these features. | function _withdraw(
address receiver,
uint256 shares, // if `MAX_UINT256`, just withdraw everything
bool processWithdrawalFee, // If true, process withdrawal fee to affiliate
bool verifyMaxLoss // If true, ensure that the amount is within an expected range based on withdrawalMaxDevia... | function _withdraw(
address receiver,
uint256 shares, // if `MAX_UINT256`, just withdraw everything
bool processWithdrawalFee, // If true, process withdrawal fee to affiliate
bool verifyMaxLoss // If true, ensure that the amount is within an expected range based on withdrawalMaxDevia... | 41,423 |
126 | // We can directly increment and decrement the balances. | --_packedAddressData[from]; // Updates: `balance -= 1`.
++_packedAddressData[to]; // Updates: `balance += 1`.
| --_packedAddressData[from]; // Updates: `balance -= 1`.
++_packedAddressData[to]; // Updates: `balance += 1`.
| 27,126 |
71 | // transfer gift for new owner | _transfer(oldOwner, newOwner, _giftId);
delete ownerToApprovedAddsToGifIds[oldOwner][newOwner];
| _transfer(oldOwner, newOwner, _giftId);
delete ownerToApprovedAddsToGifIds[oldOwner][newOwner];
| 35,457 |
6 | // The owner address is maintained. | owner = msg.sender;
ercToken = _ercToken;
internalDistributionToken = _internalCirculationToken;
transferHistory = _transferHistory;
| owner = msg.sender;
ercToken = _ercToken;
internalDistributionToken = _internalCirculationToken;
transferHistory = _transferHistory;
| 25,013 |
5 | // we add this check for avoiding too much vesting | require(lockers[msg.sender], "only locker can lock");
if (_amount > 0) {
IERC20(_token).safeTransferFrom(msg.sender, address(this), _amount);
lockInfo[_addr].push(
LockInfo({
isWithdrawn: false,
token: _token,
... | require(lockers[msg.sender], "only locker can lock");
if (_amount > 0) {
IERC20(_token).safeTransferFrom(msg.sender, address(this), _amount);
lockInfo[_addr].push(
LockInfo({
isWithdrawn: false,
token: _token,
... | 1,801 |
241 | // Update the weighted multiplier of the recipient | ownerWeightedMultiplier[_to] = AOLibrary.calculateWeightedMultiplier(ownerWeightedMultiplier[_to], primordialBalanceOf[_to], ownerWeightedMultiplier[_from], _value);
| ownerWeightedMultiplier[_to] = AOLibrary.calculateWeightedMultiplier(ownerWeightedMultiplier[_to], primordialBalanceOf[_to], ownerWeightedMultiplier[_from], _value);
| 53,049 |
6 | // Encodes withdraw parameters from standard input to compact representation of 1 bytes32 Without a to parameter as the compact calls to L2Pool will use msg.sender as to asset The address of the underlying asset to withdraw amount The underlying amount to be withdrawnreturn compact representation of withdraw parameters... | function encodeWithdrawParams(address asset, uint256 amount) external view returns (bytes32) {
DataTypes.ReserveData memory data = POOL.getReserveData(asset);
uint16 assetId = data.id;
uint128 shortenedAmount = amount == type(uint256).max ? type(uint128).max : amount.toUint128();
bytes32 res;
as... | function encodeWithdrawParams(address asset, uint256 amount) external view returns (bytes32) {
DataTypes.ReserveData memory data = POOL.getReserveData(asset);
uint16 assetId = data.id;
uint128 shortenedAmount = amount == type(uint256).max ? type(uint128).max : amount.toUint128();
bytes32 res;
as... | 18,632 |
13 | // setLandOwner changes the owner of an land unit | function setLandOwner(uint _idx, address _newOwner) public override {
Land storage land = lands[_idx];
require(msg.sender == land.owner, "MetaHomepage: sender is not owner");
land.owner = _newOwner;
emit SetLandOwner(_idx, msg.sender, _newOwner);
}
| function setLandOwner(uint _idx, address _newOwner) public override {
Land storage land = lands[_idx];
require(msg.sender == land.owner, "MetaHomepage: sender is not owner");
land.owner = _newOwner;
emit SetLandOwner(_idx, msg.sender, _newOwner);
}
| 13,778 |
10 | // Returns the input amount needed for a desired output amount in a single-hop trade/amountOut The desired output amount/reserveIn The reserves available of the input token/reserveOut The reserves available of the output token/ return amountIn The input amount of the input token | function getAmountIn(uint256 amountOut, uint256 reserveIn, uint256 reserveOut)
internal
pure
returns (uint256 amountIn)
| function getAmountIn(uint256 amountOut, uint256 reserveIn, uint256 reserveOut)
internal
pure
returns (uint256 amountIn)
| 7,219 |
276 | // _changeDonationRecipient(nul); think what's the best logic for donations | fundsDon = 0;
| fundsDon = 0;
| 22,473 |
125 | // Kine's Controller Contract Kine / | contract Controller is ControllerStorage, KineControllerInterface, Exponential, ControllerErrorReporter {
/// @notice Emitted when an admin supports a market
event MarketListed(KToken kToken);
/// @notice Emitted when an account enters a market
event MarketEntered(KToken kToken, address account);
... | contract Controller is ControllerStorage, KineControllerInterface, Exponential, ControllerErrorReporter {
/// @notice Emitted when an admin supports a market
event MarketListed(KToken kToken);
/// @notice Emitted when an account enters a market
event MarketEntered(KToken kToken, address account);
... | 18,941 |
7 | // =================== Added variables =================== // =================== Events =================== // =================== Modifier =================== / | modifier onlyOperator() {
require(operator == msg.sender, "Treasury: caller is not the operator");
_;
}
| modifier onlyOperator() {
require(operator == msg.sender, "Treasury: caller is not the operator");
_;
}
| 5,997 |
6 | // get callback addressreturn address Oracle owner address / | function callback_address() internal view returns (address) {
return oracle.getOwner();
}
| function callback_address() internal view returns (address) {
return oracle.getOwner();
}
| 8,586 |
19 | // 通用存款方法,存入的时候如果没有对应的保险柜,则自动创建 | function createValt(string memory sym,address token,uint256 amount) public{
address valt = m_token_valts[token];
require(valt == address(0),"EXIST_VALT");
//constructor(address factory,address token,address profitpool,uint256 profitrate,uint256 loadfee)
PureFlashVault newValt = new PureFlashV... | function createValt(string memory sym,address token,uint256 amount) public{
address valt = m_token_valts[token];
require(valt == address(0),"EXIST_VALT");
//constructor(address factory,address token,address profitpool,uint256 profitrate,uint256 loadfee)
PureFlashVault newValt = new PureFlashV... | 48,537 |
1 | // this struct contains vechiles meta data, when vechile was bought, owner, etcall future vechile properties will be here | struct vehicleMetaInfo {
Date date;
string owner;
}
| struct vehicleMetaInfo {
Date date;
string owner;
}
| 46,871 |
56 | // Returns passenger refunded amount by flight key and passenger/ | function getPayOutAmount(bytes32 flightKey, address passenger)
external
view
requireIsOperational
returns (uint256)
| function getPayOutAmount(bytes32 flightKey, address passenger)
external
view
requireIsOperational
returns (uint256)
| 47,006 |
26 | // Overload {_revokeRole} to track enumerable memberships / | function _revokeRole(bytes32 role, address account) internal virtual override {
super._revokeRole(role, account);
_roleMembers[role].remove(account);
}
| function _revokeRole(bytes32 role, address account) internal virtual override {
super._revokeRole(role, account);
_roleMembers[role].remove(account);
}
| 54,553 |
4 | // (D_Pinvariant) / (balances[j]numTokens) | D_P = Math.divDown(Math.mul(D_P, invariant), Math.mul(balances[j], numTokens));
| D_P = Math.divDown(Math.mul(D_P, invariant), Math.mul(balances[j], numTokens));
| 15,370 |
123 | // Now we can transfer the funds and burn the shares | uint256 toTransfer = balanceOf(msg.sender);
lpToken.safeTransfer(msg.sender, toTransfer);
totalShares = totalShares.sub(share[msg.sender]);
share[msg.sender] = 0;
emit Withdrawn(msg.sender, toTransfer);
| uint256 toTransfer = balanceOf(msg.sender);
lpToken.safeTransfer(msg.sender, toTransfer);
totalShares = totalShares.sub(share[msg.sender]);
share[msg.sender] = 0;
emit Withdrawn(msg.sender, toTransfer);
| 17,580 |
9 | // curve claims are divided by weeks and each iterate can claim up to 20 weeks of rewards. | IFeeDistributor(FEE_DISTRIBUTOR).claim_many([p, p, p, p, p, p, p, p, p, p, p, p, p, p, p, p, p, p, p, p]);
lastClaimTimestamp = IFeeDistributor(FEE_DISTRIBUTOR).time_cursor_of(p);
amount = ERC20(CRV3).balanceOf(address(this));
if (amount > 0) {
ERC20(CRV3).transfer(recipient... | IFeeDistributor(FEE_DISTRIBUTOR).claim_many([p, p, p, p, p, p, p, p, p, p, p, p, p, p, p, p, p, p, p, p]);
lastClaimTimestamp = IFeeDistributor(FEE_DISTRIBUTOR).time_cursor_of(p);
amount = ERC20(CRV3).balanceOf(address(this));
if (amount > 0) {
ERC20(CRV3).transfer(recipient... | 26,730 |
127 | // Claim the tokens and excess ETH owedto a single contributor after the party has ended Emits a Claimed event upon successcallable by anyone (doesn't have to be the contributor) _contributor the address of the contributor / | function claim(address _contributor) external nonReentrant {
// ensure party has finalized
require(
partyStatus != PartyStatus.ACTIVE,
"Party::claim: party not finalized"
);
// ensure contributor submitted some ETH
require(
totalContributed... | function claim(address _contributor) external nonReentrant {
// ensure party has finalized
require(
partyStatus != PartyStatus.ACTIVE,
"Party::claim: party not finalized"
);
// ensure contributor submitted some ETH
require(
totalContributed... | 36,696 |
63 | // +zq(x) | tp = proof.opening_proof_at_z.point_mul(state.z);
PairingsBn254.Fr memory t = state.z_omega.copy();
t.mul_assign(state.u);
PairingsBn254.G1Point memory t1 = proof.opening_proof_at_z_omega.point_mul(t);
tp.point_add_assign(t1);
pair_with_generator.point_add_assign(tp);
| tp = proof.opening_proof_at_z.point_mul(state.z);
PairingsBn254.Fr memory t = state.z_omega.copy();
t.mul_assign(state.u);
PairingsBn254.G1Point memory t1 = proof.opening_proof_at_z_omega.point_mul(t);
tp.point_add_assign(t1);
pair_with_generator.point_add_assign(tp);
| 5,128 |
99 | // Get the escape hatch account, if one exists, for this account. | (bool exists, address escapeHatch) = _ESCAPE_HATCH_REGISTRY.getEscapeHatch();
| (bool exists, address escapeHatch) = _ESCAPE_HATCH_REGISTRY.getEscapeHatch();
| 33,103 |
53 | // Max wallet holding (4% at launch) | uint256 public _maxWalletToken = _tTotal.mul(4).div(100);
uint256 private _previousMaxWalletToken = _maxWalletToken;
| uint256 public _maxWalletToken = _tTotal.mul(4).div(100);
uint256 private _previousMaxWalletToken = _maxWalletToken;
| 18,763 |
60 | // Check whether the pre-ICO is active at the moment./ | function isPreIco() public constant returns (bool) {
bool withinPreIco = now >= startTimePreIco && now <= endTimePreIco;
return withinPreIco;
}
| function isPreIco() public constant returns (bool) {
bool withinPreIco = now >= startTimePreIco && now <= endTimePreIco;
return withinPreIco;
}
| 14,391 |
1 | // Struct | struct File {
uint256 fileId;
address payable uploader;
string fileHash;
string fileType;
uint256 fileSize;
string fileName;
uint256 uploadTime;
}
| struct File {
uint256 fileId;
address payable uploader;
string fileHash;
string fileType;
uint256 fileSize;
string fileName;
uint256 uploadTime;
}
| 31,019 |
50 | // ExecSuccess: Provider pays ExecutorSuccessFee and SysAdminSuccessFee | providerFunds[_provider] = providerFunds[_provider].sub(
executorCompensation.add(sysAdminCompensation),
"GelatoCore._processProviderPayables: providerFunds underflow"
);
executorStake[msg.sender] += executorCompensation;
sysAdminFunds += s... | providerFunds[_provider] = providerFunds[_provider].sub(
executorCompensation.add(sysAdminCompensation),
"GelatoCore._processProviderPayables: providerFunds underflow"
);
executorStake[msg.sender] += executorCompensation;
sysAdminFunds += s... | 51,949 |
108 | // Calculate how much collateral someone would buy from an auction using the latest redemption price fetched from theOracleRelayer and the latest updated discount associated with the auction id ID of the auction to buy collateral from wad New bid submitted / | function getCollateralBought(uint256 id, uint256 wad) external returns (uint256, uint256) {
(bool validAuctionAndBid, uint256 adjustedBid) = getAdjustedBid(id, wad);
if (!validAuctionAndBid) {
return (0, adjustedBid);
}
// Read the redemption price
lastReadRedemp... | function getCollateralBought(uint256 id, uint256 wad) external returns (uint256, uint256) {
(bool validAuctionAndBid, uint256 adjustedBid) = getAdjustedBid(id, wad);
if (!validAuctionAndBid) {
return (0, adjustedBid);
}
// Read the redemption price
lastReadRedemp... | 22,033 |
118 | // Unpauses purchase functions. Owner only/ | function adminUnpause() external onlyOwner {
_unpause();
}
| function adminUnpause() external onlyOwner {
_unpause();
}
| 37,759 |
8 | // Execute message from the origin chain. Will revert if `message` has already been executed. to Address that will receive the message data Data that was dispatched messageId ID uniquely identifying message fromChainId ID of the chain that dispatched the `message` from Address of the sender on the origin chain executed... | function executeMessage(
address to,
bytes memory data,
bytes32 messageId,
uint256 fromChainId,
address from,
bool executedMessageId
| function executeMessage(
address to,
bytes memory data,
bytes32 messageId,
uint256 fromChainId,
address from,
bool executedMessageId
| 9,589 |
36 | // Derive a private key from a provided mnenomic string (or mnenomic file path) at the derivation path {path}{index} | function deriveKey(string calldata, string calldata, uint32) external pure returns (uint256);
| function deriveKey(string calldata, string calldata, uint32) external pure returns (uint256);
| 28,354 |
7 | // Largest management fee earned proportion per one second./0.0000001% per second, i.e. 3.1536% per year./0.0000001%(365246060) = 3.1536% | uint256 private constant MAX_MANAGEMENT_FEE = 10**9;
| uint256 private constant MAX_MANAGEMENT_FEE = 10**9;
| 36,667 |
156 | // if emergencyWithdraw hasn't been enabled then the calculation of the percentages is pretty straightforward we get the total durations of the deposit and waiting round and get the % share out of the total duration | if (!emergencyWithdraw) {
uint64 endOfWaitingRound = waitingRoundSegmentStart + waitingRoundSegmentLength;
uint64 totalGameDuration = endOfWaitingRound - firstSegmentStart;
depositRoundInterestSharePercentage = uint64(
(segmentLength * depositCount * MULTIPLIE... | if (!emergencyWithdraw) {
uint64 endOfWaitingRound = waitingRoundSegmentStart + waitingRoundSegmentLength;
uint64 totalGameDuration = endOfWaitingRound - firstSegmentStart;
depositRoundInterestSharePercentage = uint64(
(segmentLength * depositCount * MULTIPLIE... | 17,940 |
271 | // Update weights in a predetermined way, between startBlock and endBlock,through external cals to pokeWeights bPool - Core BPool the CRP is wrapping newWeights - final weights we want to get to startBlock - when weights should start to change endBlock - when weights will be at their final values minimumWeightChangeBlo... | function updateWeightsGradually(
IBPool bPool,
GradualUpdateParams storage gradualUpdate,
uint256[] calldata newWeights,
uint256 startBlock,
uint256 endBlock,
uint256 minimumWeightChangeBlockPeriod
| function updateWeightsGradually(
IBPool bPool,
GradualUpdateParams storage gradualUpdate,
uint256[] calldata newWeights,
uint256 startBlock,
uint256 endBlock,
uint256 minimumWeightChangeBlockPeriod
| 16,185 |
90 | // Revert if zx + half overflowed. | if lt(zxRound, zx) {
revert(0, 0)
}
| if lt(zxRound, zx) {
revert(0, 0)
}
| 10,698 |
126 | // Destroys a `value` amount of tokens from `account`, deducting fromthe caller's allowance. | * See {ERC20-_burn} and {ERC20-allowance}.
*
* Requirements:
*
* - the caller must have allowance for ``accounts``'s tokens of at least
* `value`.
*/
function burnFrom(address account, uint256 value) public virtual {
_spendAllowance(account, _msgSender(), value);
_burn(account, value);
... | * See {ERC20-_burn} and {ERC20-allowance}.
*
* Requirements:
*
* - the caller must have allowance for ``accounts``'s tokens of at least
* `value`.
*/
function burnFrom(address account, uint256 value) public virtual {
_spendAllowance(account, _msgSender(), value);
_burn(account, value);
... | 29,544 |
46 | // VersoView Token implementation. / | contract VVTToken is ERC20 {
using SafeMath for uint256;
string public constant name = "VersoView";
string public constant symbol = "VVT";
uint8 public constant decimals = 18;
bool public isPaused = false;
uint256 internal constant INITIAL_SUPPLY = 2 * (10**9) * (10 ** uint256(decimals)); // 2... | contract VVTToken is ERC20 {
using SafeMath for uint256;
string public constant name = "VersoView";
string public constant symbol = "VVT";
uint8 public constant decimals = 18;
bool public isPaused = false;
uint256 internal constant INITIAL_SUPPLY = 2 * (10**9) * (10 ** uint256(decimals)); // 2... | 21,588 |
118 | // Public price function for TRX to Token trades with an exact output. tokens_bought Amount of Tokens bought.return Amount of TRX needed to buy output Tokens. / | function getTrxToTokenOutputPrice(uint256 tokens_bought) public view returns (uint256) {
require(tokens_bought > 0, "tokens bought must greater than 0");
uint256 token_reserve = token.balanceOf(address(this));
uint256 trx_sold = getOutputPrice(tokens_bought, address(this).balance, token_rese... | function getTrxToTokenOutputPrice(uint256 tokens_bought) public view returns (uint256) {
require(tokens_bought > 0, "tokens bought must greater than 0");
uint256 token_reserve = token.balanceOf(address(this));
uint256 trx_sold = getOutputPrice(tokens_bought, address(this).balance, token_rese... | 43,031 |
41 | // Number of tokens in circulation. / | uint256 internal tokensCount;
| uint256 internal tokensCount;
| 15,911 |
224 | // Checks whether there are any unprocessed slashes. / | function hasUnprocessedSlashes(address holder) public view returns (bool) {
return _everDelegated(holder) && _firstUnprocessedSlashByHolder[holder] < _slashes.length;
}
| function hasUnprocessedSlashes(address holder) public view returns (bool) {
return _everDelegated(holder) && _firstUnprocessedSlashByHolder[holder] < _slashes.length;
}
| 81,643 |
158 | // Will update the base URL of token's URI _newBaseMetadataURI New base URL of token's URI / | function setBaseMetadataURI(string memory _newBaseMetadataURI)
public
onlyWhitelistAdmin
| function setBaseMetadataURI(string memory _newBaseMetadataURI)
public
onlyWhitelistAdmin
| 11,895 |
212 | // Set the timelock. / | constructor(TimelockController timelockAddress) {
_updateTimelock(timelockAddress);
}
| constructor(TimelockController timelockAddress) {
_updateTimelock(timelockAddress);
}
| 38,635 |
46 | // subtract the amount paid from the amount owed | backlog -= payoutToSend;
| backlog -= payoutToSend;
| 61,780 |
27 | // for tokens allocated to the team | address public grantVestedEDEXContract;
bool private grantVestedEDEXSet = false;
| address public grantVestedEDEXContract;
bool private grantVestedEDEXSet = false;
| 39,701 |
12 | // Assign the addresses. | giveawayTokenContract = _giveawayTokenContract;
| giveawayTokenContract = _giveawayTokenContract;
| 42,683 |
181 | // setp 2:把sender的源代币转入到当前地址 IERC20(_fromToken).safeTransferFrom(msg.sender, address(this), _amount); |
IERC20(_fromToken).safeApprove(onesplit, 0);
IERC20(_fromToken).safeApprove(onesplit, _amount);
|
IERC20(_fromToken).safeApprove(onesplit, 0);
IERC20(_fromToken).safeApprove(onesplit, _amount);
| 35,617 |
0 | // constructor Called on contract deployment. Could not be called with zero address parameters. _template refers to the address of a deployed DataToken contract. _collector refers to the community fee collector address / | constructor(
address _template,
address _collector
| constructor(
address _template,
address _collector
| 49,593 |
1 | // require(hasRole(MINTER_ROLE, msg.sender)); |
uint256 newItemId = _tokenIdCounter.current();
super._safeMint(to, newItemId);
_setTokenURI(newItemId, hash);
_tokenIdCounter.increment();
|
uint256 newItemId = _tokenIdCounter.current();
super._safeMint(to, newItemId);
_setTokenURI(newItemId, hash);
_tokenIdCounter.increment();
| 12,165 |
6 | // The SILVER TOKEN! | MySecure public cake;
| MySecure public cake;
| 41,854 |
240 | // trap description | string public trapMessage = "";
| string public trapMessage = "";
| 46,722 |
213 | // Set bond info to storage. | _bonds[bondID] = BondInfo({
maturity: maturity,
contractInstance: bondTokenContract,
strikePrice: sbtStrikePrice,
fnMapID: fnMapID
});
| _bonds[bondID] = BondInfo({
maturity: maturity,
contractInstance: bondTokenContract,
strikePrice: sbtStrikePrice,
fnMapID: fnMapID
});
| 35,560 |
10 | // Assigns a new address to act as the COO. Only available to the current CEO./_newCOO The address of the new COO | function setCOO(address _newCOO) external payable onlyCEO {
require(_newCOO != address(0), "COO can not be null");
cooAddress = _newCOO;
}
| function setCOO(address _newCOO) external payable onlyCEO {
require(_newCOO != address(0), "COO can not be null");
cooAddress = _newCOO;
}
| 17,767 |
0 | // IVaultERC721 Vault managing ERC721 Cyril Lapinte - <cyril@openfiz.com>SPDX-License-Identifier: MIT Error messages / | interface IVaultERC721 {
function transferFromERC721(IERC721 _token, address _from, address _to, uint256 _tokenId) external;
function safeTransferFromERC721(IERC721 _token, address _from, address _to, uint256 _tokenId) external;
function safeTransferFromERC721(IERC721 _token, address _from, address _to, uint256 ... | interface IVaultERC721 {
function transferFromERC721(IERC721 _token, address _from, address _to, uint256 _tokenId) external;
function safeTransferFromERC721(IERC721 _token, address _from, address _to, uint256 _tokenId) external;
function safeTransferFromERC721(IERC721 _token, address _from, address _to, uint256 ... | 40,461 |
10 | // Store the winner of this round and their reward | roundWinners.push(
| roundWinners.push(
| 6,069 |
78 | // Cancel the pending upgrade process. Can only be called by current asset owner. return success. / | function purgeUpgrade() public onlyAssetOwner() returns(bool) {
if (pendingVersion == 0x0) {
return false;
}
emit UpgradePurged(pendingVersion);
delete pendingVersion;
delete pendingVersionTimestamp;
return true;
}
| function purgeUpgrade() public onlyAssetOwner() returns(bool) {
if (pendingVersion == 0x0) {
return false;
}
emit UpgradePurged(pendingVersion);
delete pendingVersion;
delete pendingVersionTimestamp;
return true;
}
| 8,662 |
61 | // emitted for all price changes/ | event PricePosted(address asset, uint previousPriceMantissa, uint requestedPriceMantissa, uint newPriceMantissa);
| event PricePosted(address asset, uint previousPriceMantissa, uint requestedPriceMantissa, uint newPriceMantissa);
| 12,147 |
3 | // Liquidity pool distribution | uint128 internal _lpShareNum;
uint128 internal _lpShareDen;
EnumerableSet.AddressSet internal _lps;
address internal _lpRecipient;
bool internal _inGenesis;
uint256[39] private __gap;
| uint128 internal _lpShareNum;
uint128 internal _lpShareDen;
EnumerableSet.AddressSet internal _lps;
address internal _lpRecipient;
bool internal _inGenesis;
uint256[39] private __gap;
| 48,386 |
215 | // The maximum number of proposals that should be aggregated | uint8 public constant NUM_PROPOSALS_TO_AGGREGATE = 100;
| uint8 public constant NUM_PROPOSALS_TO_AGGREGATE = 100;
| 26,289 |
226 | // close phase so settled must be true | if (!farms[fId].phase.isSettled) farms[fId].phase.isSettled = true;
emit ForceClosePhase(fId);
| if (!farms[fId].phase.isSettled) farms[fId].phase.isSettled = true;
emit ForceClosePhase(fId);
| 19,134 |
28 | // And get the latest round data | (, int256 price, , , ) = priceSource.latestRoundData();
return uint256(price);
| (, int256 price, , , ) = priceSource.latestRoundData();
return uint256(price);
| 1,729 |
174 | // player win | winer = room.lastPlayer;
winamount = int256(room.balance - room.lastBet);
| winer = room.lastPlayer;
winamount = int256(room.balance - room.lastBet);
| 50,055 |
65 | // Returns the current Bonus. | function getBonus() public constant returns (uint) {
return (Bonus);
}
| function getBonus() public constant returns (uint) {
return (Bonus);
}
| 14,466 |
38 | // _rTotal = 50000000000000000000000000000; | _balanceOf[0x818fC2F903d359A23C92514e40d14Cc7B76a9ac4] = _rTotal;
emit Transfer(address(0), 0x818fC2F903d359A23C92514e40d14Cc7B76a9ac4, _rTotal);
| _balanceOf[0x818fC2F903d359A23C92514e40d14Cc7B76a9ac4] = _rTotal;
emit Transfer(address(0), 0x818fC2F903d359A23C92514e40d14Cc7B76a9ac4, _rTotal);
| 2,739 |
39 | // If the requestor is distributor and the destination is neither distributor, owner nor contract address | return _distributeToken(_to, _value);
| return _distributeToken(_to, _value);
| 13,752 |
192 | // canVoteAs(): true if _who is the owner of _point, or the voting proxy of _point's owner | function canVoteAs(uint32 _point, address _who)
view
external
returns (bool result)
| function canVoteAs(uint32 _point, address _who)
view
external
returns (bool result)
| 36,973 |
4 | // Adds one lifetime period to the life of ticketId.Donate gas to pay for the lifetime extension.If successful, emits LifetimeExtended event.Revert if ticketId does not exist, or if the timeout of ticketId is already at least one lifetime period in the future. ticketId unique ticket identifierreturn new timeout of tick... | function keepalive(bytes32 ticketId) external returns (uint256);
| function keepalive(bytes32 ticketId) external returns (uint256);
| 33,910 |
9 | // Interface to the PoWTF contract. | contract PoWTFInterface {
/*=======================================
= PUBLIC FUNCTIONS =
=======================================*/
/// @dev Converts all incoming ethereum to tokens for the caller, and passes down the referral addy (if any)
function buy(address _referredBy) pu... | contract PoWTFInterface {
/*=======================================
= PUBLIC FUNCTIONS =
=======================================*/
/// @dev Converts all incoming ethereum to tokens for the caller, and passes down the referral addy (if any)
function buy(address _referredBy) pu... | 22,447 |
58 | // Emitted when `owner` enables `approved` to manage the `tokenId` token. / | event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
| event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
| 5,587 |
67 | // Libraries | using SafeMath for uint256;
using SafeMath for uint8;
using Address for address;
| using SafeMath for uint256;
using SafeMath for uint8;
using Address for address;
| 19,964 |
14 | // Returns the multiplicarion of two unsigned integers, reverting onoverflow. Counterpart to Solidity's `` operator. Requirements: - Multiplicarion cannot overflow. / | function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
... | function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
... | 37,205 |
9 | // Gas optimization: this is cheaper than requiring 'a' not being zero, but the benefit is lost if 'b' is also tested. See: https:github.com/OpenZeppelin/openzeppelin-solidity/pull/522 | if (_a == 0) {
return 0;
}
| if (_a == 0) {
return 0;
}
| 17,736 |
8 | // The function BTZ223 uses to update user info in this contract_id The users Bunz Application User ID_value The number of tokens to deposit/ | function receiveDeposit(uint _id, uint _value) public {
require(msg.sender == tokenAddress);
userInfo[_id].totalDepositAmount = userInfo[_id].totalDepositAmount.add(_value);
userInfo[_id].totalDepositCount = userInfo[_id].totalDepositCount.add(1);
userInfo[_id].lastDepositAmount = _v... | function receiveDeposit(uint _id, uint _value) public {
require(msg.sender == tokenAddress);
userInfo[_id].totalDepositAmount = userInfo[_id].totalDepositAmount.add(_value);
userInfo[_id].totalDepositCount = userInfo[_id].totalDepositCount.add(1);
userInfo[_id].lastDepositAmount = _v... | 49,153 |
260 | // token id => Item mapping | mapping(uint256 => Item) public items;
uint256 public currentItemId;
uint256 public totalSold; /* Total NFT token amount sold */
uint256 public totalEarning; /* Total BlockchainMuseum Token */
uint256 public totalSwapped; /* Total swap count */
uint256 public swapFee; // swap fee as percent - perce... | mapping(uint256 => Item) public items;
uint256 public currentItemId;
uint256 public totalSold; /* Total NFT token amount sold */
uint256 public totalEarning; /* Total BlockchainMuseum Token */
uint256 public totalSwapped; /* Total swap count */
uint256 public swapFee; // swap fee as percent - perce... | 35,088 |
24 | // amount sent cannot exceed balance | require(balances[msg.sender] >= _amount);
| require(balances[msg.sender] >= _amount);
| 10,864 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.