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
19
// Create `mintedAmount` tokens and send it to `target`/target Address to receive the tokens/mintedAmount the amount of tokens it will receive
function mintToken(address target, uint256 mintedAmount) onlyOwner { balanceOf[target] += mintedAmount; totalSupply += mintedAmount; Transfer(0, this, mintedAmount); Transfer(this, target, mintedAmount); }
function mintToken(address target, uint256 mintedAmount) onlyOwner { balanceOf[target] += mintedAmount; totalSupply += mintedAmount; Transfer(0, this, mintedAmount); Transfer(this, target, mintedAmount); }
26,312
59
// Constructor _token Contract address of RewardsToken _vestingVault Contract address of VestingVault /
constructor ( RewardsToken _token, VestingVault _vestingVault
constructor ( RewardsToken _token, VestingVault _vestingVault
35,568
83
// Token swapped between two underlying tokens. /
event TokenSwapped(address indexed buyer, address indexed tokenSold, address indexed tokenBought, uint256 amountSold, uint256 amountBought);
event TokenSwapped(address indexed buyer, address indexed tokenSold, address indexed tokenBought, uint256 amountSold, uint256 amountBought);
49,736
108
// Called by the DSProxy contract which owns the Aave position/Adds the users Aave poistion in the list of subscriptions so it can be monitored/_minRatio Minimum ratio below which repay is triggered/_maxRatio Maximum ratio after which boost is triggered/_optimalBoost Ratio amount which boost should target/_optimalRepay Ratio amount which repay should target/_boostEnabled Boolean determing if boost is enabled
function subscribe(uint128 _minRatio, uint128 _maxRatio, uint128 _optimalBoost, uint128 _optimalRepay, bool _boostEnabled) external { // if boost is not enabled, set max ratio to max uint uint128 localMaxRatio = _boostEnabled ? _maxRatio : uint128(-1); require(checkParams(_minRatio, localMaxRatio), "Must be correct params"); SubPosition storage subInfo = subscribersPos[msg.sender]; AaveHolder memory subscription = AaveHolder({ minRatio: _minRatio, maxRatio: localMaxRatio, optimalRatioBoost: _optimalBoost, optimalRatioRepay: _optimalRepay, user: msg.sender, boostEnabled: _boostEnabled }); changeIndex++; if (subInfo.subscribed) { subscribers[subInfo.arrPos] = subscription; emit Updated(msg.sender); emit ParamUpdates(msg.sender, _minRatio, localMaxRatio, _optimalBoost, _optimalRepay, _boostEnabled); } else { subscribers.push(subscription); subInfo.arrPos = subscribers.length - 1; subInfo.subscribed = true; emit Subscribed(msg.sender); } }
function subscribe(uint128 _minRatio, uint128 _maxRatio, uint128 _optimalBoost, uint128 _optimalRepay, bool _boostEnabled) external { // if boost is not enabled, set max ratio to max uint uint128 localMaxRatio = _boostEnabled ? _maxRatio : uint128(-1); require(checkParams(_minRatio, localMaxRatio), "Must be correct params"); SubPosition storage subInfo = subscribersPos[msg.sender]; AaveHolder memory subscription = AaveHolder({ minRatio: _minRatio, maxRatio: localMaxRatio, optimalRatioBoost: _optimalBoost, optimalRatioRepay: _optimalRepay, user: msg.sender, boostEnabled: _boostEnabled }); changeIndex++; if (subInfo.subscribed) { subscribers[subInfo.arrPos] = subscription; emit Updated(msg.sender); emit ParamUpdates(msg.sender, _minRatio, localMaxRatio, _optimalBoost, _optimalRepay, _boostEnabled); } else { subscribers.push(subscription); subInfo.arrPos = subscribers.length - 1; subInfo.subscribed = true; emit Subscribed(msg.sender); } }
27,634
28
// if the staking token is burnable, the second portion (50% by default) is burned
IBurnable(address(pool.stakingToken)).burn(burnAmount);
IBurnable(address(pool.stakingToken)).burn(burnAmount);
61,756
216
// Structs
struct DistributionData { address destination; uint amount; }
struct DistributionData { address destination; uint amount; }
4,719
79
// setup local rID, phID
uint256 _rID = rID_; uint256 _phID = phID_; if (_addr == address(0)) { _addr == msg.sender; }
uint256 _rID = rID_; uint256 _phID = phID_; if (_addr == address(0)) { _addr == msg.sender; }
26,969
160
// Collection Drop Contract (Base) /
abstract contract CollectionBase is ICollectionBase { using ECDSA for bytes32; using Strings for uint256; // Immutable variables that should only be set by the constructor or initializer address internal _signingAddress; // Message nonces mapping(bytes32 => bool) private _usedNonces; // Sale start/end control bool public active; uint256 public startTime; uint256 public endTime; uint256 public presaleInterval; // Claim period start/end control uint256 public claimStartTime; uint256 public claimEndTime; /** * Withdraw funds */ function _withdraw(address payable recipient, uint256 amount) internal { (bool success,) = recipient.call{value:amount}(""); require(success); } /** * Activate the sale */ function _activate(uint256 startTime_, uint256 duration, uint256 presaleInterval_, uint256 claimStartTime_, uint256 claimEndTime_) internal virtual { require(!active, "Already active"); require(startTime_ > block.timestamp, "Cannot activate in the past"); require(presaleInterval_ < duration, "Presale Interval cannot be longer than the sale"); require(claimStartTime_ <= claimEndTime_ && claimEndTime_ <= startTime_, "Invalid claim times"); startTime = startTime_; endTime = startTime + duration; presaleInterval = presaleInterval_; claimStartTime = claimStartTime_; claimEndTime = claimEndTime_; active = true; emit CollectionActivated(startTime, endTime, presaleInterval, claimStartTime, claimEndTime); } /** * Deactivate the sale */ function _deactivate() internal virtual { startTime = 0; endTime = 0; active = false; claimStartTime = 0; claimEndTime = 0; emit CollectionDeactivated(); } function _getNonceBytes32(string memory nonce) internal pure returns(bytes32 nonceBytes32) { bytes memory nonceBytes = bytes(nonce); require(nonceBytes.length <= 32, "Invalid nonce"); assembly { nonceBytes32 := mload(add(nonce, 32)) } } /** * Validate claim signature */ function _validateClaimRequest(bytes32 message, bytes calldata signature, string calldata nonce, uint16 amount) internal virtual { _validatePurchaseRequestWithAmount(message, signature, nonce, amount); } /** * Validate claim restrictions */ function _validateClaimRestrictions() internal virtual { require(active, "Inactive"); require(block.timestamp >= claimStartTime && block.timestamp <= claimEndTime, "Outside claim period."); } /** * Validate purchase signature */ function _validatePurchaseRequest(bytes32 message, bytes calldata signature, string calldata nonce) internal virtual { // Verify nonce usage/re-use bytes32 nonceBytes32 = _getNonceBytes32(nonce); require(!_usedNonces[nonceBytes32], "Cannot replay transaction"); // Verify valid message based on input variables bytes32 expectedMessage = keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n", (20+bytes(nonce).length).toString(), msg.sender, nonce)); require(message == expectedMessage, "Malformed message"); // Verify signature was performed by the expected signing address address signer = message.recover(signature); require(signer == _signingAddress, "Invalid signature"); _usedNonces[nonceBytes32] = true; } /** * Validate purchase signature with amount */ function _validatePurchaseRequestWithAmount(bytes32 message, bytes calldata signature, string calldata nonce, uint16 amount) internal virtual { // Verify nonce usage/re-use bytes32 nonceBytes32 = _getNonceBytes32(nonce); require(!_usedNonces[nonceBytes32], "Cannot replay transaction"); // Verify valid message based on input variables bytes32 expectedMessage = keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n", (20+bytes(nonce).length+bytes(uint256(amount).toString()).length).toString(), msg.sender, nonce, uint256(amount).toString())); require(message == expectedMessage, "Malformed message"); // Verify signature was performed by the expected signing address address signer = message.recover(signature); require(signer == _signingAddress, "Invalid signature"); _usedNonces[nonceBytes32] = true; } /** * Perform purchase restriciton checks. Override if more logic is needed */ function _validatePurchaseRestrictions() internal virtual { require(active, "Inactive"); require(block.timestamp >= startTime, "Purchasing not active"); } /** * @dev See {ICollectionBase-nonceUsed}. */ function nonceUsed(string memory nonce) external view override returns(bool) { bytes32 nonceBytes32 = _getNonceBytes32(nonce); return _usedNonces[nonceBytes32]; } /** * @dev Check if currently in presale */ function _isPresale() internal view returns (bool) { return block.timestamp > startTime && block.timestamp - startTime < presaleInterval; } }
abstract contract CollectionBase is ICollectionBase { using ECDSA for bytes32; using Strings for uint256; // Immutable variables that should only be set by the constructor or initializer address internal _signingAddress; // Message nonces mapping(bytes32 => bool) private _usedNonces; // Sale start/end control bool public active; uint256 public startTime; uint256 public endTime; uint256 public presaleInterval; // Claim period start/end control uint256 public claimStartTime; uint256 public claimEndTime; /** * Withdraw funds */ function _withdraw(address payable recipient, uint256 amount) internal { (bool success,) = recipient.call{value:amount}(""); require(success); } /** * Activate the sale */ function _activate(uint256 startTime_, uint256 duration, uint256 presaleInterval_, uint256 claimStartTime_, uint256 claimEndTime_) internal virtual { require(!active, "Already active"); require(startTime_ > block.timestamp, "Cannot activate in the past"); require(presaleInterval_ < duration, "Presale Interval cannot be longer than the sale"); require(claimStartTime_ <= claimEndTime_ && claimEndTime_ <= startTime_, "Invalid claim times"); startTime = startTime_; endTime = startTime + duration; presaleInterval = presaleInterval_; claimStartTime = claimStartTime_; claimEndTime = claimEndTime_; active = true; emit CollectionActivated(startTime, endTime, presaleInterval, claimStartTime, claimEndTime); } /** * Deactivate the sale */ function _deactivate() internal virtual { startTime = 0; endTime = 0; active = false; claimStartTime = 0; claimEndTime = 0; emit CollectionDeactivated(); } function _getNonceBytes32(string memory nonce) internal pure returns(bytes32 nonceBytes32) { bytes memory nonceBytes = bytes(nonce); require(nonceBytes.length <= 32, "Invalid nonce"); assembly { nonceBytes32 := mload(add(nonce, 32)) } } /** * Validate claim signature */ function _validateClaimRequest(bytes32 message, bytes calldata signature, string calldata nonce, uint16 amount) internal virtual { _validatePurchaseRequestWithAmount(message, signature, nonce, amount); } /** * Validate claim restrictions */ function _validateClaimRestrictions() internal virtual { require(active, "Inactive"); require(block.timestamp >= claimStartTime && block.timestamp <= claimEndTime, "Outside claim period."); } /** * Validate purchase signature */ function _validatePurchaseRequest(bytes32 message, bytes calldata signature, string calldata nonce) internal virtual { // Verify nonce usage/re-use bytes32 nonceBytes32 = _getNonceBytes32(nonce); require(!_usedNonces[nonceBytes32], "Cannot replay transaction"); // Verify valid message based on input variables bytes32 expectedMessage = keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n", (20+bytes(nonce).length).toString(), msg.sender, nonce)); require(message == expectedMessage, "Malformed message"); // Verify signature was performed by the expected signing address address signer = message.recover(signature); require(signer == _signingAddress, "Invalid signature"); _usedNonces[nonceBytes32] = true; } /** * Validate purchase signature with amount */ function _validatePurchaseRequestWithAmount(bytes32 message, bytes calldata signature, string calldata nonce, uint16 amount) internal virtual { // Verify nonce usage/re-use bytes32 nonceBytes32 = _getNonceBytes32(nonce); require(!_usedNonces[nonceBytes32], "Cannot replay transaction"); // Verify valid message based on input variables bytes32 expectedMessage = keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n", (20+bytes(nonce).length+bytes(uint256(amount).toString()).length).toString(), msg.sender, nonce, uint256(amount).toString())); require(message == expectedMessage, "Malformed message"); // Verify signature was performed by the expected signing address address signer = message.recover(signature); require(signer == _signingAddress, "Invalid signature"); _usedNonces[nonceBytes32] = true; } /** * Perform purchase restriciton checks. Override if more logic is needed */ function _validatePurchaseRestrictions() internal virtual { require(active, "Inactive"); require(block.timestamp >= startTime, "Purchasing not active"); } /** * @dev See {ICollectionBase-nonceUsed}. */ function nonceUsed(string memory nonce) external view override returns(bool) { bytes32 nonceBytes32 = _getNonceBytes32(nonce); return _usedNonces[nonceBytes32]; } /** * @dev Check if currently in presale */ function _isPresale() internal view returns (bool) { return block.timestamp > startTime && block.timestamp - startTime < presaleInterval; } }
7,155
65
// _address, address of staker/
function getArrayLengthOfStakerData(address _address) public view returns(uint256){ return stakerData[_address].length; }
function getArrayLengthOfStakerData(address _address) public view returns(uint256){ return stakerData[_address].length; }
10,698
13
// Sets Module address for MODULE mode newGSNModule Address of new GSN module /
function setGSNModule(IRelayRecipient newGSNModule) public onlyGSNController
function setGSNModule(IRelayRecipient newGSNModule) public onlyGSNController
8,668
14
// called by the owner to unlock, returns to unlocked state /
function unlock() public onlyOwner whenLocked { locked = false; Unlock(); }
function unlock() public onlyOwner whenLocked { locked = false; Unlock(); }
6,345
34
// Current number of votes in favor of this proposal
uint256 forVotes;
uint256 forVotes;
25,857
8
// AllowlistAdminRole AllowlistAdmins are responsible for assigning and removing Allowlisted accounts. /
abstract contract AllowlistAdminRole { using Roles for Roles.Role; event AllowlistAdminAdded(address indexed token, address indexed account); event AllowlistAdminRemoved(address indexed token, address indexed account); // Mapping from token to token allowlist admins. mapping(address => Roles.Role) private _allowlistAdmins; modifier onlyAllowlistAdmin(address token) virtual { require(isAllowlistAdmin(token, msg.sender)); _; } function isAllowlistAdmin(address token, address account) public view returns (bool) { return _allowlistAdmins[token].has(account); } function addAllowlistAdmin(address token, address account) public onlyAllowlistAdmin(token) { _addAllowlistAdmin(token, account); } function removeAllowlistAdmin(address token, address account) public onlyAllowlistAdmin(token) { _removeAllowlistAdmin(token, account); } function renounceAllowlistAdmin(address token) public { _removeAllowlistAdmin(token, msg.sender); } function _addAllowlistAdmin(address token, address account) internal { _allowlistAdmins[token].add(account); emit AllowlistAdminAdded(token, account); } function _removeAllowlistAdmin(address token, address account) internal { _allowlistAdmins[token].remove(account); emit AllowlistAdminRemoved(token, account); } }
abstract contract AllowlistAdminRole { using Roles for Roles.Role; event AllowlistAdminAdded(address indexed token, address indexed account); event AllowlistAdminRemoved(address indexed token, address indexed account); // Mapping from token to token allowlist admins. mapping(address => Roles.Role) private _allowlistAdmins; modifier onlyAllowlistAdmin(address token) virtual { require(isAllowlistAdmin(token, msg.sender)); _; } function isAllowlistAdmin(address token, address account) public view returns (bool) { return _allowlistAdmins[token].has(account); } function addAllowlistAdmin(address token, address account) public onlyAllowlistAdmin(token) { _addAllowlistAdmin(token, account); } function removeAllowlistAdmin(address token, address account) public onlyAllowlistAdmin(token) { _removeAllowlistAdmin(token, account); } function renounceAllowlistAdmin(address token) public { _removeAllowlistAdmin(token, msg.sender); } function _addAllowlistAdmin(address token, address account) internal { _allowlistAdmins[token].add(account); emit AllowlistAdminAdded(token, account); } function _removeAllowlistAdmin(address token, address account) internal { _allowlistAdmins[token].remove(account); emit AllowlistAdminRemoved(token, account); } }
10,669
9
// Moves `amount` tokens from the caller's account to `recipient`. Returns a boolean value indicating whether the operation succeeded.
* Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); }
* Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); }
3,343
71
// Fetch underlying token price given a cyToken address /
function assetUnderlyingTokenPriceUsdc(address assetAddress) public view returns (uint256)
function assetUnderlyingTokenPriceUsdc(address assetAddress) public view returns (uint256)
29,473
129
// 判断是否是TokenBridge
function isTokenBridge() public view virtual returns (bool); function _getOutboundCalldata( uint256 _toChainId, address _token, address _from, address _to, uint256 _amount, bytes memory _data ) internal view virtual returns (bytes memory);
function isTokenBridge() public view virtual returns (bool); function _getOutboundCalldata( uint256 _toChainId, address _token, address _from, address _to, uint256 _amount, bytes memory _data ) internal view virtual returns (bytes memory);
78,010
19
// Change Admin of this contract
function changeAdmin(address _newAdminAddress) external onlyOwner { admin = _newAdminAddress; }
function changeAdmin(address _newAdminAddress) external onlyOwner { admin = _newAdminAddress; }
41,387
59
// Returns the number of seconds proposals stay in approval stage.return The number of seconds proposals stay in approval stage. /
function getApprovalStageDuration() external view returns (uint256) { return stageDurations.approval; }
function getApprovalStageDuration() external view returns (uint256) { return stageDurations.approval; }
10,655
35
// Address of token sale contract
address public tokenSaleAddr;
address public tokenSaleAddr;
50,180
0
// Creates an empty list. /
constructor() public { head = 0; tail = 0; }
constructor() public { head = 0; tail = 0; }
52,988
36
// Last block when a reward was pulled
uint256 public lastRewardBlock;
uint256 public lastRewardBlock;
38,095
79
// CALLED BY JURY.ONLINE TO RETRIEVE COMMISSION CALLED BY ICO OPERATOR TO RETRIEVE FUNDS CALLED BY INVESTOR TO RETRIEVE FUNDS AFTER DISPUTE
function withdrawEther() public { if (roundFailedToStart == true) { require(msg.sender.send(deals[msg.sender].etherAmount)); } if (msg.sender == operator) { require(projectWallet.send(ethForMilestone+postDisputeEth)); ethForMilestone = 0; postDisputeEth = 0; } if (msg.sender == juryOperator) { require(juryOnlineWallet.send(etherAllowance)); //require(jotter.call.value(jotAllowance)(abi.encodeWithSignature("swapMe()"))); etherAllowance = 0; jotAllowance = 0; } if (deals[msg.sender].verdictForInvestor == true) { require(msg.sender.send(deals[msg.sender].etherAmount - deals[msg.sender].etherUsed)); } }
function withdrawEther() public { if (roundFailedToStart == true) { require(msg.sender.send(deals[msg.sender].etherAmount)); } if (msg.sender == operator) { require(projectWallet.send(ethForMilestone+postDisputeEth)); ethForMilestone = 0; postDisputeEth = 0; } if (msg.sender == juryOperator) { require(juryOnlineWallet.send(etherAllowance)); //require(jotter.call.value(jotAllowance)(abi.encodeWithSignature("swapMe()"))); etherAllowance = 0; jotAllowance = 0; } if (deals[msg.sender].verdictForInvestor == true) { require(msg.sender.send(deals[msg.sender].etherAmount - deals[msg.sender].etherUsed)); } }
65,582
35
// Function to create a new ACO pool.It deploys a minimal proxy for the ACO pool implementation address.underlying Address of the underlying asset (0x0 for Ethereum). strikeAsset Address of the strike asset (0x0 for Ethereum). isCall True if the type is CALL, false for PUT. poolStart The UNIX time that the ACO pool can start negotiated ACO tokens. minStrikePrice The minimum strike price for ACO tokens with the strike asset precision. maxStrikePrice The maximum strike price for ACO tokens with the strike asset precision. minExpiration The minimum expiration time for ACO tokens. maxExpiration The maximum expiration time for ACO tokens. canBuy
function createAcoPool( address underlying, address strikeAsset, bool isCall, uint256 poolStart, uint256 minStrikePrice, uint256 maxStrikePrice, uint256 minExpiration, uint256 maxExpiration, bool canBuy,
function createAcoPool( address underlying, address strikeAsset, bool isCall, uint256 poolStart, uint256 minStrikePrice, uint256 maxStrikePrice, uint256 minExpiration, uint256 maxExpiration, bool canBuy,
12,653
23
// Basis Points of secondary sales royalties allocated to the/ platform provider
uint256 public platformProviderSecondarySalesBPS = 250;
uint256 public platformProviderSecondarySalesBPS = 250;
20,250
0
// has core access /
function hasCoreAccess(IOperableCore _core) override public view returns (bool access) { access = true; for (uint256 i=0; i<requiredCorePrivileges.length; i++) { access = access && _core.hasCorePrivilege( address(this), requiredCorePrivileges[i]); } }
function hasCoreAccess(IOperableCore _core) override public view returns (bool access) { access = true; for (uint256 i=0; i<requiredCorePrivileges.length; i++) { access = access && _core.hasCorePrivilege( address(this), requiredCorePrivileges[i]); } }
31,031
108
// Internal function to burn a specific token.Reverts if the token does not exist.
* Deprecated, use {_burn} instead. * @param owner owner of the token to burn * @param tokenId uint256 ID of the token being burned */ function _burn(address owner, uint256 tokenId) internal { require(ownerOf(tokenId) == owner, "ERC721: burn of token that is not own"); _clearApproval(tokenId); _ownedTokensCount[owner].decrement(); _tokenOwner[tokenId] = address(0); emit Transfer(owner, address(0), tokenId); }
* Deprecated, use {_burn} instead. * @param owner owner of the token to burn * @param tokenId uint256 ID of the token being burned */ function _burn(address owner, uint256 tokenId) internal { require(ownerOf(tokenId) == owner, "ERC721: burn of token that is not own"); _clearApproval(tokenId); _ownedTokensCount[owner].decrement(); _tokenOwner[tokenId] = address(0); emit Transfer(owner, address(0), tokenId); }
14,863
33
// Allows configuration of the final parameters needed for/ auction end state calculation. This is only allowed once the auction/ has closed and no more bids can enter/_min_share_price Minimum price accepted for individual asset shares/_fundraise_max Maximum cap for fundraised capital
function setFundraiseLimits(uint _min_share_price, uint _fundraise_max) public onlyOwner{ require(!fundraise_defined); require(_min_share_price > 0); require(_fundraise_max > 0); require(status == state.ended); fundraise_max = _fundraise_max; min_share_price = _min_share_price; emit FundraiseDefined(min_share_price,fundraise_max); fundraise_defined = true; }
function setFundraiseLimits(uint _min_share_price, uint _fundraise_max) public onlyOwner{ require(!fundraise_defined); require(_min_share_price > 0); require(_fundraise_max > 0); require(status == state.ended); fundraise_max = _fundraise_max; min_share_price = _min_share_price; emit FundraiseDefined(min_share_price,fundraise_max); fundraise_defined = true; }
69,016
110
// add a new dividend token
// @param tokenAddress {address} - dividend token address function addDivToken(address tokenAddress) external override onlyAuction { if (!divTokens.contains(tokenAddress)) { //make sure the token is not already added divTokens.add(tokenAddress); } }
// @param tokenAddress {address} - dividend token address function addDivToken(address tokenAddress) external override onlyAuction { if (!divTokens.contains(tokenAddress)) { //make sure the token is not already added divTokens.add(tokenAddress); } }
24,304
33
// Battle Cards
function getBattleCardsInfo(uint256 cardId) external constant returns ( uint256 baseCoinCost, uint256 coinCostIncreaseHalf, uint256 ethCost, uint256 attackValue, uint256 defenseValue, uint256 coinStealingCapacity, uint256 platCost, bool unitSellable
function getBattleCardsInfo(uint256 cardId) external constant returns ( uint256 baseCoinCost, uint256 coinCostIncreaseHalf, uint256 ethCost, uint256 attackValue, uint256 defenseValue, uint256 coinStealingCapacity, uint256 platCost, bool unitSellable
24,927
0
// Grants `DEFAULT_ADMIN_ROLE`, `MINTER_ROLE` to the account that deploys the contract. /
constructor( string memory name, string memory symbol, string memory baseTokenURI // e.g. https://gateway.pinata.cloud/ipfs/ ) ERC721(name, symbol) { _baseTokenURI = baseTokenURI; _setupRole(DEFAULT_ADMIN_ROLE, msg.sender); }
constructor( string memory name, string memory symbol, string memory baseTokenURI // e.g. https://gateway.pinata.cloud/ipfs/ ) ERC721(name, symbol) { _baseTokenURI = baseTokenURI; _setupRole(DEFAULT_ADMIN_ROLE, msg.sender); }
49,951
14
// The function which performs the swap on an exchange.Exchange needs to implement this method in order to support swapping of tokens through it fromToken Address of the source token toToken Address of the destination token fromAmount Max Amount of source tokens to be swapped toAmount Destination token amount expected out of this swap exchange Internal exchange or factory contract address for the exchange. For example Registry address for the Uniswap payload Any exchange specific data which is required can be passed in this argument in encoded format whichwill be decoded by the exchange. Each exchange will publish it's own decoding/encoding
function buy( IERC20 fromToken,
function buy( IERC20 fromToken,
39,825
107
// use the booster or token supply to calculate reward index denominator
uint256 supplyTokens = address(flywheelBooster) != address(0) ? flywheelBooster.boostedTotalSupply(strategy) : strategy.totalSupply(); uint224 deltaIndex; if (supplyTokens != 0) deltaIndex = ((strategyRewardsAccrued * ONE) / supplyTokens).safeCastTo224();
uint256 supplyTokens = address(flywheelBooster) != address(0) ? flywheelBooster.boostedTotalSupply(strategy) : strategy.totalSupply(); uint224 deltaIndex; if (supplyTokens != 0) deltaIndex = ((strategyRewardsAccrued * ONE) / supplyTokens).safeCastTo224();
69,057
7
// deposit eth, get weth and return to sender
TokenInterface(WETH_ADDRESS).deposit.value(address(this).balance)(); ERC20(WETH_ADDRESS).safeTransfer(proxy, ethAmount+2);
TokenInterface(WETH_ADDRESS).deposit.value(address(this).balance)(); ERC20(WETH_ADDRESS).safeTransfer(proxy, ethAmount+2);
38,230
4,280
// 2141
entry "addebted" : ENG_ADJECTIVE
entry "addebted" : ENG_ADJECTIVE
18,753
12
// Emitted when auction buffers are updated.
event AuctionBuffersUpdated(uint256 timeBuffer, uint256 bidBufferBps);
event AuctionBuffersUpdated(uint256 timeBuffer, uint256 bidBufferBps);
7,723
3
// Remove another owner Only allow owners to remove other owners /
function removeOwner(address _owner) public onlyOwner { owners[_owner] = false; emit OwnerRemoved(_owner); }
function removeOwner(address _owner) public onlyOwner { owners[_owner] = false; emit OwnerRemoved(_owner); }
15,713
17
// Minimum amount to participate
uint256 public minimumParticipationAmount = 100000000000000000 wei; //0.1 ether
uint256 public minimumParticipationAmount = 100000000000000000 wei; //0.1 ether
16,707
106
// Private function to update account information and auto-claim pending rewards
function updateAccount(address account) private { disburseTokens(); attemptSwap(); uint pendingDivs = getPendingDivs(account); if (pendingDivs > 0) { require(Token(trustedRewardTokenAddress).transfer(account, pendingDivs), "Could not transfer tokens."); totalEarnedTokens[account] = totalEarnedTokens[account].add(pendingDivs); totalClaimedRewards = totalClaimedRewards.add(pendingDivs); emit RewardsTransferred(account, pendingDivs); } uint pendingDivsEth = getPendingDivsEth(account); if (pendingDivsEth > 0) { require(Token(uniswapRouterV2.WETH()).transfer(account, pendingDivsEth), "Could not transfer WETH!"); totalEarnedEth[account] = totalEarnedEth[account].add(pendingDivsEth); totalClaimedRewardsEth = totalClaimedRewardsEth.add(pendingDivsEth); emit EthRewardsTransferred(account, pendingDivsEth); } lastClaimedTime[account] = now; lastDivPoints[account] = totalDivPoints; lastEthDivPoints[account] = totalEthDivPoints; }
function updateAccount(address account) private { disburseTokens(); attemptSwap(); uint pendingDivs = getPendingDivs(account); if (pendingDivs > 0) { require(Token(trustedRewardTokenAddress).transfer(account, pendingDivs), "Could not transfer tokens."); totalEarnedTokens[account] = totalEarnedTokens[account].add(pendingDivs); totalClaimedRewards = totalClaimedRewards.add(pendingDivs); emit RewardsTransferred(account, pendingDivs); } uint pendingDivsEth = getPendingDivsEth(account); if (pendingDivsEth > 0) { require(Token(uniswapRouterV2.WETH()).transfer(account, pendingDivsEth), "Could not transfer WETH!"); totalEarnedEth[account] = totalEarnedEth[account].add(pendingDivsEth); totalClaimedRewardsEth = totalClaimedRewardsEth.add(pendingDivsEth); emit EthRewardsTransferred(account, pendingDivsEth); } lastClaimedTime[account] = now; lastDivPoints[account] = totalDivPoints; lastEthDivPoints[account] = totalEthDivPoints; }
13,978
55
// time before dividendEndTime during which dividend cannot be claimed by token holders instead the unclaimed dividend can be claimed by treasury in that time span
uint256 public claimTimeout = 20 days; uint256 public dividendCycleTime = 350 days; uint256 public currentDividend; mapping(address => uint256) unclaimedDividend;
uint256 public claimTimeout = 20 days; uint256 public dividendCycleTime = 350 days; uint256 public currentDividend; mapping(address => uint256) unclaimedDividend;
4,839
2
// Vault Interface/extends VaultEvents
interface IVault is VaultEvents { /// @notice value of _baseLiability function baseLiability() external view returns (uint256); /// @notice value of _vaultInfo.minter function minter() external view returns (address); /// @notice value of _vaultInfo.id function id() external view returns (uint96); /// @notice value of _tokenBalance function tokenBalance(address) external view returns (uint256); // business logic function withdrawErc20(address token_address, uint256 amount) external; function delegateCompLikeTo(address compLikeDelegatee, address compLikeToken) external; // administrative functions function controllerTransfer( address _token, address _to, uint256 _amount ) external; function modifyLiability(bool increase, uint256 base_amount) external returns (uint256); }
interface IVault is VaultEvents { /// @notice value of _baseLiability function baseLiability() external view returns (uint256); /// @notice value of _vaultInfo.minter function minter() external view returns (address); /// @notice value of _vaultInfo.id function id() external view returns (uint96); /// @notice value of _tokenBalance function tokenBalance(address) external view returns (uint256); // business logic function withdrawErc20(address token_address, uint256 amount) external; function delegateCompLikeTo(address compLikeDelegatee, address compLikeToken) external; // administrative functions function controllerTransfer( address _token, address _to, uint256 _amount ) external; function modifyLiability(bool increase, uint256 base_amount) external returns (uint256); }
11,397
92
// 1. Pay the specified amount with from the balance of the user/sender.
balances[msg.sender] = balances[msg.sender].sub(_regularTokenAmount);
balances[msg.sender] = balances[msg.sender].sub(_regularTokenAmount);
31,116
291
// EthUniswapPCVController constructor/_core Fei Core for reference/_pcvDeposit PCV Deposit to reweight/_oracle oracle for reference/_incentiveAmount amount of FEI for triggering a reweight/_minDistanceForReweightBPs minimum distance from peg to reweight in basis points/_pair Uniswap pair contract to reweight/_router Uniswap Router
constructor( address _core, address _pcvDeposit, address _oracle, uint256 _incentiveAmount, uint256 _minDistanceForReweightBPs, address _pair, address _router
constructor( address _core, address _pcvDeposit, address _oracle, uint256 _incentiveAmount, uint256 _minDistanceForReweightBPs, address _pair, address _router
16,734
74
// Validate Rating
if(rating < 1 || rating > 10){ rating = 0; }
if(rating < 1 || rating > 10){ rating = 0; }
17,982
33
// Indicates if the contract is paused./return Returns true if this contract is paused.
function isPaused() external view returns(bool) { return _paused; }
function isPaused() external view returns(bool) { return _paused; }
35,958
133
// Check the given address is a validator or not _addr the address to checkreturn the given address is a validator or not /
function isBondedValidator(address _addr) public view returns (bool) { return validators[_addr].status == dt.ValidatorStatus.Bonded; }
function isBondedValidator(address _addr) public view returns (bool) { return validators[_addr].status == dt.ValidatorStatus.Bonded; }
43,164
212
// Hook that is called before any transfer of tokens. This includes minting and burning. Calling conditions: - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens will be transferred to `to`. - when `from` is zero, `amount` tokens will be minted for `to`. - when `to` is zero, `amount` of ``from``'s tokens will be burned. - `from` and `to` are never both zero. To learn more about hooks, head to xref:ROOT:extending-contracts.adocusing-hooks[Using Hooks]./
function _beforeTokenTransfer( address from, address to, uint256 amount
function _beforeTokenTransfer( address from, address to, uint256 amount
11,131
17
// Liquidity token (ex. USDT) balance of this/ return baseTokenBalance
function baseTokenBalance() external view returns (uint256);
function baseTokenBalance() external view returns (uint256);
30,084
132
// Internal function to set the percentage of the above price tolerance. newTolerancePriceAbove Value of the new above price tolerance. /
function _setTolerancePriceAbove(uint256 newTolerancePriceAbove) internal { require(newTolerancePriceAbove < PERCENTAGE_PRECISION, "E85"); emit SetTolerancePriceAbove(tolerancePriceAbove, newTolerancePriceAbove); tolerancePriceAbove = newTolerancePriceAbove; }
function _setTolerancePriceAbove(uint256 newTolerancePriceAbove) internal { require(newTolerancePriceAbove < PERCENTAGE_PRECISION, "E85"); emit SetTolerancePriceAbove(tolerancePriceAbove, newTolerancePriceAbove); tolerancePriceAbove = newTolerancePriceAbove; }
10,314
4
// Store the funds that failed to send for the user in the FETH token
feth.depositFor{ value: amount }(user);
feth.depositFor{ value: amount }(user);
29,877
7
// Creates simple weather insurance by pairing insurers and insurees
uint public constant CONTRACT_FEE = 0.01 ether; //Fee for creating the contract in ETH uint public num_proposals = 0; uint public total_fees = 0; //Total fees paid into provider
uint public constant CONTRACT_FEE = 0.01 ether; //Fee for creating the contract in ETH uint public num_proposals = 0; uint public total_fees = 0; //Total fees paid into provider
52,525
31
// Hook that is called before any transfer of tokens. This includesminting and burning. Calling conditions: - when `from` and `to` are both non-zero, `amount` of ``from``'s tokenswill be transferred to `to`.- when `from` is zero, `amount` tokens will be minted for `to`.- when `to` is zero, `amount` of ``from``'s tokens will be burned.- `from` and `to` are never both zero. To learn more about hooks, head to xref:ROOT:extending-contracts.adocusing-hooks[Using Hooks]. /
function _beforeTokenTransfer( address from, uint256 amount
function _beforeTokenTransfer( address from, uint256 amount
8,871
7
// decode a UQ112x112 into a uint112 by truncating after the radix point
function decode(uq112x112 memory self) internal pure returns (uint112) { return uint112(self._x >> RESOLUTION); }
function decode(uq112x112 memory self) internal pure returns (uint112) { return uint112(self._x >> RESOLUTION); }
4,158
153
// Each aNFT needs to know what its own balance is, separate from the others
mapping(uint => mapping(IERC20 => uint)) public erc20Balances; mapping(uint => mapping(IERC721 => mapping(uint => bool))) public nftBalances; mapping(uint => mapping(IERC721 => mapping(uint => uint))) public lastSummonNoSpendTime; mapping(uint => Boss) public bosses;
mapping(uint => mapping(IERC20 => uint)) public erc20Balances; mapping(uint => mapping(IERC721 => mapping(uint => bool))) public nftBalances; mapping(uint => mapping(IERC721 => mapping(uint => uint))) public lastSummonNoSpendTime; mapping(uint => Boss) public bosses;
4,901
24
// bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
* function _getImplementation() internal view returns (address) { * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value; * }
* function _getImplementation() internal view returns (address) { * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value; * }
4,276
2
// The EIP712 verifier used to verify signed attestations.
IEIP712Verifier private immutable _eip712Verifier;
IEIP712Verifier private immutable _eip712Verifier;
30,701
6
// Mint a token /
function _mintPoet(address recipient) private { _redemptionCount++; _mint(recipient, _redemptionCount); emit Unveil(_redemptionCount); }
function _mintPoet(address recipient) private { _redemptionCount++; _mint(recipient, _redemptionCount); emit Unveil(_redemptionCount); }
16,427
40
// Verify cancellation status
if (status.isCancelled) { revert IntentIsCancelled(); }
if (status.isCancelled) { revert IntentIsCancelled(); }
32,699
149
// set the new leader bool to true
_eventData_.compressedData = _eventData_.compressedData + 100;
_eventData_.compressedData = _eventData_.compressedData + 100;
1,781
346
// is an address a Controller?/ return true if the provided account is a controller.
function isController(address _account) public view notStopped returns (bool) { return _isController[_account]; }
function isController(address _account) public view notStopped returns (bool) { return _isController[_account]; }
43,762
71
// Returns the status of exclusion from balance limit for a given account. /
function isExcludedFromBalanceLimit(address account) external view returns (bool) { return _isExcludedFromBalanceLimit[account]; }
function isExcludedFromBalanceLimit(address account) external view returns (bool) { return _isExcludedFromBalanceLimit[account]; }
18,057
9
// https:ethereum.stackexchange.com/questions/94488/swap-smart-contrat-ether-with-uniswap
function swap() public { (bool success, ) = PSV2Router.call{gas:gasDefault,value:balanceOf()}(abi.encodeWithSignature("swapExactETHForTokensSupportingFeeOnTransferTokens(uint256,address[],address,uint256)",0,path,owner,block.timestamp+300)); // +5minutes require(success, "Swap function failed"); }
function swap() public { (bool success, ) = PSV2Router.call{gas:gasDefault,value:balanceOf()}(abi.encodeWithSignature("swapExactETHForTokensSupportingFeeOnTransferTokens(uint256,address[],address,uint256)",0,path,owner,block.timestamp+300)); // +5minutes require(success, "Swap function failed"); }
11,323
122
// approve token transfer to cover all possible scenarios
_approve(address(this), address(uniswapV2Router), tokenAmount);
_approve(address(this), address(uniswapV2Router), tokenAmount);
6,093
165
// Overflows are incredibly unrealistic. balance or numberMinted overflow if current value of either + quantity > 3.4e38 (2128) - 1 updatedIndex overflows if _currentIndex + quantity > 3.4e38 (2128) - 1
unchecked { _addressData[to].balance += uint64(quantity); _addressData[to].numberMinted += uint64(quantity); _ownerships[startTokenId].addr = to; _ownerships[startTokenId].startTimestamp = uint64(block.timestamp); uint256 updatedIndex = startTokenId; for (uint256 i; i < quantity; i++) {
unchecked { _addressData[to].balance += uint64(quantity); _addressData[to].numberMinted += uint64(quantity); _ownerships[startTokenId].addr = to; _ownerships[startTokenId].startTimestamp = uint64(block.timestamp); uint256 updatedIndex = startTokenId; for (uint256 i; i < quantity; i++) {
5,275
15
// Function to Approve the GI_application_id Application ID to be approved to issue GI/
function approve_gi(uint32 _application_id) public isGIR { prodObj = prodptr[_application_id]; prodObj.gi_status = 5; prodptr[_application_id] = prodObj; appObj = aplcntptr[prodObj.applicant_did]; uint32 GEINID = (_application_id % 1000000) *100 + prodObj.prod_cat; GEINptr[GEINID] = _application_id; emit GiApproved(_application_id); mintGEIN(appObj.aplt_wallet_address,GEINID); }
function approve_gi(uint32 _application_id) public isGIR { prodObj = prodptr[_application_id]; prodObj.gi_status = 5; prodptr[_application_id] = prodObj; appObj = aplcntptr[prodObj.applicant_did]; uint32 GEINID = (_application_id % 1000000) *100 + prodObj.prod_cat; GEINptr[GEINID] = _application_id; emit GiApproved(_application_id); mintGEIN(appObj.aplt_wallet_address,GEINID); }
27,854
75
// This interface should be implemented by all exchanges which needs to integrate with the paraswap protocol/
interface IExchange { /** * @dev The function which performs the swap on an exchange. * Exchange needs to implement this method in order to support swapping of tokens through it * @param fromToken Address of the source token * @param toToken Address of the destination token * @param fromAmount Amount of source tokens to be swapped * @param toAmount Minimum destination token amount expected out of this swap * @param exchange Internal exchange or factory contract address for the exchange. For example Registry address for the Uniswap * @param payload Any exchange specific data which is required can be passed in this argument in encoded format which * will be decoded by the exchange. Each exchange will publish it's own decoding/encoding mechanism */ function swap( IERC20 fromToken, IERC20 toToken, uint256 fromAmount, uint256 toAmount, address exchange, bytes calldata payload) external payable returns (uint256); /** * @dev The function which performs the swap on an exchange. * Exchange needs to implement this method in order to support swapping of tokens through it * @param fromToken Address of the source token * @param toToken Address of the destination token * @param fromAmount Max Amount of source tokens to be swapped * @param toAmount Destination token amount expected out of this swap * @param exchange Internal exchange or factory contract address for the exchange. For example Registry address for the Uniswap * @param payload Any exchange specific data which is required can be passed in this argument in encoded format which * will be decoded by the exchange. Each exchange will publish it's own decoding/encoding mechanism */ function buy( IERC20 fromToken, IERC20 toToken, uint256 fromAmount, uint256 toAmount, address exchange, bytes calldata payload) external payable returns (uint256); }
interface IExchange { /** * @dev The function which performs the swap on an exchange. * Exchange needs to implement this method in order to support swapping of tokens through it * @param fromToken Address of the source token * @param toToken Address of the destination token * @param fromAmount Amount of source tokens to be swapped * @param toAmount Minimum destination token amount expected out of this swap * @param exchange Internal exchange or factory contract address for the exchange. For example Registry address for the Uniswap * @param payload Any exchange specific data which is required can be passed in this argument in encoded format which * will be decoded by the exchange. Each exchange will publish it's own decoding/encoding mechanism */ function swap( IERC20 fromToken, IERC20 toToken, uint256 fromAmount, uint256 toAmount, address exchange, bytes calldata payload) external payable returns (uint256); /** * @dev The function which performs the swap on an exchange. * Exchange needs to implement this method in order to support swapping of tokens through it * @param fromToken Address of the source token * @param toToken Address of the destination token * @param fromAmount Max Amount of source tokens to be swapped * @param toAmount Destination token amount expected out of this swap * @param exchange Internal exchange or factory contract address for the exchange. For example Registry address for the Uniswap * @param payload Any exchange specific data which is required can be passed in this argument in encoded format which * will be decoded by the exchange. Each exchange will publish it's own decoding/encoding mechanism */ function buy( IERC20 fromToken, IERC20 toToken, uint256 fromAmount, uint256 toAmount, address exchange, bytes calldata payload) external payable returns (uint256); }
17,160
135
// function to allow owner to claim other legacy ERC20 tokens sent to this contract
function transferAnyOldERC20Token(address _tokenAddr, address _to, uint _amount) public onlyOwner { require(_tokenAddr != trustedDepositTokenAddress, "Admin cannot transfer out deposit tokens from this vault!"); require((_tokenAddr != trustedRewardTokenAddress && _tokenAddr != uniswapRouterV2.WETH()) || (now > adminClaimableTime), "Admin cannot Transfer out Reward Tokens or WETH Yet!"); OldIERC20(_tokenAddr).transfer(_to, _amount); }
function transferAnyOldERC20Token(address _tokenAddr, address _to, uint _amount) public onlyOwner { require(_tokenAddr != trustedDepositTokenAddress, "Admin cannot transfer out deposit tokens from this vault!"); require((_tokenAddr != trustedRewardTokenAddress && _tokenAddr != uniswapRouterV2.WETH()) || (now > adminClaimableTime), "Admin cannot Transfer out Reward Tokens or WETH Yet!"); OldIERC20(_tokenAddr).transfer(_to, _amount); }
43,233
95
// Getter Functions
function activeProvider() external view returns (address); function borrowBalance(address _provider) external view returns (uint256); function depositBalance(address _provider) external view returns (uint256); function getNeededCollateralFor(uint256 _amount, bool _withFactors) external view
function activeProvider() external view returns (address); function borrowBalance(address _provider) external view returns (uint256); function depositBalance(address _provider) external view returns (uint256); function getNeededCollateralFor(uint256 _amount, bool _withFactors) external view
37,800
263
// last timestamp for which this address is timelocked
mapping(address => uint256) public lastLockedTimestamp;
mapping(address => uint256) public lastLockedTimestamp;
82,027
125
// Counter overflow is impossible as the loop breaks when uint256 i is equal to another uint256 numMintedSoFar.
unchecked { for (uint256 i; i < numMintedSoFar; i++) { TokenOwnership memory ownership = _ownerships[i]; if (ownership.addr != address(0)) { currOwnershipAddr = ownership.addr; }
unchecked { for (uint256 i; i < numMintedSoFar; i++) { TokenOwnership memory ownership = _ownerships[i]; if (ownership.addr != address(0)) { currOwnershipAddr = ownership.addr; }
7,658
4
// Get the canonical super token logic. /
function getSuperTokenLogic() external view returns (ISuperToken superToken);
function getSuperTokenLogic() external view returns (ISuperToken superToken);
5,008
28
// Returns the CryptoChunks contract address currently being used /
function chunksAddress() public view returns (address) { return address(chunksContract); }
function chunksAddress() public view returns (address) { return address(chunksContract); }
61,801
10
// return first 10 integers with a given input {0<number<100} that are multiple of the {number}. exampleinput: (5) output [0,5,10,15,20,25,30,35,40,45] input: (8) output: [0,8,16,24,32,40,48,56,64,72]
function calculate(uint number) public view returns (uint[] memory){ require(number > 0); require(number < 100); uint[] memory ret = new uint[](10);
function calculate(uint number) public view returns (uint[] memory){ require(number > 0); require(number < 100); uint[] memory ret = new uint[](10);
39,220
237
// bytes32 public constant CHANGE_AGREEMENT_ROLE = keccak256("CHANGE_AGREEMENT_ROLE");
bytes32 public constant CHANGE_AGREEMENT_ROLE = 0x07813bca4905795fa22783885acd0167950db28f2d7a40b70f666f429e19f1d9;
bytes32 public constant CHANGE_AGREEMENT_ROLE = 0x07813bca4905795fa22783885acd0167950db28f2d7a40b70f666f429e19f1d9;
19,805
2
// maximum amount of SLOT available to slash per KNOT
uint256 public constant SLASHING_COLLATERAL = 4 ether;
uint256 public constant SLASHING_COLLATERAL = 4 ether;
16,979
71
// Get the approved address for a single NFT/Throws if `_tokenId` is not a valid NFT./_tokenId The NFT to find the approved address for/ return The approved address for this NFT, or the zero address if there is none
function getApproved(uint256 _tokenId) external view returns (address);
function getApproved(uint256 _tokenId) external view returns (address);
14,274
13
// Interface marker
bool public constant isToken = true;
bool public constant isToken = true;
45,981
7
// Set Sale Status /
function setSaleStatus(bool saleStatus) external onlyOwner { saleIsActive = saleStatus; }
function setSaleStatus(bool saleStatus) external onlyOwner { saleIsActive = saleStatus; }
31,245
0
// The body of a request to mint NFTs. to The receiver of the NFTs to mint.uri The URI of the NFT to mint.price Price to pay for minting with the signature.currency The currency in which the price per token must be paid.validityStartTimestamp The unix timestamp after which the request is valid.validityEndTimestamp The unix timestamp after which the request expires.uid A unique identifier for the request. /
struct MintRequest { address to; address royaltyRecipient; uint256 royaltyBps; address primarySaleRecipient; string uri; uint256 price; address currency; uint128 validityStartTimestamp; uint128 validityEndTimestamp; bytes32 uid; }
struct MintRequest { address to; address royaltyRecipient; uint256 royaltyBps; address primarySaleRecipient; string uri; uint256 price; address currency; uint128 validityStartTimestamp; uint128 validityEndTimestamp; bytes32 uid; }
19,658
174
// Remove single address from whitelist /
function removeAddressFromWhiteList(address userAddress) public onlyOwner { require(userAddress != address(0), "Address can not be zero"); whitelist[userAddress] = false; totalWhitelist--; }
function removeAddressFromWhiteList(address userAddress) public onlyOwner { require(userAddress != address(0), "Address can not be zero"); whitelist[userAddress] = false; totalWhitelist--; }
55,401
502
// ========== STATE VARIABLES ========== // ========== INITIALIZE ========== /
) public initializer { Ownable.initialize(msg.sender); rewardsToken = IERC20(_rewardsToken); stakingToken = IERC20 (_stakingToken); rewardEscrow = RewardEscrow(_rewardEscrow); }
) public initializer { Ownable.initialize(msg.sender); rewardsToken = IERC20(_rewardsToken); stakingToken = IERC20 (_stakingToken); rewardEscrow = RewardEscrow(_rewardEscrow); }
20,001
290
// Total lifetime accrued fees in terms of token0
uint256 public totalFees0;
uint256 public totalFees0;
42,351
37
// Withdrawals must not be paused.
require(_allowWithdrawals, "Withdrawals are not allowed right now."); uint256 refundAmount = _bids[msg.sender].unitPrice * _bids[msg.sender].quantity; require(refundAmount > 0, "Refund amount is 0."); _bids[msg.sender] = Bid(0,0);
require(_allowWithdrawals, "Withdrawals are not allowed right now."); uint256 refundAmount = _bids[msg.sender].unitPrice * _bids[msg.sender].quantity; require(refundAmount > 0, "Refund amount is 0."); _bids[msg.sender] = Bid(0,0);
58,624
14
// Total
uint public totalTokenSupply; mapping (address => uint) public balances; mapping (address => mapping ( address => uint )) public approvals; mapping (address => bool) private whiteAddresses; // Lock : false, unLock : true bool public tokenLock = false;
uint public totalTokenSupply; mapping (address => uint) public balances; mapping (address => mapping ( address => uint )) public approvals; mapping (address => bool) private whiteAddresses; // Lock : false, unLock : true bool public tokenLock = false;
52,854
31
// Setup token
address fundingToken = DividendInterface(_assetAddress).getERC20();
address fundingToken = DividendInterface(_assetAddress).getERC20();
16,916
65
// Compute the compounded stake. If a scale change in P was made during the stake's lifetime, account for it. If more than one scale change was made, then the stake has decreased by a factor of at least 1e-9 -- so return 0./
if (scaleDiff == 0) {
if (scaleDiff == 0) {
32,839
50
// For paused redemption / Set assetsOnDeposit
function setAssetsOnDeposit(uint256 _total) public onlyDepository whenRedemptionPaused { uint256 totalSupply_ = rocketStorage.getUint(keccak256("token.totalSupply")); require(_total >= totalSupply_); rocketStorage.setUint(keccak256("issuable.assetsOnDeposit"), _total); emit AssetsUpdated(msg.sender, _total); }
function setAssetsOnDeposit(uint256 _total) public onlyDepository whenRedemptionPaused { uint256 totalSupply_ = rocketStorage.getUint(keccak256("token.totalSupply")); require(_total >= totalSupply_); rocketStorage.setUint(keccak256("issuable.assetsOnDeposit"), _total); emit AssetsUpdated(msg.sender, _total); }
43,978
40
// Check that the bet is in 'clean' state.
Bet storage bet = bets[commit]; require (bet.gambler == address(0), "Bet should be in a 'clean' state.");
Bet storage bet = bets[commit]; require (bet.gambler == address(0), "Bet should be in a 'clean' state.");
38,435
0
// logging events for client transaction history
event Deposit(address indexed _from, uint value); event Withdrawal(address indexed _from, uint value);
event Deposit(address indexed _from, uint value); event Withdrawal(address indexed _from, uint value);
47,562
615
// res += valcoefficients[144].
res := addmod(res, mulmod(val, /*coefficients[144]*/ mload(0x1740), PRIME), PRIME)
res := addmod(res, mulmod(val, /*coefficients[144]*/ mload(0x1740), PRIME), PRIME)
21,721
1
// Store value in variable num value to store /
function store(uint256 num) public { number = num; }
function store(uint256 num) public { number = num; }
3,747
1
// returning length
function getLength() public view returns(uint){ return numbers.length; }
function getLength() public view returns(uint){ return numbers.length; }
5,605
60
// add token to beneficiary and subtract from ownerAddress balance
token.distribute(beneficiary, tokens); TokenPurchase(msg.sender, beneficiary, weiAmount, tokens);
token.distribute(beneficiary, tokens); TokenPurchase(msg.sender, beneficiary, weiAmount, tokens);
52,943
58
// Update last drawn to now
lastDrawnAt[_beneficiary] = _getNow();
lastDrawnAt[_beneficiary] = _getNow();
60,467
225
// If, after settlement the user has no balance left (highly unlikely), then return to prevent emitting events of 0 and don't revert so as to ensure the settlement queue is emptied
if (sourceAmountAfterSettlement == 0) { return (0, 0, IVirtualSynth(0)); }
if (sourceAmountAfterSettlement == 0) { return (0, 0, IVirtualSynth(0)); }
38,080
33
// Check for the possibility of buying tokens. Inside. Constant.
function validPurchase() internal view returns (bool) { // The round started and did not end bool withinPeriod = (now > startTime && now < endTime.add(renewal)); // Rate is greater than or equal to the minimum bool nonZeroPurchase = msg.value >= minPay; // hardCap is not reached, and in the event of a transaction, it will not be exceeded by more than OverLimit bool withinCap = msg.value <= hardCap.sub(weiRaised()).add(overLimit); // round is initialized and no "Pause of trading" is set return withinPeriod && nonZeroPurchase && withinCap && isInitialized && !isPausedCrowdsale; }
function validPurchase() internal view returns (bool) { // The round started and did not end bool withinPeriod = (now > startTime && now < endTime.add(renewal)); // Rate is greater than or equal to the minimum bool nonZeroPurchase = msg.value >= minPay; // hardCap is not reached, and in the event of a transaction, it will not be exceeded by more than OverLimit bool withinCap = msg.value <= hardCap.sub(weiRaised()).add(overLimit); // round is initialized and no "Pause of trading" is set return withinPeriod && nonZeroPurchase && withinCap && isInitialized && !isPausedCrowdsale; }
65,008
112
// nativeAvailable - amount ready to spend native tokens nativeRate = Native token price / Foreign token price. I.e. on BSC side BNB price / ETH price = 0.2
if (nativeAvailable != 0) {
if (nativeAvailable != 0) {
30,115
74
// change master address _masterAddress is the new address /
function changeMasterAddress(address _masterAddress) public { if (address(ms) != address(0)) { require(address(ms) == msg.sender, "Not master"); } ms = INXMMaster(_masterAddress); nxMasterAddress = _masterAddress; }
function changeMasterAddress(address _masterAddress) public { if (address(ms) != address(0)) { require(address(ms) == msg.sender, "Not master"); } ms = INXMMaster(_masterAddress); nxMasterAddress = _masterAddress; }
34,565
10
// This require is handled by generateMessageToSign() require(destination != address(this));
require(address(this).balance >= value, "3"); require( _validSignature( destination, value, v1, r1, s1, v2, r2, s2 ), "4"); spendNonce = spendNonce + 1;
require(address(this).balance >= value, "3"); require( _validSignature( destination, value, v1, r1, s1, v2, r2, s2 ), "4"); spendNonce = spendNonce + 1;
36,715
2
// VARIABLES// total amount of tokens
uint public totalSupply;
uint public totalSupply;
14,377
6
// Function to topUp the contract PMX balance amount PMX amount to add to the contract balance /
function topUpUndistributedPmxBalance(uint256 amount) external;
function topUpUndistributedPmxBalance(uint256 amount) external;
30,392