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
107
// Throws if the sender is not the owner. /
function _checkOwner() internal view virtual { require(owner() == _msgSender(), "Ownable: caller is not the owner"); }
function _checkOwner() internal view virtual { require(owner() == _msgSender(), "Ownable: caller is not the owner"); }
3,106
1
// nest地址
address constant NEST_TOKEN_ADDRESS = address(0x04abEdA201850aC0124161F037Efd70c74ddC74C);
address constant NEST_TOKEN_ADDRESS = address(0x04abEdA201850aC0124161F037Efd70c74ddC74C);
52,128
3
// Send a message through the Commun Room if in possession/ of a connection/_message The message to be sent/ return hash of the message and the connection
function send(string calldata _message) external returns (bytes32);
function send(string calldata _message) external returns (bytes32);
44,837
41
// function {_configHashMatches} Check the passed config against the stored config hashmetaId_ The drop Id being approved salt_ Salt for create2 erc20Config_ ERC20 configuration signedMessage_ The signed message object lockerFee_ The fee for the unicrypt locker deploymentFee_ The fee for deployment, if any deployer_ Address performing the deploymentreturn matches_ Whether the hash matches (true) or not (false) /
function _configHashMatches( string calldata metaId_, bytes32 salt_, ERC20Config calldata erc20Config_, SignedDropMessageDetails calldata signedMessage_, uint256 lockerFee_, uint256 deploymentFee_, address deployer_ ) internal pure returns (bool matches_) {
function _configHashMatches( string calldata metaId_, bytes32 salt_, ERC20Config calldata erc20Config_, SignedDropMessageDetails calldata signedMessage_, uint256 lockerFee_, uint256 deploymentFee_, address deployer_ ) internal pure returns (bool matches_) {
31,333
156
// Returns the downcasted uint56 from uint256, reverting onoverflow (when the input is greater than largest uint56). Counterpart to Solidity's `uint56` operator. Requirements: - input must fit into 56 bits _Available since v4.7._ /
function toUint56(uint256 value) internal pure returns (uint56) { require(value <= type(uint56).max, "SafeCast: value doesn't fit in 56 bits"); return uint56(value); }
function toUint56(uint256 value) internal pure returns (uint56) { require(value <= type(uint56).max, "SafeCast: value doesn't fit in 56 bits"); return uint56(value); }
936
143
// Storage of map keys and values
MapEntry[] _entries;
MapEntry[] _entries;
2,387
6
// Returns the addition of two unsigned integers, reverting onoverflow. Counterpart to Solidity's `+` operator. Requirements: - Addition cannot overflow. /
function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; }
function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; }
4,632
9
// Reverts transaction if isInitialized is false. Used by child contracts to ensure contract is initialized before functions can be called. /
function _requireIsInitialized() internal view { require(isInitialized == true, ERROR_NOT_INITIALIZED); }
function _requireIsInitialized() internal view { require(isInitialized == true, ERROR_NOT_INITIALIZED); }
3,065
15
// Returns the token decimals. /
function decimals() external view returns (uint8);
function decimals() external view returns (uint8);
7,571
240
// Constraint expression for public_memory_addr_zero: column17_row2.
let val := /*column17_row2*/ mload(0x26a0)
let val := /*column17_row2*/ mload(0x26a0)
19,583
1
// IERC165 supports an interfaceId/interfaceId The interfaceId to check/ return true if the interfaceId is supported
function supportsInterface(bytes4 interfaceId) public pure override returns (bool) { return interfaceId == type(IAny2EVMMessageReceiver).interfaceId || interfaceId == type(IERC165).interfaceId; }
function supportsInterface(bytes4 interfaceId) public pure override returns (bool) { return interfaceId == type(IAny2EVMMessageReceiver).interfaceId || interfaceId == type(IERC165).interfaceId; }
21,206
93
// If denominator is zero then by the precodition numerator is also zero and therefore prod is zero. We get div(_, 0), which evaluates to 0.
partialAmount := div(prod0, denominator)
partialAmount := div(prod0, denominator)
643
52
// ICO finished Event
event TokenSaleFinished(string desc, address indexed contributors, uint256 icoTotalAmount, uint256 totalSoldToken, uint256 leftAmount);
event TokenSaleFinished(string desc, address indexed contributors, uint256 icoTotalAmount, uint256 totalSoldToken, uint256 leftAmount);
11,793
20
// Calculates current pledge state borrower Address of borrower debt Index of borrowers's debtreturn Amount of unpaid debt, amount of interest payment /
function getDebtRequiredPayments(address borrower, uint256 debt) public view returns(uint256, uint256) {
function getDebtRequiredPayments(address borrower, uint256 debt) public view returns(uint256, uint256) {
52,788
157
// gives estiomate of future APR with a change of debt limit. Useful for governance to decide debt limits
function estimatedFutureAPR(uint256 newDebtLimit) public view returns (uint256) { uint256 oldDebtLimit = vault.strategies(address(this)).totalDebt; uint256 change; if (oldDebtLimit < newDebtLimit) { change = newDebtLimit - oldDebtLimit; return _estimateDebtLimitIncrease(change); } else { change = oldDebtLimit - newDebtLimit; return _estimateDebtLimitDecrease(change); } }
function estimatedFutureAPR(uint256 newDebtLimit) public view returns (uint256) { uint256 oldDebtLimit = vault.strategies(address(this)).totalDebt; uint256 change; if (oldDebtLimit < newDebtLimit) { change = newDebtLimit - oldDebtLimit; return _estimateDebtLimitIncrease(change); } else { change = oldDebtLimit - newDebtLimit; return _estimateDebtLimitDecrease(change); } }
3,118
74
// Returns the Name for a given token ID.Throws if the token ID does not exist. May return an empty string. tokenId uint256 ID of the token to query /
function tokenName(uint256 tokenId) external view returns (string memory) { require(_exists(tokenId), "ERC721Metadata: Name query for nonexistent token"); uint256 niftyType = _getNiftyTypeId(tokenId); return _niftyTypeName[niftyType]; }
function tokenName(uint256 tokenId) external view returns (string memory) { require(_exists(tokenId), "ERC721Metadata: Name query for nonexistent token"); uint256 niftyType = _getNiftyTypeId(tokenId); return _niftyTypeName[niftyType]; }
26,024
117
// transfers between UniswapRouter and UniswapPair are tax and lock free
address uniswapV2Router=address(_uniswapV2Router); bool isLiquidityTransfer = ((sender == _uniswapV2PairAddress && recipient == uniswapV2Router) || (recipient == _uniswapV2PairAddress && sender == uniswapV2Router));
address uniswapV2Router=address(_uniswapV2Router); bool isLiquidityTransfer = ((sender == _uniswapV2PairAddress && recipient == uniswapV2Router) || (recipient == _uniswapV2PairAddress && sender == uniswapV2Router));
29,441
119
// round 49
ark(i, q, 9386595745626044000666050847309903206827901310677406022353307960932745699524); sbox_partial(i, q); mix(i, q);
ark(i, q, 9386595745626044000666050847309903206827901310677406022353307960932745699524); sbox_partial(i, q); mix(i, q);
27,733
62
// SKILL
function buySkill( uint256 _id, uint256 _target, uint256 _expectedPrice, uint32 _expectedEffect
function buySkill( uint256 _id, uint256 _target, uint256 _expectedPrice, uint32 _expectedEffect
13,455
1
// variable visibility (private, internal, public)
uint256 a;
uint256 a;
19,860
13
// a method that returns a struct/ return a Struct struct
function structOutput() public pure returns(Struct memory s) { bytes[] memory byteArray = new bytes[](2); byteArray[0] = "0x123"; byteArray[1] = "0x321"; return Struct({ someBytes: "0x123", anInteger: 5, aDynamicArrayOfBytes: byteArray, aString: "abc"
function structOutput() public pure returns(Struct memory s) { bytes[] memory byteArray = new bytes[](2); byteArray[0] = "0x123"; byteArray[1] = "0x321"; return Struct({ someBytes: "0x123", anInteger: 5, aDynamicArrayOfBytes: byteArray, aString: "abc"
41,844
80
// Event emitted when the `licenseUri` is set for the collection. licenseUri the new URI /
event LicenseUriSet(string licenseUri);
event LicenseUriSet(string licenseUri);
9,095
278
// mint by ETH -> convert to WETH
if (msg.value > 0) { IWETH(WETH).deposit{value: msg.value}();
if (msg.value > 0) { IWETH(WETH).deposit{value: msg.value}();
39,158
78
// IInitializableAToken Interface for the initialize function on AToken Aave /
interface IInitializableAToken { /** * @dev Emitted when an aToken is initialized * @param underlyingAsset The address of the underlying asset * @param pool The address of the associated lending pool * @param treasury The address of the treasury * @param incentivesController The address of the incentives controller for this aToken * @param aTokenDecimals the decimals of the underlying * @param aTokenName the name of the aToken * @param aTokenSymbol the symbol of the aToken * @param params A set of encoded parameters for additional initialization **/ event Initialized( address indexed underlyingAsset, address indexed pool, address treasury, address incentivesController, uint8 aTokenDecimals, string aTokenName, string aTokenSymbol, bytes params ); /** * @dev Initializes the aToken * @param pool The address of the lending pool where this aToken will be used * @param treasury The address of the Aave treasury, receiving the fees on this aToken * @param underlyingAsset The address of the underlying asset of this aToken (E.g. WETH for aWETH) * @param incentivesController The smart contract managing potential incentives distribution * @param aTokenDecimals The decimals of the aToken, same as the underlying asset's * @param aTokenName The name of the aToken * @param aTokenSymbol The symbol of the aToken */ function initialize( ILendingPool pool, address treasury, address underlyingAsset, IAaveIncentivesController incentivesController, uint8 aTokenDecimals, string calldata aTokenName, string calldata aTokenSymbol, bytes calldata params ) external; }
interface IInitializableAToken { /** * @dev Emitted when an aToken is initialized * @param underlyingAsset The address of the underlying asset * @param pool The address of the associated lending pool * @param treasury The address of the treasury * @param incentivesController The address of the incentives controller for this aToken * @param aTokenDecimals the decimals of the underlying * @param aTokenName the name of the aToken * @param aTokenSymbol the symbol of the aToken * @param params A set of encoded parameters for additional initialization **/ event Initialized( address indexed underlyingAsset, address indexed pool, address treasury, address incentivesController, uint8 aTokenDecimals, string aTokenName, string aTokenSymbol, bytes params ); /** * @dev Initializes the aToken * @param pool The address of the lending pool where this aToken will be used * @param treasury The address of the Aave treasury, receiving the fees on this aToken * @param underlyingAsset The address of the underlying asset of this aToken (E.g. WETH for aWETH) * @param incentivesController The smart contract managing potential incentives distribution * @param aTokenDecimals The decimals of the aToken, same as the underlying asset's * @param aTokenName The name of the aToken * @param aTokenSymbol The symbol of the aToken */ function initialize( ILendingPool pool, address treasury, address underlyingAsset, IAaveIncentivesController incentivesController, uint8 aTokenDecimals, string calldata aTokenName, string calldata aTokenSymbol, bytes calldata params ) external; }
50,903
12
// Time between proposals
uint256 public transferProposalCooldown = 1 days;
uint256 public transferProposalCooldown = 1 days;
26,865
9
// create the MarketMaker and the CC token put all the CC token in the Market Maker reserve/_name string name for CC token that is created./_symbol string symbol for CC token that is created./_decimals uint8 percison for CC token that is created./_totalSupply uint256 total supply of the CC token that is created./_tokenURI string the URI may point to a JSON file that conforms to the "Metadata JSON Schema".
function createCurrency(string _name, string _symbol, uint8 _decimals, uint256 _totalSupply, string _tokenURI) public
function createCurrency(string _name, string _symbol, uint8 _decimals, uint256 _totalSupply, string _tokenURI) public
17,615
230
// verify that redeem will not overflow for this locker
require((scores[_locker] * reputationReward)/scores[_locker] == reputationReward, "score is too high"); totalScore = totalScore.add(score); emit Lock(_locker, lockingId, _amount, _period);
require((scores[_locker] * reputationReward)/scores[_locker] == reputationReward, "score is too high"); totalScore = totalScore.add(score); emit Lock(_locker, lockingId, _amount, _period);
29,959
65
// The arbitrator accepts a dispute as being valid. Accept a dispute with ID `_disputeID` _disputeID ID of the dispute to be accepted /
function acceptDispute(bytes32 _disputeID) external override onlyArbitrator { Dispute memory dispute = _resolveDispute(_disputeID); // Slash uint256 tokensToReward = _slashIndexer(dispute.indexer, dispute.fisherman); // Give the fisherman their deposit back if (dispute.deposit > 0) { require( graphToken().transfer(dispute.fisherman, dispute.deposit), "Error sending dispute deposit" ); } // Resolve the conflicting dispute if any _resolveDisputeInConflict(dispute); emit DisputeAccepted( _disputeID, dispute.indexer, dispute.fisherman, dispute.deposit.add(tokensToReward) ); }
function acceptDispute(bytes32 _disputeID) external override onlyArbitrator { Dispute memory dispute = _resolveDispute(_disputeID); // Slash uint256 tokensToReward = _slashIndexer(dispute.indexer, dispute.fisherman); // Give the fisherman their deposit back if (dispute.deposit > 0) { require( graphToken().transfer(dispute.fisherman, dispute.deposit), "Error sending dispute deposit" ); } // Resolve the conflicting dispute if any _resolveDisputeInConflict(dispute); emit DisputeAccepted( _disputeID, dispute.indexer, dispute.fisherman, dispute.deposit.add(tokensToReward) ); }
16,256
3
// pre-deteremine the flip outcome
uint256 blockValue = uint256(blockhash(block.number-1)); uint256 coinFlip = blockValue / FACTOR; bool side = coinFlip == 1 ? true : false;
uint256 blockValue = uint256(blockhash(block.number-1)); uint256 coinFlip = blockValue / FACTOR; bool side = coinFlip == 1 ? true : false;
4,222
176
// Reward Control Contract address /
RewardControlInterface public rewardControl;
RewardControlInterface public rewardControl;
17,425
25
// This can happen
_last_point.bias = 0;
_last_point.bias = 0;
19,588
26
// Upgrade the validator by setting the current validator as the proposed validator. Must have a proposed validator. Only owner can call. /
function upgradeValidator() external onlyOwner()
function upgradeValidator() external onlyOwner()
22,860
54
// Apply the interest remaining so we get up to the netInterestSharePrice
(interestRemaining, principalRemaining) = applyToTrancheBySharePrice( interestRemaining, principalRemaining, desiredNetInterestSharePrice, expectedPrincipalSharePrice, seniorTranche );
(interestRemaining, principalRemaining) = applyToTrancheBySharePrice( interestRemaining, principalRemaining, desiredNetInterestSharePrice, expectedPrincipalSharePrice, seniorTranche );
44,871
238
// Called during round initialization to set the total active stake for the round. Only callable by the RoundsManager /
function setCurrentRoundTotalActiveStake() external onlyRoundsManager { currentRoundTotalActiveStake = nextRoundTotalActiveStake; }
function setCurrentRoundTotalActiveStake() external onlyRoundsManager { currentRoundTotalActiveStake = nextRoundTotalActiveStake; }
35,251
30
// method to transfer unipilot earned fees to Index Fund
function transferFeesToIF( bool isReadjustLiquidity, uint256 fees0, uint256 fees1
function transferFeesToIF( bool isReadjustLiquidity, uint256 fees0, uint256 fees1
26,598
97
// final bonus rate
sharesToAdd = deposit.addBP(bonusRangeBP[currentBonusIndex]);
sharesToAdd = deposit.addBP(bonusRangeBP[currentBonusIndex]);
4,974
96
// Implementation template Do something
} else if (sig == bytes4(keccak256(bytes("handlerFunction_2()")))) {
} else if (sig == bytes4(keccak256(bytes("handlerFunction_2()")))) {
15,688
74
// function to calculate amount of tokens received after sending collateral /
function calculateTokenReceived(address contractAddress, uint256 _collateToSell) public view returns(uint256)
function calculateTokenReceived(address contractAddress, uint256 _collateToSell) public view returns(uint256)
582
539
// Verify only the transfer quantity is subtracted
require( newBalance == existingBalance.sub(_quantity), "Invalid post transfer balance" );
require( newBalance == existingBalance.sub(_quantity), "Invalid post transfer balance" );
32,540
32
// Attribution to the awesome delta.financial contracts/
function marketParticipationAgreement() public pure returns (string memory) { return "I understand that I'm interacting with a smart contract. I understand that tokens committed are subject to the token issuer and local laws where applicable. I reviewed code of the smart contract and understand it fully. I agree to not hold developers or other people associated with the project liable for any losses or misunderstandings"; }
function marketParticipationAgreement() public pure returns (string memory) { return "I understand that I'm interacting with a smart contract. I understand that tokens committed are subject to the token issuer and local laws where applicable. I reviewed code of the smart contract and understand it fully. I agree to not hold developers or other people associated with the project liable for any losses or misunderstandings"; }
33,377
0
// the token to distribute
ERC20 internal _token;
ERC20 internal _token;
12,836
238
// Future Borrow Rate with the amount to borrow counted as already borrowed
uint _borrowRate = interestModule.getBorrowRate(address(this), underlyingBalance().sub(_amount), totalBorrowed.add(_amount), totalReserve); uint _minFees = minBorrowLength.mul(_amount.mul(_borrowRate)).div(mantissaScale); return _minFees > 0 ? _minFees : 1;
uint _borrowRate = interestModule.getBorrowRate(address(this), underlyingBalance().sub(_amount), totalBorrowed.add(_amount), totalReserve); uint _minFees = minBorrowLength.mul(_amount.mul(_borrowRate)).div(mantissaScale); return _minFees > 0 ? _minFees : 1;
75,048
230
// Getter for number of future registeredreturn the number of future registered /
function futureVaultCount() external view returns (uint256);
function futureVaultCount() external view returns (uint256);
20,555
243
// get output price. return how many quote asset you will get with the input base amount _dir ADD_TO_AMM for short, REMOVE_FROM_AMM for long, opposite direction from `getInput`. _baseAssetAmount base asset amountreturn quote asset amount /
function getOutputPrice(Dir _dir, Decimal.decimal memory _baseAssetAmount) public view override returns (Decimal.decimal memory)
function getOutputPrice(Dir _dir, Decimal.decimal memory _baseAssetAmount) public view override returns (Decimal.decimal memory)
2,513
44
// zero out the 32 bytes slice we are about to returnwe need to do it because Solidity does not garbage collect
mstore(tempBytes, 0) mstore(0x40, add(tempBytes, 0x20))
mstore(tempBytes, 0) mstore(0x40, add(tempBytes, 0x20))
4,443
185
// Contracts
IMAL public MAL; ISTAKING public STAKING; IERC721 public APES; event TreasuriesMinted(address indexed mintedBy, uint256 indexed tokensNumber);
IMAL public MAL; ISTAKING public STAKING; IERC721 public APES; event TreasuriesMinted(address indexed mintedBy, uint256 indexed tokensNumber);
38,809
26
// before = 4 bytes domain
return _tokenId.index(4, 32);
return _tokenId.index(4, 32);
14,690
20
// Return an empty array
return new uint256[](0);
return new uint256[](0);
46,884
467
// Mint tokens to recipient
_transferTokensMint(_recipient, amount);
_transferTokensMint(_recipient, amount);
34,987
213
// invalid pid, set default pid:1
_winPID = 1;
_winPID = 1;
7,719
1
// check if specific token has atomic pricing (has atomic oracle wrapper) /
function isAtomicPricing() external view returns (bool);
function isAtomicPricing() external view returns (bool);
22,568
169
// xyz token path
address[] memory xyzPath = new address[](4); xyzPath[0] = address(xyz); xyzPath[1] = address(usdc); xyzPath[2] = address(weth); xyzPath[3] = address(want);
address[] memory xyzPath = new address[](4); xyzPath[0] = address(xyz); xyzPath[1] = address(usdc); xyzPath[2] = address(weth); xyzPath[3] = address(want);
37,394
0
// Utility functions and data used in AaveV2 actions
contract InstHelper is MainnetInstAddresses{ IManager public constant mcdManager = IManager(MCD_MANAGER); IInstaIndex public constant instaAccountBuilder = IInstaIndex(INST_ACCOUNT_BUILDER); IInstaMakerDAOMerkleDistributor public constant rewardDistributor = IInstaMakerDAOMerkleDistributor(INST_MAKER_MERKLE_DISTRIBUTOR); }
contract InstHelper is MainnetInstAddresses{ IManager public constant mcdManager = IManager(MCD_MANAGER); IInstaIndex public constant instaAccountBuilder = IInstaIndex(INST_ACCOUNT_BUILDER); IInstaMakerDAOMerkleDistributor public constant rewardDistributor = IInstaMakerDAOMerkleDistributor(INST_MAKER_MERKLE_DISTRIBUTOR); }
27,368
140
// Read next variable bytes starting from offset, buffSource bytes array offsetThe position from where we read the bytes valuereturnThe read variable bytes array value and updated offset/
function NextVarBytes(bytes memory buff, uint256 offset) internal pure returns(bytes memory, uint256) { uint len; (len, offset) = NextVarUint(buff, offset); require(offset + len <= buff.length && offset < offset + len, "NextVarBytes, offset exceeds maximum"); bytes memory tempBytes; assembly{ switch iszero(len) case 0 { // Get a location of some free memory and store it in tempBytes as // Solidity does for memory variables. tempBytes := mload(0x40) // The first word of the slice result is potentially a partial // word read from the original array. To read it, we calculate // the length of that partial word and start copying that many // bytes into the array. The first word we copy will start with // data we don't care about, but the last `lengthmod` bytes will // land at the beginning of the contents of the new array. When // we're done copying, we overwrite the full first word with // the actual length of the slice. let lengthmod := and(len, 31) // The multiplication in the next line is necessary // because when slicing multiples of 32 bytes (lengthmod == 0) // the following copy loop was copying the origin's length // and then ending prematurely not copying everything it should. let mc := add(add(tempBytes, lengthmod), mul(0x20, iszero(lengthmod))) let end := add(mc, len) for { // The multiplication in the next line has the same exact purpose // as the one above. let cc := add(add(add(buff, lengthmod), mul(0x20, iszero(lengthmod))), offset) } lt(mc, end) { mc := add(mc, 0x20) cc := add(cc, 0x20) } { mstore(mc, mload(cc)) } mstore(tempBytes, len) //update free-memory pointer //allocating the array padded to 32 bytes like the compiler does now mstore(0x40, and(add(mc, 31), not(31))) } //if we want a zero-length slice let's just return a zero-length array default { tempBytes := mload(0x40) mstore(0x40, add(tempBytes, 0x20)) } } return (tempBytes, offset + len); }
function NextVarBytes(bytes memory buff, uint256 offset) internal pure returns(bytes memory, uint256) { uint len; (len, offset) = NextVarUint(buff, offset); require(offset + len <= buff.length && offset < offset + len, "NextVarBytes, offset exceeds maximum"); bytes memory tempBytes; assembly{ switch iszero(len) case 0 { // Get a location of some free memory and store it in tempBytes as // Solidity does for memory variables. tempBytes := mload(0x40) // The first word of the slice result is potentially a partial // word read from the original array. To read it, we calculate // the length of that partial word and start copying that many // bytes into the array. The first word we copy will start with // data we don't care about, but the last `lengthmod` bytes will // land at the beginning of the contents of the new array. When // we're done copying, we overwrite the full first word with // the actual length of the slice. let lengthmod := and(len, 31) // The multiplication in the next line is necessary // because when slicing multiples of 32 bytes (lengthmod == 0) // the following copy loop was copying the origin's length // and then ending prematurely not copying everything it should. let mc := add(add(tempBytes, lengthmod), mul(0x20, iszero(lengthmod))) let end := add(mc, len) for { // The multiplication in the next line has the same exact purpose // as the one above. let cc := add(add(add(buff, lengthmod), mul(0x20, iszero(lengthmod))), offset) } lt(mc, end) { mc := add(mc, 0x20) cc := add(cc, 0x20) } { mstore(mc, mload(cc)) } mstore(tempBytes, len) //update free-memory pointer //allocating the array padded to 32 bytes like the compiler does now mstore(0x40, and(add(mc, 31), not(31))) } //if we want a zero-length slice let's just return a zero-length array default { tempBytes := mload(0x40) mstore(0x40, add(tempBytes, 0x20)) } } return (tempBytes, offset + len); }
29,014
226
// Send quoted Ether amount to recipient and revert with reason on failure.
(bool ok, ) = recipient.call.value(etherAmount)(""); if (!ok) { assembly { returndatacopy(0, 0, returndatasize) revert(0, returndatasize) }
(bool ok, ) = recipient.call.value(etherAmount)(""); if (!ok) { assembly { returndatacopy(0, 0, returndatasize) revert(0, returndatasize) }
35,739
0
// ICryptopiaERC721/Non-fungible token (ERC721) /HFB - <frank@cryptopia.com>
interface ICryptopiaERC721 { /// @dev Returns whether `_spender` is allowed to manage `_tokenId` /// @param spender Account to check /// @param tokenId Token id to check /// @return true if `spender` is allowed ot manage `_tokenId` function isApprovedOrOwner(address spender, uint256 tokenId) external view returns (bool); }
interface ICryptopiaERC721 { /// @dev Returns whether `_spender` is allowed to manage `_tokenId` /// @param spender Account to check /// @param tokenId Token id to check /// @return true if `spender` is allowed ot manage `_tokenId` function isApprovedOrOwner(address spender, uint256 tokenId) external view returns (bool); }
28,664
13
// Total Staked tokens
/*function showTotalStaked() view external returns(uint) { return totalStaked;}*/
/*function showTotalStaked() view external returns(uint) { return totalStaked;}*/
19,919
139
// The indicate we consumed the input bond and (inputBondunderlyingPerBond)
amountsIn[baseIndex] = neededUnderlying; amountsIn[bondIndex] = inputBond;
amountsIn[baseIndex] = neededUnderlying; amountsIn[bondIndex] = inputBond;
60,276
70
// Enumerate valid NFTs/Throws if `_index` >= `totalSupply()`./_index A counter less than `totalSupply()`/ return The token identifier for the `_index`th NFT,/(sort order not specified)
function tokenByIndex(uint256 _index) external view returns (uint256);
function tokenByIndex(uint256 _index) external view returns (uint256);
28,662
109
// Private: Checks if an address is the creator of a specific post _postID: ID of the post _member: Address of the member /
function _isCreator( uint _postID, address _member
function _isCreator( uint _postID, address _member
17,355
8
// Whether timelock is alerady set
bool public timeLockSet;
bool public timeLockSet;
51,104
238
// Issue a Rebalancing Set using a specified ERC20 payment token. The payment token is used in ExchangeIssueto acquire the base SetToken components and issue the base SetToken. The base SetToken is then used toissue the Rebalancing SetToken. The payment token can be utilized as a component of the base SetToken.All remaining tokens / change are flushed and returned to the user.Ahead of calling this function, the user must approve their paymentToken to the transferProxy. _rebalancingSetAddressAddress of the rebalancing Set to issue_rebalancingSetQuantity Quantity of the rebalancing Set_paymentTokenAddressAddress of the ERC20 token to pay with_paymentTokenQuantity Quantity of the payment token_exchangeIssuanceParams Struct containing
function issueRebalancingSetWithERC20( address _rebalancingSetAddress, uint256 _rebalancingSetQuantity, address _paymentTokenAddress, uint256 _paymentTokenQuantity, ExchangeIssuanceLibrary.ExchangeIssuanceParams memory _exchangeIssuanceParams, bytes memory _orderData, bool _keepChangeInVault ) public
function issueRebalancingSetWithERC20( address _rebalancingSetAddress, uint256 _rebalancingSetQuantity, address _paymentTokenAddress, uint256 _paymentTokenQuantity, ExchangeIssuanceLibrary.ExchangeIssuanceParams memory _exchangeIssuanceParams, bytes memory _orderData, bool _keepChangeInVault ) public
17,856
4
// Mapping of bookingId to Booking objet
mapping(uint256 => Booking) public bookings;
mapping(uint256 => Booking) public bookings;
42,260
114
// only whitelisted addresses can make transfers after the fixed-sale has started
if (!tradingIsEnabled) { require(canTransferBeforeTradingIsEnabled[from], "Wait until trading is enabled"); }
if (!tradingIsEnabled) { require(canTransferBeforeTradingIsEnabled[from], "Wait until trading is enabled"); }
5,965
173
// Returns if a particular pool exists or not poolSymbol Synthetic token symbol of the pool collateral ERC20 contract of collateral currency poolVersion Version of the pool pool Contract of the pool to checkreturn isDeployed Returns true if a particular pool exists, otherwiise false /
function isPoolDeployed( string calldata poolSymbol, IERC20 collateral, uint8 poolVersion, ISynthereumPoolDeployment pool
function isPoolDeployed( string calldata poolSymbol, IERC20 collateral, uint8 poolVersion, ISynthereumPoolDeployment pool
29,233
15
// arrangement not found
require(i < policy.arrangements.length);
require(i < policy.arrangements.length);
6,266
6
// Set shared metadata and threshold balance for a level
function setSharedMetadata( uint256 level, uint256 threshold, SharedMetadataInfo calldata _metadata
function setSharedMetadata( uint256 level, uint256 threshold, SharedMetadataInfo calldata _metadata
15,366
24
// Remove liquidity in uniswap
IERC20(pairAddress).approve(address(router), amount); (uint256 tokenAmount, uint256 bnbAmount) = router.removeLiquidity( address(startToken), weth, amount, 0, 0, address(this), block.timestamp + 1 days );
IERC20(pairAddress).approve(address(router), amount); (uint256 tokenAmount, uint256 bnbAmount) = router.removeLiquidity( address(startToken), weth, amount, 0, 0, address(this), block.timestamp + 1 days );
38,494
197
// Checks if provided address is a policyBookFacade
function isPolicyBookFacade(address _facadeAddress) external view returns (bool);
function isPolicyBookFacade(address _facadeAddress) external view returns (bool);
40,019
63
// TAKES ALL BNB FROM THE CONTRACT ADDRESS AND SENDS IT TO OWNERS WALLET
function Sweep() external onlyOwner { uint256 amountBNB = address(this).balance; payable(msg.sender).transfer(amountBNB); }
function Sweep() external onlyOwner { uint256 amountBNB = address(this).balance; payable(msg.sender).transfer(amountBNB); }
1,129
7
// lay mssv cac thanh vien trong nhom tac gia
function lay_mssv_tac_gia() public view returns(uint auth1,uint auth2,uint auth3){ (auth1, auth2, auth3) = (authors[0].MSSV, authors[1].MSSV, authors[2].MSSV); }
function lay_mssv_tac_gia() public view returns(uint auth1,uint auth2,uint auth3){ (auth1, auth2, auth3) = (authors[0].MSSV, authors[1].MSSV, authors[2].MSSV); }
1,732
122
// View the amount of dividend in wei that an address has earned in total./accumulativeDividendOf(_owner) = withdrawableDividendOf(_owner) + withdrawnDividendOf(_owner)/ = (magnifiedDividendPerSharebalanceOf(_owner) + magnifiedDividendCorrections[_owner]) / magnitude/_owner The address of a token holder./ return The amount of dividend in wei that `_owner` has earned in total.
function accumulativeDividendOf(address _owner) public view override returns(uint256) { return magnifiedDividendPerShare.mul(balanceOf(_owner)).toInt256Safe() .add(magnifiedDividendCorrections[_owner]).toUint256Safe() / magnitude; }
function accumulativeDividendOf(address _owner) public view override returns(uint256) { return magnifiedDividendPerShare.mul(balanceOf(_owner)).toInt256Safe() .add(magnifiedDividendCorrections[_owner]).toUint256Safe() / magnitude; }
10,595
87
// total valuation of bonus tokens
uint256 _bonusValue = ((self.totalValuation.mul(self.priceBonusPercent.add(100)))/100).sub(self.totalValuation);
uint256 _bonusValue = ((self.totalValuation.mul(self.priceBonusPercent.add(100)))/100).sub(self.totalValuation);
50,358
4
// ambassador program
mapping(address => bool) internal ambassadors_; uint256 constant internal ambassadorMaxPurchase_ = 1 ether; uint256 constant internal ambassadorQuota_ = 20 ether;
mapping(address => bool) internal ambassadors_; uint256 constant internal ambassadorMaxPurchase_ = 1 ether; uint256 constant internal ambassadorQuota_ = 20 ether;
43,999
144
// Hook that is called after any transfer of tokens. This includesminting and burning. Calling conditions: - when `from` and `to` are both non-zero.- `from` and `to` are never both zero. To learn more about hooks, head to xref:ROOT:extending-contracts.adocusing-hooks[Using Hooks]. /
function _afterTokenTransfer( address from, address to, uint256 tokenId
function _afterTokenTransfer( address from, address to, uint256 tokenId
103
400
// Emitted when liquidation incentive is changed by admin
event NewLiquidationIncentive(uint oldLiquidationIncentiveMantissa, uint newLiquidationIncentiveMantissa);
event NewLiquidationIncentive(uint oldLiquidationIncentiveMantissa, uint newLiquidationIncentiveMantissa);
961
18
// return array of all whitelisted tokens /
function getWhitelistedTokens() public view returns (address[] memory) { // the first item in our private list is a placeholder, so we want to skip it uint256 whitelistedTokensLength = _whitelistedTokens.length - 1; address[] memory whitelistedTokens = new address[]( whitelistedTokensLength ); // construct a new array skipping over the first element in our private array for (uint256 i = 0; i < whitelistedTokensLength; i++) { whitelistedTokens[i] = _whitelistedTokens[i + 1]; } return whitelistedTokens; }
function getWhitelistedTokens() public view returns (address[] memory) { // the first item in our private list is a placeholder, so we want to skip it uint256 whitelistedTokensLength = _whitelistedTokens.length - 1; address[] memory whitelistedTokens = new address[]( whitelistedTokensLength ); // construct a new array skipping over the first element in our private array for (uint256 i = 0; i < whitelistedTokensLength; i++) { whitelistedTokens[i] = _whitelistedTokens[i + 1]; } return whitelistedTokens; }
12,151
20
// Match a takerAsk with a makerBid takerAsk taker ask order makerBid maker bid order /
function matchBidWithTakerAsk(OrderTypes.TakerOrder calldata takerAsk, OrderTypes.MakerOrder calldata makerBid) external override nonReentrant
function matchBidWithTakerAsk(OrderTypes.TakerOrder calldata takerAsk, OrderTypes.MakerOrder calldata makerBid) external override nonReentrant
27,993
11
// ========== MUTATIVE FUNCTIONS ========== // Destroy the vesting information associated with an account. /
function purgeAccount(address account) external onlyOwner onlyDuringSetup { delete vestingSchedules[account]; totalVestedBalance = totalVestedBalance.sub(totalVestedAccountBalance[account]); delete totalVestedAccountBalance[account]; }
function purgeAccount(address account) external onlyOwner onlyDuringSetup { delete vestingSchedules[account]; totalVestedBalance = totalVestedBalance.sub(totalVestedAccountBalance[account]); delete totalVestedAccountBalance[account]; }
32,597
13
// Interface for defining crowdsale ceiling. /
contract CeilingStrategy { /** Interface declaration. */ function isCeilingStrategy() public constant returns (bool) { return true; } /** * When somebody tries to buy tokens for X wei, calculate how many weis they are allowed to use. * * * @param _value - What is the value of the transaction sent in as wei. * @param _weiRaised - How much money has been raised so far. * @param _weiInvestedBySender - the investment made by the address that is sending the transaction. * @param _weiFundingCap - the caller's declared total cap. May be reinterpreted by the implementation of the CeilingStrategy. * @return Amount of wei the crowdsale can receive. */ function weiAllowedToReceive(uint _value, uint _weiRaised, uint _weiInvestedBySender, uint _weiFundingCap) public constant returns (uint amount); function isCrowdsaleFull(uint _weiRaised, uint _weiFundingCap) public constant returns (bool); /** * Calculate a new cap if the provided one is not above the amount already raised. * * * @param _newCap - The potential new cap. * @param _weiRaised - How much money has been raised so far. * @return The adjusted cap. */ function relaxFundingCap(uint _newCap, uint _weiRaised) public constant returns (uint); }
contract CeilingStrategy { /** Interface declaration. */ function isCeilingStrategy() public constant returns (bool) { return true; } /** * When somebody tries to buy tokens for X wei, calculate how many weis they are allowed to use. * * * @param _value - What is the value of the transaction sent in as wei. * @param _weiRaised - How much money has been raised so far. * @param _weiInvestedBySender - the investment made by the address that is sending the transaction. * @param _weiFundingCap - the caller's declared total cap. May be reinterpreted by the implementation of the CeilingStrategy. * @return Amount of wei the crowdsale can receive. */ function weiAllowedToReceive(uint _value, uint _weiRaised, uint _weiInvestedBySender, uint _weiFundingCap) public constant returns (uint amount); function isCrowdsaleFull(uint _weiRaised, uint _weiFundingCap) public constant returns (bool); /** * Calculate a new cap if the provided one is not above the amount already raised. * * * @param _newCap - The potential new cap. * @param _weiRaised - How much money has been raised so far. * @return The adjusted cap. */ function relaxFundingCap(uint _newCap, uint _weiRaised) public constant returns (uint); }
37,287
239
// The liquidator liquidates the borrowers collateral. The collateral seized is transferred to the liquidator. borrower The borrower of this slToken to be liquidated liquidator The address repaying the borrow and seizing collateral slTokenCollateral The market in which to seize collateral from the borrower repayAmount The amount of the underlying borrowed asset to repayreturn (uint, uint) An error code (0=success, otherwise a failure, see ErrorReporter.sol), and the actual repayment amount. /
function liquidateBorrowFresh(address liquidator, address borrower, uint repayAmount, SLTokenInterface slTokenCollateral) internal returns (uint, uint) { /* Fail if liquidate not allowed */ uint allowed = comptroller.liquidateBorrowAllowed(address(this), address(slTokenCollateral), liquidator, borrower, repayAmount); if (allowed != 0) { return (failOpaque(Error.COMPTROLLER_REJECTION, FailureInfo.LIQUIDATE_COMPTROLLER_REJECTION, allowed), 0); } /* Verify market's block number equals current block number */ if (accrualBlockNumber != getBlockNumber()) { return (fail(Error.MARKET_NOT_FRESH, FailureInfo.LIQUIDATE_FRESHNESS_CHECK), 0); } /* Verify slTokenCollateral market's block number equals current block number */ if (slTokenCollateral.accrualBlockNumber() != getBlockNumber()) { return (fail(Error.MARKET_NOT_FRESH, FailureInfo.LIQUIDATE_COLLATERAL_FRESHNESS_CHECK), 0); } /* Fail if borrower = liquidator */ if (borrower == liquidator) { return (fail(Error.INVALID_ACCOUNT_PAIR, FailureInfo.LIQUIDATE_LIQUIDATOR_IS_BORROWER), 0); } /* Fail if repayAmount = 0 */ if (repayAmount == 0) { return (fail(Error.INVALID_CLOSE_AMOUNT_REQUESTED, FailureInfo.LIQUIDATE_CLOSE_AMOUNT_IS_ZERO), 0); } /* Fail if repayAmount = -1 */ if (repayAmount == uint(-1)) { return (fail(Error.INVALID_CLOSE_AMOUNT_REQUESTED, FailureInfo.LIQUIDATE_CLOSE_AMOUNT_IS_UINT_MAX), 0); } /* Fail if repayBorrow fails */ (uint repayBorrowError, uint actualRepayAmount) = repayBorrowFresh(liquidator, borrower, repayAmount); if (repayBorrowError != uint(Error.NO_ERROR)) { return (fail(Error(repayBorrowError), FailureInfo.LIQUIDATE_REPAY_BORROW_FRESH_FAILED), 0); } ///////////////////////// // EFFECTS & INTERACTIONS // (No safe failures beyond this point) /* We calculate the number of collateral tokens that will be seized */ (uint amountSeizeError, uint seizeTokens) = comptroller.liquidateCalculateSeizeTokens(address(this), address(slTokenCollateral), actualRepayAmount); require(amountSeizeError == uint(Error.NO_ERROR), "LIQUIDATE_COMPTROLLER_CALCULATE_AMOUNT_SEIZE_FAILED"); /* Revert if borrower collateral token balance < seizeTokens */ require(slTokenCollateral.balanceOf(borrower) >= seizeTokens, "LIQUIDATE_SEIZE_TOO_MUCH"); // If this is also the collateral, run seizeInternal to avoid re-entrancy, otherwise make an external call uint seizeError; if (address(slTokenCollateral) == address(this)) { seizeError = seizeInternal(address(this), liquidator, borrower, seizeTokens); } else { seizeError = slTokenCollateral.seize(liquidator, borrower, seizeTokens); } /* Revert if seize tokens fails (since we cannot be sure of side effects) */ require(seizeError == uint(Error.NO_ERROR), "token seizure failed"); /* We emit a LiquidateBorrow event */ emit LiquidateBorrow(liquidator, borrower, actualRepayAmount, address(slTokenCollateral), seizeTokens); /* We call the defense hook */ comptroller.liquidateBorrowVerify(address(this), address(slTokenCollateral), liquidator, borrower, actualRepayAmount, seizeTokens); return (uint(Error.NO_ERROR), actualRepayAmount); }
function liquidateBorrowFresh(address liquidator, address borrower, uint repayAmount, SLTokenInterface slTokenCollateral) internal returns (uint, uint) { /* Fail if liquidate not allowed */ uint allowed = comptroller.liquidateBorrowAllowed(address(this), address(slTokenCollateral), liquidator, borrower, repayAmount); if (allowed != 0) { return (failOpaque(Error.COMPTROLLER_REJECTION, FailureInfo.LIQUIDATE_COMPTROLLER_REJECTION, allowed), 0); } /* Verify market's block number equals current block number */ if (accrualBlockNumber != getBlockNumber()) { return (fail(Error.MARKET_NOT_FRESH, FailureInfo.LIQUIDATE_FRESHNESS_CHECK), 0); } /* Verify slTokenCollateral market's block number equals current block number */ if (slTokenCollateral.accrualBlockNumber() != getBlockNumber()) { return (fail(Error.MARKET_NOT_FRESH, FailureInfo.LIQUIDATE_COLLATERAL_FRESHNESS_CHECK), 0); } /* Fail if borrower = liquidator */ if (borrower == liquidator) { return (fail(Error.INVALID_ACCOUNT_PAIR, FailureInfo.LIQUIDATE_LIQUIDATOR_IS_BORROWER), 0); } /* Fail if repayAmount = 0 */ if (repayAmount == 0) { return (fail(Error.INVALID_CLOSE_AMOUNT_REQUESTED, FailureInfo.LIQUIDATE_CLOSE_AMOUNT_IS_ZERO), 0); } /* Fail if repayAmount = -1 */ if (repayAmount == uint(-1)) { return (fail(Error.INVALID_CLOSE_AMOUNT_REQUESTED, FailureInfo.LIQUIDATE_CLOSE_AMOUNT_IS_UINT_MAX), 0); } /* Fail if repayBorrow fails */ (uint repayBorrowError, uint actualRepayAmount) = repayBorrowFresh(liquidator, borrower, repayAmount); if (repayBorrowError != uint(Error.NO_ERROR)) { return (fail(Error(repayBorrowError), FailureInfo.LIQUIDATE_REPAY_BORROW_FRESH_FAILED), 0); } ///////////////////////// // EFFECTS & INTERACTIONS // (No safe failures beyond this point) /* We calculate the number of collateral tokens that will be seized */ (uint amountSeizeError, uint seizeTokens) = comptroller.liquidateCalculateSeizeTokens(address(this), address(slTokenCollateral), actualRepayAmount); require(amountSeizeError == uint(Error.NO_ERROR), "LIQUIDATE_COMPTROLLER_CALCULATE_AMOUNT_SEIZE_FAILED"); /* Revert if borrower collateral token balance < seizeTokens */ require(slTokenCollateral.balanceOf(borrower) >= seizeTokens, "LIQUIDATE_SEIZE_TOO_MUCH"); // If this is also the collateral, run seizeInternal to avoid re-entrancy, otherwise make an external call uint seizeError; if (address(slTokenCollateral) == address(this)) { seizeError = seizeInternal(address(this), liquidator, borrower, seizeTokens); } else { seizeError = slTokenCollateral.seize(liquidator, borrower, seizeTokens); } /* Revert if seize tokens fails (since we cannot be sure of side effects) */ require(seizeError == uint(Error.NO_ERROR), "token seizure failed"); /* We emit a LiquidateBorrow event */ emit LiquidateBorrow(liquidator, borrower, actualRepayAmount, address(slTokenCollateral), seizeTokens); /* We call the defense hook */ comptroller.liquidateBorrowVerify(address(this), address(slTokenCollateral), liquidator, borrower, actualRepayAmount, seizeTokens); return (uint(Error.NO_ERROR), actualRepayAmount); }
21,627
77
// delegate call to `updateRole`
updateRole(address(this), _mask);
updateRole(address(this), _mask);
43,395
166
// Divider for input amount, 5 bps
uint256 public constant MAX_DFS_FEE = 2000;
uint256 public constant MAX_DFS_FEE = 2000;
35,393
160
// to recieve ETH from uniswapV2Router when swaping
receive() external payable {} /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve(address owner, address spender, uint256 amount) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); }
receive() external payable {} /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve(address owner, address spender, uint256 amount) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); }
6,642
237
// we're done harvesting, so reset our trigger if we used it
forceHarvestTriggerOnce = false;
forceHarvestTriggerOnce = false;
40,274
37
// Calculate uniswap time-weighted average price Underflow is a property of the accumulators: https:uniswap.org/audit.htmlorgc9b3190
FixedPoint.uq112x112 memory priceAverage = FixedPoint.uq112x112(uint224((nowCumulativePrice - oldCumulativePrice) / timeElapsed)); uint rawUniswapPriceMantissa = priceAverage.decode112with18(); // 10 * 10 ** 18 eth / token uint unscaledPriceMantissa = mul(rawUniswapPriceMantissa, 10 ** 6); // 10 * 10 ** 18 * 3000 * 10 ** 6 uint anchorPrice;
FixedPoint.uq112x112 memory priceAverage = FixedPoint.uq112x112(uint224((nowCumulativePrice - oldCumulativePrice) / timeElapsed)); uint rawUniswapPriceMantissa = priceAverage.decode112with18(); // 10 * 10 ** 18 eth / token uint unscaledPriceMantissa = mul(rawUniswapPriceMantissa, 10 ** 6); // 10 * 10 ** 18 * 3000 * 10 ** 6 uint anchorPrice;
38,768
190
// Cant send tokens to the zero address.
if (_beneficiary == address(0)) revert PAY_TO_ZERO_ADDRESS();
if (_beneficiary == address(0)) revert PAY_TO_ZERO_ADDRESS();
23,922
5
// Not used for this auction, but required parameter
string seed = "Seed";
string seed = "Seed";
49,680
384
// winner, even ids are winners!
_grandPVPWinnerReward(CryptoUtils._unpackIdValue(warriorsData[id]));
_grandPVPWinnerReward(CryptoUtils._unpackIdValue(warriorsData[id]));
40,925
42
// Find head of list
uint256 linkedListIndex = _self.lastUpdatedIndex; for (uint256 i = 0; i < _dataPoints; i++) {
uint256 linkedListIndex = _self.lastUpdatedIndex; for (uint256 i = 0; i < _dataPoints; i++) {
29,718
220
// newBalTo = poolRatio^(1/weightTo)balTo;
uint256 tokenOutRatio = poolRatio.bpow(BONE.bdiv(normalizedWeight)); uint256 newTokenBalanceOut = tokenOutRatio.bmul(tokenBalanceOut); uint256 tokenAmountOutBeforeSwapFee = tokenBalanceOut.bsub(newTokenBalanceOut);
uint256 tokenOutRatio = poolRatio.bpow(BONE.bdiv(normalizedWeight)); uint256 newTokenBalanceOut = tokenOutRatio.bmul(tokenBalanceOut); uint256 tokenAmountOutBeforeSwapFee = tokenBalanceOut.bsub(newTokenBalanceOut);
877
105
// Hair N°17 => Classic 2 Yellow
function item_17() public pure returns (string memory) { return base(classicTwoHairs(Colors.YELLOW)); }
function item_17() public pure returns (string memory) { return base(classicTwoHairs(Colors.YELLOW)); }
33,895
27
// the risk structure; this structure keeps track of the risk- specific parameters. several policies can share the same risk structure (typically some people flying with the same plane)
struct Risk { // 0 - Airline Code + FlightNumber bytes32 carrierFlightNumber; // 1 - scheduled departure and arrival time in the format /dep/YYYY/MM/DD bytes32 departureYearMonthDay; // 2 - the inital arrival time uint arrivalTime; // 3 - the final delay in minutes uint delayInMinutes; // 4 - the determined delay category (0-5) uint8 delay; // 5 - we limit the cumulated weighted premium to avoid cluster risks uint cumulatedWeightedPremium; // 6 - max cumulated Payout for this risk uint premiumMultiplier; }
struct Risk { // 0 - Airline Code + FlightNumber bytes32 carrierFlightNumber; // 1 - scheduled departure and arrival time in the format /dep/YYYY/MM/DD bytes32 departureYearMonthDay; // 2 - the inital arrival time uint arrivalTime; // 3 - the final delay in minutes uint delayInMinutes; // 4 - the determined delay category (0-5) uint8 delay; // 5 - we limit the cumulated weighted premium to avoid cluster risks uint cumulatedWeightedPremium; // 6 - max cumulated Payout for this risk uint premiumMultiplier; }
45,414
29
// reset cooldown
pegMoveReadyTime = now+pegMoveCooldown;
pegMoveReadyTime = now+pegMoveCooldown;
33,319
6
// Verify hash matches sent data
bytes32 computedHash = keccak256(abi.encode( chainId(), _msgSender(), 100, feeToken, feeAmount, maxBlock, messageWithBool )).toEthSignedMessageHash();
bytes32 computedHash = keccak256(abi.encode( chainId(), _msgSender(), 100, feeToken, feeAmount, maxBlock, messageWithBool )).toEthSignedMessageHash();
11,394
6
// Emitted when the tranfer percent is updated, along with updated percent for transfer. /
event TranferPercentUpdated(uint256 percentForPlatform);
event TranferPercentUpdated(uint256 percentForPlatform);
9,082
3
// Ownable Base contract with an owner.Provides onlyOwner modifier, which prevents function from running if it is called by anyone other than the owner. /
contract Ownable { address public owner; constructor(){ owner = msg.sender; } modifier onlyOwner() { if (msg.sender != owner) { revert(); } _; } //transfer owner to another address function transferOwnership(address _newOwner) onlyOwner { if (_newOwner != address(0)) { owner = _newOwner; } } }
contract Ownable { address public owner; constructor(){ owner = msg.sender; } modifier onlyOwner() { if (msg.sender != owner) { revert(); } _; } //transfer owner to another address function transferOwnership(address _newOwner) onlyOwner { if (_newOwner != address(0)) { owner = _newOwner; } } }
13,919
241
// Mirror of the value in LibStorage, solidity compiler does not allow assigning/ two constants to each other.
uint256 private constant NUM_NTOKEN_MARKET_FACTORS = 14;
uint256 private constant NUM_NTOKEN_MARKET_FACTORS = 14;
5,891
33
// get Token for seed
ISVGRenderer.Part[] memory _parts = nounsDescriptor.getPartsForSeed(_seed);
ISVGRenderer.Part[] memory _parts = nounsDescriptor.getPartsForSeed(_seed);
5,308
40
// Returns True if address is a worker, False otherwise/_worker The address being checked for worker permissions
function isWorker(address _worker) external view onlyAdminOrOwner returns (bool)
function isWorker(address _worker) external view onlyAdminOrOwner returns (bool)
1,992