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
2
// Contracts that should not own Ether Remco Bloemen <remco@2π.com> This tries to block incoming ether to prevent accidental loss of Ether. Should Ether end upin the contract, it will allow the owner to reclaim this ether. Ether can still be send to this contract by:calling functions labeled `payable``selfdestruct(contract_address)`mining directly to the contract address/
contract HasNoEther is Ownable { /** * @dev Transfer all Ether held by the contract to the owner. */ function reclaimEther(address ) external onlyOwner { address _owner = owner(); payable(_owner).transfer(address(this).balance); } function reclaimToken(address tokenAddress) external onlyOwner { require(tokenAddress != address(0),'tokenAddress can not a Zero address'); IERC20 token = IERC20(tokenAddress); address _owner = owner(); token.transfer(_owner,token.balanceOf(address(this))); } }
contract HasNoEther is Ownable { /** * @dev Transfer all Ether held by the contract to the owner. */ function reclaimEther(address ) external onlyOwner { address _owner = owner(); payable(_owner).transfer(address(this).balance); } function reclaimToken(address tokenAddress) external onlyOwner { require(tokenAddress != address(0),'tokenAddress can not a Zero address'); IERC20 token = IERC20(tokenAddress); address _owner = owner(); token.transfer(_owner,token.balanceOf(address(this))); } }
518
125
// Mints a new token with a seed./
function mintTo(address _to, string seed) external onlyMinter returns (uint) { return _mint(_to, seed); }
function mintTo(address _to, string seed) external onlyMinter returns (uint) { return _mint(_to, seed); }
39,992
2
// Initialises the addresses of the ETHBTC price feeds./_tbtcSystemAddress Address of the `TBTCSystem` contract. Used for access control./_ETHBTCPriceFeed The ETHBTC price feed address.
function initialize( address _tbtcSystemAddress, IMedianizer _ETHBTCPriceFeed ) external onlyOwner
function initialize( address _tbtcSystemAddress, IMedianizer _ETHBTCPriceFeed ) external onlyOwner
36,055
128
// Buys ZAPP beneficiary address of buyer eth amount of ETH sentreturn Amount of ZAPP bought /
function _buyZAPP(address beneficiary, uint256 eth) internal returns (uint256) { // Verify amount of ETH require(eth > 0, "Not enough ETH"); // First purchase if (_wallets[beneficiary].addr == address(0)) { _wallets[beneficiary].addr = payable(beneficiary); _walletKeys.push(beneficiary); } // Make sure the rate is consistent in this purchase uint256 rate = getRate(); // Calculate the amount of ZAPP to receive and add it to the total sold uint256 zapp = _calculateZAPPAmount(eth, rate); _soldZAPP = _soldZAPP.add(zapp); // Verify that this purchase isn't surpassing the hard cap, otherwise refund exceeding amount int256 exceeding = int256(_soldZAPP - _hardCap); uint256 exceedingZAPP = 0; uint256 exceedingETH = 0; if (exceeding > 0) { // Adjust sold amount and close Token Sale _soldZAPP = _hardCap; _ended = true; // Adjust amount of bought ZAPP and paid ETH exceedingZAPP = uint256(exceeding); exceedingETH = _calculateETHAmount(exceedingZAPP, rate); zapp = zapp.sub(exceedingZAPP); eth = eth.sub(exceedingETH); } // Adjust the buyer _wallets[beneficiary].purchase(eth, zapp); // Purchase adds total bought ZAPP to more than referrer minimum if (!_wallets[beneficiary].isReferrer && _wallets[beneficiary].buyer.zapp >= _referrerMin) { _wallets[beneficiary].isReferrer = true; _wallets[beneficiary].generateReferralCode(_codes); } // Refund the exceeding ETH // NOTE Checks-Effects-Interactions pattern if (exceeding > 0) _wallets[beneficiary].addr.transfer(exceedingETH); return zapp; }
function _buyZAPP(address beneficiary, uint256 eth) internal returns (uint256) { // Verify amount of ETH require(eth > 0, "Not enough ETH"); // First purchase if (_wallets[beneficiary].addr == address(0)) { _wallets[beneficiary].addr = payable(beneficiary); _walletKeys.push(beneficiary); } // Make sure the rate is consistent in this purchase uint256 rate = getRate(); // Calculate the amount of ZAPP to receive and add it to the total sold uint256 zapp = _calculateZAPPAmount(eth, rate); _soldZAPP = _soldZAPP.add(zapp); // Verify that this purchase isn't surpassing the hard cap, otherwise refund exceeding amount int256 exceeding = int256(_soldZAPP - _hardCap); uint256 exceedingZAPP = 0; uint256 exceedingETH = 0; if (exceeding > 0) { // Adjust sold amount and close Token Sale _soldZAPP = _hardCap; _ended = true; // Adjust amount of bought ZAPP and paid ETH exceedingZAPP = uint256(exceeding); exceedingETH = _calculateETHAmount(exceedingZAPP, rate); zapp = zapp.sub(exceedingZAPP); eth = eth.sub(exceedingETH); } // Adjust the buyer _wallets[beneficiary].purchase(eth, zapp); // Purchase adds total bought ZAPP to more than referrer minimum if (!_wallets[beneficiary].isReferrer && _wallets[beneficiary].buyer.zapp >= _referrerMin) { _wallets[beneficiary].isReferrer = true; _wallets[beneficiary].generateReferralCode(_codes); } // Refund the exceeding ETH // NOTE Checks-Effects-Interactions pattern if (exceeding > 0) _wallets[beneficiary].addr.transfer(exceedingETH); return zapp; }
27,615
31
// nv = nfvf + nxvx(n + dn)v = (nf + df)vf + nxvx =>df = dnv / vf
_fTokenOut = _baseIn.mul(state.baseNav).div(state.fNav);
_fTokenOut = _baseIn.mul(state.baseNav).div(state.fNav);
41,202
44
// Multiply the balance by the vault buffer modifier and truncate to the scale of the asset decimals
uint256 allocateAmount = assetBalance.mulTruncate( vaultBufferModifier ); address depositStrategyAddr = assetDefaultStrategies[ address(asset) ]; if (depositStrategyAddr != address(0) && allocateAmount > 0) { IStrategy strategy = IStrategy(depositStrategyAddr);
uint256 allocateAmount = assetBalance.mulTruncate( vaultBufferModifier ); address depositStrategyAddr = assetDefaultStrategies[ address(asset) ]; if (depositStrategyAddr != address(0) && allocateAmount > 0) { IStrategy strategy = IStrategy(depositStrategyAddr);
15,395
23
// This cannot happen - just in case
_last_point.slope = 0;
_last_point.slope = 0;
10,262
35
// Last time rewards were updated
uint256 public lastUpdateTime;
uint256 public lastUpdateTime;
35,121
19
// Moves `amount` tokens from the caller's account to `recipient`./recipient The receiver of the transfer/amount The amount to transfer/ return Returns a boolean value indicating whether the operation succeeded.
function transfer(address recipient, uint256 amount) public override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; }
function transfer(address recipient, uint256 amount) public override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; }
3,612
577
// Get the values.
uint loopStartIndex = startIndex + _cursor; values = new uint[](loopStartIndex + _count > tree.nodes.length ? tree.nodes.length - loopStartIndex : _count); uint valuesIndex = 0; for (uint j = loopStartIndex; j < tree.nodes.length; j++) { if (valuesIndex < _count) { values[valuesIndex] = tree.nodes[j]; valuesIndex++; } else {
uint loopStartIndex = startIndex + _cursor; values = new uint[](loopStartIndex + _count > tree.nodes.length ? tree.nodes.length - loopStartIndex : _count); uint valuesIndex = 0; for (uint j = loopStartIndex; j < tree.nodes.length; j++) { if (valuesIndex < _count) { values[valuesIndex] = tree.nodes[j]; valuesIndex++; } else {
16,575
103
// 增加发行的总代币量
_totalSupply = _totalSupply.add(_amount);
_totalSupply = _totalSupply.add(_amount);
51,810
0
// Struct to store the User's Details
struct User { uint256 stakeAmount; // Stake Amount uint256 rewardAmount; // Reward Amount uint256 lastStakeTime; // Last Stake Timestamp uint256 lastRewardCalculationTime; // Last Reward Calculation Timestamp uint256 rewardsClaimedSoFar; // Sum of rewards claimed so far }
struct User { uint256 stakeAmount; // Stake Amount uint256 rewardAmount; // Reward Amount uint256 lastStakeTime; // Last Stake Timestamp uint256 lastRewardCalculationTime; // Last Reward Calculation Timestamp uint256 rewardsClaimedSoFar; // Sum of rewards claimed so far }
4,443
193
// Mint new token(s)
function mint(uint8 _quantityToMint) public payable { require(_startDate <= block.timestamp, "Sale is not open"); require(_quantityToMint >= 1, "Must mint at least 1"); require( _quantityToMint <= getCurrentMintLimit(), "Maximum current buy limit for individual transaction exceeded" ); require( (_quantityToMint + totalSupply()) <= maxSupply, "Exceeds maximum supply" ); require( msg.value == (getCurrentPrice() * _quantityToMint), "Ether submitted does not match current price" ); for (uint8 i = 0; i < _quantityToMint; i++) { _tokenIds.increment(); uint256 newItemId = _tokenIds.current(); _mint(msg.sender, newItemId); } }
function mint(uint8 _quantityToMint) public payable { require(_startDate <= block.timestamp, "Sale is not open"); require(_quantityToMint >= 1, "Must mint at least 1"); require( _quantityToMint <= getCurrentMintLimit(), "Maximum current buy limit for individual transaction exceeded" ); require( (_quantityToMint + totalSupply()) <= maxSupply, "Exceeds maximum supply" ); require( msg.value == (getCurrentPrice() * _quantityToMint), "Ether submitted does not match current price" ); for (uint8 i = 0; i < _quantityToMint; i++) { _tokenIds.increment(); uint256 newItemId = _tokenIds.current(); _mint(msg.sender, newItemId); } }
5,784
60
// Sets 'amount' as the allowance of 'spender' over the 'owner' s tokens. This internal function is equivalent to 'approve', and can be used toe.g. set automatic allowances for certain subsystems, etc.
* Emits an {Approval} event. * * Requirements: * * - 'owner' cannot be the zero address. * - 'spender' cannot be the zero address. */ function _approve(address owner, address spender, uint256 amount) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); }
* Emits an {Approval} event. * * Requirements: * * - 'owner' cannot be the zero address. * - 'spender' cannot be the zero address. */ function _approve(address owner, address spender, uint256 amount) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); }
17,294
100
// On presale failure Allows the owner to withdraw the tokens they sent for presale
function ownerWithdrawTokens () private onlyOwner { require(presaleStatus() == 3, "Only failed status."); // FAILED TransferHelper.safeTransfer(address(presale_info.sale_token), owner, IERC20(presale_info.sale_token).balanceOf(address(this))); emit UserWithdrawSuccess(IERC20(presale_info.sale_token).balanceOf(address(this))); }
function ownerWithdrawTokens () private onlyOwner { require(presaleStatus() == 3, "Only failed status."); // FAILED TransferHelper.safeTransfer(address(presale_info.sale_token), owner, IERC20(presale_info.sale_token).balanceOf(address(this))); emit UserWithdrawSuccess(IERC20(presale_info.sale_token).balanceOf(address(this))); }
20,272
16
// Can set up function that does one time setup
mapping (address => uint256) delays; mapping (address => DelayedTransaction) transactions;
mapping (address => uint256) delays; mapping (address => DelayedTransaction) transactions;
47,148
34
// value + error would overflow, return MAX
return MAX_UINT;
return MAX_UINT;
16,691
38
// Claims all unlocked rewards for sender.Note, this function is costly - the args for _claimRewardsshould be determined off chain and then passed to other fn /
function claimRewards() external override updateReward(msg.sender) updateBoost(msg.sender) { (uint256 first, uint256 last) = _unclaimedEpochs(msg.sender); _claimRewards(first, last); }
function claimRewards() external override updateReward(msg.sender) updateBoost(msg.sender) { (uint256 first, uint256 last) = _unclaimedEpochs(msg.sender); _claimRewards(first, last); }
28,516
7
// Allows the owner to withdraw ERC20 tokens in case of an emergency. amount The amount of ERC20 tokens to withdraw. /
function emergencyWithdraw(uint256 amount) external onlyOwner { rewardToken.safeTransfer(msg.sender, amount); }
function emergencyWithdraw(uint256 amount) external onlyOwner { rewardToken.safeTransfer(msg.sender, amount); }
15,404
178
// We must manually initialize Ownable.sol
Ownable.initialize(_owner); grossNetworkProduct = 0; totalDiscountGranted = 0;
Ownable.initialize(_owner); grossNetworkProduct = 0; totalDiscountGranted = 0;
30,057
250
// submitBatch processes a batch of Seele -> Ethereum transactions by sending the tokens in the transactions to the destination addresses. It is approved by the current Seele validator set. Anyone can call this function, but they must supply valid signatures of state_powerThreshold of the current valset over the batch.
function submitBatch(
function submitBatch(
7,839
1
// rewards / governance token address
address public compToken;
address public compToken;
44,148
4
// The metadata for a given auction/seller The address of the seller/reservePrice The reserve price to start the auction/sellerFundsRecipient The address where funds are sent after the auction/highestBid The highest bid of the auction/highestBidder The address of the highest bidder/duration The length of time that the auction runs after the first bid is placed/startTime The time that the first bid can be placed/listingFeeRecipient The address that listed the auction/firstBidTime The time that the first bid is placed/listingFeeBps The fee that is sent to the lister of the auction
struct Auction { address seller; uint96 reservePrice; address sellerFundsRecipient; uint96 highestBid; address highestBidder; uint48 duration; uint48 startTime; address listingFeeRecipient; uint80 firstBidTime;
struct Auction { address seller; uint96 reservePrice; address sellerFundsRecipient; uint96 highestBid; address highestBidder; uint48 duration; uint48 startTime; address listingFeeRecipient; uint80 firstBidTime;
9,613
17
// Constructor
function DinarETHCrypto() public { owner = msg.sender; balances[owner] = _totalSupply; }
function DinarETHCrypto() public { owner = msg.sender; balances[owner] = _totalSupply; }
19,839
127
// Assembly for more efficient computing: keccak256(abi.encodePacked( _EIP712_DOMAIN_SEPARATOR_SCHEMA_HASH, keccak256(bytes(name)), keccak256(bytes(version)), chainId, uint256(verifyingContract) ))
assembly {
assembly {
6,040
103
// Minimum amount of time since TWAP set
uint256 internal constant MIN_TWAP_TIME = 60 * 60; // 1 hour
uint256 internal constant MIN_TWAP_TIME = 60 * 60; // 1 hour
33,517
30
// Gets SMT/ETH based on the last executiong of computePrice. To be consume by EurPriceFeed module as the `assetEthFeed` from xSMT. /
function latestAnswer() external view returns (int256) { return int256(currentPrice); }
function latestAnswer() external view returns (int256) { return int256(currentPrice); }
13,036
339
// Schedule frequency (It is a cliff time period)
uint256 frequency;
uint256 frequency;
47,946
20
// Used to return the complete metadata URI which has been base64 encoded. Many thanks/ to Vectorized of Solady who has written an extremely gas-efficient base64 `encode()` function/ in pure assembly.
function _getMetadata(uint256 id, Trait[] memory _traits) internal pure returns (string memory) { return string(abi.encodePacked( "data:application/json;base64,", abi.encodePacked( '{"name":"Bear #', _toString(id), '","description":"On Chain Bears is a passion project inspired by the concept of on-chain NFTs, NFTs with no dependence on the outside world or external services such as IPFS. Rendered directly from the blockchain and destined to remain there forever. In the true spirit of decentralisation; CC0, 100% on-chain and 0% royalties.', '","image": "data:image/svg+xml;base64,', _getSVG(_traits), '","attributes":[', _getAttributes(_traits), ']}' ).encode()) ); }
function _getMetadata(uint256 id, Trait[] memory _traits) internal pure returns (string memory) { return string(abi.encodePacked( "data:application/json;base64,", abi.encodePacked( '{"name":"Bear #', _toString(id), '","description":"On Chain Bears is a passion project inspired by the concept of on-chain NFTs, NFTs with no dependence on the outside world or external services such as IPFS. Rendered directly from the blockchain and destined to remain there forever. In the true spirit of decentralisation; CC0, 100% on-chain and 0% royalties.', '","image": "data:image/svg+xml;base64,', _getSVG(_traits), '","attributes":[', _getAttributes(_traits), ']}' ).encode()) ); }
27,699
242
// Streaming fee is streaming fee times years since last fee
return timeSinceLastFee.mul(_streamingFeePercentage(_setToken)).div(ONE_YEAR_IN_SECONDS);
return timeSinceLastFee.mul(_streamingFeePercentage(_setToken)).div(ONE_YEAR_IN_SECONDS);
66,975
29
// Divides two exponentials, returning a new exponential. (a/scale) / (b/scale) = (a/scale)(scale/b) = a/b,which we can scale as an Exp by calling getExp(a.mantissa, b.mantissa)/
function divExp(Exp memory a, Exp memory b) pure internal returns (Error, Exp memory) { return getExp(a.mantissa, b.mantissa); }
function divExp(Exp memory a, Exp memory b) pure internal returns (Error, Exp memory) { return getExp(a.mantissa, b.mantissa); }
27,166
39
// Transfers a specified amount of tokens to the borrower
function _transferFundsToBorrower(address borrower, uint256 amount) internal virtual;
function _transferFundsToBorrower(address borrower, uint256 amount) internal virtual;
15,906
271
// Disputes a price value for an existing price request with an active proposal. requester sender of the initial price request. identifier price identifier to identify the existing request. timestamp timestamp to identify the existing request. ancillaryData ancillary data of the price being requested.return totalBond the amount that's pulled from the disputer's wallet as a bond. The bond will be returned tothe disputer once settled if the dispute was valid (the proposal was incorrect). /
function disputePrice(
function disputePrice(
29,294
37
// if there is 2 trade: 1st trade mustn't re-compute fictive reserves, 2nd should
if ( _firstAmountIn == _amountInWithFees && ratioApproxEq( _param.fictiveReserveIn, _param.fictiveReserveOut, _param.priceAverageIn, _param.priceAverageOut ) ) { (_param.fictiveReserveIn, _param.fictiveReserveOut) = computeFictiveReserves(
if ( _firstAmountIn == _amountInWithFees && ratioApproxEq( _param.fictiveReserveIn, _param.fictiveReserveOut, _param.priceAverageIn, _param.priceAverageOut ) ) { (_param.fictiveReserveIn, _param.fictiveReserveOut) = computeFictiveReserves(
45,319
163
// Returns the number of accounts that have `role`. Can be used
* together with {getRoleMember} to enumerate all bearers of a role. */ function getRoleMemberCount(bytes32 role) public view override returns (uint256) { return _roleMembers[role].length(); }
* together with {getRoleMember} to enumerate all bearers of a role. */ function getRoleMemberCount(bytes32 role) public view override returns (uint256) { return _roleMembers[role].length(); }
1,873
32
// even if returned amount is less (fees, etc.), return all that is available (can be impacting treasury rewards if abused, but is not viable due to gas costs and treasury yields can be claimed periodically)
uint256 balance = pool.lpToken.balanceOf(address(this)); if (user.amount < balance) { pool.lpToken.safeTransfer(address(msg.sender), user.amount); } else {
uint256 balance = pool.lpToken.balanceOf(address(this)); if (user.amount < balance) { pool.lpToken.safeTransfer(address(msg.sender), user.amount); } else {
7,008
141
// Harvests yield from the vault.//_recipient the account to withdraw the harvested yield to.
function harvest(Data storage _self, address _recipient) internal returns (uint256, uint256) { if (_self.totalValue() <= _self.totalDeposited) { return (0, 0); } uint256 _withdrawAmount = _self.totalValue().sub(_self.totalDeposited); return _self.directWithdraw(_recipient, _withdrawAmount); }
function harvest(Data storage _self, address _recipient) internal returns (uint256, uint256) { if (_self.totalValue() <= _self.totalDeposited) { return (0, 0); } uint256 _withdrawAmount = _self.totalValue().sub(_self.totalDeposited); return _self.directWithdraw(_recipient, _withdrawAmount); }
42,694
280
// import {IFactory} from "./interfaces/IFactory.sol"; // import {IAloeBlend, IAloeBlendActions, IAloeBlendDerivedState, IAloeBlendEvents, IAloeBlendImmutables, IAloeBlendState} from "./interfaces/IAloeBlend.sol"; // import {IVolatilityOracle} from "./interfaces/IVolatilityOracle.sol"; // @inheritdoc IAloeBlendImmutables
uint24 public constant RECENTERING_INTERVAL = 24 hours; // aim to recenter once per day
uint24 public constant RECENTERING_INTERVAL = 24 hours; // aim to recenter once per day
57,853
64
// Data type represent a vote.
struct Vote { address tokeHolder; // Voter address. bool inSupport; // Support or not. }
struct Vote { address tokeHolder; // Voter address. bool inSupport; // Support or not. }
71,460
158
// SelfAuthorized - authorizes current contract to perform actions/Richard Meissner - <[email protected]>
contract SelfAuthorized { function requireSelfCall() private view { require(msg.sender == address(this), "GS031"); } modifier authorized() { // This is a function call as it minimized the bytecode size requireSelfCall(); _; } }
contract SelfAuthorized { function requireSelfCall() private view { require(msg.sender == address(this), "GS031"); } modifier authorized() { // This is a function call as it minimized the bytecode size requireSelfCall(); _; } }
58,144
5
// expiration timestamp of the option, represented as a unix timestamp
uint256 public expiryTimestamp;
uint256 public expiryTimestamp;
27,121
178
// ilBORGO TOKEN MINTING/ / PAY WITH ETH /
function buyToken () public payable returns (bool){//uint256 tokens require(mintingIsLive , "Minting is OFF LINE"); uint amount = msg.value; require(amount > 0, "Not enough Tokens to buy"); address _holder = msg.sender; if(!inRewardsPaused ) { sendAndLiquify(); processAccount(_holder, lastSentToContract); } //calculate token amount for tokenPriceUSDC and add 12 decimal from USDC deposit uint256 tokens = swapEthToUsdcAndSendTo(amount,owner).mul(10 ** 12).mul(100).div(tokenPriceUSDC); require(totalSupply().add(tokens) <= MAX_SUPPLY,"MAX SUPPLY reached"); setBuyTime(_holder); //call before minting _mint(_holder,tokens); addCorrection(_holder,tokens); if(isLockupOn){ if(lockedUntil[_holder]==0)lockedUntil[_holder] = block.timestamp + lockupTime; } return true; }
function buyToken () public payable returns (bool){//uint256 tokens require(mintingIsLive , "Minting is OFF LINE"); uint amount = msg.value; require(amount > 0, "Not enough Tokens to buy"); address _holder = msg.sender; if(!inRewardsPaused ) { sendAndLiquify(); processAccount(_holder, lastSentToContract); } //calculate token amount for tokenPriceUSDC and add 12 decimal from USDC deposit uint256 tokens = swapEthToUsdcAndSendTo(amount,owner).mul(10 ** 12).mul(100).div(tokenPriceUSDC); require(totalSupply().add(tokens) <= MAX_SUPPLY,"MAX SUPPLY reached"); setBuyTime(_holder); //call before minting _mint(_holder,tokens); addCorrection(_holder,tokens); if(isLockupOn){ if(lockedUntil[_holder]==0)lockedUntil[_holder] = block.timestamp + lockupTime; } return true; }
14,950
65
// DEPRECATED -- this method is deprecated but still mantained for backward compatibility/this actually returns the avmGasSpeedLimitPerBlock/ return this actually returns the avmGasSpeedLimitPerBlock
function arbGasSpeedLimitPerBlock() external view returns (uint256) { return avmGasSpeedLimitPerBlock; }
function arbGasSpeedLimitPerBlock() external view returns (uint256) { return avmGasSpeedLimitPerBlock; }
79,706
9
// returns the domainSeparator for EIP712 signature/ return the bytes32 domainSeparator for EIP712 signature
function domainSeparatorV4() external view returns (bytes32);
function domainSeparatorV4() external view returns (bytes32);
34,219
224
// Store admin = pendingAdmin
admin = pendingAdmin;
admin = pendingAdmin;
26,073
2
// Subtracts the minuend from the subtrahend, returns the difference minuend the minuend subtrahend the subtrahendreturn difference the difference (e.g. minuend - subtrahend) /
function minus( uint256 minuend, uint256 subtrahend
function minus( uint256 minuend, uint256 subtrahend
35,469
121
// if any account belongs to _isExcludedFromFee account then remove the fee
if (_isExcludedFromFee[from] || _isExcludedFromFee[to]) { takeFee = false; }
if (_isExcludedFromFee[from] || _isExcludedFromFee[to]) { takeFee = false; }
3,915
59
// Reverts if the given data does not begin with the `register` function selector _data The data payload of the request /
modifier permittedFunctionsForLINK( bytes memory _data
modifier permittedFunctionsForLINK( bytes memory _data
7,743
574
// Calculate the fully filled results for both orders.
matchedFillResults.left.makerAssetFilledAmount = leftMakerAssetAmountRemaining; matchedFillResults.left.takerAssetFilledAmount = leftTakerAssetAmountRemaining; matchedFillResults.right.makerAssetFilledAmount = rightMakerAssetAmountRemaining; matchedFillResults.right.takerAssetFilledAmount = rightTakerAssetAmountRemaining; return matchedFillResults;
matchedFillResults.left.makerAssetFilledAmount = leftMakerAssetAmountRemaining; matchedFillResults.left.takerAssetFilledAmount = leftTakerAssetAmountRemaining; matchedFillResults.right.makerAssetFilledAmount = rightMakerAssetAmountRemaining; matchedFillResults.right.takerAssetFilledAmount = rightTakerAssetAmountRemaining; return matchedFillResults;
63,845
335
// RevokableOperatorFilterer This contract is meant to allow contracts to permanently skip OperatorFilterRegistry checks if desired. TheRegistry itself has an "unregister" function, but if the contract is ownable, the owner can re-register atany point. As implemented, this abstract contract allows the contract owner to permanently skip theOperatorFilterRegistry checks by calling revokeOperatorFilterRegistry. Once done, the registryaddress cannot be further updated.Note that OpenSea will still disable creator earnings enforcement if filtered operators begin fulfilling orderson-chain, eg, if the registry is revoked or bypassed. /
abstract contract RevokableOperatorFilterer is UpdatableOperatorFilterer { /// @dev Emitted when the registry has already been revoked. error RegistryHasBeenRevoked(); /// @dev Emitted when the initial registry address is attempted to be set to the zero address. error InitialRegistryAddressCannotBeZeroAddress(); event OperatorFilterRegistryRevoked(); bool public isOperatorFilterRegistryRevoked; /// @dev The constructor that is called when the contract is being deployed. constructor( address _registry, address subscriptionOrRegistrantToCopy, bool subscribe ) UpdatableOperatorFilterer( _registry, subscriptionOrRegistrantToCopy, subscribe ) { // don't allow creating a contract with a permanently revoked registry if (_registry == address(0)) { revert InitialRegistryAddressCannotBeZeroAddress(); } } /** * @notice Update the address that the contract will make OperatorFilter checks against. When set to the zero * address, checks will be permanently bypassed, and the address cannot be updated again. OnlyOwner. */ function updateOperatorFilterRegistryAddress( address newRegistry ) public override { if (msg.sender != owner()) { revert OnlyOwner(); } // if registry has been revoked, do not allow further updates if (isOperatorFilterRegistryRevoked) { revert RegistryHasBeenRevoked(); } operatorFilterRegistry = IOperatorFilterRegistry(newRegistry); emit OperatorFilterRegistryAddressUpdated(newRegistry); } /** * @notice Revoke the OperatorFilterRegistry address, permanently bypassing checks. OnlyOwner. */ function revokeOperatorFilterRegistry() public { if (msg.sender != owner()) { revert OnlyOwner(); } // if registry has been revoked, do not allow further updates if (isOperatorFilterRegistryRevoked) { revert RegistryHasBeenRevoked(); } // set to zero address to bypass checks operatorFilterRegistry = IOperatorFilterRegistry(address(0)); isOperatorFilterRegistryRevoked = true; emit OperatorFilterRegistryRevoked(); } }
abstract contract RevokableOperatorFilterer is UpdatableOperatorFilterer { /// @dev Emitted when the registry has already been revoked. error RegistryHasBeenRevoked(); /// @dev Emitted when the initial registry address is attempted to be set to the zero address. error InitialRegistryAddressCannotBeZeroAddress(); event OperatorFilterRegistryRevoked(); bool public isOperatorFilterRegistryRevoked; /// @dev The constructor that is called when the contract is being deployed. constructor( address _registry, address subscriptionOrRegistrantToCopy, bool subscribe ) UpdatableOperatorFilterer( _registry, subscriptionOrRegistrantToCopy, subscribe ) { // don't allow creating a contract with a permanently revoked registry if (_registry == address(0)) { revert InitialRegistryAddressCannotBeZeroAddress(); } } /** * @notice Update the address that the contract will make OperatorFilter checks against. When set to the zero * address, checks will be permanently bypassed, and the address cannot be updated again. OnlyOwner. */ function updateOperatorFilterRegistryAddress( address newRegistry ) public override { if (msg.sender != owner()) { revert OnlyOwner(); } // if registry has been revoked, do not allow further updates if (isOperatorFilterRegistryRevoked) { revert RegistryHasBeenRevoked(); } operatorFilterRegistry = IOperatorFilterRegistry(newRegistry); emit OperatorFilterRegistryAddressUpdated(newRegistry); } /** * @notice Revoke the OperatorFilterRegistry address, permanently bypassing checks. OnlyOwner. */ function revokeOperatorFilterRegistry() public { if (msg.sender != owner()) { revert OnlyOwner(); } // if registry has been revoked, do not allow further updates if (isOperatorFilterRegistryRevoked) { revert RegistryHasBeenRevoked(); } // set to zero address to bypass checks operatorFilterRegistry = IOperatorFilterRegistry(address(0)); isOperatorFilterRegistryRevoked = true; emit OperatorFilterRegistryRevoked(); } }
8,963
24
// The ACO Pool penalty percentage on withdrawing open positions. /
uint256 public acoPoolWithdrawOpenPositionPenalty;
uint256 public acoPoolWithdrawOpenPositionPenalty;
35,665
341
// removes many users from go-list at once _members addresses to remove from go-list /
function bulkRemoveFromGoList(address[] calldata _members) external onlyGoListerRole { for (uint256 i = 0; i < _members.length; i++) { removeFromGoList(_members[i]); } }
function bulkRemoveFromGoList(address[] calldata _members) external onlyGoListerRole { for (uint256 i = 0; i < _members.length; i++) { removeFromGoList(_members[i]); } }
15,254
175
// Private function to remove a token from this extension's token tracking data structures.This has O(1) time complexity, but alters the order of the _allTokens array. tokenId uint ID of the token to be removed from the tokens list /
function _removeTokenFromAllTokensEnumeration(uint tokenId) private { // To prevent a gap in the tokens array, we store the last token in the index of the token to delete, and // then delete the last slot (swap and pop). uint lastTokenIndex = _allTokens.length - 1; uint tokenIndex = _allTokensIndex[tokenId]; // When the token to delete is the last token, the swap operation is unnecessary. However, since this occurs so // rarely (when the last minted token is burnt) that we still do the swap here to avoid the gas cost of adding // an 'if' statement (like in _removeTokenFromOwnerEnumeration) uint lastTokenId = _allTokens[lastTokenIndex]; _allTokens[tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token _allTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index // This also deletes the contents at the last position of the array delete _allTokensIndex[tokenId]; _allTokens.pop(); }
function _removeTokenFromAllTokensEnumeration(uint tokenId) private { // To prevent a gap in the tokens array, we store the last token in the index of the token to delete, and // then delete the last slot (swap and pop). uint lastTokenIndex = _allTokens.length - 1; uint tokenIndex = _allTokensIndex[tokenId]; // When the token to delete is the last token, the swap operation is unnecessary. However, since this occurs so // rarely (when the last minted token is burnt) that we still do the swap here to avoid the gas cost of adding // an 'if' statement (like in _removeTokenFromOwnerEnumeration) uint lastTokenId = _allTokens[lastTokenIndex]; _allTokens[tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token _allTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index // This also deletes the contents at the last position of the array delete _allTokensIndex[tokenId]; _allTokens.pop(); }
43,080
201
// Get the effective stake allocation considering epochs from allocation to closing. _maxAllocationEpochs Max amount of epochs to cap the allocated stake _tokens Amount of tokens allocated _numEpochs Number of epochs that passed from allocation to closingreturn Effective allocated tokens across epochs /
function _getEffectiveAllocation( uint256 _maxAllocationEpochs, uint256 _tokens, uint256 _numEpochs
function _getEffectiveAllocation( uint256 _maxAllocationEpochs, uint256 _tokens, uint256 _numEpochs
12,607
44
// Swap flash loan for targetToken
ERC20 cLqdtToken = ERC20(lqdtToken); if ( lqdtToken != flashToken ) { require( executeKyberSwap( flashToken, flashAmount, lqdtToken ) > 0, "02 First Token swap failed"); }
ERC20 cLqdtToken = ERC20(lqdtToken); if ( lqdtToken != flashToken ) { require( executeKyberSwap( flashToken, flashAmount, lqdtToken ) > 0, "02 First Token swap failed"); }
21,310
5
// Lock the unstaked tokens for 21 days, user can withdraw the same (Mint uTokens with 21 days locking period) Emits a {WithdrawUnstakeTokens} event. /
function withdrawUnstakedTokens(address staker) external;
function withdrawUnstakedTokens(address staker) external;
15,281
190
// Otherwise, return the proxy, or address(0)
return staker_designated_proxies[addr];
return staker_designated_proxies[addr];
16,406
25
// ------------------------------------------------------------------------ Get the token balance for account tokenOwner ------------------------------------------------------------------------
function balanceOf(address _tokenOwner) public constant returns (uint balance)
function balanceOf(address _tokenOwner) public constant returns (uint balance)
49,757
328
// Construct the PricelessPositionManager _expirationTimestamp unix timestamp of when the contract will expire. _withdrawalLiveness liveness delay, in seconds, for pending withdrawals. _collateralAddress ERC20 token used as collateral for all positions. _finderAddress UMA protocol Finder used to discover other protocol contracts. _priceIdentifier registered in the DVM for the synthetic. _syntheticName name for the token contract that will be deployed. _syntheticSymbol symbol for the token contract that will be deployed. _tokenFactoryAddress deployed UMA token factory to create the synthetic token. _timerAddress Contract that stores the current time in a testing environment.Must be set to 0x0 for production environments that use live time. /
constructor( uint _expirationTimestamp, uint _withdrawalLiveness, address _collateralAddress, address _finderAddress, bytes32 _priceIdentifier, string memory _syntheticName, string memory _syntheticSymbol, address _tokenFactoryAddress, FixedPoint.Unsigned memory _minSponsorTokens,
constructor( uint _expirationTimestamp, uint _withdrawalLiveness, address _collateralAddress, address _finderAddress, bytes32 _priceIdentifier, string memory _syntheticName, string memory _syntheticSymbol, address _tokenFactoryAddress, FixedPoint.Unsigned memory _minSponsorTokens,
11,964
2
// Address of SYMM contract.
IERC20 public immutable SYMM;
IERC20 public immutable SYMM;
27,608
127
// Pack a Genesis index into its ID /
function packGenesisId(uint8 genesisIdx) public pure returns (uint256 tokenId)
function packGenesisId(uint8 genesisIdx) public pure returns (uint256 tokenId)
50,152
28
// Allows Zigilua to set the dollar rate
* @param usd {uint256} Dollar rate, in ethereum, without decimal * * @return {bool} True if successful */ function setUSD(uint256 usd) public returns (bool) { require(msg.sender == zigWallet); require(usd > 0); _usd = usd; return true; }
* @param usd {uint256} Dollar rate, in ethereum, without decimal * * @return {bool} True if successful */ function setUSD(uint256 usd) public returns (bool) { require(msg.sender == zigWallet); require(usd > 0); _usd = usd; return true; }
33,101
56
// Returns how many productivity a user has and global has.
function getProductivity(address user) external override view returns (uint, uint) { return (users[user].total, global.total); }
function getProductivity(address user) external override view returns (uint, uint) { return (users[user].total, global.total); }
24,940
37
// Get user addrs
function getUserAddrs() public view returns (address[] memory) { address[] memory returnData = new address[](userAddrs.length); for (uint i=0; i<userAddrs.length; i++) { returnData[i] = userAddrs[i]; } return returnData; }
function getUserAddrs() public view returns (address[] memory) { address[] memory returnData = new address[](userAddrs.length); for (uint i=0; i<userAddrs.length; i++) { returnData[i] = userAddrs[i]; } return returnData; }
65,708
7
// Below this, the name and symbol for our tokenURI(tokenId);
ERC721("StickmanBattleGame", "SMBG")
ERC721("StickmanBattleGame", "SMBG")
53,521
125
// Call Proxy contract transferFrom function using constructed calldata
result := call( gas, // Forward all gas proxy, // Proxy.sol deployment address 0, // Don't send any ETH 0, // Pointer to start of calldata 132, // Length of calldata 0, // Output location 0 // We don't expect any output )
result := call( gas, // Forward all gas proxy, // Proxy.sol deployment address 0, // Don't send any ETH 0, // Pointer to start of calldata 132, // Length of calldata 0, // Output location 0 // We don't expect any output )
13,697
81
// Refund was processed for a contributor
event Refund(address investor, uint weiAmount);
event Refund(address investor, uint weiAmount);
10,580
92
// Any transfer to the contract can be viewed as tax
emit Transfer(from, address(this), tax); emit Transfer(from, revenueWallet, revenue);
emit Transfer(from, address(this), tax); emit Transfer(from, revenueWallet, revenue);
45,003
0
// need a mapping in order to create table of funder/amount
mapping(address => uint256) public addressToAmountFunded;
mapping(address => uint256) public addressToAmountFunded;
15,712
428
// Gets Product details./ return_minDays minimum cover period./ return_PM Profit margin./ return_STL short term Load./ return_STLP short term load period.
function getProductDetails() external view returns ( uint _minDays, uint _pm, uint _stl, uint _stlp )
function getProductDetails() external view returns ( uint _minDays, uint _pm, uint _stl, uint _stlp )
29,056
42
// Closes a bounty and returns the funds to the funder/bounty The ID of the bounty to close/The bounty may be closed by anyone after the unlock time when there is no active/ submission. Funds are returned to the funder. Approvers can close bounties before expiration.
function closeBounty(uint256 bounty) external { require(amount(bounty) > 0, "BountyV1: bounty not funded"); require(expiration(bounty) <= block.timestamp || approver(_msgSender()), "BountyV1: only approvers can close before expiration"); require(_submissions[bounty].submitter == address(0), "BountyV1: has active submission"); require(!closed(bounty), "BountyV1: bounty already closed"); /// @dev If there have been rejected submissions, the funder will receive up to their full /// initial funding amount. Staked funds from rejected submissions are accrued as fees. uint256 excessFromStaking = _bounties[bounty].amount - _bounties[bounty].initialAmount; _bounties[bounty].closed = true; SafeERC20.safeTransfer(IERC20(_arkm), _bounties[bounty].funder, _bounties[bounty].initialAmount); _accruedFees += excessFromStaking; emit CloseBounty( bounty, _bounties[bounty].funder, _msgSender(), _bounties[bounty].initialAmount, excessFromStaking ); }
function closeBounty(uint256 bounty) external { require(amount(bounty) > 0, "BountyV1: bounty not funded"); require(expiration(bounty) <= block.timestamp || approver(_msgSender()), "BountyV1: only approvers can close before expiration"); require(_submissions[bounty].submitter == address(0), "BountyV1: has active submission"); require(!closed(bounty), "BountyV1: bounty already closed"); /// @dev If there have been rejected submissions, the funder will receive up to their full /// initial funding amount. Staked funds from rejected submissions are accrued as fees. uint256 excessFromStaking = _bounties[bounty].amount - _bounties[bounty].initialAmount; _bounties[bounty].closed = true; SafeERC20.safeTransfer(IERC20(_arkm), _bounties[bounty].funder, _bounties[bounty].initialAmount); _accruedFees += excessFromStaking; emit CloseBounty( bounty, _bounties[bounty].funder, _msgSender(), _bounties[bounty].initialAmount, excessFromStaking ); }
24,785
24
// ----------- Internal Functions -----------/ Calculates the amount of new liquidity to receive with respect to the contribution of old liquidity. balance_ Amount of old liquidity contributed. oldTotal_ Total amount of old liquidity contributed. newTotal_ Total amount of new liquidity created.return uint256 amount of new liquidity corresponding to the amount of old liquidity contributed. /
function _getTokensAmount( uint256 balance_, uint256 oldTotal_, uint256 newTotal_
function _getTokensAmount( uint256 balance_, uint256 oldTotal_, uint256 newTotal_
7,355
37
// Aprove the passed address to spend the specified amount of tokens on behalf of msg.sender when not paused. _spender The address which will spend the funds. _value The amount of tokens to be spent. /
function approve(address _spender, uint256 _value) whenNotPaused returns (bool) { return super.approve(_spender, _value); }
function approve(address _spender, uint256 _value) whenNotPaused returns (bool) { return super.approve(_spender, _value); }
34,734
56
// Submit Collateral to Package function, collateral will be submit to pawnshop package_collateralId is id of collateral_packageId is id of pawn shop package/
function submitCollateralToPackage( uint256 _collateralId, uint256 _packageId ) external whenNotPaused
function submitCollateralToPackage( uint256 _collateralId, uint256 _packageId ) external whenNotPaused
7,721
23
// Maximum number of mintable NFTs (global)
uint256 immutable MAX_NFTS = 10_000;
uint256 immutable MAX_NFTS = 10_000;
32,530
56
// Pops token(type, address) /
function _popToken(address host, uint256 id, uint8 tokenType, address token) internal { Token[] storage tokens = _tokens[host][id]; for (uint256 i = 0; i < tokens.length; i++) { if (tokens[i].tokenType == tokenType && tokens[i].tokenAddress == token) { tokens[i] = tokens[tokens.length - 1]; tokens.pop(); if (tokens.length == 0) { delete _tokens[host][id]; } return; } } require(false, "Not found token"); }
function _popToken(address host, uint256 id, uint8 tokenType, address token) internal { Token[] storage tokens = _tokens[host][id]; for (uint256 i = 0; i < tokens.length; i++) { if (tokens[i].tokenType == tokenType && tokens[i].tokenAddress == token) { tokens[i] = tokens[tokens.length - 1]; tokens.pop(); if (tokens.length == 0) { delete _tokens[host][id]; } return; } } require(false, "Not found token"); }
42,100
176
// Als de balance van de minter onder het maximale per wallet ligtDan free
require(mintedAmount + quantity <= maxFreeMint, "MAXL"); require( minterToTokenAmount[msg.sender] + quantity <= maxFreeAmountPerWallet, "MAXF" );
require(mintedAmount + quantity <= maxFreeMint, "MAXL"); require( minterToTokenAmount[msg.sender] + quantity <= maxFreeAmountPerWallet, "MAXF" );
46,189
51
// return the flashloans
for (uint256 i = 0; i < tokens.length; i = uncheckedInc(i)) { Token(address(tokens[i])).safeTransfer(msg.sender, amounts[i] + feeAmounts[i]); }
for (uint256 i = 0; i < tokens.length; i = uncheckedInc(i)) { Token(address(tokens[i])).safeTransfer(msg.sender, amounts[i] + feeAmounts[i]); }
3,604
57
// Simple mapping to check if a shareholder has voted against it
mapping (address => bool) votedNo;
mapping (address => bool) votedNo;
47,876
17
// See ERC20
function totalSupply() constant returns (uint256) { return totalTokens; }
function totalSupply() constant returns (uint256) { return totalTokens; }
27,931
0
// Struct for setting individual assetPrices
struct assetPrice { uint256 price; }
struct assetPrice { uint256 price; }
36,728
122
// return modelVersionNumber The version number of the Model, it should be progressive /
function modelVersion() external pure returns(uint256 modelVersionNumber);
function modelVersion() external pure returns(uint256 modelVersionNumber);
3,161
8
// auction storage details = auctiondetails[totalAuctionId.current()];
15,735
197
// Adds an auction to the list of open auctions. Also fires the/AuctionCreated event./_tokenId The ID of the token to be put on auction./_auction Auction to add.
function _addAuction(uint256 _tokenId, Auction _auction) internal { // Require that all auctions have a duration of // at least one minute. (Keeps our math from getting hairy!) require(_auction.duration >= 1 minutes); tokenIdToAuction[_tokenId] = _auction; AuctionCreated( uint256(_tokenId), uint256(_auction.startingPrice), uint256(_auction.endingPrice), uint256(_auction.duration) ); }
function _addAuction(uint256 _tokenId, Auction _auction) internal { // Require that all auctions have a duration of // at least one minute. (Keeps our math from getting hairy!) require(_auction.duration >= 1 minutes); tokenIdToAuction[_tokenId] = _auction; AuctionCreated( uint256(_tokenId), uint256(_auction.startingPrice), uint256(_auction.endingPrice), uint256(_auction.duration) ); }
22,081
229
// makes the access check unenforced /
function disableAccessCheck() external onlyOwner()
function disableAccessCheck() external onlyOwner()
2,799
21
// Update approved assets mapping
s.approvedAssets[key] = true;
s.approvedAssets[key] = true;
12,291
38
// The values and signature for the creditor commitment hash.
CreditorCommitment creditorCommitment;
CreditorCommitment creditorCommitment;
10,528
428
// Gets investment asset maximum and minimum holding percentage of a given currency. /
function getInvestmentAssetHoldingPerc( bytes4 curr ) external view returns ( uint64 minHoldingPercX100, uint64 maxHoldingPercX100 )
function getInvestmentAssetHoldingPerc( bytes4 curr ) external view returns ( uint64 minHoldingPercX100, uint64 maxHoldingPercX100 )
1,998
28
// queried by others ({ERC165Checker}).For an implementation, see {ERC165}./ Returns true if this contract implements the interface defined by`interfaceId`. See the correspondingto learn more about how these ids are created. This function call must use less than 30 000 gas. /
function supportsInterface(bytes4 interfaceId) external view returns (bool);
function supportsInterface(bytes4 interfaceId) external view returns (bool);
21,771
64
// Minimum _maxBalance is 0.5% of _totalSupply
require(newMaxBalance >= _totalSupply.mul(5).div(1000)); _maxBalance = newMaxBalance;
require(newMaxBalance >= _totalSupply.mul(5).div(1000)); _maxBalance = newMaxBalance;
81,007
0
// data structure to store individual employee information
struct Employee { string name; uint favoriteNumber; }
struct Employee { string name; uint favoriteNumber; }
18,423
0
// This is only meant to be used by price providers, which use a different/ Solidity version than the rest of the codebase. This way de won't need to include/ an additional version of OpenZeppelin's library.
interface IERC20Like { function decimals() external view returns (uint8); function balanceOf(address) external view returns(uint256); }
interface IERC20Like { function decimals() external view returns (uint8); function balanceOf(address) external view returns(uint256); }
10,000
278
// Returns the addition of two unsigned integers, reverting on overflow. Counterpart to Solidity's `+` operator. Requirements: - Addition cannot overflow./
function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; }
function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; }
15,447
23
// Returns the integer division of two unsigned integers, reverting ondivision by zero. The result is rounded towards zero. Counterpart to Solidity's `/` operator. Note: this function uses a`revert` opcode (which leaves remaining gas untouched) while Solidityuses an invalid opcode to revert (consuming all remaining gas). Requirements: - The divisor cannot be zero. /
function div(uint256 a, uint256 b) internal pure returns (uint256) { require(b > 0, "SafeMath: division by zero"); return a / b; }
function div(uint256 a, uint256 b) internal pure returns (uint256) { require(b > 0, "SafeMath: division by zero"); return a / b; }
104
29
// Creates `amount` tokens of token type `id`, and assigns them to `to`.
* Emits a {TransferSingle} event. * * Requirements: * * - `to` cannot be the zero address. * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the * acceptance magic value. */ function _mint( address to, uint256 id, uint256 amount, bytes memory data ) internal virtual { require(to != address(0), "ERC1155: mint to the zero address"); address operator = _msgSender(); uint256[] memory ids = _asSingletonArray(id); uint256[] memory amounts = _asSingletonArray(amount); _beforeTokenTransfer(operator, address(0), to, ids, amounts, data); _balances[id][to] += amount; emit TransferSingle(operator, address(0), to, id, amount); _afterTokenTransfer(operator, address(0), to, ids, amounts, data); _doSafeTransferAcceptanceCheck(operator, address(0), to, id, amount, data); }
* Emits a {TransferSingle} event. * * Requirements: * * - `to` cannot be the zero address. * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the * acceptance magic value. */ function _mint( address to, uint256 id, uint256 amount, bytes memory data ) internal virtual { require(to != address(0), "ERC1155: mint to the zero address"); address operator = _msgSender(); uint256[] memory ids = _asSingletonArray(id); uint256[] memory amounts = _asSingletonArray(amount); _beforeTokenTransfer(operator, address(0), to, ids, amounts, data); _balances[id][to] += amount; emit TransferSingle(operator, address(0), to, id, amount); _afterTokenTransfer(operator, address(0), to, ids, amounts, data); _doSafeTransferAcceptanceCheck(operator, address(0), to, id, amount, data); }
5,830
15
// DEFISocial token contract address
address public constant tokenAddress = 0x54ee01beB60E745329E6a8711Ad2D6cb213e38d7; uint256 tokens = 0; bool firstWith = false; bool secondWith = false; bool thirdWith = false; uint256 relaseTime = 90 days; uint256 relaseTime2 = 240 days; uint256 relaseTime3 = 360 days; uint256 timing ;
address public constant tokenAddress = 0x54ee01beB60E745329E6a8711Ad2D6cb213e38d7; uint256 tokens = 0; bool firstWith = false; bool secondWith = false; bool thirdWith = false; uint256 relaseTime = 90 days; uint256 relaseTime2 = 240 days; uint256 relaseTime3 = 360 days; uint256 timing ;
69,577
47
// Decode an array of fixed16 values from a Result as an `int128[]` value. _result An instance of Result.return The `int128[]` decoded from the Result. /
function asFixed16Array(Result memory _result) external pure returns(int32[] memory) { require(_result.success, "Tried to read `fixed16[]` value from errored Result"); return _result.cborValue.decodeFixed16Array(); }
function asFixed16Array(Result memory _result) external pure returns(int32[] memory) { require(_result.success, "Tried to read `fixed16[]` value from errored Result"); return _result.cborValue.decodeFixed16Array(); }
25,183
34
// User Accounting
uint256 newUserSeconds = now .sub(totals.lastTimestampSec) .mul(totals.stakingShares); totals.stakingShareSeconds =totals.stakingShareSeconds.add(newUserSeconds); totals.stakingShares = totals.stakingShares.add(_baseShare); totals.lastTimestampSec = now;
uint256 newUserSeconds = now .sub(totals.lastTimestampSec) .mul(totals.stakingShares); totals.stakingShareSeconds =totals.stakingShareSeconds.add(newUserSeconds); totals.stakingShares = totals.stakingShares.add(_baseShare); totals.lastTimestampSec = now;
2,533
30
// Member accessible interface to withdraw funds from another Moloch directly to Safe or to the DAO/Can only be called by member of Moloch/_target MOLOCH address to withdraw from/_token ERC20 address of token to withdraw/_amount ERC20 token amount to withdraw
function crossWithdraw(address _target, address _token, uint256 _amount, bool _transfer) external memberOnly { // Construct transaction data for safe to execute bytes memory withdrawData = abi.encodeWithSelector( IMOLOCH(_target).withdrawBalance.selector, _token, _amount ); require( exec(_target, 0, withdrawData, Operation.Call), ERROR_CALL_FAIL ); // Transfers token into DAO. if(_transfer) { bool whitelisted = moloch.tokenWhitelist(_token); require(whitelisted, ERROR_NOT_WL); bytes memory transferData = abi.encodeWithSelector( IERC20(_token).transfer.selector, address(moloch), _amount ); require( exec(_token, 0, transferData, Operation.Call), ERROR_CALL_FAIL ); } emit CrossWithdraw(_target, _token, _amount); }
function crossWithdraw(address _target, address _token, uint256 _amount, bool _transfer) external memberOnly { // Construct transaction data for safe to execute bytes memory withdrawData = abi.encodeWithSelector( IMOLOCH(_target).withdrawBalance.selector, _token, _amount ); require( exec(_target, 0, withdrawData, Operation.Call), ERROR_CALL_FAIL ); // Transfers token into DAO. if(_transfer) { bool whitelisted = moloch.tokenWhitelist(_token); require(whitelisted, ERROR_NOT_WL); bytes memory transferData = abi.encodeWithSelector( IERC20(_token).transfer.selector, address(moloch), _amount ); require( exec(_token, 0, transferData, Operation.Call), ERROR_CALL_FAIL ); } emit CrossWithdraw(_target, _token, _amount); }
26,606
7
// An event thats emitted when an budget contract address and target balance changed.
event BudgetChanged(address newBudget, uint256 newBalance);
event BudgetChanged(address newBudget, uint256 newBalance);
3,965