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 |
|---|---|---|---|---|
7 | // LibTradingConfig.setMaxTpRatioForLeverage(pairBase, maxTpRatios); | setMaxTpRatioForLeverage2(pairBase, maxTpRatios);
| setMaxTpRatioForLeverage2(pairBase, maxTpRatios);
| 35,008 |
11 | // Method that allows a beneficiary to withdraw their allocated funds for a specific vesting ID./_vestingId - The ID of the vesting the beneficiary can withdraw their funds for. | function withdraw(uint256 _vestingId) external {
uint256 amount = getAvailableAmount(msg.sender, _vestingId);
require(amount > 0, "DON_T_HAVE_RELEASED_TOKENS");
// Increased released amount in in mapping
vestingMap[msg.sender][_vestingId].releasedAmount = vestingMap[msg.sender][
_vestingId
... | function withdraw(uint256 _vestingId) external {
uint256 amount = getAvailableAmount(msg.sender, _vestingId);
require(amount > 0, "DON_T_HAVE_RELEASED_TOKENS");
// Increased released amount in in mapping
vestingMap[msg.sender][_vestingId].releasedAmount = vestingMap[msg.sender][
_vestingId
... | 30,635 |
13 | // This function emits an event that is listened to by NFT marketplaces and allows for the entire collection to be available and viewed even before ownership of tokens is written to as per common ERC implementation. True ownership is determined by our parent collectioninterface until a transaction decouples ownershipof... | function initialize2309()
public
virtual
| function initialize2309()
public
virtual
| 36,520 |
0 | // reverts on non-existing group id _id group id / | modifier groupExists(
uint _id
| modifier groupExists(
uint _id
| 10,929 |
2 | // 产品(被赞助) | struct Product{
address addr; //众筹账户的钱包地址
string name; //被赞助产品的名称
uint total; //想要众筹的总金额
uint numFunder; //记录有多少人赞助
uint amount; //当前已经众筹的金额
// 以后希望通过产品查询出赞助者
mapping(uint=>Funder) funders;
}
| struct Product{
address addr; //众筹账户的钱包地址
string name; //被赞助产品的名称
uint total; //想要众筹的总金额
uint numFunder; //记录有多少人赞助
uint amount; //当前已经众筹的金额
// 以后希望通过产品查询出赞助者
mapping(uint=>Funder) funders;
}
| 43,655 |
9 | // checks if current donation is bigger than the previous top one and alters info | function alterTopDonor(uint currentDonationAmount, uint _topDonation) private {
if (_topDonation < currentDonationAmount) {
topDonation = currentDonationAmount;
topDonor = msg.sender;
}
}
| function alterTopDonor(uint currentDonationAmount, uint _topDonation) private {
if (_topDonation < currentDonationAmount) {
topDonation = currentDonationAmount;
topDonor = msg.sender;
}
}
| 17,114 |
14 | // transfer ownership of the _star to :this contract | ecliptic.transferPoint(_star, address(this), true);
| ecliptic.transferPoint(_star, address(this), true);
| 766 |
24 | // Test | l1Bridge.regularSendToL2{ value: amount }(
| l1Bridge.regularSendToL2{ value: amount }(
| 33,501 |
5 | // Validates a borrow action asset The address of the asset to borrow reserve The reserve state from which the user is borrowing userAddress The address of the user amount The amount to be borrowed amountInETH The amount to be borrowed, in ETH interestRateMode The interest rate mode at which the user is borrowing maxSt... |
function validateBorrow(
address asset,
DataTypes.ReserveData storage reserve,
address userAddress,
uint256 amount,
uint256 amountInETH,
uint256 interestRateMode,
uint256 maxStableLoanPercent,
mapping(address => DataTypes.ReserveData) storage reservesData,
|
function validateBorrow(
address asset,
DataTypes.ReserveData storage reserve,
address userAddress,
uint256 amount,
uint256 amountInETH,
uint256 interestRateMode,
uint256 maxStableLoanPercent,
mapping(address => DataTypes.ReserveData) storage reservesData,
| 25,260 |
2 | // Prevent DOS attacks by limiting the number of sets. | uint256 public constant MAX_SET_LENGTH = 25;
| uint256 public constant MAX_SET_LENGTH = 25;
| 8,783 |
65 | // ERC664 Standard Balances Contract chrisfranko / | contract ERC664Balances is IERC664Balances, SafeGuard {
using SafeMath for uint256;
uint256 public totalSupply;
event BalanceAdj(address indexed module, address indexed account, uint amount, string polarity);
event ModuleSet(address indexed module, bool indexed set);
mapping(address => bool) publ... | contract ERC664Balances is IERC664Balances, SafeGuard {
using SafeMath for uint256;
uint256 public totalSupply;
event BalanceAdj(address indexed module, address indexed account, uint amount, string polarity);
event ModuleSet(address indexed module, bool indexed set);
mapping(address => bool) publ... | 30,482 |
11 | // Internal function to mint fungible tokenReverts if the given ID is not exsit to address recipient that will own the minted tokens collection uint256 ID of the fungible collection to be minted value uint256 amount to mint / | function _mintFungible(
address to,
uint256 collection,
uint256 value
| function _mintFungible(
address to,
uint256 collection,
uint256 value
| 9,409 |
42 | // lock beneficiary | locked[_beneficiary] = true;
emit Locked(_beneficiary, _isStraight);
| locked[_beneficiary] = true;
emit Locked(_beneficiary, _isStraight);
| 38,616 |
20 | // The `escapeHatch()` should only be called as a last resort if a/ security issue is uncovered or something unexpected happened | function escapeHatch() onlyEscapeHatchCallerOrOwner {
uint total = this.balance;
// Send the total balance of this contract to the `escapeHatchDestination`
if (!escapeHatchDestination.send(total)) {
throw;
}
EscapeHatchCalled(total);
}
| function escapeHatch() onlyEscapeHatchCallerOrOwner {
uint total = this.balance;
// Send the total balance of this contract to the `escapeHatchDestination`
if (!escapeHatchDestination.send(total)) {
throw;
}
EscapeHatchCalled(total);
}
| 38,882 |
18 | // Emits a {NodeCreated} event.Requirements:- Node IP must be non-zero.- Node IP must be available.- Node name must not already be registered.- Node port must be greater than zero. / | function createNode(address from, NodeCreationParams calldata params)
external
override
allow("SkaleManager")
nonZeroIP(params.ip)
{
| function createNode(address from, NodeCreationParams calldata params)
external
override
allow("SkaleManager")
nonZeroIP(params.ip)
{
| 9,963 |
32 | // loop through half race then return the team has the most athCount | uint length = halfRace.halfRaceCount;
uint greatest;
uint index;
for(uint i =0 ; i < length; i++){
if(halfRace.halfRaceDatas[i].athThatFinishedAboveHalfCount >= greatest){
greatest = halfRace.halfRaceDatas[i].athThatFinishedAboveHalfCount;
inde... | uint length = halfRace.halfRaceCount;
uint greatest;
uint index;
for(uint i =0 ; i < length; i++){
if(halfRace.halfRaceDatas[i].athThatFinishedAboveHalfCount >= greatest){
greatest = halfRace.halfRaceDatas[i].athThatFinishedAboveHalfCount;
inde... | 23,845 |
6 | // Receive current unrealized for trader for trading pair. _pool The MarginLiquidityPool. _trader The trader. _pair The trading pair. / | function getPairTraderUnrealized(
MarginLiquidityPoolInterface _pool,
address _trader,
MarginFlowProtocol.TradingPair calldata _pair
| function getPairTraderUnrealized(
MarginLiquidityPoolInterface _pool,
address _trader,
MarginFlowProtocol.TradingPair calldata _pair
| 1,549 |
49 | // There must be an array of units | require(_units.length > 0, "Units must be greater than 0");
| require(_units.length > 0, "Units must be greater than 0");
| 45,071 |
39 | // Reverts if value is 0. | modifier notZero(uint256 _value) {
require(_value != 0, "VaultHandler::notZero: value can't be 0");
_;
}
| modifier notZero(uint256 _value) {
require(_value != 0, "VaultHandler::notZero: value can't be 0");
_;
}
| 22,136 |
23 | // EVENT TRACKING | event SubmitProposal(address indexed applicant, uint256 sharesRequested, uint256 lootRequested, uint256 tributeOffered, address tributeToken, uint256 paymentRequested, address paymentToken, bytes32 details, uint8[8] flags, bytes data, uint256 proposalId, address indexed delegateKey, address indexed memberAddress);
... | event SubmitProposal(address indexed applicant, uint256 sharesRequested, uint256 lootRequested, uint256 tributeOffered, address tributeToken, uint256 paymentRequested, address paymentToken, bytes32 details, uint8[8] flags, bytes data, uint256 proposalId, address indexed delegateKey, address indexed memberAddress);
... | 23,643 |
125 | // Save | _tokenContract = Token(tokenAddress);
_crowdsaleAddress = crowdsaleAddress;
_carMechanicsAddress = carMechanicsAddress;
| _tokenContract = Token(tokenAddress);
_crowdsaleAddress = crowdsaleAddress;
_carMechanicsAddress = carMechanicsAddress;
| 38,659 |
26 | // sufficient balance exists? (funder may have under-funded) | if (holding.balance < amount) {
return false;
}
| if (holding.balance < amount) {
return false;
}
| 41,433 |
298 | // Ratio used to determine amount of collateral required based on the collateral asset price | uint16 collateralRatio;
| uint16 collateralRatio;
| 44,352 |
99 | // insertHash,insert hash into contract _hash is input value of hash _uploadedData is the uploaded value on to the blockchainreturn bool,true is successful and false is failed / | function insertHash(string memory _hash, bytes memory _uploadedData)
public
onlyOwner
returns (bool)
| function insertHash(string memory _hash, bytes memory _uploadedData)
public
onlyOwner
returns (bool)
| 2,394 |
6 | // state transition function/ | function nextPhase() internal {
phase = Phases(uint(phase) + 1);
emit LogPhaseTransition(phaseToString(phase));
}
| function nextPhase() internal {
phase = Phases(uint(phase) + 1);
emit LogPhaseTransition(phaseToString(phase));
}
| 30,038 |
80 | // Defines an optional token address used to provide additional incentives to users. Accepts "0x0" adresses when no incentive token exists. | IERC20 public incentiveToken;
| IERC20 public incentiveToken;
| 17,881 |
134 | // requires function to be called from owner. sets a bonding curve implementation for this product._address the address of the bonding curve implementation / | function setBondingCurve(address _address) external virtual onlyOwner {
require(_address!=address(0), "Invalid address");
bondingCurve = BancorBondingCurveV1Interface(_address);
}
| function setBondingCurve(address _address) external virtual onlyOwner {
require(_address!=address(0), "Invalid address");
bondingCurve = BancorBondingCurveV1Interface(_address);
}
| 57,710 |
127 | // RugBullToken with Governance. | contract RugBullToken is BEP20('RugBull Finance', 'RBULL') {
/// @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 RugBullToken is BEP20('RugBull Finance', 'RBULL') {
/// @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,264 |
89 | // new investor | investorCount++;
| investorCount++;
| 40,552 |
403 | // Disallow adding 0 principal | require(
principalToAdd > 0,
"IncreasePositionImpl#increaseWithoutCounterpartyImpl: Cannot add 0 principal"
);
| require(
principalToAdd > 0,
"IncreasePositionImpl#increaseWithoutCounterpartyImpl: Cannot add 0 principal"
);
| 17,882 |
19 | // e.g. price is 15000 for $150 per ether If $30, $30/$150 would be 0.2 ether. to avoid floating points, or 3000/15000 we do 3000(1e18-1e15)/15000 = 200 finney == 0.2 ether With this reasoning, we can do 3000e18/15000 to obtain the same value in wei | price = price / rate;
require(msg.value >= price, "Not enough money!");
| price = price / rate;
require(msg.value >= price, "Not enough money!");
| 41,079 |
4 | // Mapping from Burn Lot ID to BurnLot object | mapping (bytes32 => BurnLot) internal burnLots;
| mapping (bytes32 => BurnLot) internal burnLots;
| 28,807 |
8 | // ---------------------- /Minter ---------------------- | 32,421 | ||
77 | // Removes an identity registry from being agent of the Identity Registry Storage Contract.This function can only be called by the wallet set as owner of the smart contractThis function removes the identity registry from the list of identityRegistries linked to the storage contract _identityRegistry The identity regist... | function unbindIdentityRegistry(address _identityRegistry) external;
| function unbindIdentityRegistry(address _identityRegistry) external;
| 15,144 |
30 | // mapping consumer => peer for global use to check if those exist | mapping(IUniftyGovernanceConsumer => mapping( address => bool )) public consumerPeerExists;
| mapping(IUniftyGovernanceConsumer => mapping( address => bool )) public consumerPeerExists;
| 10,340 |
56 | // called from crowdsale contract to pause, triggers stopped statecan run only from crowdsale contract / | function pause() public onlyOwner whenNotPaused {
paused = true;
emit Paused();
}
| function pause() public onlyOwner whenNotPaused {
paused = true;
emit Paused();
}
| 27,258 |
193 | // Modify a record, writing to the 'database' mapping with updates to multiple fields / | function modifyRecord(
| function modifyRecord(
| 5,440 |
12 | // Perform relay call and require success to avoid that user paid for failed transaction | (bool success, bytes memory data) = relayTarget.call(relayData);
if (!success) revert RelayExecutionFailure(data);
| (bool success, bytes memory data) = relayTarget.call(relayData);
if (!success) revert RelayExecutionFailure(data);
| 30,542 |
178 | // Returns the borrowing power of a vault/_vault The vault to get the borrowing power of/ return _borrowPower The borrowing power of the vaultsolhint-disable-next-line code-complexity | function _getVaultBorrowingPower(IVault _vault) private returns (uint192 _borrowPower) {
CollateralInfo memory _collateral;
address _tokenAddress;
uint256 _balance;
uint192 _rawPrice;
uint192 _tokenValue;
// loop over each registered token, adding the individuals ltv to the total ltv of the v... | function _getVaultBorrowingPower(IVault _vault) private returns (uint192 _borrowPower) {
CollateralInfo memory _collateral;
address _tokenAddress;
uint256 _balance;
uint192 _rawPrice;
uint192 _tokenValue;
// loop over each registered token, adding the individuals ltv to the total ltv of the v... | 17,951 |
103 | // Returns true is a given subnode is available. _subnode The target subnode.return true if the subnode is available. / | function isAvailable(bytes32 _subnode) external view returns(bool);
| function isAvailable(bytes32 _subnode) external view returns(bool);
| 2,252 |
2 | // Token总量 | uint256 public totalSupply = 1_000_000;
| uint256 public totalSupply = 1_000_000;
| 22,024 |
29 | // and update the starts | starts[user] = block.timestamp;
token.transfer(user, claimAmount);
emit Claimed(user, claimAmount, block.timestamp);
| starts[user] = block.timestamp;
token.transfer(user, claimAmount);
emit Claimed(user, claimAmount, block.timestamp);
| 37,692 |
449 | // edit specific item in case token goes up in value and the price for items gets to expensive for normal users. | function editItem(
uint256 _id,
uint256 _price,
uint256 _points,
string calldata _name,
uint256 _timeExtension
| function editItem(
uint256 _id,
uint256 _price,
uint256 _points,
string calldata _name,
uint256 _timeExtension
| 10,705 |
117 | // Update current stake period total stake - For Auto Approvals | windowTotalStake = windowTotalStake.add(stakeAmount);
emit SubmitStake(currentStakeMapIndex, msg.sender, stakeAmount);
| windowTotalStake = windowTotalStake.add(stakeAmount);
emit SubmitStake(currentStakeMapIndex, msg.sender, stakeAmount);
| 51,486 |
78 | // Check balance | uint b = token.balanceOf(address(this));
if (b < r) {
uint _withdraw = r.sub(b);
Controller(controller).withdraw(address(token), _withdraw);
uint _after = token.balanceOf(address(this));
uint _diff = _after.sub(b);
if (_diff < _withdraw) {
... | uint b = token.balanceOf(address(this));
if (b < r) {
uint _withdraw = r.sub(b);
Controller(controller).withdraw(address(token), _withdraw);
uint _after = token.balanceOf(address(this));
uint _diff = _after.sub(b);
if (_diff < _withdraw) {
... | 9,253 |
20 | // 每日投票 | function dailyVoteForCandidate(bytes32 candidate) public payable {
require(voteType == 3, "非每日投票");
uint index = indexOfCandidate(candidate);
require(index != uint(-1), "候选人不存在");
voterInfo[msg.sender].voterAddress = msg.sender;
require(voterInfo[msg.sender].lastVoteTime == 0 || (block.timestamp - voterInfo[... | function dailyVoteForCandidate(bytes32 candidate) public payable {
require(voteType == 3, "非每日投票");
uint index = indexOfCandidate(candidate);
require(index != uint(-1), "候选人不存在");
voterInfo[msg.sender].voterAddress = msg.sender;
require(voterInfo[msg.sender].lastVoteTime == 0 || (block.timestamp - voterInfo[... | 11,262 |
87 | // ============ Internal Functions ============ //Check if direct or inverse oracle exists. If so return that price along with boolean indicatingit exists. Otherwise return boolean indicating oracle doesn't exist._assetOne Address of first asset in pair _assetTwo Address of second asset in pairreturn bool Boolean indic... | function _getDirectOrInversePrice(
address _assetOne,
address _assetTwo
)
internal
view
returns (bool, uint256)
| function _getDirectOrInversePrice(
address _assetOne,
address _assetTwo
)
internal
view
returns (bool, uint256)
| 85,714 |
583 | // new galaxy means a new registered voter | polls.incrementTotalVoters();
| polls.incrementTotalVoters();
| 51,400 |
15 | // Converts a digit from 0 - 10000 into its corresponding rarity based on the given rarity tier. _randinput The input from 0 - 10000 to use for rarity gen. _rarityTier The tier to use. / | function rarityGen(uint256 _randinput, uint8 _rarityTier)
internal
view
returns (uint8)
| function rarityGen(uint256 _randinput, uint8 _rarityTier)
internal
view
returns (uint8)
| 5,736 |
49 | // Update fee / | function updateFeeWeight(address _token, uint8 _weight) external onlyOwner {
require(_weight <= 1000, "Maximum weight is 1000");
registeredTokens[_token].feeWeight = _weight;
}
| function updateFeeWeight(address _token, uint8 _weight) external onlyOwner {
require(_weight <= 1000, "Maximum weight is 1000");
registeredTokens[_token].feeWeight = _weight;
}
| 41,798 |
101 | // triggered after a conversion with new price data_connectorToken reserve token _tokenSupplysmart token supply _connectorBalance reserve balance _connectorWeightreserve ratio/ | event PriceDataUpdate(
| event PriceDataUpdate(
| 10,300 |
6 | // @custom:security-contact security@example.com | contract MySpectacularToken is ERC721, ERC721Enumerable, Pausable, Ownable {
using Counters for Counters.Counter;
Counters.Counter private _tokenIdCounter;
constructor() ERC721("MySpectacularToken", "MTK") {}
function pause() public onlyOwner {
_pause();
}
function unpause() public o... | contract MySpectacularToken is ERC721, ERC721Enumerable, Pausable, Ownable {
using Counters for Counters.Counter;
Counters.Counter private _tokenIdCounter;
constructor() ERC721("MySpectacularToken", "MTK") {}
function pause() public onlyOwner {
_pause();
}
function unpause() public o... | 23,173 |
4 | // handle celo 1.8 hardfork that now matches regular blocks structure (numItems>10) | if (chainId != 42220 || it.item.numItems() > 10) it.next(); //pos 4
receiptsRoot = bytes32(it.next().toUint()); //pos 4 or 5
| if (chainId != 42220 || it.item.numItems() > 10) it.next(); //pos 4
receiptsRoot = bytes32(it.next().toUint()); //pos 4 or 5
| 17,665 |
7 | // Emit the Transfer/Mint event. the 0x0 source address implies a mintIt will also provide the circulating supply info. | emit TransferSingle(msg.sender, address(0x0), _to, _id, _quantity);
if (_to.isContract()) {
_doSafeTransferAcceptanceCheck(msg.sender, msg.sender, _to, _id, _quantity, '');
}
| emit TransferSingle(msg.sender, address(0x0), _to, _id, _quantity);
if (_to.isContract()) {
_doSafeTransferAcceptanceCheck(msg.sender, msg.sender, _to, _id, _quantity, '');
}
| 73,379 |
1 | // We expect a single uint256 value | case 32 {
returndatacopy(0, 0, 32)
allowance := mload(0)
}
| case 32 {
returndatacopy(0, 0, 32)
allowance := mload(0)
}
| 9,914 |
21 | // This should match the domain you set in your client side signing. | keccak256(bytes("BlockheadsSwap")),
keccak256(bytes("1")),
block.chainid,
address(this)
)
);
| keccak256(bytes("BlockheadsSwap")),
keccak256(bytes("1")),
block.chainid,
address(this)
)
);
| 12,069 |
22 | // calculates the ln(p / (1 - p)) and returns a uint64 | function _ln(uint256 shortProportion) internal pure returns (uint64) {
if (shortProportion > SwapConstants.MAX64) return uint64(0);
int128 convertedProportion = ABDKMath64x64.fromUInt(shortProportion);
if (convertedProportion <= 0) return uint64(0);
int256 logarithm = ABDKMath64x64... | function _ln(uint256 shortProportion) internal pure returns (uint64) {
if (shortProportion > SwapConstants.MAX64) return uint64(0);
int128 convertedProportion = ABDKMath64x64.fromUInt(shortProportion);
if (convertedProportion <= 0) return uint64(0);
int256 logarithm = ABDKMath64x64... | 10,739 |
84 | // Helper that checks if conditions are met for rebalance or ripcord. Returns an enum with 0 = no rebalance, 1 = call rebalance(), 2 = call iterateRebalance()3 = call ripcord() return ShouldRebalance Enum detailing whether to rebalance, iterateRebalance, ripcord or no action / | function shouldRebalance() external view returns(ShouldRebalance) {
uint256 currentLeverageRatio = getCurrentLeverageRatio();
return _shouldRebalance(currentLeverageRatio, methodology.minLeverageRatio, methodology.maxLeverageRatio);
}
| function shouldRebalance() external view returns(ShouldRebalance) {
uint256 currentLeverageRatio = getCurrentLeverageRatio();
return _shouldRebalance(currentLeverageRatio, methodology.minLeverageRatio, methodology.maxLeverageRatio);
}
| 65,904 |
8 | // Emitted when `forceUpdateSlippage` is called by an user on the destination domain transferId - The unique identifier of the crosschain transaction slippage - The updated slippage boundary / | event SlippageUpdated(bytes32 indexed transferId, uint256 slippage);
| event SlippageUpdated(bytes32 indexed transferId, uint256 slippage);
| 29,984 |
267 | // we cannot pay more than loose balance | uint256 balance = balanceOfInvestmentToken();
amount = Math.min(amount, balance);
| uint256 balance = balanceOfInvestmentToken();
amount = Math.min(amount, balance);
| 20,628 |
12 | // Function to remove list of addresses to adminscan only be called by creator of contract _admins the list of addresses to remove / | function removeAdmins(address[] memory _admins) public onlyOwner {
for (uint256 i = 0; i < _admins.length; i++) {
revokeRole(WALLET_ADMIN_ROLE, _admins[i]);
}
emit AdminsRemoved(_admins);
}
| function removeAdmins(address[] memory _admins) public onlyOwner {
for (uint256 i = 0; i < _admins.length; i++) {
revokeRole(WALLET_ADMIN_ROLE, _admins[i]);
}
emit AdminsRemoved(_admins);
}
| 18,276 |
3 | // returnimplementationType The type of external implementation this extension is. / | function getImplementationType()
| function getImplementationType()
| 41,506 |
4 | // Add approvals of the underlying token to the cToken contract | ERC20Wrapper.approve(
underlyingAddress,
cTokenAddress,
CommonMath.maxUInt256()
);
| ERC20Wrapper.approve(
underlyingAddress,
cTokenAddress,
CommonMath.maxUInt256()
);
| 49,787 |
41 | // Set optional fallback extension addresses / | function setExtensionsAddresses(address[] memory _newExtensionsAddresses)
external
onlyOwner
| function setExtensionsAddresses(address[] memory _newExtensionsAddresses)
external
onlyOwner
| 85,401 |
0 | // mapping of `tokenId` to amount amount defaults to 0 and is in wei apparently the data type for ether units is uint256 so we can interact with it the same see: https:docs.soliditylang.org/en/v0.7.1/units-and-global-variables.html | mapping (uint256 => uint256) private _book;
| mapping (uint256 => uint256) private _book;
| 49,045 |
18 | // Gas optimization: this is cheaper than requiring 'a' not being zero, but thebenefit is lost if 'b' is also tested.See: https:github.com/OpenZeppelin/openzeppelin-contracts/pull/522 | if (a == 0) {
return 0;
}
| if (a == 0) {
return 0;
}
| 45,126 |
67 | // Check fees are paid | require(getFeesAmount(contentSize) == msg.value, "msg.value does not match the fees");
| require(getFeesAmount(contentSize) == msg.value, "msg.value does not match the fees");
| 25,818 |
187 | // Returns the stake actualAmount for active personal stakes for an address _address address that created the stakesreturn uint256[] array of actualAmounts / | function getPersonalStakeActualAmounts(address _address) external view returns (uint256[] memory) {
uint256[] memory actualAmounts;
(,actualAmounts,) = getPersonalStakes(_address);
return actualAmounts;
}
| function getPersonalStakeActualAmounts(address _address) external view returns (uint256[] memory) {
uint256[] memory actualAmounts;
(,actualAmounts,) = getPersonalStakes(_address);
return actualAmounts;
}
| 49,170 |
148 | // Function to increase allowance of tokens. spender The address that will receive an allowance increase. value The amount of tokens to increase allowance. / | function approve(address spender, uint256 value)
external
override
returns (bool)
| function approve(address spender, uint256 value)
external
override
returns (bool)
| 79,951 |
272 | // Index of the AMMs on chain that will be made available. Idiosyncratic fCash that is dated less than the longest AMM will be tradable. | uint8 maxMarketIndex;
| uint8 maxMarketIndex;
| 2,217 |
39 | // Ticket price./ | uint256 public ticketPrice = 0.001 ether;
| uint256 public ticketPrice = 0.001 ether;
| 2,541 |
1 | // CToken initialize does the bulk of the work | super.initialize(comptroller_, interestRateModel_, initialExchangeRateMantissa_, name_, symbol_, decimals_);
| super.initialize(comptroller_, interestRateModel_, initialExchangeRateMantissa_, name_, symbol_, decimals_);
| 7,214 |
0 | // SPDX-License-Identifier: Unlicensed | interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount)
external
returns (bool);
function allowance(address owner, address spender)
exte... | interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount)
external
returns (bool);
function allowance(address owner, address spender)
exte... | 1,500 |
16 | // ERC20 fields. // Constructor _owner The address which controls this contract. _associatedContract The ERC20 contract whose state this composes. / | constructor(address _owner, address _associatedContract)
State(_owner, _associatedContract)
public
| constructor(address _owner, address _associatedContract)
State(_owner, _associatedContract)
public
| 24,875 |
16 | // Data fetching | function getAllTokens() public view returns (FormattedToken[] memory) {
uint256 lastId = _tokenIds.current();
uint256 counter = 0;
FormattedToken[] memory _formattedTokens = new FormattedToken[](lastId);
for (uint256 i = 0; i < lastId; i++) {
if (_exists(counter + 1)) {
... | function getAllTokens() public view returns (FormattedToken[] memory) {
uint256 lastId = _tokenIds.current();
uint256 counter = 0;
FormattedToken[] memory _formattedTokens = new FormattedToken[](lastId);
for (uint256 i = 0; i < lastId; i++) {
if (_exists(counter + 1)) {
... | 12,109 |
71 | // `value` is the amount of tokens at a specific block number | uint128 value;
| uint128 value;
| 54,571 |
25 | // Set community multisig address/ | function setMultisigAddress(address multisigAddress)
external
onlyOwner
returns(bool success)
| function setMultisigAddress(address multisigAddress)
external
onlyOwner
returns(bool success)
| 11,703 |
79 | // Constructor HazzaTokenInterface / | function HazzaTokenInterface() public TokenFunctions() {
}
| function HazzaTokenInterface() public TokenFunctions() {
}
| 3,007 |
15 | // @custom:legacy Legacy function used to tell ChugSplashProxy contracts if an upgrade is happening. return Whether or not there is an upgrade going on. May not actually tell you whether anupgrade is going on, since we don't currently plan to use this variable for anythingother than a legacy indicator to fix a UX bug i... | function isUpgrading() external view returns (bool) {
return upgrading;
}
| function isUpgrading() external view returns (bool) {
return upgrading;
}
| 20,996 |
10 | // computes square roots using the babylonian method https:en.wikipedia.org/wiki/Methods_of_computing_square_rootsBabylonian_method | library Babylonian {
// credit for this implementation goes to
// https://github.com/abdk-consulting/abdk-libraries-solidity/blob/master/ABDKMath64x64.sol#L687
function sqrt(uint256 x) internal pure returns (uint256) {
if (x == 0) return 0;
// this block is equivalent to r = uint256(1) << (B... | library Babylonian {
// credit for this implementation goes to
// https://github.com/abdk-consulting/abdk-libraries-solidity/blob/master/ABDKMath64x64.sol#L687
function sqrt(uint256 x) internal pure returns (uint256) {
if (x == 0) return 0;
// this block is equivalent to r = uint256(1) << (B... | 17,472 |
2 | // Throw when sender is unauthorized to perform action / | error Unauthorized();
| error Unauthorized();
| 40,478 |
134 | // Take the wrapped ERC-20 tokens | _burn(msg.sender, count * _baseWrappedAmount);
| _burn(msg.sender, count * _baseWrappedAmount);
| 57,796 |
102 | // function sellWithFee() external onlyWhitelisted returns (uint[] memory amounts) | // {
// require(pathSellTx[1] == WETH, 'UniswapV2Router: INVALID_PATH');
// IERC20 erc20Token = IERC20(targetTokenBuyTx);
// uint tokenBalance = erc20Token.balanceOf(singleReceiverAddress);
// amounts = PancakeLibrary.getAmountsOut(factory, tokenBalance, pathSellTx);
// Trans... | // {
// require(pathSellTx[1] == WETH, 'UniswapV2Router: INVALID_PATH');
// IERC20 erc20Token = IERC20(targetTokenBuyTx);
// uint tokenBalance = erc20Token.balanceOf(singleReceiverAddress);
// amounts = PancakeLibrary.getAmountsOut(factory, tokenBalance, pathSellTx);
// Trans... | 23,670 |
170 | // Withdraw LP tokens from TestaFarm. | function withdraw(uint256 _pid, uint256 _amount) public {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][msg.sender];
require(user.amount >= _amount, "No jETHToken cannot withdraw");
updatePool(_pid);
if(_amount > 0) {
user... | function withdraw(uint256 _pid, uint256 _amount) public {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][msg.sender];
require(user.amount >= _amount, "No jETHToken cannot withdraw");
updatePool(_pid);
if(_amount > 0) {
user... | 33,055 |
31 | // fixedTokenDelta that will be applied to the fixed token balance of the position executing the swap (recipient) | int256 fixedTokenDeltaCumulative;
| int256 fixedTokenDeltaCumulative;
| 3,469 |
51 | // Change interval for adjusting out from adapters _adjustOutInterval New interval in seconds / | function changeAdjustOutInterval(uint256 _adjustOutInterval) external onlyOwner {
adjustOutInterval = _adjustOutInterval;
}
| function changeAdjustOutInterval(uint256 _adjustOutInterval) external onlyOwner {
adjustOutInterval = _adjustOutInterval;
}
| 13,533 |
9 | // Set the new contract URI. | ERC721ContractMetadataStorage.layout()._contractURI = newContractURI;
| ERC721ContractMetadataStorage.layout()._contractURI = newContractURI;
| 23,770 |
2 | // / | mapping(uint256 => mapping(uint256 => mapping(uint256 => uint256))) private _splitCountOf;
| mapping(uint256 => mapping(uint256 => mapping(uint256 => uint256))) private _splitCountOf;
| 4,527 |
26 | // calculate maximum LP tokens to be generated | maxLPamount = (R_ * LP_FACTOR_ADD * (totalSupply() + c.unclaimedRewards) / NORMALIZE_FACTOR) >> 128;
| maxLPamount = (R_ * LP_FACTOR_ADD * (totalSupply() + c.unclaimedRewards) / NORMALIZE_FACTOR) >> 128;
| 19,649 |
26 | // Get the velocity / | function getVelocity(uint16 index)
private
pure
returns (string memory)
| function getVelocity(uint16 index)
private
pure
returns (string memory)
| 26,216 |
124 | // Claims rewards and then swaps the rewards tokens to the specified asset via UniswapV2/_vaultProxy The VaultProxy of the calling fund/_encodedCallArgs Encoded order parameters/Requires the adapter to be granted an allowance of each reward token by the vault./ For supported assets (e.g., CRV), this must be done via th... | function claimRewardsAndSwap(
address _vaultProxy,
bytes calldata _encodedCallArgs,
bytes calldata
| function claimRewardsAndSwap(
address _vaultProxy,
bytes calldata _encodedCallArgs,
bytes calldata
| 52,460 |
6 | // TODO: decrease writable uint256 count | uint256 public periodFinish;
uint256 public rewardRate;
uint256 public rewardsDuration;
uint256 public lastUpdateTime;
uint256 public rewardPerTokenStored;
mapping(address => uint256) public userRewardPerTokenPaid;
mapping(address => uint256) public rewards;
| uint256 public periodFinish;
uint256 public rewardRate;
uint256 public rewardsDuration;
uint256 public lastUpdateTime;
uint256 public rewardPerTokenStored;
mapping(address => uint256) public userRewardPerTokenPaid;
mapping(address => uint256) public rewards;
| 72,630 |
66 | // Moves `amount` tokens from the caller's account to `recipient`. Returns a boolean value indicating whether the operation succeeded. | * Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
*... | * Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
*... | 185 |
310 | // clear outstanding redeemables | uint256 redeemable = totalCDSDRedeemable();
if (redeemable != 0) {
clearCDSDRedeemable();
}
| uint256 redeemable = totalCDSDRedeemable();
if (redeemable != 0) {
clearCDSDRedeemable();
}
| 53,494 |
122 | // Split the contract balance into halves | uint256 denominator= (_liquidityFee + _marketingFee) * 2;
uint256 tokensToAddLiquidityWith = tokens * _liquidityFee / denominator;
uint256 toSwap = tokens - tokensToAddLiquidityWith;
uint256 initialBalance = address(this).balance;
swapTokensForEth(toSwap);
uint256 delt... | uint256 denominator= (_liquidityFee + _marketingFee) * 2;
uint256 tokensToAddLiquidityWith = tokens * _liquidityFee / denominator;
uint256 toSwap = tokens - tokensToAddLiquidityWith;
uint256 initialBalance = address(this).balance;
swapTokensForEth(toSwap);
uint256 delt... | 38,317 |
18 | // new tier42 subscription | _mint(SBA, dappCreditsTier42);
| _mint(SBA, dappCreditsTier42);
| 21,484 |
26 | // add insuree to list of insurees | for(i=0; i<allInsurees.length; i++)
if(allInsurees[i]==insuree)
break;
if(i==allInsurees.length) // first time this key appears
allInsurees.push(insuree);
| for(i=0; i<allInsurees.length; i++)
if(allInsurees[i]==insuree)
break;
if(i==allInsurees.length) // first time this key appears
allInsurees.push(insuree);
| 31,593 |
38 | // return string(abi.encodePacked( | // '<style>g.c{fill:none;animation:', duration, 's ease-in-out infinite r1;transform-origin:320px 320px;}@keyframes r1{0%{transform:rotate(0) scale(1)}50%{transform:rotate(180deg) scale(1.4)}}</style>'
// // animation-delay:calc(-1 * 8s * var(--n, 1))
// // .cf-c2 { fill: ',
// ... | // '<style>g.c{fill:none;animation:', duration, 's ease-in-out infinite r1;transform-origin:320px 320px;}@keyframes r1{0%{transform:rotate(0) scale(1)}50%{transform:rotate(180deg) scale(1.4)}}</style>'
// // animation-delay:calc(-1 * 8s * var(--n, 1))
// // .cf-c2 { fill: ',
// ... | 2,909 |
41 | // Results | uint256 banditsAmount = 0;
uint256 arrestedAmount = 0;
uint256 burntAmount = 0;
uint256 vaultCommissionAmount = 0;
uint256 potDistributionAmount = 0;
| uint256 banditsAmount = 0;
uint256 arrestedAmount = 0;
uint256 burntAmount = 0;
uint256 vaultCommissionAmount = 0;
uint256 potDistributionAmount = 0;
| 57,735 |
50 | // Total number of tokens in circulation | uint256 private _totalSupply;
| uint256 private _totalSupply;
| 17,058 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.