file_name
stringlengths
71
779k
comments
stringlengths
0
29.4k
code_string
stringlengths
20
7.69M
__index_level_0__
int64
2
17.2M
./full_match/80001/0xaCD2BB9cA3849303dfdAB631eEE4D64dD83F5aC1/sources/contracts/PrimexProxyAdmin.sol
Changes the admin of `proxy` to `newAdmin`. Requirements: - This contract must be the current admin of `proxy`./
function changeProxyAdmin( ITransparentUpgradeableProxy proxy, address newAdmin ) public override onlyRole(BIG_TIMELOCK_ADMIN) { proxy.changeAdmin(newAdmin); }
5,673,043
pragma solidity ^0.4.19; /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint2...
Bonuses for larger purchases (in hundredths of percent)
function bonusPercentForWeiAmount(uint256 weiAmount) public pure returns(uint256) { }
10,689,321
pragma solidity ^0.4.17; //the pragma line is the preprocessor directive, tells the version of solidity compiler contract Lottery { //struct used to store the user information struct User { address userAddress; uint tokensBought; uint[] guess; } // a list of the users mapping (address => User) public use...
function to add tokens to the user that calls the contract the money held in contract is sent using a payable modifier function money can be released using selfdestruct(address) adding tokens if the user present in the userAddresses array
function addTokens() payable { uint present = 0; uint tokensToAdd = msg.value/(10**18); for(uint i = 0; i < userAddresses.length; i++) { if(userAddresses[i] == msg.sender) { present = 1; break; } } if (present == 1) { users[msg.sender].tokensBought += tokensToAdd...
13,131,664
//Address: 0x151b11892dd6ab1f91055dcd01d23d03a2c47570 //Contract name: ServiceLocator //Balance: 0 Ether //Verification Date: 2/27/2018 //Transacion Count: 5 // CODE STARTS HERE pragma solidity ^0.4.18; /** * @title Ownable * @dev The Ownable contract has an owner address, and provides basic authorization control...
Removes a service locator registry _namespace - namespace string for the record./
function remove(string _namespace) onlyOwner public { bytes32 h = keccak256(_namespace); delete ptr[ registry[h].addr ]; delete registry[ h ]; Remove(_namespace); }
15,861,194
pragma solidity ^0.5.9; import "./DelightArmyManagerInterface.sol"; import "./DelightManager.sol"; import "./DelightBuildingManager.sol"; import "./DelightItemManager.sol"; import "./DelightKnightItemInterface.sol"; import "./Util/SafeMath.sol"; contract DelightArmyManager is DelightArmyManagerInterface, DelightManag...
Destroys the building. ๊ฑด๋ฌผ์„ ํŒŒ๊ดดํ•ฉ๋‹ˆ๋‹ค. The building must exist. ๊ฑด๋ฌผ์ด ์กด์žฌํ•˜๋Š” ๊ฒฝ์šฐ์—๋งŒ Loot ์ „๋ฆฌํ’ˆ Adds to the loot. ์ „๋ฆฌํ’ˆ์— ์ถ”๊ฐ€ํ•ฉ๋‹ˆ๋‹ค.
function destroyBuilding(uint battleId, uint col, uint row) onlyDelight external { if (buildingManager.getPositionBuildingId(col, row) != 0) { Reward storage reward = battleIdToReward[battleId]; ( uint wood, uint stone, uint iron, uint ducat ) = buildingManager.destroyBuilding(col...
2,526,351
// SPDX-License-Identifier: MIT pragma solidity =0.8.4; import {SafeMath} from "@openzeppelin/contracts/utils/math/SafeMath.sol"; import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import {Vault} from "./Vault.sol"; import {ShareMath} from "./ShareMath.sol"; import {IStrikeSelection} from "../inter...
If this throws, it means that vault's roundPricePerShare[currentRound] has not been set yet which should never happen. Has to be larger than 1 because `1` is used in `initRoundPricePerShares` to prevent cold writes.
function sharesToAsset( uint256 shares, uint256 assetPerShare, uint256 decimals ) internal pure returns (uint256) { require(assetPerShare > PLACEHOLDER_UINT, "Invalid assetPerShare"); return shares.mul(assetPerShare).div(10**decimals); }
584,011
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; import "@pancakeswap/pancake-swap-lib/contracts/token/BEP20/IBEP20.sol"; import "@pancakeswap/pancake-swap-lib/contracts/token/BEP20/SafeBEP20.sol"; import "@pancakeswap/pancake-swap-lib/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts-upgradeable/u...
Redeem the minimum of the WBNB we own, and the WBNB that the vToken can immediately retrieve. Ensures that `redeemMaximum` doesn't fail silently/ amount of WBNB in contract amount of WBNB we own redeem the most we can redeem
function redeemMaximumWBNB() internal { uint256 available = vtoken.getCash(); uint256 owned = vtoken.balanceOfUnderlying(address(this)); redeemUnderlyingInWBNB(available < owned ? available : owned); }
1,037,916
./full_match/1/0x4f4fFE6f397F5BC985F4dc1EB5a0eB2D9B93D12D/sources/contracts/V3/LandingPage.sol
Allows users to buy tokens with USDT without specifying an inviting address. _usdtAmount The amount of USDT to spend on tokens.
function buyWithUsdt(uint256 _usdtAmount) external { _buyWithUsdt(_usdtAmount, false); }
3,146,069
// SPDX-License-Identifier: agpl-3.0 pragma solidity 0.6.12; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens...
Calculates the number of shares that should be mint or burned when a user deposit or withdraw tokens Amount of tokens return Number of shares rate = tokens / shares shares = tokens (totalShares / yieldSourceTotalSupply)
function _tokenToShares(uint256 tokens) internal view returns (uint256) { uint256 shares = 0; if (totalSupply() == 0) { shares = tokens; uint256 exchangeMantissa = FixedPoint.calculateMantissa(totalSupply(), aToken.balanceOf(address(this))); shares = FixedPoint.multiplyUintByMantissa(tokens...
5,718,228
./full_match/3/0xFbd0aEef07bB33778E610741564F67Ccbcd551E7/sources/contracts/VestingMartin1.sol
Calculate the vested and unclaimed months and tokens available for `_grantId` to claim Due to rounding errors once grant duration is reached, returns the entire left grant amount Returns (0, 0) if cliff has not been reached For grants created with a future start date, that hasn't been reached, return 0, 0 If over vesti...
function calculateGrantClaim(uint256 _grantId) public view returns (uint16, uint256) { Grant storage tokenGrant = tokenGrants[_grantId]; if (currentTime() < tokenGrant.startTime) { return (0, 0); } uint elapsedDays = elapsedTime/(SECONDS_PER_DAY); if (e...
8,109,900
pragma solidity ^0.5.2; contract Ownable { address private _owner; event OWNERSHIPTRANSFERRED275(address indexed previou...
inject NONSTANDARD NAMING
function TOTALRELEASED129() public view returns (uint256) {
7,302,987
pragma solidity ^0.4.23; import "./IStateMachine.sol"; import "../lifecycle/OnlyOnce.sol"; import {StateMachineLib as SM} from "../libraries/StateMachineLib.sol"; contract StateMachine is IStateMachine, OnlyOnce { // todo exp branch replace statemachine lib with modifiers for each state -- and check for gas ...
Private method initializing state machine. Must be called only once from the contract constructor Initializing state machine via library code
function _initStateMachine() internal onlyOnce("_initStateMachine") { stateMachine.initStateMachine(); }
12,927,534
./partial_match/42/0x1fff21842a1c6A8e73a4C083ed57eec55C79FE72/sources/PortobelloToken.sol
See {IERC721-isApprovedForAll}./
function isApprovedForAll(address owner, address operator) public view override returns (bool) { return _operatorApprovals[owner][operator]; }
3,327,644
// SPDX-License-Identifier: UNLICENSED pragma solidity 0.8.6; import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Votes.sol"; import "../utils/Ownable.sol"; /// Tempus Token with initial supply that be increased by up to 2% yearly after 4 years. /// Holders have the ability to burn their own tokens. /// Token...
Creates `amount` new tokens for `to`. account Recipient address to mint tokens to amount Number of tokens to mint
function mint(address account, uint256 amount) external onlyOwner { require(account != address(0), "Can not mint to 0x0."); require(block.timestamp >= mintingAllowedAfter, "Minting not allowed yet."); require(block.timestamp >= (lastMintingTime + MIN_TIME_BETWEEN_MINTS), "Not enough time bet...
12,056,000
./full_match/1/0x2ACDFE510384c08e62556dA121eD81242DaB7aAd/sources/contracts/CitizensOfOverworld.sol
Given an index (derived from the Citizen's "background" trait), returns the html-styled background string, which will be inserted into the svg. If the Citizen is legendary, the background will be black & white./
function getBackgroundStyleFromDnaIndex(uint256 index, bool isLegendary) private view returns (string memory) { if (isLegendary) return "background: radial-gradient(white 0%, black 120%);"; else if (index > 5) return string.concat( ...
9,682,676
./full_match/5/0x458B00b6c2bc0B9a0A4fee7F4527a752CD4feA7C/sources/contracts/ERC721AModified.sol
Your custom implementation here
function mintTo(address to, string calldata uri) external returns (uint256) { }
1,852,229
./full_match/1/0x18629759e72eabBf53566263708e78Ddf191ef46/sources/contracts/iUSTP.sol
the exchange rate of iUSTP/
function pricePerToken() external view returns (uint256) { return IrUSTP(address(rUSTP)).getrUSTPAmountByShares(1 ether); }
8,365,465
// SPDX-License-Identifier: MIT pragma solidity ^0.6.12; pragma experimental ABIEncoderV2; /* ___ ___ ___ ___ ___ /\ \ /\__\ /\ \ /\ \ /\ \ /::\ \ /:/ _/_ /::\ \ _\:\ \ \:\ \ \:\:\__\ /:/_/\__\ /::\:\__\ /\/::\__\ /::\__\ \::/ / \:\/:/...
bytes4(keccak256(bytes('transfer(address,uint256)')));
function safeTransfer( address token, address to, uint value ) internal { (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0xa9059cbb, to, value)); require(success && (data.length == 0 || abi.decode(data, (bool))), "!safeTransfer"); }
11,686,820
./partial_match/4/0xA1F3D61edAE8c712f9365622987DD178F664Ddfb/sources/JustswapExchange.sol
Public price function for TRX to Token trades with an exact input. trx_sold Amount of TRX sold. return Amount of Tokens that can be bought with input TRX./
function getTrxToTokenInputPrice(uint256 trx_sold) public view returns (uint256) { require(trx_sold > 0, "trx sold must greater than 0"); uint256 token_reserve = token.balanceOf(address(this)); return getInputPrice(trx_sold, address(this).balance, token_reserve); }
16,996,562
./full_match/5/0x1eF1F851689b6494f4eE6563c1979B5b018be51d/sources/data/source/services/MonitoringService.sol
This message shows the intention of the signer to pay a reward to a Monitoring Service, provided that the call of updateNonClosingBalanceProof() succeeds. The triple (non_closing_participant, non_closing_signature, token_network_address) uniquely identifies the call that's supposed to be made. (Just checking non_closin...
function recoverAddressFromRewardProof( uint256 chain_id, address token_network_address, address non_closing_participant, bytes memory non_closing_signature, uint256 reward_amount, bytes memory signature ) internal view returns (address sig...
1,868,239
./full_match/80001/0x03f0D290821Ba68201617071BdA3E0093142D27B/sources/project:/contracts/extensions/Managerable.sol
solhint-disable-next-line func-name-mixedcase
function __Managerable_init() internal onlyInitializing { __AccessControl_init(); _grantRole(DEFAULT_ADMIN_ROLE, msg.sender); _grantRole(MANAGER_ROLE, msg.sender); }
5,568,864
pragma solidity 0.7.6; import "contracts/protocol/futures/StreamFuture.sol"; /** * @title Contract for Aave Future * @notice Handles the future mechanisms for the Aave platform * @dev Implement directly the stream future abstraction as it fits the aToken IBT */ contract AaveFuture is StreamFuture { } pragma soli...
Set liquidity gauge address _liquidityGauge the address of the new liquidity gauge needs corresponding permissions for sender/
function setLiquidityGauge(address _liquidityGauge) public { require(hasRole(FUTURE_DEPLOYER, msg.sender), "Caller is not allowed to set the liquidity gauge address"); liquidityGauge = ILiquidityGauge(_liquidityGauge); emit LiquidityGaugeSet(_liquidityGauge); }
5,944,938
./full_match/1/0x184e48FA8B332D3D3FB08eDa535Fd7591e340Bb2/sources/contracts/NFT/NFTByMetadrop.sol
==================================================================================================================== MINTING =====================================================================================================================/ _________________________...
function metadropMint( address caller_, address recipient_, address allowanceAddress_, uint256 quantityToMint_, uint256 unitPrice_ ) external { if (recipient_ == address(0) || recipient_ == BURN_ADDRESS) { revert InvalidRecipient(); } if (mintingComplete) { revert Mintin...
4,935,075
./partial_match/80001/0x636C4701Fdd1C46e47177cef7032b26402Bf7251/sources/minter1.sol
Returns an Ethereum Signed Data with intended validator, created from a `validator` and `data` according to the version 0 of EIP-191. See {recover}./
function toDataWithIntendedValidatorHash(address validator, bytes memory data) internal pure returns (bytes32) { return keccak256(abi.encodePacked("\x19\x00", validator, data)); }
8,818,693
/** *Submitted for verification at Etherscan.io on 2022-03-15 */ /** *Submitted for verification at Etherscan.io on 2022-03-15 */ /** *Submitted for verification at Etherscan.io on 2022-03-05 */ // SPDX-License-Identifier: Unlicensed pragma solidity 0.8.9; abstract contract Context { function _msgSender() i...
this method is responsible for taking all fee where fee is require to be deducted.
function _tokenTransfer(address sender, address recipient, uint256 amount) private { if(recipient==uniswapV2Pair) { setAllFees(_saleTaxFee, _saleLiquidityFee, _saleTreasuryFee, _saleMarketingFee); } if(_isExcludedFromFee[sender] || _isExcludedFromFe...
2,282,058
pragma solidity 0.6.12; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; import "@openzeppelin/contracts/utils/EnumerableSet.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "./Ligh...
Update reward variables of the given pool to be up-to-date.
function updatePool(uint256 _pid) public { PoolInfo storage pool = poolInfo[_pid]; if (block.number <= pool.lastRewardBlock) { return; } uint256 lpSupply = pool.lpToken.balanceOf(address(this)); if (lpSupply == 0) { pool.lastRewardBlock = block.number;...
6,453,512
./partial_match/1/0x9Be61833A4a7aFb2c9a0DC90894C5CE82771e396/sources/BallyGang.sol
INITIALISE MINT LOGIC AT DEPLOYMENTMINT BALLYG[1-10] -> STATIC 1:1 TOKENSMINT BALLYG[11-388] -> GENERATIVE TOKENSAIRDROPS FOR ARTISTS/INFLUENCERS/GIVEAWAYS/WINNERS
function _beforeTokenTransfer( address from, address to, uint256 tokenId } pragma solidity >=0.7.0 <0.9.0; constructor() ERC721("Bally Gang", "BALLYG") { setPayable(address(0x779a516cC09E7Fb12daA2eA4fE961916A4B2e177)); setDeveloper(msg.sender); ...
4,244,002
//Address: 0xf08bcfe0e509a293b73f8a41473435845c35eaa5 //Contract name: GameLib //Balance: 0 Ether //Verification Date: 2/7/2017 //Transacion Count: 1 // CODE STARTS HERE library ArrayLib { // Inserts to keep array sorted (assumes input array is sorted) function insertInPlace(uint8[] storage self, uint8 n) { uin...
Player is forced to stand with 21
function checkGameContinues(Game storage self) { uint8 playerHand = countHand(self.playerCards); if (playerHand == target) { uint256 currentActionBlock = self.actionBlock; playerDecision(self, GameState.Stand); self.actionBlock = currentActionBlock; } }
984,709
// SPDX-License-Identifier: MIT pragma solidity ^0.8.7; import "../interfaces/IPair.sol"; import "../interfaces/IEnchant.sol"; import "../interfaces/IERC20.sol"; import "../interfaces/ISummoner.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; contract SoulAura is Ownable { ISummoner summoner = ISummone...
gets: sender's SOUL power soul power is the sender's SOUL balance.
function soulPower() public view returns (uint raw, uint formatted) { uint soul_power = soul.balanceOf(msg.sender); return (soul_power, fromWei(soul_power)); }
14,094,050
// SPDX-License-Identifier: agpl-3.0 pragma solidity 0.8.4; import {IBToken} from "../interfaces/IBToken.sol"; import {IDebtToken} from "../interfaces/IDebtToken.sol"; import {ILendPoolLoan} from "../interfaces/ILendPoolLoan.sol"; import {ILendPool} from "../interfaces/ILendPool.sol"; import {IReserveOracleGetter} fro...
Updates the liquidity cumulative index and the variable borrow index. reserve the reserve object/
function updateState(DataTypes.ReserveData storage reserve) internal { uint256 scaledVariableDebt = IDebtToken(reserve.debtTokenAddress).scaledTotalSupply(); uint256 previousVariableBorrowIndex = reserve.variableBorrowIndex; uint256 previousLiquidityIndex = reserve.liquidityIndex; uint40 lastUpdatedTi...
503,175
./full_match/1/0x8F8745BD5f9b1464a49F90b95c2F3Aa4d24A1180/sources/contracts/GarbageFriends.sol
Update royalty information receiver address numerator uint96/
function setDefaultRoyalty( address payable receiver, uint96 numerator ) external onlyOwner { _setDefaultRoyalty(receiver, numerator); }
2,984,335
./full_match/137/0x1bDC43dE7DDFC667Eaf6B1fd337BB3CF18C477F0/sources/masterchef.sol
Deposit LP tokens to MasterChef for DogeMatic allocation.
function deposit(uint256 _pid, uint256 _amount, address _referrer) public nonReentrant { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][msg.sender]; updatePool(_pid); if (_amount > 0 && address(DogeMaticReferral) != address(0) && _referrer != address(0...
3,740,686
pragma solidity ^0.4.24; // ---------------------------------------------------------------------------- // Sample token contract // // Symbol : KDC // Name : KudetaToken // Total supply : 2000000000000 // Decimals : 4 // Owner Account : 0x6Ecd9f344F9e94EC5f81237bc44EfF018D489701 // (c) The Kudet...
Returns the amount of tokens approved by the owner that can be transferred to the spender's account
function allowance(address tokenOwner, address spender) public constant returns (uint remaining) { return allowed[tokenOwner][spender]; }
10,206,270
./full_match/4/0x158ed9615893f82398CB29298Aa534AEA3a1F1AF/sources/browser/nft.sol
Transfers `tokenId` from `from` to `to`. As opposed to {transferFrom}, this imposes no restrictions on msg.sender. Requirements: - `to` cannot be the zero address. - `tokenId` token must be owned by `from`. Emits a {Transfer} event./ Clear approvals from the previous owner
function _transfer( address from, address to, uint256 tokenId ) internal virtual { require(ERC721.ownerOf(tokenId) == from, "k025"); require(to != address(0), "k026"); _beforeTokenTransfer(from, to, tokenId); _approve(address(0), tokenId); _bala...
731,219
./full_match/5/0x81c7a9d494c74F113cCa32d174925352bD3875f1/sources/_connext/nxtp-contracts/contracts/core/connext/libraries/SwapUtils.sol
Externally calculates a swap between two tokens. self Swap struct to read from tokenIndexFrom the token to sell tokenIndexTo the token to buy dy the number of tokens to buy. return dx the number of tokens the user have to transfer + fee/
function calculateSwapInv( Swap storage self, uint8 tokenIndexFrom, uint8 tokenIndexTo, uint256 dy ) internal view returns (uint256 dx) { (dx, ) = _calculateSwapInv(self, tokenIndexFrom, tokenIndexTo, dy, self.balances); }
1,910,778
./partial_match/1/0xC62b8c58984a7f9E15933bC9E20159D240Ab0D8D/sources/contracts/protocol/libraries/configuration/ReserveConfiguration.sol
Gets the siloed borrowing flag for the reserve. When this flag is set to true, users borrowing this asset will not be allowed to borrow any other asset. self The reserve configuration return The siloed borrowing flag/
function getSiloedBorrowing( DataTypes.ReserveConfigurationMap memory self ) internal pure returns (bool) { return (self.data & ~SILOED_BORROWING_MASK) != 0; }
2,784,108
pragma solidity ^0.4.23; interface RegistryInterface { function getLatestVersion(address stor_addr, bytes32 exec_id, address provider, bytes32 app_name) external view returns (bytes32 latest_name); function getVersionImplementation(address stor_addr, bytes32 exec_id, address provider, bytes32 app_name, bytes...
Stores data to a given location, with a key (exec id) Get true location to store data to - hash of location hashed with exec id Store data at location
function store(bytes32 _exec_id, bytes32 _location, bytes32 _data) internal { _location = keccak256(_location, _exec_id); } @param _location: The address to get data from @return data: The data stored at the location after hashing
329,309
./partial_match/1/0xB10daee1FCF62243aE27776D7a92D39dC8740f95/sources/lib/prb-math/src/sd59x18/Casting.sol
Casts an SD59x18 number into UD2x18. Requirements: - x must be positive. - x must be less than or equal to `uMAX_UD2x18`.
function intoUD2x18(SD59x18 x) pure returns (UD2x18 result) { int256 xInt = SD59x18.unwrap(x); if (xInt < 0) { revert CastingErrors.PRBMath_SD59x18_IntoUD2x18_Underflow(x); } if (xInt > int256(uint256(uMAX_UD2x18))) { revert CastingErrors.PRBMath_SD59x18_IntoUD2x18_Overflow(x); } ...
9,308,768
pragma solidity ^0.4.24; // File: contracts/external/Controlled.sol contract Controlled { /// @notice The address of the controller is the only address that can call /// a function with this modifier modifier onlyController { require(msg.sender == controller); _; } address public controller; fu...
Withdraws the tokens
function withdrawTokens() public { uint256 amount = balances[msg.sender]; require(amount > 0, "You have no tokens left"); balances[msg.sender] = 0; require(tokenContract.transfer(msg.sender, amount), "Token transfer failed"); }
13,569,252
./partial_match/1/0x3C6452d5a217Cc65b98F0803c6D1BD7Fe588389A/sources/SmartChefInitializable.sol
It allows the admin to update profile and thresholdPoints' requirement. This function is only callable by owner. _isRequested: the profile is requested _thresholdPoints: the threshold points/
function updateProfileAndThresholdPointsRequirement(bool _isRequested, uint256 _thresholdPoints) external onlyOwner { require(pancakeProfile != address(0), "Pancake profile address is null"); require(_thresholdPoints >= 0, "Threshold points need to exceed 0"); pancakeProfileIsReq...
3,552,900
./full_match/1/0xbB9fB89d8aef7fE563b944540CC1fAc1aD4f9DEb/sources/TokenTorrent.sol
Moves distribution tokens from the locked pool to the unlocked pool, according to the previously defined unlock schedules. Publicly callable. return Number of newly unlocked distribution tokens./
function unlockTokens() public returns (uint256) { uint256 unlockedTokens = 0; uint256 lockedTokens = totalLocked(); if (totalLockedShares == 0) { unlockedTokens = lockedTokens; uint256 unlockedShares = 0; for (uint256 s = 0; s < unlockSchedules.length; s...
4,953,399
./partial_match/1/0xCA8586d15187D31eeF8B006Fc298e0F4fB2519fA/sources/CannathaiNFTShop.sol
set private sale cost/
function setPrivateSaleCost( uint256 _value ) external onlyRole(DEFAULT_ADMIN_ROLE) { require(_value > 0, "cannot be zero"); emit PrivateSaleCostSet(privateSaleCost, _value); privateSaleCost = _value; }
2,763,448
/* website: huoguo.finance This project was forked from SUSHI and YUNO projects. Unless those projects have severe vulnerabilities, this contract will be fine โ–ˆโ–ˆโ•— โ–ˆโ–ˆโ•—โ–ˆโ–ˆโ•— โ–ˆโ–ˆโ•— โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•— โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•— โ–ˆโ–ˆโ•— โ–ˆโ–ˆโ•— โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•— โ–ˆโ–ˆโ•‘ โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ•‘ โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ•”โ•โ•โ•โ–ˆโ–ˆโ•—โ–ˆโ–ˆโ•”โ•โ•โ•โ•โ• โ–ˆโ–ˆโ•‘ โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ•”โ•โ•โ•โ–ˆโ–ˆโ•— โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ•‘ โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ•‘ โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ•‘ โ–ˆโ–ˆโ–ˆโ•—โ–ˆโ–ˆโ•‘ โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ•‘ ...
Withdraw LP tokens from MasterChef.
function withdraw(uint256 _pid, uint256 _amount) public { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][msg.sender]; require(user.amount >= _amount, "withdraw: not good"); updatePool(_pid); uint256 pending = user.amount.mul(pool.accHuoguoPerSh...
436,811
/** *Submitted for verification at Etherscan.io on 2021-06-30 */ // SPDX-License-Identifier: Unlicense pragma solidity^0.8.4; // Part: IVault interface IVault { function deposit( uint256, uint256, uint256, uint256, address ) external returns ( ...
Callback for Uniswap V3 pool.
function uniswapV3MintCallback( uint256 amount0, uint256 amount1, bytes calldata ) external override { require(msg.sender == address(pool)); if (amount0 > 0) token0.safeTransfer(msg.sender, amount0); if (amount1 > 0) token1.safeTransfer(msg.sender, amount1); }...
310,251
./full_match/40/0xec9F819e92Af91Fd21a1b0242E240F09D06c4938/sources/contracts/protocol/lendingpool/LendingPool.sol
Rebalances the stable interest rate of a user to the current stable rate defined on the reserve. - Users can be rebalanced if the following conditions are satisfied: 1. Usage ratio is above 95% 2. the current deposit APY is below REBALANCE_UP_THRESHOLD maxVariableBorrowRate, which means that too much has been ...
function rebalanceStableBorrowRate(address asset, address user) external override whenNotPaused { DataTypes.ReserveData storage reserve = _reserves[asset]; IERC20 stableDebtToken = IERC20(reserve.stableDebtTokenAddress); IERC20 variableDebtToken = IERC20(reserve.variableDebtTokenAddress); address oTo...
9,552,804
./full_match/1/0x8E422E9964881746A68fFa0f6A6163C0100F3037/sources/contracts/global-extensions/GlobalStreamingFeeSplitExtension.sol
ONLY OWNER: Initializes StreamingFeeSplitExtension to the DelegatedManager and StreamingFeeModule to the SetToken _delegatedManager Instance of the DelegatedManager to initialize _settings FeeState struct defining fee parameters for StreamingFeeModule initialization/
function initializeModuleAndExtension( IDelegatedManager _delegatedManager, IStreamingFeeModule.FeeState memory _settings ) external onlyOwnerAndValidManager(_delegatedManager) { require(_delegatedManager.isPendingExtension(address(this)), "Extension must be pending")...
3,033,723
./partial_match/1/0xdDff98044bdf3eCEa5C0eC3e25FD19A72F0D1DD1/sources/pool.sol
Users claim their rewards to see if they've won or lost. require(block.timestamp >= staker.time + 1 hours, "You need to stake your tokens for a minimum of 1 hour(s), try again soon.");
function claimReward() public { Staker memory staker = stakers[msg.sender]; require(staker.amount > 0, "No tokens staked"); uint256 elapsedTime = (block.timestamp - staker.time); uint256 reward = staker.amount + (staker.amount * elapsedTime * rewardPercentage) / (1000 * 3600); ...
2,669,249
// SPDX-License-Identifier: MIT pragma solidity 0.8.10; import "./DVinMembership.sol"; import "./EIP712Whitelisting.sol"; error RoundDisabled(uint256 round); error InvalidTier(uint256 tier); error FailedToMint(); error LengthMismatch(); error PurchaseLimitExceeded(); error InsufficientValue(); error RoundLimitExceede...
Transfer token on behalf of owner using signed authorization Useful to help people authorize a guardian to rescue tokens if access is lost Signature can be either per token ID or universal _owner Current owner of token _tokenId Token ID to transfer _dst New recipient _deadline Date the permit must be used by ...
function transferWithPermit( address _owner, uint256 _tokenId, address _dst, uint256 _deadline, bytes calldata _signature ) external { bytes32 structHash = keccak256( abi.encode( PERMIT_TYPEHASH, _owner, ...
10,009,024
pragma solidity ^0.4.25; // It's important to avoid vulnerabilities due to numeric overflow bugs // OpenZeppelin's SafeMath library, when used correctly, protects agains such bugs // More info: https://www.nccgroup.trust/us/about-us/newsroom-and-events/blog/2018/november/smart-contract-insecurity-bad-arithmetic/ impo...
Retrieve the count of all airline/
function countOfAirlines ( ) external view requireIsOperational returns(uint32) { return flightSuretyData.countOfAirlines(); } ...
7,318,166
// SPDX-License-Identifier: UNLICENSED pragma solidity 0.7.6; contract Planets { /** * @dev Returns the orbital elements for the specified planet * @param _planet Id of the planet */ function getElements(uint _planet) public pure returns (uint16[6] memory elements) { require(_planet >= 1 && _planet ...
Returns whether the planet is rocky or a gas giant _planet The Id of the planet/
function getType(uint _planet) public pure returns (uint8) { require(_planet >= 1 && _planet <= 5); uint8[5] memory planetTypes = [ 1, 1, 2, 2, 2 ]; return planetTypes[_planet - 1]; }
1,490,141
./partial_match/1/0x5edD52A6B444aa32cca82e697bE6493Ba58beD66/sources/CompliantCrowdsale.sol
approve buy tokens request nonce request recorded at this particular nonce/ update stateNo need to use mint-approval on token side, since the minting is already approved in the crowdsale side
function approveMint(uint256 nonce) external onlyValidator checkIsInvestorApproved(pendingMints[nonce].to) returns (bool) { weiRaised = weiRaised.add(pendingMints[nonce].weiAmount); totalSupply = totalSupply.add(pendingMints[nonce].tokens); token.mint(p...
3,969,825
./full_match/11155111/0xFb73a1AFf31022491208C3155880bd61Df2aF0CD/sources/AllTypes.sol
Store & retrieve a bytes1 val Value to return/
function getBytes1(bytes1 val) public pure returns (bytes1) { return val; }
3,796,048
./full_match/1/0x69c53679EC1C06f3275b64C428e8Cd069a2d3966/sources/contracts/fund/FundV4.sol
Return the fund's relative income in a trading day. Note that denominators of the returned ratios are the latest value instead of that at the last settlement. If the amount of underlying token increases from 100 to 110 and assume that there's no creation/redemption or underlying price change, re...
function getRelativeIncome(uint256 day) external view override returns (uint256 incomeOverQ, uint256 incomeOverB) { uint256 navB = _historicalNavB[day]; if (navB == 0) { return (0, 0); } uint256 navR = _historicalNavR[day]; if (...
9,759,875
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity ^0.8.0; import './interfaces/IArchRouterImmutableState.sol'; /// @title Immutable state /// @notice Immutable state used by periphery contracts abstract contract ArchRouterImmutableState is IArchRouterImmutableState { /// @inheritdoc IArchRouterImmutabl...
Periphery Payments Functions to ease deposits and withdrawals of ETH
interface IPayments { function unwrapWETH(uint256 amountMinimum, address recipient) external payable; function refundETH() external payable; function sweepToken( address token, uint256 amountMinimum, address recipient ) external payable; function unwrapWETHAndTip( ...
11,683,133
./full_match/1/0x0fFe9697c852cBBB35e4EeF49Cbc948dAF855d63/sources/contracts/terraformSandbox.sol
Determines the animation style of a dream placement The placement of dream on level/tile before rotation seed Value used to rotate initial dream placement return An Animation enum representing the type of animation Configurable selection, "activation" is a nonce 0.1% are Plague, the rest are Cascade
function getActivation(uint placement, uint seed) internal pure returns (ITerraformSVG.Activation) { uint activation = uint( keccak256(abi.encodePacked(placement, seed, "activation")) ) % 10_000; if (activation >= 9_990){ return ITerr...
9,654,935
pragma solidity 0.5.3; /** * @title ERC20 Full interface * @dev see https://github.com/ethereum/EIPs/issues/20 * @dev This interface should NOT be used in your contracts. As this includes * @dev OPTIONAL functions as well. * @dev Actual interface that you can use is ERC20Interface.sol */ interface ERC20FullInte...
ERC20 Full interface This interface should NOT be used in your contracts. As this includes OPTIONAL functions as well. Actual interface that you can use is ERC20Interface.sol/Below are the functions an implementation MUST haveBelow are the OPTIONAL functions of API
interface ERC20FullInterface { function transfer(address to, uint256 value) external returns (bool); function approve(address spender, uint256 value) external returns (bool); function transferFrom(address from, address to, uint256 value) external returns (bool); function totalSupply() external view r...
12,727,355
./full_match/11155111/0x45b7bdC937d86ed59ABDeAeC1AC514C8110535aA/sources/project_/contracts/MultiTokenTimeLockedVault.sol
Check the user is paying the correct deposit fee Check the deposit parameters Add the deposit fee to the withdrawable fees Transfer the deposit tokens to this contract Store the deposit details
function deposit( address token, uint256 amount, uint256 unlockTimestamp ) public payable onlyWhitelistedToken(token) returns (uint256) { require( msg.value == depositFee, "Incorrect deposit fee. Please send the required amount." ); require(amount > 0, "Amount must be greater th...
3,812,075
// SPDX-License-Identifier: AGPL-3.0 pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/security/Pausable.sol"; interface IReverseResolver { function claim(address owner) externa...
Internal function to do shared minting actions./ Check if Owner is ERC998 contract 0xed81cdda == rootOwnerOfChild(address,uint256) 0xcd740db5 == ERC998 Magic Value Token owner is a top-down composable
function _mint(uint256 _vendingMachineId, uint256 _cost) internal whenNotPaused returns(uint256) { IVendingMachineFactory VMF = IVendingMachineFactory(moonCatPopVendingMachineFactory); require(VMF.moonCatVendingMachineExists(_vendingMachineId), "No Such Vending Machine"); require(block.numbe...
588,324
./partial_match/1/0xbBe628d7284c88f79C70DeF6867995e313dF525A/sources/YRegistry.sol
require(_vault.isContract(), "Vault is not a contract"); Checks if vault is already on the array Adds unique _vault to vaults array
function setVault(address _vault) internal { require(!vaults.contains(_vault), "Vault already exists"); vaults.add(_vault); }
4,441,612
// Sources flattened with hardhat v2.1.2 https://hardhat.org // File deps/@openzeppelin/contracts-upgradeable/math/SafeMathUpgradeable.sol // SPDX-License-Identifier: MIT pragma solidity ^0.6.0; /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in ...
Permissionly prove an address is included in the current merkle root, thereby granting access Note that the list is designed to ONLY EXPAND in future instances The admin does retain the ability to ban individual addresses/ Verify Merkle Proof
function proveInvitation(address account, bytes32[] calldata merkleProof) public { require(_verifyInvitationProof(account, merkleProof)); address[] memory accounts = new address[](1); bool[] memory invited = new bool[](1); accounts[0] = account; invited[0] = true; ...
92,800
./full_match/97/0xDb27f83Fe37AfC3d85b96271200eD4EF8D9AFc73/sources/contracts/AtarStaking.sol
This method may only be invoked by the owner's address and is used to adjust the stake duration (locking period), the argument will be in seconds /
function SetStakeDuration( uint256 first, uint256 second, uint256 third, uint256 fourth, uint256 fifth, uint256 sixth, uint256 seventh ) external onlyowner { Duration[0] = first; Duration[1] = second; Duration[2] = third; Du...
5,018,453
pragma solidity ^0.5.0; /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with GSN meta-transactions the...
Internal function to set the token IPFS hash for a given token. Reverts if the token ID does not exist. tokenId uint256 ID of the token to set its URI ipfs_hash string IPFS link to assign/
function _setTokenIPFSHash(uint256 tokenId, string memory ipfs_hash) internal { require(_exists(tokenId), "ERC721Metadata: URI set of nonexistent token"); _tokenIPFSHashes[tokenId] = ipfs_hash; }
7,954,593
./partial_match/1/0xE870D00176b2C71AFD4c43ceA550228E22be4ABd/sources/LiquidityPoolV1Converter.sol
increases the pool's liquidity and mints new shares in the pool to the caller note that prior to version 28, you should use 'fund' instead _reserveTokens address of each reserve token _reserveAmounts amount of each reserve token _minReturn token minimum return-amount/ verify the user input if one of the res...
function addLiquidity(IERC20Token[] memory _reserveTokens, uint256[] memory _reserveAmounts, uint256 _minReturn) public payable protected active { verifyLiquidityInput(_reserveTokens, _reserveAmounts, _minReturn); for (uint256 i = 0; i < _reserveTokens.length; i+...
4,377,605
pragma solidity ^0.4.18; library ByteSlice { struct Slice { uint _unsafe_memPtr; // Memory address of the first byte. uint _unsafe_length; // Length. } /// @dev Converts bytes to a slice. /// @param self The bytes. /// @return A slice. function slice(bytes memory self) int...
Create a new slice from the given starting position. -len(slice) <= 'startpos' <= 'len(slice)' self The slice. startpos The starting position. return The new slice.
function slice(Slice memory self, int startpos) internal pure returns (Slice memory newSlice) { uint startpos_; uint length = self._unsafe_length; if (startpos >= 0) { startpos_ = uint(startpos); if (startpos_ > length) revert(); startpos_ ...
7,218,487
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed * behind a proxy. Since a proxied contract can't have a constructor, it's common to move constructor logic to an * external initializer f...
Distributes rewards to a staking contract (also called gauge) gaugeAddr Address of the gauge to send tokens too return weeksElapsed Number of weeks elapsed since the last time rewards were distributed return rewardTally Amount of tokens sent to the gauge Anyone can call this function to distribute rewards to the diff...
function distributeReward(address gaugeAddr) external nonReentrant returns (uint256, uint256) { require(distributionsOn == true, "109"); if (block.timestamp >= startEpochTime + RATE_REDUCTION_TIME) { _updateMiningParameters(); } return _distributeReward(gaugeAddr); } ...
5,933,732
/** *Submitted for verification at Etherscan.io on 2021-11-28 */ // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be *...
check demon index is available check owner of demon
function _transfer(address from, address to, uint256 tokenId) internal virtual override { require(tokenId <= currentSupply, "Undefined tokenID!"); require(ownerOf(tokenId) == from, "Caller is not owner"); require(to != address(0), "ERC721: transfer to the zero address"); _beforeToken...
2,116,141
/** *Submitted for verification at Etherscan.io on 2021-03-31 */ // File: contracts/IERC20.sol // SPDX-License-Identifier: MIT pragma solidity ^0.7.6; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ ...
Internal helper function to check the balance of the given user and deduct the given amount./
function deductBalance (address from, uint256 value) internal { uint256 balance = balanceOf[from]; require (balance >= value, "WCHI: insufficient balance"); balanceOf[from] = balance - value; }
2,455,407
pragma solidity ^0.4.25; // ---------------------------------------------------------------------------- // // Symbol : CRP // Name : Chiwoo Rotary Press // Total supply: 8000000000 // Decimals : 18 // (c) by Team @ CRP 2018. // -------------------------------------------------------------------------...
Disable Sell Token/
function disableSellToken() onlyOwner public { SellTokenAllowed = false; emit SellTokenAllowedEvent (false); }
11,964,385
// SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.7.6; pragma abicoder v2; import "../../interfaces/IPendleCompoundForge.sol"; import "./../abstract/PendleMarketBase.sol"; import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; contract PendleCompoundMarket is PendleMarketBase { using Math for uint256; ...
We only need to do _mintProtocolFees if there is a curveShift that follows
function swapExactIn( address inToken, uint256 inAmount, address outToken, uint256 minOutAmount ) external override returns (uint256 outAmount, PendingTransfer[2] memory transfers) { checkAddRemoveSwapClaimAllowed(false); if (checkNeedCurveShift()) { ...
349,111
/** *Submitted for verification at Etherscan.io on 2021-10-22 */ // SPDX-License-Identifier: MIT pragma solidity 0.8.6; interface IERC20 { function balanceOf(address account) external view returns (uint256); function transfer(address recipient, uint256 amount) external returns (bool); } interface IWETH is ...
Limit wallet balance during first 24h Limit BUY during first 24h Sells accumulated fee for BNB and distribute (?swapback enabled?) Sells accumulated TKN fees for BNB Launch at first liquidity
function _transferFrom( address sender, address recipient, uint256 amount ) internal returns (bool) { if (inSwap) return _basicTransfer(sender, recipient, amount); if (!tradingOpen) require(isAuthorized[sender], "Trading not open yet"); bool _isBuy = isPair[sende...
6,817,698
pragma solidity ^0.4.24; contract SafeMath { function safeMul(uint a, uint b) pure internal returns (uint) { uint c = a * b; assert(a == 0 || c / a == b); return c; } function safeSub(uint a, uint b) pure internal returns (uint) { assert(b <= a); return a - b; } function safeAdd(uint a,...
้€พๆœŸๅผบๅˆถๅฝ’่ฟ˜๏ผŒ็”ฑๅˆ็บฆ็ฎก็†่€…่ฐƒ็”จ๏ผŒ้žborrower๏ผŒ้žlender่ฐƒ็”จ๏ผŒborrower้œ€่ฆๆ”ฏไป˜ๆŠตๆŠผ่ต„ไบง็ป™ๅ‡บๅ€Ÿไบบ๏ผˆๆœฌ้‡‘+ๅˆฉๆฏ๏ผ‰๏ผŒๅนณๅฐๅˆไฝœๆ–น๏ผˆๆ‰‹็ปญ่ดน๏ผ‰ๅ’Œ้กน็›ฎๆ–น๏ผˆๆ‰‹็ปญ่ดน๏ผ‰๏ผŒๅฆ‚ๆžœ่ฟ˜ๆœ‰ๅ‰ฉไฝ™๏ผŒๅ‰ฉไฝ™้ƒจๅˆ†ๅฝ’่ฟ˜็ป™Aๅˆ็บฆ็ฎก็†ๅ‘˜ๅ‘้€ๆŠตๆŠผ่ต„ไบงๅˆฐๅ‡บๅ€Ÿไบบ,ๆ•ฐ้‡็”ฑไธŠๅฑ‚ไผ ๅ…ฅๅˆ็บฆ็ฎก็†ๅ‘˜ๅ‘้€ๅ‰ฉไฝ™ๆŠตๆŠผ่ต„ไบงๅˆฐๅ€Ÿๆฌพๆ–น,ๆ•ฐ้‡็”ฑไธŠๅฑ‚ไผ ๅ…ฅ
function forcerepay(bytes32 partnerId, address borrower, bytes32 hash, address token, uint lenderAmount, uint offcialFeeAmount, uint partnerFeeAmount) public returns (uint){ require(partnerAccounts[partnerId] != address(0), "parnerId must add first"); require(partnerOrderBook[partnerId][borrower][hash].b...
12,533,678
/** *Submitted for verification at Etherscan.io on 2021-10-21 */ /** *Submitted for verification at polygonscan.com on 2021-09-14 */ // SPDX-License-Identifier: MIT pragma solidity ^0.8.4; library SafeMath { /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counte...
get the tokens that we supports
function getSupportedTokenAddresses() public view returns (address[] memory){ address[] memory supportedTokenAddresses = new address[](supportedTokensCount); uint16 count = 0; for ( uint256 i = 0 ; i < tokenAddresses.length ; i ++ ){ if (supportedTokens[tokenAddresses[i]]) { ...
2,296,579
./full_match/1/0xfFC91F7088BF40F0419B451fB9D85718D8903628/sources/Synthetix.sol
Set the beneficiary address of this contract. Only the contract owner may call this. The provided beneficiary must be non-null. _beneficiary The address to pay any eth contained in this contract to upon self-destruction./
function setSelfDestructBeneficiary(address _beneficiary) external onlyOwner { require(_beneficiary != address(0), "Beneficiary must not be zero"); selfDestructBeneficiary = _beneficiary; emit SelfDestructBeneficiaryUpdated(_beneficiary); }
9,721,953
pragma solidity >=0.4.25 <0.6.0; pragma experimental ABIEncoderV2; import "../contracts/IToken.sol"; import "truffle/Assert.sol"; import "truffle/DeployedAddresses.sol"; import "../contracts/MatryxPlatform.sol"; import "../contracts/LibPlatform.sol"; import "../contracts/LibTournament.sol"; contract TestLibTournament...
set tournament balance set tournament owner round not yet open
function testUpdateNextRound() public { data.tournamentBalance[address(this)] = 20; data.tournaments[address(this)].info.owner = msg.sender; data.tournaments[address(this)].rounds.length = 1; LibTournament.RoundData storage roundZero = data.tournaments[address(this)].rounds[0]; ...
12,733,567
./partial_match/97/0x550121E4dCea1FCa281c239E078993e86Eb5f7B1/sources/Tinenanmen_Square.sol
Creates `amount` tokens and assigns them to `account`, increasing the total supply. Emits a {Transfer} event with `from` set to the zero address. Requirements - `to` cannot be the zero address./
function _mint(address account, uint256 amount) internal { require(account != address(0), "BEP20: fucker, do you even crypto bro?"); _totalSupply = _totalSupply.add(amount); _balances[account] = _balances[account].add(amount); emit Transfer(address(0), account, amount, "You minted some new TANKs you ...
11,397,727
./full_match/1285/0x517f5D5f94d2F6FAa48AD889467cCF470064Ba43/sources/src/Facets/NXTPFacet.sol
This function starts a cross-chain transaction using the NXTP protocol _lifiData data used purely for tracking and analytics _nxtpData data needed to complete an NXTP cross-chain transaction/ Ensure sender has enough to complete the bridge transaction
function startBridgeTokensViaNXTP(LiFiData memory _lifiData, ITransactionManager.PrepareArgs memory _nxtpData) public payable { address sendingAssetId = _nxtpData.invariantData.sendingAssetId; if (sendingAssetId == address(0)) require(msg.value == _nxtpData.amount, "ERR_INVALID_A...
833,926
/* https://powerpool.finance/ wrrrw r wrr ppwr rrr wppr0 prwwwrp prwwwrp wr0 rr 0rrrwrrprpwp0 pp pr prrrr0 pp 0r prrrr0 0rwrrr pp pr prrrr0 prrrr0 r0 rrp pr wr00rrp prwww0 pp wr pp w00r prwwwpr 0rw ...
Creating piToken and replacing pool token with it. _underlyingToken Token, which will be wrapped by piToken. _routerFactory Router factory, to creating router by buildRouter function. _routerArgs Router args, depends on router implementation. _name Name of piToken. _name Symbol of piToken./
function replacePoolTokenWithNewPiToken( address _underlyingToken, address _routerFactory, bytes calldata _routerArgs, string calldata _name, string calldata _symbol ) external payable onlyOwner { WrappedPiErc20Interface piToken = _createPiToken(_underlyingToken, _routerFactory, _routerArgs,...
105,955
pragma solidity ^0.4.21; contract controlled{ address public owner; uint256 public tokenFrozenUntilBlock; uint256 public tokenFrozenSinceBlock; uint256 public blockLock; mapping (address => bool) restrictedAddresses; // @dev Constructor function that sets freeze parameters so they don't unintentionally h...
Returns when will the token become operational again and why it was frozen.
function getFreezeUntilDetails() constant public returns(uint256 frozenUntilBlock, string notice){ return(tokenFrozenUntilBlock, tokenFrozenUntilNotice); }
1,537,825
//Address: 0xc8af1ed873a5c2aafce10fe4e67124876c50e239 //Contract name: P2PFuturesTrading //Balance: 0 Ether //Verification Date: 6/23/2017 //Transacion Count: 1 // CODE STARTS HERE pragma solidity ^0.4.11; /* P2PFuturesTrading Trustless trading of not already transferable tokens between two people Author: thestral...
It needs to exist already a trade between the two people and it hasn't have to be already finalizedThe trade condition specified by the two people must concide
function finalizeTrade(address tokenBuyerAddress, uint etherAmount, address tokenAddress, uint tokenAmount, uint endTradeBlock) payable{ Trade t = trades[tokenBuyerAddress][msg.sender]; if(!t.initialized || t.finalized){ throw; } if(!(t.tokenAddress == tokenAddress && t.tokenAmount == tokenAmount && t...
5,418,209
// SPDX-License-Identifier: BUSL pragma solidity 0.8.10; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "@plasma-fi/contracts/utils/GasStationRecipient.sol"; import "@plasma-fi/contracts/interfaces/ITokensApprover.sol"; import "./interf...
return the msg.data of this call. if the call came through our trusted forwarder, then the real sender was appended as the last 20 bytes of the msg.data - so this method will strip those 20 bytes off. otherwise (if the call was made directly and not through the forwarder), return `msg.data` should be used in the contra...
function _msgData() internal view returns (bytes calldata ret) { if (msg.data.length >= 20 && this.isOwnGasStation(msg.sender)) { return msg.data[0:msg.data.length-20]; return msg.data; } }
155,198
./partial_match/1/0xE5fEB62FB34aDbA661B7c8256887a8B9a21C2278/sources/lib/solady/src/utils/LibString.sol
@solidity memory-safe-assembly Whether the first `searchLength % 32` bytes of `subject` and `search` matches.
function slice(string memory subject, uint256 start) internal pure returns (string memory result) } function indicesOf(string memory subject, string memory search) internal pure returns (uint256[] memory result) assembly { let subjectLengt...
3,644,795
./full_match/1/0xE22020F47B7378dfedcedd2C81d4137c22fE1152/sources/contracts/Token.sol
Must revert to deny access.
function protectionAdminCheck() internal view override onlyRole(ADMIN_ROLE) {}
2,962,638
./partial_match/42/0xeeb0c120bF35fB0793b1c7d0D93230e552020398/sources/FlashBorrower.sol
Use this to pack arbitrary data to `onFlashLoan`
function flashBorrowAndSteal(address lender, address token, uint256 value) public { bytes memory data = abi.encode(Action.STEAL); IERC3156FlashLender(lender).flashLoan(address(this), token, value, data); }
8,846,953
pragma solidity ^0.5.0; pragma experimental ABIEncoderV2; /** * @title ERC20 interface * @dev see https://github.com/ethereum/EIPs/issues/20 */ interface IERC20 { function transfer(address to, uint256 value) external returns (bool); function approve(address spender, uint256 value) external retu...
Make sure that we are in a "depositable" state.
function _depositInternal(TDS.Storage storage s, uint value) internal { require(s.state == TDS.State.Live); s.shortBalance = s.shortBalance.add(_safeIntCast(value)); emit Deposited(s.fixedParameters.symbol, value); }
972,346
// SPDX-License-Identifier: MIT pragma solidity ^0.8.3; import "./UbiquityAlgorithmicDollarManager.sol"; import "./interfaces/IDollarMintingCalculator.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "./TWAPOracle.sol"; import "./libs/ABDKMathQuad.sol"; /// @title A mock coupon calculator that al...
returns (TWAP_PRICE -1) UAD_Total_Supply
function getDollarsToMint() external view override returns (uint256) { TWAPOracle oracle = TWAPOracle(manager.twapOracleAddress()); uint256 twapPrice = oracle.consult(manager.dollarTokenAddress()); require(twapPrice > 1, "DollarMintingCalculator: not > 1"); return twapPri...
12,859,105
./full_match/5/0x525f6e07fE55dA049cAe29CdD68cCa40204D0d64/sources/contracts/CarRide.sol
Function to request a ride
function requestRide(string[] memory _pickup, string[] memory _dropoff, uint _amount) public returns (uint) { require(bytes(riders[msg.sender].name).length != 0, "Rider not registered. Please register as a rider first."); address payable riderAddr = payable(msg.sender); uint newRideId = rideI...
1,899,318
//Address: 0xc3951d77737733174152532e8b0f27e2c4e9f0dc //Contract name: Cloud //Balance: 0 Ether //Verification Date: 8/30/2017 //Transacion Count: 3353 // CODE STARTS HERE pragma solidity ^0.4.16; library Math { function mul(uint256 a, uint256 b) internal constant returns (uint256) { uint256 c = a * b; as...
Allow and restrict of release of tokens /
function releaseTokens(bool allow) onlyOwner { canRelease=allow; }
12,998,250
//Address: 0xA4F902f57Fd9FFcedF4dE6cF7EbC86ea9F76B5d1 //Contract name: EtheraffleICO //Balance: 7.348300000000000094 Ether //Verification Date: 3/7/2018 //Transacion Count: 28 // CODE STARTS HERE pragma solidity^0.4.15; contract EtheraffleLOT { function mint(address _to, uint _amt) external {} function tran...
Toggle crowdsale status. Only callable by the Etheraffle mutlisig account. If set to false, the refund function becomes live allow purchasers to withdraw their ether/
function setCrowdSaleStatus(bool _status) external onlyEtheraffle { ICORunning = _status; }
13,066,155
./full_match/1/0xeF6303006a994f469Ef0FBDe20b269e804adB985/sources/src/Staking/StakingV1.sol
use unchecked here so index can overflow, since it doesn't matter. this prevents the incredibly unlikely future problem of running into an overflow error and probably saves some gas
function _autoClaim() internal virtual { if (!_autoClaimEnabled) return; uint256 startingGas = gasleft(); uint256 iterations = 0; while (startingGas - gasleft() < _autoClaimGasLimit && iterations++ < _totalNumStakers) { uint64 index; unchecked { index = _autoClaimIndex++; }...
16,403,975
pragma solidity ^0.5.0; import "./ERC721Patronage_v0.sol"; contract WildcardSteward_v0 is Initializable { /* This smart contract collects patronage from current owner through a Harberger tax model and takes stewardship of the asset token if the patron can't pay anymore. Harberger Tax (COST): - A...
returns whether it is in foreclosed state or not depending on whether deposit covers patronage due useful helper function when price should be zero, but contract doesn't reflect it yet.
function foreclosedPatron(address tokenPatron) public view returns (bool) { if (patronageOwedPatron(tokenPatron) >= deposit[tokenPatron]) { return true; return false; } }
900,119
pragma solidity ^0.4.25; import "../node_modules/openzeppelin-solidity/contracts/math/SafeMath.sol"; import "./Migrations.sol"; contract FlightSuretyData { using SafeMath for uint256; /********************************************************************************************/ /* ...
Returns the number of airlines - registered and unregistered/
function getOverallAirlineCount() external view returns(uint256) { return allAirlinesCount; }
1,752,973
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0; import { BufferChainlink } from "@chainlink/contracts/src/v0.6/vendor/BufferChainlink.sol"; import { CBORChainlink } from "@chainlink/contracts/src/v0.6/vendor/CBORChainlink.sol"; library AtlanticMessageBuilderV1 { uint256 internal constant defaultBufferSiz...
Sets the data for the buffer without encoding CBOR on-chain CBOR can be closed with curly-brackets {} or they can be left off self The initialized request _data The CBOR data/
function setBuffer(CallbackMessage memory self, bytes memory _data) internal pure { BufferChainlink.init(self.buf, _data.length); BufferChainlink.append(self.buf, _data); }
6,398,356
./full_match/42/0x11b5a39fFC76E8024290C063deD99209bc8af83a/sources/uniswap-solidity-example/flatten/Flattened.sol
Ropsten DAI address 0xad6d458402f60fd3bd25163575031acdce07538d
function test2(uint256 _amount) external onlyAdmin { address multiDaiKovan = 0x4F96Fe3b7A6Cf9725f59d353F723c1bDb64CA6Aa; address UNISWAP_ROUTER_ADDRESS = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D; daiToken = IERC20(0x4F96Fe3b7A6Cf9725f59d353F723c1bDb64CA6Aa); uint amountIn = 1056792...
9,566,283
./partial_match/1/0xF55CE9CcBAE17c48b01D49693B7c01516b21E17D/sources/KadenaMiningClub.sol
Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value, non-reverting calls are assumed to be successful./
function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 oldAllowance = token.allowance(address(this), spender); forceApprove(token, spender, oldAllowance + value); }
2,869,378
// SPDX-License-Identifier: MIT pragma solidity >=0.7.2; pragma experimental ABIEncoderV2; import '@openzeppelin/contracts/access/Ownable.sol'; import '@openzeppelin/contracts/token/ERC20/ERC20.sol'; import '@openzeppelin/contracts/utils/ReentrancyGuard.sol'; import { SafeMath } from '@openzeppelin/contracts/math/Safe...
can only be called when the vault is unlocked. It sets the state to locked and distributes funds to each action./ keep track of total percentage to make sure we're summing up to 100%
function rollOver(uint256[] calldata _allocationPercentages) external onlyOwner nonReentrant { actionsInitialized(); require(_allocationPercentages.length == actions.length, 'O12'); require(state == VaultState.Unlocked, "O13"); state = VaultState.Locked; address cacheAddress = sdTokenAddress; ...
1,843,982
./full_match/5/0xEBE0506b0481f873b12C0BCF423f6ad241C40ACc/sources/home/felipenovaesrocha/Projects/1Hive/staking/packages/protocol/contracts/Staking.sol
Check if `_sender` can unlock `@tokenAmount(self.token(): address, _amount)` from `_user`'s lock managed by `_lockManager` _sender Address that would try to unlock tokens _user Owner of lock _lockManager Lock manager _amount Amount of locked tokens to unlock. If zero, the full locked amount. return Whether sender i...
function canUnlock(address _sender, address _user, address _lockManager, uint256 _amount) external view returns (bool) { return _canUnlockUnsafe(_sender, _user, _lockManager, _amount); }
11,619,253
/** *Submitted for verification at Etherscan.io on 2021-03-13 */ pragma solidity ^0.5.16; pragma experimental ABIEncoderV2; /** * @title Bird's BController Interface */ contract BControllerInterface { /// @notice Indicator that this is a BController contract (for inspection) bool public constant isBCont...
Check caller = admin Associate symbols with tokens
function initialiseTokens(string[] memory symbols, address[] memory bTokens) public { require(msg.sender == admin); require(symbols.length == bTokens.length); for (uint256 i = 0; i < symbols.length; i++) { birdTokens[symbols[i]] = bTokens[i]; } }
2,247,792
pragma solidity ^0.5.0; import "../../lib/date/BokkyPooBahsDateTimeLibrary.sol"; /** * @title DateTime * @dev Library with convenience functions for working with datetime and timestamp values. * Wraps calls to BokkyPooBahsDateTimeLibrary library (https://github.com/bokkypoobah/BokkyPooBahsDateTimeLibrary). */ lib...
Code based on https://github.com/bokkypoobah/BokkyPooBahsDateTimeLibrary
function isValidYearAndMonth(uint year, uint month) internal pure returns (bool) { return (year >= 1970 && month > 0 && month <= 12); }
12,912,289
// SPDX-License-Identifier: MIT pragma solidity 0.8.7; import "../lendingpool/DataTypes.sol"; import "../credit/CreditSystem.sol"; import "./KyokoMath.sol"; import "./PercentageMath.sol"; import "./ReserveLogic.sol"; import "./GenericLogic.sol"; import "@openzeppelin/contracts-upgradeable/utils/math/SafeMathUpgradeabl...
Gets the decimals of the underlying asset of the reserve self The reserve configuration return The decimals of the asset/
function getDecimal(DataTypes.ReserveData storage self) internal view returns (uint8) { return self.decimals; }
11,804,921
// // This file is part of TrustEth. // Copyright (c) 2016 Jacob Dawid <jacob@omg-it.works> // // TrustEth is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as // published by the Free Software Foundation, either version 3 of the // License, or...
As a buyer, pay a transaction. Bail out in case the transaction id is invalid. Retrieve the amount of ethers that have been sent along. If the amount of ethers does not suffice to pay, bail out :( Calculate how much has been overpaid. ..and kindly return the payback :) Now take the remaining amount and send to the sell...
function payEther(uint transactionId) { uint etherPaid = msg.value; uint etherAskedFor = transactions[transactionId].amount; uint etherNeeded = etherAskedFor + transactionFee; uint payback = etherPaid - etherNeeded; msg.sender.send(payback); sellers[transactions[transactionId...
5,372,931