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
6
// Returns the subtraction of two unsigned integers, reverting with custom message onoverflow (when the result is negative). Counterpart to Solidity's `-` operator. Requirements:- Subtraction cannot overflow. /
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { assert(b <= a/*, errorMessage*/); uint256 c = a - b; return c; }
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { assert(b <= a/*, errorMessage*/); uint256 c = a - b; return c; }
2,040
2
// This function slices a uint/_bts some bytes/_from start position credit to https:ethereum.stackexchange.com/questions/51229/how-to-convert-bytes-to-uint-in-solidity and Nick Johnson https:ethereum.stackexchange.com/questions/4170/how-to-convert-a-uint-to-bytes-in-solidity/41774177
function _bytesToUint256(bytes memory _bts, uint256 _from) internal pure returns (uint256) { require(_bts.length >= _from.add(32), "slicing out of range"); uint256 convertedUint256; uint256 startByte = _from.add(32); //first 32 bytes denote the array length assembly { c...
function _bytesToUint256(bytes memory _bts, uint256 _from) internal pure returns (uint256) { require(_bts.length >= _from.add(32), "slicing out of range"); uint256 convertedUint256; uint256 startByte = _from.add(32); //first 32 bytes denote the array length assembly { c...
38,666
279
// Make sure sire isn't pregnant, or in the middle of a siring cooldown
require( _isReadyToHatch(sire), "CryptoAlpaca: Sire is not yet ready to hatch" );
require( _isReadyToHatch(sire), "CryptoAlpaca: Sire is not yet ready to hatch" );
39,419
138
// preliminary calc newDeposit (minimum deposit rule not yet applied)
newDeposit = (oldFlowData.deposit.toInt256() + depositDelta).toUint256();
newDeposit = (oldFlowData.deposit.toInt256() + depositDelta).toUint256();
6,055
0
// The token being sold
IERC20 private _token;
IERC20 private _token;
16,918
18
// register interfaces
ERC777Helper.register(address(this));
ERC777Helper.register(address(this));
5,082
28
// for (uint c=0;c<len;c++){ indexSet[c] =indexSet[c+1]; }
delete indexSet; indexSet.push(uint(8));
delete indexSet; indexSet.push(uint(8));
38,571
32
// Allows users to sign up with their own address
function signUpUser(string memory casedUserName) public requireStake(msg.sender, minimumHydroStakeUser) { return _userSignUp(casedUserName, msg.sender); }
function signUpUser(string memory casedUserName) public requireStake(msg.sender, minimumHydroStakeUser) { return _userSignUp(casedUserName, msg.sender); }
18,711
102
// We can't give people infinite ETH
if(tokenTotalSupply > 0) {
if(tokenTotalSupply > 0) {
46,435
42
// withdraw collects due funds in a safe manner /
function withdraw(uint256 sum) public { address withdrawer = msg.sender; // do we have enough funds for withdrawal? require(balances[withdrawer] >= sum); // notify the world Withdraw(withdrawer, sum, block.timestamp); // update (safely) balances[with...
function withdraw(uint256 sum) public { address withdrawer = msg.sender; // do we have enough funds for withdrawal? require(balances[withdrawer] >= sum); // notify the world Withdraw(withdrawer, sum, block.timestamp); // update (safely) balances[with...
36,231
10
// @inheritdoc AutomationCompatibleInterface executes executePayload action on payload controller. performData array of proposal ids to execute. /
function performUpkeep(bytes calldata performData) external override { uint40[] memory payloadIdsToExecute = abi.decode(performData, (uint40[])); bool isActionPerformed; // executes action on payloadIds in order from first to last for (uint256 i = payloadIdsToExecute.length; i > 0; i--) { uint4...
function performUpkeep(bytes calldata performData) external override { uint40[] memory payloadIdsToExecute = abi.decode(performData, (uint40[])); bool isActionPerformed; // executes action on payloadIds in order from first to last for (uint256 i = payloadIdsToExecute.length; i > 0; i--) { uint4...
32,015
7
// Treasury fee take on all rewards amount claimed/_fee New fee to set
function setFee(uint256 _fee) external onlyOwner { require(_fee < 20e16, "Too high"); // Max 20% fee = _fee; }
function setFee(uint256 _fee) external onlyOwner { require(_fee < 20e16, "Too high"); // Max 20% fee = _fee; }
24,776
3
// Throws if called by any account other than the owner of a tokenId./
modifier onlyOwnerOf(uint tokenId) { require(exists(tokenId), "Token doesn't exist."); require(ownerOf(tokenId) == msg.sender, "Caller is not the token owner"); _; }
modifier onlyOwnerOf(uint tokenId) { require(exists(tokenId), "Token doesn't exist."); require(ownerOf(tokenId) == msg.sender, "Caller is not the token owner"); _; }
35,094
78
// Allows a caller to sweep multiple handlers in one transaction /
function multiHandlerSweep(address[] memory handlers, IERC20 tokenContract) public {
function multiHandlerSweep(address[] memory handlers, IERC20 tokenContract) public {
18,988
0
// Arguments used to initialize the party.
struct PartyOptions { PartyGovernance.GovernanceOpts governance; ProposalStorage.ProposalEngineOpts proposalEngine; string name; string symbol; uint256 customizationPresetId; }
struct PartyOptions { PartyGovernance.GovernanceOpts governance; ProposalStorage.ProposalEngineOpts proposalEngine; string name; string symbol; uint256 customizationPresetId; }
41,466
2
// Emits when the trading is enabled/disabled for the asset/trading is the boolean representing the new state of trading
event StatusChanged(bool trading);
event StatusChanged(bool trading);
7,162
15
// management of the repositories
function updateCaller(address _caller, bool allowed) public onlyOwner { callers[_caller] = allowed; }
function updateCaller(address _caller, bool allowed) public onlyOwner { callers[_caller] = allowed; }
13,933
3
// Redeeming a voucher token burns it. /
function _doRedeem(address, uint256 tokenId) internal virtual override { _burn(tokenId); }
function _doRedeem(address, uint256 tokenId) internal virtual override { _burn(tokenId); }
7,759
44
// Refund the sender the excess he sent
uint purchaseExcess = SafeMath.sub(msg.value, currentPrice);
uint purchaseExcess = SafeMath.sub(msg.value, currentPrice);
42,589
213
// 加载代币数组
Option[] storage options = _options;
Option[] storage options = _options;
66,337
5
// Setters
function setOwner(address _owner) external
function setOwner(address _owner) external
32,806
0
// Transfers tokens from contract to a recipient/If token is 0x0000000000000000000000000000000000000001, an ETH transfer is done/_token The target token/_recipient The recipient of the transfer/_amount The amount of the transfer
function safeTransfer( address _token, address _recipient, uint256 _amount
function safeTransfer( address _token, address _recipient, uint256 _amount
36,172
2
// The factory which was used to create this collection. This is used to read common config. /
ICollectionFactory public immutable collectionFactory;
ICollectionFactory public immutable collectionFactory;
38,579
11
// Yield Info
uint256 public globalModulus = 10e14; // Round up 14 Decimals uint256 public yieldRatePerToken = 5 ether / globalModulus; // 5 Zen per Day
uint256 public globalModulus = 10e14; // Round up 14 Decimals uint256 public yieldRatePerToken = 5 ether / globalModulus; // 5 Zen per Day
20,831
223
// e.g. (1e201e18) / 1e18 = 1e20 e.g. (1e201e18) / 14e17 = 7.1429e19
credits = _underlying.add(1).divPrecisely(exchangeRate);
credits = _underlying.add(1).divPrecisely(exchangeRate);
5,400
74
// TOKEN AND ASSET FUNCTIONS /
function nTokens() public view returns (uint) { return assetSet.length(); }
function nTokens() public view returns (uint) { return assetSet.length(); }
7,862
12
// transfer of stake share
if (_stakeShare > 0) { _pmonToken.transferFrom( from, _stakeAddress, (amount * _stakeShare) / 100 ); }
if (_stakeShare > 0) { _pmonToken.transferFrom( from, _stakeAddress, (amount * _stakeShare) / 100 ); }
34,008
31
// return the best offer for a token pairthe best offer is the lowest one if it's an ask,and highest one if it's a bid offer
function getBestOffer(IERC20 sell_gem, IERC20 buy_gem) public view returns(uint) { return _best[address(sell_gem)][address(buy_gem)]; }
function getBestOffer(IERC20 sell_gem, IERC20 buy_gem) public view returns(uint) { return _best[address(sell_gem)][address(buy_gem)]; }
19,354
14
// ==== PAUSE / UNPAUSE ====
function toggle_pause() external;
function toggle_pause() external;
3,774
15
// Eyes SVG generator
library EyesParts1 { /// @dev Eyes N°23 => Moon Gold function item_1() public pure returns (string memory) { return string( abi.encodePacked( eyes, '<linearGradient id="Moon Aka" gradientUnits="userSpaceOnUse" x1="234.5972" y1="-460.801...
library EyesParts1 { /// @dev Eyes N°23 => Moon Gold function item_1() public pure returns (string memory) { return string( abi.encodePacked( eyes, '<linearGradient id="Moon Aka" gradientUnits="userSpaceOnUse" x1="234.5972" y1="-460.801...
18,205
99
// Claim stuck Balance in Contract Token \\
function claimTokens() public onlyOwner { payable(_owner).transfer(address(this).balance); }
function claimTokens() public onlyOwner { payable(_owner).transfer(address(this).balance); }
24,243
88
// Decimals override
function decimals() public pure override returns (uint8){ return DECIMALS; }
function decimals() public pure override returns (uint8){ return DECIMALS; }
33,411
401
// Get the edition number from a token id Returns `0` if it's not an edition tokenId The token id for the editionreturn editionNumber The edition number e.g. 2 of 10 /
function getEditionNumberFromTokenId(uint256 tokenId) external pure returns (uint256) { if (tokenId >= MAX_EDITION_SIZE) return 0; return tokenId % MAX_EDITION_SIZE; }
function getEditionNumberFromTokenId(uint256 tokenId) external pure returns (uint256) { if (tokenId >= MAX_EDITION_SIZE) return 0; return tokenId % MAX_EDITION_SIZE; }
26,635
9
// Save token with token standardtokenAddress Token addressstandard Standard of the token/
function setTokenStandard(address tokenAddress, bytes32 standard) public;
function setTokenStandard(address tokenAddress, bytes32 standard) public;
20,327
5
// Returns the interface hash for an `interfaceName`, as defined in thecorresponding /
function interfaceHash(string calldata interfaceName) external pure returns (bytes32);
function interfaceHash(string calldata interfaceName) external pure returns (bytes32);
27,998
68
// to emit Trove's debt update event, to be called from trove/ _token address of token/ _newAmount new trove's debt value/ _newCollateralization new trove's collateralization value
function emitTroveDebtUpdate( address _token, uint256 _newAmount, uint256 _newCollateralization, uint256 _feePaid
function emitTroveDebtUpdate( address _token, uint256 _newAmount, uint256 _newCollateralization, uint256 _feePaid
12,251
28
// Update user voting status to true
disp.voted[msg.sender] = true;
disp.voted[msg.sender] = true;
49,783
21
// Cast a with a reason Emits a {VoteCast} event. /
function castVoteWithReason(
function castVoteWithReason(
20,519
103
// - COMPOUND - //
function balanceToCompound(ICompoundBridge cToken) external { IERC20 underlying = IERC20(ICompoundBridge(cToken).underlying()); // sanity check for `underlying` token cToken.mint(underlying.safeBalanceOfSelf()); }
function balanceToCompound(ICompoundBridge cToken) external { IERC20 underlying = IERC20(ICompoundBridge(cToken).underlying()); // sanity check for `underlying` token cToken.mint(underlying.safeBalanceOfSelf()); }
24,020
26
// function for Defender Victory
function defenderVictory(address _attacker, address _defender, uint256 _attackerId, uint256 _defenderId, bool critDefend, uint256 _random, uint256 _powerDiff) public { // calculates 25% of what the Prize would have been for Attacker uint256 _prize = getPrizeAmount(_random) * 25 / 100; // upd...
function defenderVictory(address _attacker, address _defender, uint256 _attackerId, uint256 _defenderId, bool critDefend, uint256 _random, uint256 _powerDiff) public { // calculates 25% of what the Prize would have been for Attacker uint256 _prize = getPrizeAmount(_random) * 25 / 100; // upd...
24,429
74
// Calculate the public input hash (a SHA256 hash of several values)
uint256 publicInputHash = genProcessMessagesPublicInputHash( _poll, _currentMessageBatchIndex, _messageRoot, numSignUps, _currentSbCommitment, _newSbCommitment );
uint256 publicInputHash = genProcessMessagesPublicInputHash( _poll, _currentMessageBatchIndex, _messageRoot, numSignUps, _currentSbCommitment, _newSbCommitment );
35,312
4
// Emits when a configurator is upgraded
event NewConfigurator(address indexed newConfigurator);
event NewConfigurator(address indexed newConfigurator);
20,220
186
// Mint the fee
token.mint(feeRecipient, absoluteFee); emit LogMint(_recipient, receivedAmount, nextN, signedMessageHash); nextN += 1;
token.mint(feeRecipient, absoluteFee); emit LogMint(_recipient, receivedAmount, nextN, signedMessageHash); nextN += 1;
14,518
8
// Change Super Admin of the contract to a new account (`newSuperAdmin`).Can only be called by the current super admin. /
function changeSuperAdmin(address newSuperAdmin) public onlySuperAdmin { require( newSuperAdmin != address(0), "Super Admin: new super admin is the zero address" ); emit SuperAdminChanged(superAdmin, newSuperAdmin); superAdmin = newSuperAdmin; }
function changeSuperAdmin(address newSuperAdmin) public onlySuperAdmin { require( newSuperAdmin != address(0), "Super Admin: new super admin is the zero address" ); emit SuperAdminChanged(superAdmin, newSuperAdmin); superAdmin = newSuperAdmin; }
56,073
110
// if total position size less than IGNORABLE_DIGIT_FOR_SHUTDOWN, treat it as 0 positions due to rounding error
if (totalPositionSize.toUint() > IGNORABLE_DIGIT_FOR_SHUTDOWN) { settlementPrice = positionNotionalValue.abs().divD(totalPositionSize.abs()); }
if (totalPositionSize.toUint() > IGNORABLE_DIGIT_FOR_SHUTDOWN) { settlementPrice = positionNotionalValue.abs().divD(totalPositionSize.abs()); }
16,263
36
// reduce address balance and Token total supply
function addressburn(address _of, uint256 _value) onlyOwner public { require(_value > 0, INVALID_TOKEN_VALUES); require(_value <= balances[_of], NOT_ENOUGH_TOKENS); balances[_of] = balances[_of].sub(_value); _totalSupply = _totalSupply.sub(_value); emit AddressBurn(_of, _value); emit Transfer(_of, address...
function addressburn(address _of, uint256 _value) onlyOwner public { require(_value > 0, INVALID_TOKEN_VALUES); require(_value <= balances[_of], NOT_ENOUGH_TOKENS); balances[_of] = balances[_of].sub(_value); _totalSupply = _totalSupply.sub(_value); emit AddressBurn(_of, _value); emit Transfer(_of, address...
42,738
102
// solhint-enable var-name-mixedcase // Initializes the domain separator and parameter caches. The meaning of `name` and `version` is specified in - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol.- `version`: the current major version of the signing domain. NOTE: These p...
constructor(string memory name, string memory version) internal { bytes32 hashedName = keccak256(bytes(name)); bytes32 hashedVersion = keccak256(bytes(version)); bytes32 typeHash = keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)");
constructor(string memory name, string memory version) internal { bytes32 hashedName = keccak256(bytes(name)); bytes32 hashedVersion = keccak256(bytes(version)); bytes32 typeHash = keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)");
29,669
30
// amount should be greater than 0
require( _amounts[i] > 0, "addRecipients: vesting amount cannot be 0" );
require( _amounts[i] > 0, "addRecipients: vesting amount cannot be 0" );
13,067
163
// The number to divide an amount by to get the size/for that amount
uint denominator;
uint denominator;
47,942
16
// ____________________________________________________________________________________________________________________-->LOCK MINTING (function) setMintingCompleteForeverCannotBeUndoneAllow project owner to set minting completeEnter confirmation value to confirm that you are closing minting. --------------------------...
function setMintingCompleteForeverCannotBeUndone(
function setMintingCompleteForeverCannotBeUndone(
37,005
1
// change the owner of the contract/_newOwner the address of the new owner of the contract.
function changeOwner(address _newOwner) onlyOwner
function changeOwner(address _newOwner) onlyOwner
51,270
101
// Returns the balance of the payment plugin contract for a token (or ETH).
function _balance(address token) private view returns(uint) { if(token == ZERO) { return address(this).balance; } else { return IERC20(token).balanceOf(address(this)); } }
function _balance(address token) private view returns(uint) { if(token == ZERO) { return address(this).balance; } else { return IERC20(token).balanceOf(address(this)); } }
11,712
7
// Marketing
periodsElapsed = (currentTime - lastMarketingRewardTime) / (12 * ONE_MONTH); if (periodsElapsed > 0) { lastMarketingRewardTime += periodsElapsed * 12 * ONE_MONTH; releaseTokens(marketing, 4500000 * 10**18 * periodsElapsed); }
periodsElapsed = (currentTime - lastMarketingRewardTime) / (12 * ONE_MONTH); if (periodsElapsed > 0) { lastMarketingRewardTime += periodsElapsed * 12 * ONE_MONTH; releaseTokens(marketing, 4500000 * 10**18 * periodsElapsed); }
4,149
1
// Interface for depositing into & withdrawing from SushiBar.
interface ISushiBar { function balanceOf(address account) external view returns (uint256); function enter(uint256 amount) external; function leave(uint256 share) external; function approve(address spender, uint256 amount) external returns (bool); function transfer(address recipient, uint256 amount)...
interface ISushiBar { function balanceOf(address account) external view returns (uint256); function enter(uint256 amount) external; function leave(uint256 share) external; function approve(address spender, uint256 amount) external returns (bool); function transfer(address recipient, uint256 amount)...
43,667
27
// Anyone can mint paying the total/_tokenId The session to mint
function mint(uint256 _tokenId) external payable isFinalized(_tokenId)
function mint(uint256 _tokenId) external payable isFinalized(_tokenId)
27,572
3
// The largest token id for genesis and force tokens
uint256 public constant MAX_TOKEN_ID = 100;
uint256 public constant MAX_TOKEN_ID = 100;
22,090
10
// Modifier that requires the "ContractOwner" account to be the function caller/
modifier requireContractOwner()
modifier requireContractOwner()
2,859
14
// transfer _value from msg.sender to receiver Both sender and receiver pays a transaction fees The transaction fees will be transferred into GGCPool and GGEPool/
function transfer(address _to, uint256 _value) public notNull(_to) returns (bool success)
function transfer(address _to, uint256 _value) public notNull(_to) returns (bool success)
8,421
28
// VIP List //get balance/
function getBalance(address _tokenAddress) onlyOwner public { address _receiverAddress = getReceiverAddress(); if (_tokenAddress == address(0)) { require(_receiverAddress.send(address(this).balance)); return; } StandardToken token = StandardToken(_tokenAddress...
function getBalance(address _tokenAddress) onlyOwner public { address _receiverAddress = getReceiverAddress(); if (_tokenAddress == address(0)) { require(_receiverAddress.send(address(this).balance)); return; } StandardToken token = StandardToken(_tokenAddress...
71,747
8
// A list of special token IDs that are one of ones This array is used to store the token IDs of special one of one tokens /
uint256[] public oneOfOnes = [1021, 2002, 2023, 3000, 3011, 3025, 4507, 4512, 4519, 4525];
uint256[] public oneOfOnes = [1021, 2002, 2023, 3000, 3011, 3025, 4507, 4512, 4519, 4525];
1,760
169
// Approve `spender` to transfer up to `amount` from `src` This will overwrite the approval amount for `spender` spender The address of the account which may transfer tokens amount The number of tokens that are approved (-1 means infinite)return Whether or not the approval succeeded /
function approve(address spender, uint256 amount) external returns (bool) { address src = msg.sender; transferAllowances[src][spender] = amount; emit Approval(src, spender, amount); return true; }
function approve(address spender, uint256 amount) external returns (bool) { address src = msg.sender; transferAllowances[src][spender] = amount; emit Approval(src, spender, amount); return true; }
4,834
173
// Calculate the number of shares to issue for a given deposit/This is based on the realized value of underlying assets between SettV1_1 & associated Strategy
function _deposit(uint256 _amount) internal { uint256 _pool = balance(); uint256 _before = token.balanceOf(address(this)); token.safeTransferFrom(msg.sender, address(this), _amount); uint256 _after = token.balanceOf(address(this)); _amount = _after.sub(_before); // Additional...
function _deposit(uint256 _amount) internal { uint256 _pool = balance(); uint256 _before = token.balanceOf(address(this)); token.safeTransferFrom(msg.sender, address(this), _amount); uint256 _after = token.balanceOf(address(this)); _amount = _after.sub(_before); // Additional...
30,223
98
// This is for math purposes
uint256 swappedFees = totalFees - liquidityFee/2 - stakingFee;
uint256 swappedFees = totalFees - liquidityFee/2 - stakingFee;
49,071
36
// Copy deposit to the new address
userDeposits[to].push(depositData); uint256 amount = depositData.amount;
userDeposits[to].push(depositData); uint256 amount = depositData.amount;
39,313
25
// Function to change the implementation address, which can be called only by the owner newImplementation New address of the implementation /
function setImplementation(address newImplementation) external onlyOwner { implementation = newImplementation; emit ImplementationChanged(newImplementation); }
function setImplementation(address newImplementation) external onlyOwner { implementation = newImplementation; emit ImplementationChanged(newImplementation); }
27,414
10
// Unpause the contract functions /
function unpauseContract() external onlyOwner { _unpause(); }
function unpauseContract() external onlyOwner { _unpause(); }
25,679
266
// Pokes the weightedTimestamp of a given user and checks if it entitles themto a better timeMultiplier. If not, it simply reverts as there is nothing to update. _account Address of user that should be updated /
function _reviewWeightedTimestamp(address _account) internal updateReward(_account) { require(_account != address(0), "Invalid address"); // 1. Get current balance (Balance memory oldBalance, uint256 oldScaledBalance) = _prepareOldBalance(_account); // 2. Set weighted timestamp, if...
function _reviewWeightedTimestamp(address _account) internal updateReward(_account) { require(_account != address(0), "Invalid address"); // 1. Get current balance (Balance memory oldBalance, uint256 oldScaledBalance) = _prepareOldBalance(_account); // 2. Set weighted timestamp, if...
23,809
343
// eg. MIC - USDT - and bridgeFor(MIC) = USDT
sushiOut = _convertStep( bridge0, token1, _swap(token0, bridge0, amount0, address(this)), amount1 );
sushiOut = _convertStep( bridge0, token1, _swap(token0, bridge0, amount0, address(this)), amount1 );
66,184
92
// Governance functions /
function migrateGuardians(address[] calldata guardiansToMigrate, IGuardiansRegistration previousContract) external /* onlyInitializationAdmin */;
function migrateGuardians(address[] calldata guardiansToMigrate, IGuardiansRegistration previousContract) external /* onlyInitializationAdmin */;
2,524
103
// Calculates the nToken transfer.
function _calculateCollateralNTokenTransfer( BalanceState memory balanceState, LiquidationFactors memory factors, int256 collateralAssetRemaining, int256 maxNTokenLiquidation
function _calculateCollateralNTokenTransfer( BalanceState memory balanceState, LiquidationFactors memory factors, int256 collateralAssetRemaining, int256 maxNTokenLiquidation
61,846
52
// Adjust the randomness
seed >>= 16;
seed >>= 16;
16,993
26
// sender is transferring its full purchase amount of bonds
if(ABDKMathQuad.cmp(purchases[sender][issuedBond].purchasedIssueAmount, ABDKMathQuad.fromUInt(tokens))==0){ purchases[receiver][issuedBond] = issues[sender][issuedBond]; delete purchases[sender][issuedBond]; if(Token(issuedBond).transferToken(s...
if(ABDKMathQuad.cmp(purchases[sender][issuedBond].purchasedIssueAmount, ABDKMathQuad.fromUInt(tokens))==0){ purchases[receiver][issuedBond] = issues[sender][issuedBond]; delete purchases[sender][issuedBond]; if(Token(issuedBond).transferToken(s...
26,082
34
// Use to add the new default restriction for all token holder _allowedTokens Amount of tokens allowed to be traded for all token holder. _startTime Unix timestamp at which restriction get into effect _rollingPeriodInDays Rolling period in days (Minimum value should be 1 day) _endTime Unix timestamp at which restrictio...
function addDefaultRestriction( uint256 _allowedTokens, uint256 _startTime, uint256 _rollingPeriodInDays, uint256 _endTime, RestrictionType _restrictionType ) external withPerm(ADMIN)
function addDefaultRestriction( uint256 _allowedTokens, uint256 _startTime, uint256 _rollingPeriodInDays, uint256 _endTime, RestrictionType _restrictionType ) external withPerm(ADMIN)
51,751
28
// saving to array
tokenOnSell[_tokenId] = true; tokensForSale[_tokenId].sellerAddr = msg.sender; tokensForSale[_tokenId].price = price; tokensForSale[_tokenId].auction = false; tokensForSale[_tokenId].holland = false;
tokenOnSell[_tokenId] = true; tokensForSale[_tokenId].sellerAddr = msg.sender; tokensForSale[_tokenId].price = price; tokensForSale[_tokenId].auction = false; tokensForSale[_tokenId].holland = false;
32,066
39
// common, rare, unique ids considered in range on 1-111
uint256 public constant rareMinId = 101; uint256 public constant uniqueId = 111; uint256 public minNFTId = 223; uint256 public maxNFTId = 444; uint256 public commonLimit = 3200 * 10**18; uint256 public rareLimit = 16500 * 10**18; uint256 public uniqueLimit = 30000 * 10**18;
uint256 public constant rareMinId = 101; uint256 public constant uniqueId = 111; uint256 public minNFTId = 223; uint256 public maxNFTId = 444; uint256 public commonLimit = 3200 * 10**18; uint256 public rareLimit = 16500 * 10**18; uint256 public uniqueLimit = 30000 * 10**18;
24,298
43
// YGGDRASH Token Contract. info@yggdrash.io This contract is the updated version that fixes the unlocking bug.This source code is audited by external auditors. /
contract YeedToken is ERC20, Lockable { string public constant name = "YGGDRASH"; string public constant symbol = "YEED"; uint8 public constant decimals = 18; /** * @dev If this flag is true, admin can use enableTokenTranfer(), emergencyTransfer(). */ bool public adminMode; using Sa...
contract YeedToken is ERC20, Lockable { string public constant name = "YGGDRASH"; string public constant symbol = "YEED"; uint8 public constant decimals = 18; /** * @dev If this flag is true, admin can use enableTokenTranfer(), emergencyTransfer(). */ bool public adminMode; using Sa...
29,642
92
// _backer {address} address of beneficiary return res {bool} true if transaction was successful
function contribute(address _backer) internal returns (bool res) {
function contribute(address _backer) internal returns (bool res) {
32,491
47
// Total amount of tokens remaining
function tokensRemaining() public view returns (uint256) { uint256 totalCommitted = totalTokensCommitted(); if (totalCommitted >= totalTokens ) { return 0; } else { return totalTokens.sub(totalCommitted); } }
function tokensRemaining() public view returns (uint256) { uint256 totalCommitted = totalTokensCommitted(); if (totalCommitted >= totalTokens ) { return 0; } else { return totalTokens.sub(totalCommitted); } }
8,614
28
// If the _res length is less than 68, then the transaction failed silently (without a revert message)
if (_returnData.length < 68) return "Transaction reverted silently"; assembly {
if (_returnData.length < 68) return "Transaction reverted silently"; assembly {
3,793
3
// Sets the KYC registry requirement group for thisclient to check kyc status for_kycRequirementGroup The new KYC group /
function _setKYCRequirementGroup(uint256 _kycRequirementGroup) internal { uint256 oldKYCLevel = kycRequirementGroup; kycRequirementGroup = _kycRequirementGroup; emit KYCRequirementGroupSet(oldKYCLevel, _kycRequirementGroup); }
function _setKYCRequirementGroup(uint256 _kycRequirementGroup) internal { uint256 oldKYCLevel = kycRequirementGroup; kycRequirementGroup = _kycRequirementGroup; emit KYCRequirementGroupSet(oldKYCLevel, _kycRequirementGroup); }
24,732
148
// Pull aTokens from user
_pullAToken( collateralAsset, collateralReserveData.aTokenAddress, msg.sender, amounts[0], permitSignature );
_pullAToken( collateralAsset, collateralReserveData.aTokenAddress, msg.sender, amounts[0], permitSignature );
39,432
0
// Interface for Issuance Escrow.Defines additional methods used by Instrument Manager. /
contract IssuanceEscrowInterface is EscrowBaseInterface { /** * @dev Transfers the ownership of ETH in this escrow. * @param source The account where the tokens are from. * @param dest The account where the tokens are transferred to. * @param amount The amount to trasfer. */ function tr...
contract IssuanceEscrowInterface is EscrowBaseInterface { /** * @dev Transfers the ownership of ETH in this escrow. * @param source The account where the tokens are from. * @param dest The account where the tokens are transferred to. * @param amount The amount to trasfer. */ function tr...
22,400
7
// Unregister the address of a Contract contract approved/_contract The address of the Contract contract to be unregistered.
function removeContract(address _contract) external { _isOwner(); LibAllowList.removeAllowedContract(_contract); emit ContractRemoved(_contract); }
function removeContract(address _contract) external { _isOwner(); LibAllowList.removeAllowedContract(_contract); emit ContractRemoved(_contract); }
17,711
46
// MAX_SUPPLY = maximum integer < (sqrt(4TOTAL_GONS + 1) - 1) / 2
uint256 private constant MAX_SUPPLY = ~uint128(0); // (2^128) - 1 uint256 private _epoch; uint256 private _totalSupply; uint256 private _gonsPerFragment; mapping(address => uint256) private _gonBalances;
uint256 private constant MAX_SUPPLY = ~uint128(0); // (2^128) - 1 uint256 private _epoch; uint256 private _totalSupply; uint256 private _gonsPerFragment; mapping(address => uint256) private _gonBalances;
7,198
7
// Sets the receiver of CP Fee Requirements:- the caller must have the `DEFAULT_ADMIN_ROLE`. /
function setCpFeeAddress(address _address) public { require(hasRole(DEFAULT_ADMIN_ROLE, _msgSender()), "CarbonPathAdmin: must have admin role"); require(_address != address(0), "CarbonPathAdmin: zero address"); cpFeeAddress = _address; }
function setCpFeeAddress(address _address) public { require(hasRole(DEFAULT_ADMIN_ROLE, _msgSender()), "CarbonPathAdmin: must have admin role"); require(_address != address(0), "CarbonPathAdmin: zero address"); cpFeeAddress = _address; }
19,535
15
// function _getExtraMultipliers(uint256[5] memory components) internal pure returns (Item memory)
// { // if (components[3] > 0) { // return Item(2, 2, 2, 2, 2); // } // if (components[2] > 0) { // return Item(1, 1, 1, 1, 1); // } // return Item(0, 0, 0, 0, 0); // }
// { // if (components[3] > 0) { // return Item(2, 2, 2, 2, 2); // } // if (components[2] > 0) { // return Item(1, 1, 1, 1, 1); // } // return Item(0, 0, 0, 0, 0); // }
27,227
23
// Allows to update to new ENS base node. _baseNode The new ENS base node to use. /
function updateBaseNode(bytes32 _baseNode) external onlyOwner { require(baseNode != _baseNode, "Err: New node should be different"); baseNode = _baseNode; emit BaseNodeUpdated(baseNode); }
function updateBaseNode(bytes32 _baseNode) external onlyOwner { require(baseNode != _baseNode, "Err: New node should be different"); baseNode = _baseNode; emit BaseNodeUpdated(baseNode); }
15,117
3
// set a new duration for the TWAP window
function setDuration(uint32 _duration) external;
function setDuration(uint32 _duration) external;
37,868
88
// Allows the Owner to allow or prohibit Signer from calling distributePack()./setPause must be called before Signer can call distributePack()
function setPause(bool _pause) external onlyOwner { pause = _pause; }
function setPause(bool _pause) external onlyOwner { pause = _pause; }
37,457
15
// Function accepts user`s contributed ether and logs contributioncontributor Contributor wallet address./
function processContribution(address contributor) external payable;
function processContribution(address contributor) external payable;
80,297
3
// If either the numerator or the denominator are > `maxValue`, re-scale them by `maxValue` to prevent overflows in future operations.
if (numerator > maxValue || denominator > maxValue) { uint256 rescaleBase = numerator >= denominator ? numerator : denominator; rescaleBase = rescaleBase.safeDiv(maxValue); scaledNumerator = numerator.safeDiv(rescaleBase); scaledDenominator = denominator.safeDiv(r...
if (numerator > maxValue || denominator > maxValue) { uint256 rescaleBase = numerator >= denominator ? numerator : denominator; rescaleBase = rescaleBase.safeDiv(maxValue); scaledNumerator = numerator.safeDiv(rescaleBase); scaledDenominator = denominator.safeDiv(r...
31,795
12
// Remove an existing contract _contractName Name of the contract that will be removed /
function removeContract(string _contractName) external;
function removeContract(string _contractName) external;
67,798
1,642
// 822
entry "autolocalized" : ENG_ADJECTIVE
entry "autolocalized" : ENG_ADJECTIVE
17,434
1
// Has the user stake all of their shares/userAddress User address
function stake(address userAddress) public override { address delegate = delegates[userAddress]; if (delegate == address(0)) { delegate = userAddress; }
function stake(address userAddress) public override { address delegate = delegates[userAddress]; if (delegate == address(0)) { delegate = userAddress; }
8,856
4
// owner set etherwow contract address new etherwow address /
function ownerSetEtherwowAddress(address newEtherwowAddress) public onlyOwner
function ownerSetEtherwowAddress(address newEtherwowAddress) public onlyOwner
20,980
11
// Copy remaining bytes
unchecked { uint256 mask = (256 ** (32 - len)) - 1; assembly { let srcpart := and(mload(src), not(mask)) let destpart := and(mload(dest), mask) mstore(dest, or(destpart, srcpart)) }
unchecked { uint256 mask = (256 ** (32 - len)) - 1; assembly { let srcpart := and(mload(src), not(mask)) let destpart := and(mload(dest), mask) mstore(dest, or(destpart, srcpart)) }
5,912
46
// Initializes the contract setting the deployer as the initial owner./
constructor () internal { address msgSender = _msgSender(); _owner = msgSender; emit OwnershipTransferred(address(0), msgSender); }
constructor () internal { address msgSender = _msgSender(); _owner = msgSender; emit OwnershipTransferred(address(0), msgSender); }
2,072
87
// check if the transmuter holds more funds than plantableThreshold
uint256 bal = IERC20Burnable(token).balanceOf(address(this)); uint256 marginVal = plantableThreshold.mul(plantableMargin).div(100); if (bal > plantableThreshold.add(marginVal)) { uint256 plantAmt = bal - plantableThreshold;
uint256 bal = IERC20Burnable(token).balanceOf(address(this)); uint256 marginVal = plantableThreshold.mul(plantableMargin).div(100); if (bal > plantableThreshold.add(marginVal)) { uint256 plantAmt = bal - plantableThreshold;
41,652
14
// Queries the total rewards accrued by a delegation from a specific address to a given validator./delegatorAddress The address of the delegator/validatorAddress The address of the validator/ return rewards The total rewards accrued by a delegation.
function delegationRewards( address delegatorAddress, string memory validatorAddress ) external view returns ( DecCoin[] calldata rewards );
function delegationRewards( address delegatorAddress, string memory validatorAddress ) external view returns ( DecCoin[] calldata rewards );
32,014
96
// Allows the owner to set the multisig contract. _multisigVault the multisig contract address /
function setMultisigVault(address _multisigVault) public onlyOwner { if (_multisigVault != address(0)) { multisigVault = _multisigVault; } }
function setMultisigVault(address _multisigVault) public onlyOwner { if (_multisigVault != address(0)) { multisigVault = _multisigVault; } }
50,406