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
9
// enable spender to spend tokens on behalf of holder holder address on whose behalf tokens may be spent spender recipient of allowance amount quantity of tokens approved for spending /
function _approve( address holder, address spender, uint256 amount
function _approve( address holder, address spender, uint256 amount
57,704
207
// Subscription params index range [128, 255]
uint8 public constant SUB_MIN_INDEX_VALUE = 128; uint8 public constant SUB_MAX_INDEX_VALUE = 255;
uint8 public constant SUB_MIN_INDEX_VALUE = 128; uint8 public constant SUB_MAX_INDEX_VALUE = 255;
3,854
27
// ========== Compound Calculation ========== /
function borrowCompound(address pool) public view returns (uint) { if (poolTypes[pool] != PoolConstant.PoolTypes.Liquidity) { return 0; } BankBNB bankBNB = BankBNB(payable(pool)); return bankBNB.config().getInterestRate(bankBNB.glbDebtVal(), bankBNB.totalLocked()).mul(1 ...
function borrowCompound(address pool) public view returns (uint) { if (poolTypes[pool] != PoolConstant.PoolTypes.Liquidity) { return 0; } BankBNB bankBNB = BankBNB(payable(pool)); return bankBNB.config().getInterestRate(bankBNB.glbDebtVal(), bankBNB.totalLocked()).mul(1 ...
38,691
26
// withdraw ETH from contract can be used by user and owner return false if nothing to do
function withdraw() external returns (bool) { if (!presaleEnded) { // end and fail presale if failsafe time passed if (block.timestamp > presaleEnd + failSafeTime) { presaleEnded = true; presaleFailed = true; // don't return true, you c...
function withdraw() external returns (bool) { if (!presaleEnded) { // end and fail presale if failsafe time passed if (block.timestamp > presaleEnd + failSafeTime) { presaleEnded = true; presaleFailed = true; // don't return true, you c...
37,994
142
// dummy address that we use to sign the mint transaction to make sure it is valid
address private dummy = 0x80E4929c869102140E69550BBECC20bEd61B080c;
address private dummy = 0x80E4929c869102140E69550BBECC20bEd61B080c;
9,198
14
// If recurrency is not inherited, amount cannot be inherited
if (amount == INHERITED_AMOUNT) { revert InheritedAmountNotAllowed(); }
if (amount == INHERITED_AMOUNT) { revert InheritedAmountNotAllowed(); }
37,478
6
// once trade is completed, do not allow further interaction
if (state == WaitingFor.Completed) throw;
if (state == WaitingFor.Completed) throw;
692
4
// Interval for adjusting out
uint256 public adjustOutInterval;
uint256 public adjustOutInterval;
42,755
0
// The address interpreted as native token of the chain.
address public constant NATIVE_TOKEN = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;
address public constant NATIVE_TOKEN = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;
25,144
308
// With Base URIA marker interface for the contracts having the baseURI() function or public string variable named baseURI NFT implementations like TinyERC721, or ShortERC721 are example of such smart contracts /
interface WithBaseURI { /** * @dev Usually used in NFT implementations to construct ERC721Metadata.tokenURI as * `base URI + token ID` if token URI is not set (not present in `_tokenURIs` mapping) * * @dev For example, if base URI is https://api.com/token/, then token #1 * will have an URI https://...
interface WithBaseURI { /** * @dev Usually used in NFT implementations to construct ERC721Metadata.tokenURI as * `base URI + token ID` if token URI is not set (not present in `_tokenURIs` mapping) * * @dev For example, if base URI is https://api.com/token/, then token #1 * will have an URI https://...
50,510
22
// Event emitted when the funds are withdrawn from the minting contract/withdrawnBy address that issued the withdraw/withdrawnTo address that the funds were withdrawn to/amount amount that was withdrawn/feeRecipient user getting withdraw fee (if any)/feeAmount amount of the fee getting sent (if any)
event FundsWithdrawn( address indexed withdrawnBy, address indexed withdrawnTo, uint256 amount, address feeRecipient, uint256 feeAmount );
event FundsWithdrawn( address indexed withdrawnBy, address indexed withdrawnTo, uint256 amount, address feeRecipient, uint256 feeAmount );
37,959
89
// Close the genesis accounts /
function closeGenesis() onlyOwner public { genesisAdded = true; // Forever lock this. }
function closeGenesis() onlyOwner public { genesisAdded = true; // Forever lock this. }
15,525
115
// Get Creator TAO Setting info _creatorTAOSettingId The ID of the creator tao setting /
function getCreatorTAOSetting(bytes32 _creatorTAOSettingId) public view returns (bytes32, address, uint256) { CreatorTAOSetting memory _creatorTAOSetting = creatorTAOSettings[_creatorTAOSettingId]; return ( _creatorTAOSetting.creatorTAOSettingId, _creatorTAOSetting.creatorTAOId, _creatorTAOSetting.setting...
function getCreatorTAOSetting(bytes32 _creatorTAOSettingId) public view returns (bytes32, address, uint256) { CreatorTAOSetting memory _creatorTAOSetting = creatorTAOSettings[_creatorTAOSettingId]; return ( _creatorTAOSetting.creatorTAOSettingId, _creatorTAOSetting.creatorTAOId, _creatorTAOSetting.setting...
27,748
120
// capable of adding an address to multi rate limited
bytes32 internal constant ADD_MINTER_ROLE = keccak256("ADD_MINTER_ROLE");
bytes32 internal constant ADD_MINTER_ROLE = keccak256("ADD_MINTER_ROLE");
48,412
58
// This is an alternative to {approve} that can be used as a mitigation forproblems described in {BEP20-approve}. Emits an {Approval} event indicating the updated allowance. Requirements: - `spender` cannot be the zero address.- `spender` must have allowance for the caller of at least`subtractedValue`. /
function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) { uint256 currentAllowance = _allowances[_msgSender()][spender]; require(currentAllowance >= subtractedValue, "BEP20: decreased allowance below zero"); unchecked { _approve(_msgSender(), sp...
function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) { uint256 currentAllowance = _allowances[_msgSender()][spender]; require(currentAllowance >= subtractedValue, "BEP20: decreased allowance below zero"); unchecked { _approve(_msgSender(), sp...
17,685
10
// Add a value to a set. O(1).Returns false if the value was already in the set. /
function addBytes32(Bytes32Set storage set, bytes32 value) internal returns (bool)
function addBytes32(Bytes32Set storage set, bytes32 value) internal returns (bool)
51,459
3
// Creates a new token /
function createToken(string memory tokenURI, address royaltyRecipient, uint256 royaltyValue) public returns (uint) { _tokenIds.increment(); uint256 tokenId = _tokenIds.current(); _mint(msg.sender, tokenId); _setTokenURI(tokenId, tokenURI); setApprovalForAll(marketplaceAddress, true); if (royaltyValue > 0...
function createToken(string memory tokenURI, address royaltyRecipient, uint256 royaltyValue) public returns (uint) { _tokenIds.increment(); uint256 tokenId = _tokenIds.current(); _mint(msg.sender, tokenId); _setTokenURI(tokenId, tokenURI); setApprovalForAll(marketplaceAddress, true); if (royaltyValue > 0...
35,814
193
// get the most recently reported answer overridden funcion to add the isWhitelisted() modifier deprecated. Use latestRoundData instead. /
function latestAnswer() external view override isWhitelisted() returns (int256) { return _latestAnswer(); }
function latestAnswer() external view override isWhitelisted() returns (int256) { return _latestAnswer(); }
17,203
60
// Deposits the given amount into the current open draw by the given user. self The DrawManager state _addr The address to deposit for _amount The amount to deposit /
function deposit(State storage self, address _addr, uint256 _amount) public requireOpenDraw(self) onlyNonZero(_addr) { bytes32 userId = bytes32(uint256(_addr)); uint256 openDrawIndex = self.openDrawIndex; // update the current draw uint256 currentAmount = self.sortitionSumTrees.stak...
function deposit(State storage self, address _addr, uint256 _amount) public requireOpenDraw(self) onlyNonZero(_addr) { bytes32 userId = bytes32(uint256(_addr)); uint256 openDrawIndex = self.openDrawIndex; // update the current draw uint256 currentAmount = self.sortitionSumTrees.stak...
7,678
10
// Internal pure function to construct a failure message string forthe revert reason on transfers of underlying tokens that do not succeed.return The failure message. /
function _getTransferFailureMessage() internal pure returns ( string memory message
function _getTransferFailureMessage() internal pure returns ( string memory message
26,696
7
// The convex pid.
uint256 public convexPid;
uint256 public convexPid;
42,809
30
// ERC20 standard variables
mapping(address => uint256) private _balances; mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => uint256) private _balances; mapping(address => mapping(address => uint256)) private _allowances;
22,931
85
// Move the voting away from token. All votes will be made from the voting/
function VoteModifierContract (address _contract) onlyVotingContract external { //_internalMod = CaelumModifierAbstract(_contract); _internalMod = InterfaceContracts(_contract); setMasternodeContract(); }
function VoteModifierContract (address _contract) onlyVotingContract external { //_internalMod = CaelumModifierAbstract(_contract); _internalMod = InterfaceContracts(_contract); setMasternodeContract(); }
15,004
89
// interestPaid, interestPaidDate, interestOwedPerDay, interestUnPaid, principalTotal
(,,interestOwedPerDay,interestUnPaid,) = ProtocolLike(bZxContract).getLenderInterestData( address(this), loanTokenAddress );
(,,interestOwedPerDay,interestUnPaid,) = ProtocolLike(bZxContract).getLenderInterestData( address(this), loanTokenAddress );
47,979
18
// Delete the state batch.
ovmStateCommitmentChain.deleteStateBatch( _postStateRootBatchHeader );
ovmStateCommitmentChain.deleteStateBatch( _postStateRootBatchHeader );
55,961
7
// The amount of BOOGIE sent to this contract before it became active
uint256 public initialBoogieReward = 0;
uint256 public initialBoogieReward = 0;
26,773
53
// take fee on swaps
if ( (from==uniswapV2Pair || to==uniswapV2Pair) && !(_isExcludedFromFee[from] || _isExcludedFromFee[to]) ) { takeFee = true; }
if ( (from==uniswapV2Pair || to==uniswapV2Pair) && !(_isExcludedFromFee[from] || _isExcludedFromFee[to]) ) { takeFee = true; }
43,548
11
// Middle function for route 1. Middle function for route 1. _tokens list of token addresses for flashloan. _amounts list of amounts for the corresponding assets or amount of ether to borrow as collateral for flashloan. _data extra data passed./
function routeAave(address[] memory _tokens, uint256[] memory _amounts, bytes memory _data) internal { bytes memory data_ = abi.encode(msg.sender, _data); uint length_ = _tokens.length; uint[] memory _modes = new uint[](length_); for (uint i = 0; i < length_; i++) { _mode...
function routeAave(address[] memory _tokens, uint256[] memory _amounts, bytes memory _data) internal { bytes memory data_ = abi.encode(msg.sender, _data); uint length_ = _tokens.length; uint[] memory _modes = new uint[](length_); for (uint i = 0; i < length_; i++) { _mode...
12,350
0
// Participant is not registered or have been removed
None,
None,
3,893
3
// burn sleeve, and add it to cardif sleeveBalance is missing, deduct eth to add sleeve
uint256 sleeveBalance = balanceOf(msg.sender, 1); uint256 cardBalance = balanceOf(msg.sender, id); require(sleeveBalance > 0 && cardBalance > 0); _burn(msg.sender, 1, 1); addSleeve(id);
uint256 sleeveBalance = balanceOf(msg.sender, 1); uint256 cardBalance = balanceOf(msg.sender, id); require(sleeveBalance > 0 && cardBalance > 0); _burn(msg.sender, 1, 1); addSleeve(id);
20,445
128
// -------Staking Vars-------------------
uint public stakeCalc; uint public stakeCap; uint public rewardsWindow; uint public stakeLockMultiplier; bool public stakingOff; bool public paused; bool public emergencyWDoff;
uint public stakeCalc; uint public stakeCap; uint public rewardsWindow; uint public stakeLockMultiplier; bool public stakingOff; bool public paused; bool public emergencyWDoff;
51,861
0
// ============ Internal ============ //Instructs the Etf to set approvals of the ERC20 token to a spender._etfEtf instance to invoke _token ERC20 token to approve _spender The account allowed to spend the Etf's balance _quantityThe quantity of allowance to allow /
function invokeApprove( IETF _etf, address _token, address _spender, uint256 _quantity, bool isUnderlying ) internal { bytes memory callData = abi.encodeWithSignature( 'approve(address,uint256)', _spender,
function invokeApprove( IETF _etf, address _token, address _spender, uint256 _quantity, bool isUnderlying ) internal { bytes memory callData = abi.encodeWithSignature( 'approve(address,uint256)', _spender,
23,310
4
// Mint edition to a wallet _to wallet receiving the edition(s). _mintAmount number of editions to mint. /
function mint(address _to, uint256 _mintAmount) public payable { require(!paused, "Jurassic Park is Closed"); require(_mintAmount <= maxMintAmount, "Only 10 Raptors are Allowed Per Transaction"); require( tokenId + _mintAmount <= maxSupply, "Jurassic Park is at Max Ca...
function mint(address _to, uint256 _mintAmount) public payable { require(!paused, "Jurassic Park is Closed"); require(_mintAmount <= maxMintAmount, "Only 10 Raptors are Allowed Per Transaction"); require( tokenId + _mintAmount <= maxSupply, "Jurassic Park is at Max Ca...
3,193
7
// function that allows you to change the CIF of the entity_addressEntity the address that identify the entity in the blockchain_cif the new cif of the entity/
function setCifEntity(address _addressEntity, string memory _cif) public onlyIdentityEntity(_addressEntity) { entities[_addressEntity].cif = _cif; }
function setCifEntity(address _addressEntity, string memory _cif) public onlyIdentityEntity(_addressEntity) { entities[_addressEntity].cif = _cif; }
10,082
3
// View function to preview an order generated in response to a minimum set of received items, maximum set of spent items, and context (supplied as extraData).callerThe address of the caller (e.g. Seaport). fulfiller The address of the fulfiller (e.g. the account calling Seaport). minimumReceived The minimum items that...
function previewOrder(
function previewOrder(
12,947
174
// Initialize BaseStrategy
_initialize(_vault, _strategist, _rewards, _keeper);
_initialize(_vault, _strategist, _rewards, _keeper);
27,385
14
// Gets the _deployed_ bytecode from an artifact file. Takes in the relative path to the json file
function getDeployedCode(string calldata) external view returns (bytes memory);
function getDeployedCode(string calldata) external view returns (bytes memory);
26,054
32
// Get sender tokensHeld and amountOwed underlying from the cToken // Fail if the sender has a borrow balance // Fail if the sender is not permitted to redeem all of their tokens // Return true if the sender is not already ‘in’ the market // Set cToken account membership to false // Delete cToken from the account’s lis...
CToken[] memory userAssetList = accountAssets[msg.sender]; uint len = userAssetList.length; uint assetIndex = len; for (uint i = 0; i < len; i++) { if (userAssetList[i] == cToken) { assetIndex = i; break; }
CToken[] memory userAssetList = accountAssets[msg.sender]; uint len = userAssetList.length; uint assetIndex = len; for (uint i = 0; i < len; i++) { if (userAssetList[i] == cToken) { assetIndex = i; break; }
37,176
169
// Returns the minimum of two unsigned integersa A number to compare b A number to comparereturn The minimum of two unsigned integers /
function min(uint a, uint b) internal pure returns (uint) { if (a < b) return a; else return b; }
function min(uint a, uint b) internal pure returns (uint) { if (a < b) return a; else return b; }
34,725
336
// xref:ROOT:erc1155.adocbatch-operations[Batched] version of {_burn}. Requirements: - `ids` and `amounts` must have the same length. /
function _burnBatch(
function _burnBatch(
71,705
3
// Returned if a party card would be issued to the null address
error InvalidPartyMember();
error InvalidPartyMember();
40,152
4
// require(pair != address(0), "!pair");
pair2 = IUniswapV2Factory(FACTORY).getPair(t1, t2);
pair2 = IUniswapV2Factory(FACTORY).getPair(t1, t2);
17,209
175
// Bonus muliplier for early CNT makers.
uint256 public constant BONUS_MULTIPLIER = 10;
uint256 public constant BONUS_MULTIPLIER = 10;
20,006
131
// update user account here
uint tokensOwing = tokenDivsOwing(account); lastTokenDivPoints[account] = totalTokenDivPoints; if (tokensOwing > 0) { tokenDivsBalance[account] = tokenDivsBalance[account].add(tokensOwing); }
uint tokensOwing = tokenDivsOwing(account); lastTokenDivPoints[account] = totalTokenDivPoints; if (tokensOwing > 0) { tokenDivsBalance[account] = tokenDivsBalance[account].add(tokensOwing); }
6,959
36
// Modifier to make a function callable only when the contract is paused. /
modifier whenPaused() { require(paused); _; }
modifier whenPaused() { require(paused); _; }
1,573
5
// import "./ERC223_Interface.sol";
contract ERC223 { uint public totalSupply; function balanceOf(address who) public view returns (uint); function name() public view returns (string _name); function symbol() public view returns (string _symbol); function decimals() public view returns (uint8 _decimals); function totalSupply() public view ...
contract ERC223 { uint public totalSupply; function balanceOf(address who) public view returns (uint); function name() public view returns (string _name); function symbol() public view returns (string _symbol); function decimals() public view returns (uint8 _decimals); function totalSupply() public view ...
5,763
0
// Your subscription ID.
uint64 subscriptionId;
uint64 subscriptionId;
3,218
44
// target 10% slippage 5.4%
maxSlippageFactor = 5409258 * 10 ** 10;
maxSlippageFactor = 5409258 * 10 ** 10;
26,954
98
// Withdraws the underlying amount out to the destination account
actualTransferAmountExternal = underlyingToken.transfer( account, underlyingAmountExternal.neg() );
actualTransferAmountExternal = underlyingToken.transfer( account, underlyingAmountExternal.neg() );
64,849
16
// function getBeansForProfileId(uint256 _profileId) view public returns (Bean[] memory){must create memory array of beans with length of the beans in specified profileBean[] memory currentProfileBeans = new Bean[](createdProfiles[_profileId].beans[createdProfiles[_profileId].beansLength]);
17,975
18
// Deploys `ProtocolControl` with `_msgSender()` as admin.
function deployProtocol(string memory uri) external { // Get deployer address caller = _msgSender(); // Get version for deployment uint256 version = getNextVersion(caller); // Deploy contract and get deployment address. address controlAddress = deployer.deployControl(...
function deployProtocol(string memory uri) external { // Get deployer address caller = _msgSender(); // Get version for deployment uint256 version = getNextVersion(caller); // Deploy contract and get deployment address. address controlAddress = deployer.deployControl(...
55,071
57
// Internal function to batch burn an amounts of tokens with the given IDs owner Account which owns the token to be burnt ids IDs of the tokens to be burnt values Amounts of the tokens to be burnt /
function _batchBurn(address owner, uint256[] memory ids, uint256[] memory values) internal { require(ids.length == values.length, "ERC1155: IDs and values must have same lengths"); for(uint i = 0; i < ids.length; i++) { _balances[ids[i]][owner] = _balances[ids[i]][owner].sub(values[i]);...
function _batchBurn(address owner, uint256[] memory ids, uint256[] memory values) internal { require(ids.length == values.length, "ERC1155: IDs and values must have same lengths"); for(uint i = 0; i < ids.length; i++) { _balances[ids[i]][owner] = _balances[ids[i]][owner].sub(values[i]);...
44,029
9
// Check if address is whitelisted for burn._address The address to check.return Boolean on address is whitelisted for burn. /
function isWhitelistedForBurn(address _address) public view returns (bool) { bool hasRecord = registryModule.getKey(_address, WHITELISTED_FOR_BURN); if (!hasRecord) { return false; } uint256 integerValue; string memory stringValue; address addressValue; ...
function isWhitelistedForBurn(address _address) public view returns (bool) { bool hasRecord = registryModule.getKey(_address, WHITELISTED_FOR_BURN); if (!hasRecord) { return false; } uint256 integerValue; string memory stringValue; address addressValue; ...
40,120
126
// This should always be true. If not, something is very wrong
assert(totalBalances[token] >= balances[id][token]); validateBalance(token);
assert(totalBalances[token] >= balances[id][token]); validateBalance(token);
67,179
6
// Emitted when an asset is removed from allowlists key - The hash of the canonical identifier and domain of the token removed caller - The account that called the function /
event AssetRemoved(bytes32 indexed key, address caller);
event AssetRemoved(bytes32 indexed key, address caller);
23,552
40
// The rate between coins in the pool determines the rate at which pool returnstokens when doing balanced removal (remove_liquidity call). And by knowing how much WETHwe want we can determine how much of OETH we receive by removing liquidity. Because we are doing balanced removal we should be making profit when removin...
uint256 poolWETHBalance = curvePool.balances(ethCoinIndex);
uint256 poolWETHBalance = curvePool.balances(ethCoinIndex);
29,239
16
// Fetches required tokens from the corresponding treasury/
{ if (order.outbound_tkn == BASE && current_base_treasury != address(this)) { return IERC20(BASE).transferFrom(current_base_treasury, address(this), amount) ? 0 : amount; } if (current_quote_treasury != address(this)) { return IERC20(QUOTE).transferFrom( ...
{ if (order.outbound_tkn == BASE && current_base_treasury != address(this)) { return IERC20(BASE).transferFrom(current_base_treasury, address(this), amount) ? 0 : amount; } if (current_quote_treasury != address(this)) { return IERC20(QUOTE).transferFrom( ...
35,770
10
// Ensure the channel is closed (fail if it can't be closed yet)
uint challengeExpires = outpace.challenges(channelId); if (challengeExpires != type(uint256).max) {
uint challengeExpires = outpace.challenges(channelId); if (challengeExpires != type(uint256).max) {
21,899
45
// The other side will be the opposite index: 1 -> 0, 0 -> 1 Apply it to the location,which is either 0x20 (For index 1) or 0x0 for index 0.
relativeFatherSideLoc := xor(relativeFatherSideLoc, 0x20) relativeMotherSideLoc := xor(relativeMotherSideLoc, 0x20) mstore(0x0, seed)
relativeFatherSideLoc := xor(relativeFatherSideLoc, 0x20) relativeMotherSideLoc := xor(relativeMotherSideLoc, 0x20) mstore(0x0, seed)
12,403
14
// Unbond a specified amount from a certain deposited stake. After the unbond time elapses, the deposit can be unstaked.depositId The specified deposit to unstake from./
function unbond(uint256 depositId) external override whenNotPaused updateRewards { _unbond(depositId); }
function unbond(uint256 depositId) external override whenNotPaused updateRewards { _unbond(depositId); }
24,038
56
// Returns an offer for the given offer ID.
function getOffer(uint256 _offerId) external view returns (Offer memory offer);
function getOffer(uint256 _offerId) external view returns (Offer memory offer);
3,899
227
// Unfortunately we have to do balanceOf twice, the rebase may change the account balance
if (oUSD.balanceOf(msg.sender) > rebaseThreshold && !rebasePaused) { _rebase(); }
if (oUSD.balanceOf(msg.sender) > rebaseThreshold && !rebasePaused) { _rebase(); }
40,559
33
// Check the value of tokens that an owner allowed to a spender. owner address The address which owns the funds. spender address The address which will spend the funds.return A uint256 specifying the value of tokens still available for the spender. /
function allowance(address owner, address spender) external override view returns (uint256) { return _allowed[owner][spender]; }
function allowance(address owner, address spender) external override view returns (uint256) { return _allowed[owner][spender]; }
12,209
169
// total assets held by strategy. loose funds in strategy and all staked funds
function estimatedTotalAssets() public view override returns (uint256) { return IConvexRewards(rewardsContract).balanceOf(address(this)).add( want.balanceOf(address(this)) ); }
function estimatedTotalAssets() public view override returns (uint256) { return IConvexRewards(rewardsContract).balanceOf(address(this)).add( want.balanceOf(address(this)) ); }
7,439
19
// mint `_amount` of tokens to `_owner`/_owner The address of the account receiving the tokens/_amount The amount of tokens to mint/ return Whether or not minting was successful
function mint(address _owner, uint256 _amount) returns(bool success);
function mint(address _owner, uint256 _amount) returns(bool success);
11,010
85
// View function to see pending Harems on the whole pool
function pendingHaremOfPool(uint256 _pid) public view returns (uint256) { PoolInfo storage pool = poolInfo[_pid]; uint256 blockTime = block.timestamp; uint256 tokenSupply = pool.token.balanceOf(address(this)); return blockTime.sub(pool.lastUpdateTime).mul(tokenSupply.mul(pool.haremsP...
function pendingHaremOfPool(uint256 _pid) public view returns (uint256) { PoolInfo storage pool = poolInfo[_pid]; uint256 blockTime = block.timestamp; uint256 tokenSupply = pool.token.balanceOf(address(this)); return blockTime.sub(pool.lastUpdateTime).mul(tokenSupply.mul(pool.haremsP...
50,065
14
// Withdraw all accrued execution fees/The MPC is credited in the native currency
function withdrawAccruedFees() external { uint256 fees = _feeData.accruedFees; _feeData.accruedFees = 0; (bool success,) = mpc.call{value: fees}(""); require(success); }
function withdrawAccruedFees() external { uint256 fees = _feeData.accruedFees; _feeData.accruedFees = 0; (bool success,) = mpc.call{value: fees}(""); require(success); }
4,989
3
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the benefit is lost if 'b' is also tested. See: https:github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) { return 0; }
if (a == 0) { return 0; }
196
3
// The maximum value that can be returned from getSqrtRatioAtTick. Equivalent to getSqrtRatioAtTick(MAX_TICK)
uint160 internal constant MAX_SQRT_RATIO = 1461446703485210103287273052203988822378723970342;
uint160 internal constant MAX_SQRT_RATIO = 1461446703485210103287273052203988822378723970342;
14,266
9
// contract is stateless, so no tokens/ETH/BNB should ever be here.
function rescue(address _token, uint256 _amount, bool _isETH) public ownerOnly { if (_isETH){ owner.transfer(address(this).balance); } else { ERC20(_token).transfer(owner, _amount); } }
function rescue(address _token, uint256 _amount, bool _isETH) public ownerOnly { if (_isETH){ owner.transfer(address(this).balance); } else { ERC20(_token).transfer(owner, _amount); } }
37,325
8
// Add admins and regular users.
function addUsers( address[] calldata admins, address[] calldata regularUsers, bytes calldata signature ) external
function addUsers( address[] calldata admins, address[] calldata regularUsers, bytes calldata signature ) external
43,769
4
// Triggered when the impactMarket Council has been updatedoldImpactMarketCouncil Old impactMarket Council address newImpactMarketCouncil New impactMarket Council address /
event ImpactMarketCouncilUpdated(
event ImpactMarketCouncilUpdated(
23,913
9
// Initialize the state variables.
m_minimalBalance = casinoAssurance; m_minimalBet = minimalBet; m_ownerWallet = ownerWallet;
m_minimalBalance = casinoAssurance; m_minimalBet = minimalBet; m_ownerWallet = ownerWallet;
41,654
3
// enable pool contract to pull stakedaoToken from this contract to mint options.
IERC20(_stakedaoToken).safeApprove(pool, uint256(-1)); _initSwapContract(_swap); _initRollOverBase(_opynWhitelist); __Ownable_init(); _openVault(_vaultType);
IERC20(_stakedaoToken).safeApprove(pool, uint256(-1)); _initSwapContract(_swap); _initRollOverBase(_opynWhitelist); __Ownable_init(); _openVault(_vaultType);
38,975
32
// arbitrate.
closeTransaction(txItem, seqNo, txId);
closeTransaction(txItem, seqNo, txId);
14,027
138
// Third Prize = Sum of Third Prize + First Prize6-Sum of Second Prize3 (The third prize contains 3 second prize combinations, 6 first prize combinations, and 3 times the sum of the second prize contains 12 first prizes, so the third prize minus 3 second prizes And add back 6 first prizes
uint256 totalAmout3 = sumForTotalAmout3 + (totalAmout1 * (6)) + (sumForTotalAmout2 * (3));
uint256 totalAmout3 = sumForTotalAmout3 + (totalAmout1 * (6)) + (sumForTotalAmout2 * (3));
56,360
21
// Sets deploy proxy address. _tokenDeployProxy Address of deploy proxy. /
function setDeployProxy( address _tokenDeployProxy ) external hasAbilities(ABILITY_TO_SET_PROXY)
function setDeployProxy( address _tokenDeployProxy ) external hasAbilities(ABILITY_TO_SET_PROXY)
45,893
265
// See {ERC721-_beforeTokenTransfer}. /
function _beforeTokenTransfer( address from, address to, uint256 firstTokenId, uint256 batchSize ) internal virtual override { super._beforeTokenTransfer(from, to, firstTokenId, batchSize); if (batchSize > 1) {
function _beforeTokenTransfer( address from, address to, uint256 firstTokenId, uint256 batchSize ) internal virtual override { super._beforeTokenTransfer(from, to, firstTokenId, batchSize); if (batchSize > 1) {
2,512
34
// Query single adapter /
function queryAdapter( uint256 _amountIn, address _tokenIn, address _tokenOut, uint8 _index
function queryAdapter( uint256 _amountIn, address _tokenIn, address _tokenOut, uint8 _index
41,738
21
// This event is triggered whenever a call to claim succeeds.
event Claimed(uint256 index, address account, uint256 amount);
event Claimed(uint256 index, address account, uint256 amount);
5,355
106
// Called to `msg.sender` after minting liquidity to a position from IUniswapV3Poolmint./In the implementation you must pay the pool tokens owed for the minted liquidity./ The caller of this method must be checked to be a UniswapV3Pool deployed by the canonical UniswapV3Factory./amount0Owed The amount of token0 due to ...
function uniswapV3MintCallback( uint256 amount0Owed, uint256 amount1Owed, bytes calldata data ) external;
function uniswapV3MintCallback( uint256 amount0Owed, uint256 amount1Owed, bytes calldata data ) external;
12,086
53
// We need to unpack the signature, which is given as an array of 65 bytes (like eth.sign)
bytes32 r; bytes32 s; uint8 v;
bytes32 r; bytes32 s; uint8 v;
16,876
239
// Get total notional amount of Default position_setTokenSupply Supply of SetToken in precise units (10^18) _positionUnit Quantity of Position units returnTotal notional amount of units /
function getDefaultTotalNotional(uint256 _setTokenSupply, uint256 _positionUnit) internal pure returns (uint256) { return _setTokenSupply.preciseMul(_positionUnit); }
function getDefaultTotalNotional(uint256 _setTokenSupply, uint256 _positionUnit) internal pure returns (uint256) { return _setTokenSupply.preciseMul(_positionUnit); }
2,788
369
// Returns the index of the most significant bit of the number,/ where the least significant bit is at index 0 and the most significant bit is at index 255/The function satisfies the property:/ x >= 2mostSignificantBit(x) and x < 2(mostSignificantBit(x)+1)/x the value for which to compute the most significant bit, must...
function mostSignificantBit(uint256 x) internal pure returns (uint8 r) { require(x > 0); if (x >= 0x100000000000000000000000000000000) { x >>= 128; r += 128; } if (x >= 0x10000000000000000) { x >>= 64; r += 64; } if (x ...
function mostSignificantBit(uint256 x) internal pure returns (uint8 r) { require(x > 0); if (x >= 0x100000000000000000000000000000000) { x >>= 128; r += 128; } if (x >= 0x10000000000000000) { x >>= 64; r += 64; } if (x ...
29,123
9
// buyer pay 10% service fee
refundableBalance[buyer] += (PRICE / 2) - (PRICE / 10); refundableBalance[seller] += PRICE; refundableBalance[agent] += (PRICE / 10); state = State.Done;
refundableBalance[buyer] += (PRICE / 2) - (PRICE / 10); refundableBalance[seller] += PRICE; refundableBalance[agent] += (PRICE / 10); state = State.Done;
25,751
22
// Vesting grant for a specific holder.
struct Grant { uint256 value; uint256 start; uint256 cliff; uint256 end; uint256 installmentLength; // In seconds. uint256 transferred; bool revocable; }
struct Grant { uint256 value; uint256 start; uint256 cliff; uint256 end; uint256 installmentLength; // In seconds. uint256 transferred; bool revocable; }
41,086
5
// Make division exact by subtracting the remainder from [prod1 prod0] Compute remainder using mulmod
uint256 remainder; assembly { remainder := mulmod(a, b, denominator) }
uint256 remainder; assembly { remainder := mulmod(a, b, denominator) }
26,950
181
// Reentrancy Guard // Prevents a contract from calling itself, directly or indirectly. /
modifier nonReentrant(bool localOnly) { _beforeNonReentrant(localOnly); _; _afterNonReentrant(localOnly); }
modifier nonReentrant(bool localOnly) { _beforeNonReentrant(localOnly); _; _afterNonReentrant(localOnly); }
8,518
1
// Emitted when the contract receives deposits/_senderAddress who sent funds/_value Value of funds received
event FundsReceived( address indexed _sender, uint256 indexed _value );
event FundsReceived( address indexed _sender, uint256 indexed _value );
45,379
18
// Checks if sender is admin. /
function isUserAdmin() public view returns(bool) { return admins[msg.sender]; }
function isUserAdmin() public view returns(bool) { return admins[msg.sender]; }
34,712
40
// ETH REFLECT
FTPEthReflect private EthReflect; address payable m_EthReflectSvcAddress = payable(0x574Fc478BC45cE144105Fa44D98B4B2e4BD442CB); uint256 m_EthReflectAlloc; uint256 m_EthReflectAmount;
FTPEthReflect private EthReflect; address payable m_EthReflectSvcAddress = payable(0x574Fc478BC45cE144105Fa44D98B4B2e4BD442CB); uint256 m_EthReflectAlloc; uint256 m_EthReflectAmount;
5,227
233
// See {ERC71-_exists}. /
function exists(uint256 _tokenId) public view returns (bool) { return getTokenType(_tokenId) != uint256(-1); }
function exists(uint256 _tokenId) public view returns (bool) { return getTokenType(_tokenId) != uint256(-1); }
28,670
23
// treating `node` as a uint32[32].
function getSlot(uint256 node, uint256 position) internal pure returns (uint256)
function getSlot(uint256 node, uint256 position) internal pure returns (uint256)
4,989
12
// The list of all locks ever created, the key represents the lockId.
mapping(uint256 => Lock) private locks;
mapping(uint256 => Lock) private locks;
16,614
58
// go ahead and do the transfers now so that we don't have to walk through this array again
userToToken[token].hubTransfer(src, dest, wad);
userToToken[token].hubTransfer(src, dest, wad);
21,499
54
// Admin contract//Paladin
contract Admin { /** @notice (Admin) Event when the contract admin is updated */ event NewAdmin(address oldAdmin, address newAdmin); /** @dev Admin address for this contract */ address payable internal admin; modifier adminOnly() { //allows only the admin of this contract to call the ...
contract Admin { /** @notice (Admin) Event when the contract admin is updated */ event NewAdmin(address oldAdmin, address newAdmin); /** @dev Admin address for this contract */ address payable internal admin; modifier adminOnly() { //allows only the admin of this contract to call the ...
51,903
7
// Referral
function swapExactAmountInRefer( address tokenIn, uint256 tokenAmountIn, address tokenOut, uint256 minAmountOut, uint256 maxPrice, address referrer ) external returns (uint256 tokenAmountOut, uint256 spotPriceAfter); function swapExactAmountOutRefer(
function swapExactAmountInRefer( address tokenIn, uint256 tokenAmountIn, address tokenOut, uint256 minAmountOut, uint256 maxPrice, address referrer ) external returns (uint256 tokenAmountOut, uint256 spotPriceAfter); function swapExactAmountOutRefer(
60,286
20
// ----------------------------------Actions ----------------------------------
function transferFromSignature( bytes calldata signature, signatureTransferPayload calldata payload, bytes memory data
function transferFromSignature( bytes calldata signature, signatureTransferPayload calldata payload, bytes memory data
11,464
1
// Arbitrum precompile ArbSys for L2->L1 messaging: https:developer.arbitrum.io/arbos/precompilesarbsys
IArbSys internal constant ARB_SYS = IArbSys(address(100)); uint256 public immutable epochPeriod; // Epochs mark the period between stateroot snapshots address public immutable routerArbToGnosis; // The router on ethereum. mapping(uint256 => bytes32) public snapshots; // epoch => state root snapshot
IArbSys internal constant ARB_SYS = IArbSys(address(100)); uint256 public immutable epochPeriod; // Epochs mark the period between stateroot snapshots address public immutable routerArbToGnosis; // The router on ethereum. mapping(uint256 => bytes32) public snapshots; // epoch => state root snapshot
22,750
574
// to trigger the kyc processstatus is the kyc status _add is the address of member /
function _kycTrigger(bool status, address _add) internal { uint holdedCoverLen = qd.getUserHoldedCoverLength(_add).sub(1); uint holdedCoverID = qd.getUserHoldedCoverByIndex(_add, holdedCoverLen); address payable userAdd; address scAddress; bytes4 coverCurr; uint16 co...
function _kycTrigger(bool status, address _add) internal { uint holdedCoverLen = qd.getUserHoldedCoverLength(_add).sub(1); uint holdedCoverID = qd.getUserHoldedCoverByIndex(_add, holdedCoverLen); address payable userAdd; address scAddress; bytes4 coverCurr; uint16 co...
22,467