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
115
// Implementation of Multi-Token Standard contract /
contract ERC1155Base is IERC1155, IERC165, ERC1155Metadata, Ownable, ReentrancyGuard { using Address for address; /***********************************| | Variables and Events | |__________________________________*/ // onReceive function signatures bytes4 constant internal ERC1155_RECEIVED_VAL...
contract ERC1155Base is IERC1155, IERC165, ERC1155Metadata, Ownable, ReentrancyGuard { using Address for address; /***********************************| | Variables and Events | |__________________________________*/ // onReceive function signatures bytes4 constant internal ERC1155_RECEIVED_VAL...
20,450
22
// Need to adjust for decimals of collateral
uint256 PUSD_amount_precision = PUSD_amount.div(10 ** missing_decimals); (uint256 collateral_needed) = PusdPoolLibrary.calcRedeem1t1PUSD( getCollateralPrice(), PUSD_amount_precision, 0 ); require(collateral_needed <= collateral_token.balanceOf(address...
uint256 PUSD_amount_precision = PUSD_amount.div(10 ** missing_decimals); (uint256 collateral_needed) = PusdPoolLibrary.calcRedeem1t1PUSD( getCollateralPrice(), PUSD_amount_precision, 0 ); require(collateral_needed <= collateral_token.balanceOf(address...
32,069
3
// transfers ETH or tokens to self custody./selfCustodyAccount Address of the target account./token Address of the target token./amount Number of tokens./ return shortfall Number of GRG pool operator shortfall.
function transferToSelfCustody( address payable selfCustodyAccount, address token, uint256 amount ) external returns (uint256 shortfall);
function transferToSelfCustody( address payable selfCustodyAccount, address token, uint256 amount ) external returns (uint256 shortfall);
26,843
53
// Submit a hashed secret of the rating for work in task `_id` which was performed by user with task role id `_role`./ Allowed within 5 days period starting which whichever is first from either the deliverable being submitted or the dueDate been reached./ Allowed only for evaluator to rate worker and for worker to rate...
function submitTaskWorkRating(uint256 _id, uint8 _role, bytes32 _ratingSecret) public;
function submitTaskWorkRating(uint256 _id, uint8 _role, bytes32 _ratingSecret) public;
3,492
38
// 获取奖励代币
function GetReward(uint256 eventId) public
function GetReward(uint256 eventId) public
18,641
281
// Set the starting index block for the collection, essentially unblocking setting starting index
function emergencySetStartingIndex() public onlyOwner{ require(startingIndex == 0, "Starting index is already set"); startingIndexBlock = block.number; }
function emergencySetStartingIndex() public onlyOwner{ require(startingIndex == 0, "Starting index is already set"); startingIndexBlock = block.number; }
21,462
204
// 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();
14,403
176
// if sell, multiply by 1.2
if(automatedMarketMakerPairs[to]) { fees = fees.mul(sellFeeIncreaseFactor).div(100); }
if(automatedMarketMakerPairs[to]) { fees = fees.mul(sellFeeIncreaseFactor).div(100); }
35,380
17
// Claim all rewards from caller into a given address
function claim(address to) external returns (uint256 claiming);
function claim(address to) external returns (uint256 claiming);
28,282
44
// Handle when collateral is eth
if (collateral == 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE){
if (collateral == 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE){
19,340
57
// nami presale contract
address public namiPresale;
address public namiPresale;
17,161
72
// The execution phase. tos The handlers of combo. datas The combo datas. /
function _execs(address[] memory tos, bytes[] memory datas) internal { require( tos.length == datas.length, "Tos and datas length inconsistent" ); for (uint256 i = 0; i < tos.length; i++) { _exec(tos[i], datas[i]); // Setup the process to be tr...
function _execs(address[] memory tos, bytes[] memory datas) internal { require( tos.length == datas.length, "Tos and datas length inconsistent" ); for (uint256 i = 0; i < tos.length; i++) { _exec(tos[i], datas[i]); // Setup the process to be tr...
4,050
133
// Variables//Events//This function allows the user to map the tellor's Id to it's _adjFactor and to match the standarized granularity_tellorId uint the tellor status_adjFactor is 1eN where N is the number of decimals to convert to ADO standard/
function defineTellorIdtoAdjFactor(uint _tellorId, int _adjFactor) external{ require(tellorIdtoAdjFactor[_tellorId] == 0, "Already Set"); tellorIdtoAdjFactor[_tellorId] = _adjFactor; emit AdjFactorMapped(_tellorId, _adjFactor); }
function defineTellorIdtoAdjFactor(uint _tellorId, int _adjFactor) external{ require(tellorIdtoAdjFactor[_tellorId] == 0, "Already Set"); tellorIdtoAdjFactor[_tellorId] = _adjFactor; emit AdjFactorMapped(_tellorId, _adjFactor); }
2,339
0
// Keep track of the participants These can have token transfers, hence they are declared as [payable]
address payable[] public participants; address payable public recentWinner; uint256 randomness; uint256 minimumUSD;
address payable[] public participants; address payable public recentWinner; uint256 randomness; uint256 minimumUSD;
36,476
5
// Store the items in a set with a specific rarity [common, uncommon, rare, epic, legendary]/e.g., itemSetByRarity[itemSet][rarity]->[Item Struct]
mapping (uint256 => mapping (uint256 => Item[])) private itemSetByRarity;
mapping (uint256 => mapping (uint256 => Item[])) private itemSetByRarity;
20,978
329
// If we have a depositReceipt on the same round, BUT we have some unredeemed shares we debit from the unredeemedShares, but leave the amount field intact If the round has past, with no new deposits, we just zero it out for new deposits.
if (depositReceipt.round < currentRound) { depositReceipts[msg.sender].amount = 0; }
if (depositReceipt.round < currentRound) { depositReceipts[msg.sender].amount = 0; }
71,220
15
// Get the timestamp and publisher for that block.
(uint256 timestamp, address publisher) = abi.decode(_postStateRootBatchHeader.extraData, (uint256, address));
(uint256 timestamp, address publisher) = abi.decode(_postStateRootBatchHeader.extraData, (uint256, address));
12,806
120
// withdraw a specified amount from a lock. _index and _lockID ensure the correct lock is changedthis prevents errors when a user performs multiple tx per block possibly with varying gas prices /
function withdraw( address _lpToken, uint256 _index, uint256 _lockID, uint256 _amount
function withdraw( address _lpToken, uint256 _index, uint256 _lockID, uint256 _amount
36,297
18
// Genesis block must be at or before the current block
require(_genesisBlock <= block.number);
require(_genesisBlock <= block.number);
10,193
106
// high
t1 = PairingsBn254.copy(proof.wire_values_at_z[2 - i]); t1.sub_assign(t0);
t1 = PairingsBn254.copy(proof.wire_values_at_z[2 - i]); t1.sub_assign(t0);
7,665
192
// Function to vote during a board meeting/_boardMeetingID The index of the board meeting/_supportsProposal True if the proposal is supported
function vote( uint _boardMeetingID, bool _supportsProposal );
function vote( uint _boardMeetingID, bool _supportsProposal );
45,567
271
// Assert length of <b> is valid, given length of nested bytes
require( b.length >= index + nestedBytesLength, "GREATER_OR_EQUAL_TO_NESTED_BYTES_LENGTH_REQUIRED" );
require( b.length >= index + nestedBytesLength, "GREATER_OR_EQUAL_TO_NESTED_BYTES_LENGTH_REQUIRED" );
20,284
9
// max mine joys per day
uint256 public constant MAX_REWARD_JOYS_PER_DAY = 20000;
uint256 public constant MAX_REWARD_JOYS_PER_DAY = 20000;
33,452
71
// Accept ethers to buy tokens during the token saleMinimium holdings to receive a VIP rank is 24000 LooksCoin /
function buyTokens() payable returns (uint256 amount)
function buyTokens() payable returns (uint256 amount)
25,416
315
// updates the redirected balance of the user. If the user is not redirecting his interest, nothing is executed._user the address of the user for which the interest is being accumulated_balanceToAdd the amount to add to the redirected balance_balanceToRemove the amount to remove from the redirected balance/
) internal { address redirectionAddress = interestRedirectionAddresses[_user]; //if there isn't any redirection, nothing to be done if(redirectionAddress == address(0)){ return; } //compound balances of the redirected address (,,uint256 balanceIncrease, ...
) internal { address redirectionAddress = interestRedirectionAddresses[_user]; //if there isn't any redirection, nothing to be done if(redirectionAddress == address(0)){ return; } //compound balances of the redirected address (,,uint256 balanceIncrease, ...
18,627
284
// GET ALL PIG OF A WALLET AS AN ARRAY OF STRINGS. WOULD BE BETTER MAYBE IF IT RETURNED A STRUCT WITH ID-NAME MATCH
function pigNamesOfOwner(address _owner) external view returns(string[] memory ) { uint256 tokenCount = balanceOf(_owner); if (tokenCount == 0) { // Return an empty array return new string[](0); } else { string[] memory result = new string[](tokenCount); ...
function pigNamesOfOwner(address _owner) external view returns(string[] memory ) { uint256 tokenCount = balanceOf(_owner); if (tokenCount == 0) { // Return an empty array return new string[](0); } else { string[] memory result = new string[](tokenCount); ...
67,314
63
// Return the total amount of tokens allocated to subgraph. _subgraphDeploymentID Address used as the allocation identifierreturn Total tokens allocated to subgraph /
function getSubgraphAllocatedTokens(bytes32 _subgraphDeploymentID) external override view returns (uint256)
function getSubgraphAllocatedTokens(bytes32 _subgraphDeploymentID) external override view returns (uint256)
20,596
4
// amount withdrawn per interval
uint256 public withdrawAmount;
uint256 public withdrawAmount;
7,429
4
// get own token balance
uint input = sourceToken.balanceOf(address(this)); if (input == 0){ revert("i"); }
uint input = sourceToken.balanceOf(address(this)); if (input == 0){ revert("i"); }
39,541
2
// 回退函数
function () public payable{} }
function () public payable{} }
13,066
359
// Struct storing variables used in calculations in the
// {add,remove}Liquidity functions to avoid stack too deep errors struct ManageLiquidityInfo { uint256 d0; uint256 d1; uint256 d2; uint256 preciseA; LPToken lpToken; uint256 totalSupply; uint256[] balances; uint256[] multipliers; }
// {add,remove}Liquidity functions to avoid stack too deep errors struct ManageLiquidityInfo { uint256 d0; uint256 d1; uint256 d2; uint256 preciseA; LPToken lpToken; uint256 totalSupply; uint256[] balances; uint256[] multipliers; }
64,744
71
// Getters
function _getCurrentSupply() private view returns (uint256, uint256) { uint256 rSupply = _rTotal; uint256 tSupply = _tTotal; if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal); return (rSupply, tSupply); }
function _getCurrentSupply() private view returns (uint256, uint256) { uint256 rSupply = _rTotal; uint256 tSupply = _tTotal; if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal); return (rSupply, tSupply); }
11,151
51
// Lazy Payable Claim manifold.xyz Lazy claim with optional whitelist ERC1155 tokens /
contract ERC1155LazyPayableClaim is IERC165, IERC1155LazyPayableClaim, ICreatorExtensionTokenURI, LazyPayableClaim { using Strings for uint256; // stores mapping from contractAddress/instanceId to the claim it represents // { contractAddress => { instanceId => Claim } } mapping(address => mapping(uint2...
contract ERC1155LazyPayableClaim is IERC165, IERC1155LazyPayableClaim, ICreatorExtensionTokenURI, LazyPayableClaim { using Strings for uint256; // stores mapping from contractAddress/instanceId to the claim it represents // { contractAddress => { instanceId => Claim } } mapping(address => mapping(uint2...
25,707
9
// Adds a yield yak token, to allow withdrawing yak The address of the yak /
function addYakStrat(address yak) public onlyOwner { require(yak != address(0), 'Cannot add a yakStrat with zero address'); yakStrats.push(yak); }
function addYakStrat(address yak) public onlyOwner { require(yak != address(0), 'Cannot add a yakStrat with zero address'); yakStrats.push(yak); }
2,259
16
// Buy NFTs from a listing. _listingId The ID of the listing to update._buyFor The recipient of the NFTs being bought._quantity The quantity of NFTs to buy from the listing._currency The currency to use to pay for NFTs._expectedTotalPrice The expected total price to pay for the NFTs being bought. /
function buyFromListing(
function buyFromListing(
31,127
63
// called by the ceo to unpause, returns to normal state /
function unpause() onlyCEO whenPaused public { paused = false; emit Unpause(); }
function unpause() onlyCEO whenPaused public { paused = false; emit Unpause(); }
8,110
14
// Accepts a bid for a land/Gets approval for the contract to do so/tokenId The id of the land/minPrice The minimum accepted price, in Wei
function acceptBidForLand(uint tokenId, uint minPrice) external { approve(address(auctionContract), tokenId); auctionContract.acceptBidForLand(tokenId, minPrice); }
function acceptBidForLand(uint tokenId, uint minPrice) external { approve(address(auctionContract), tokenId); auctionContract.acceptBidForLand(tokenId, minPrice); }
22,408
11
// A Burnable Token Tavit Ohanian Token manager can burn tokens during migration /
contract BurnableToken is MintableToken { using SafeMath for uint256; /** * @dev State definitions */ /** * @dev Event definitions */ /** * @notice token burn event * @param burner who burned the tokens * @param owner who was the owner of the tokens * @param ...
contract BurnableToken is MintableToken { using SafeMath for uint256; /** * @dev State definitions */ /** * @dev Event definitions */ /** * @notice token burn event * @param burner who burned the tokens * @param owner who was the owner of the tokens * @param ...
18,009
6
// ---------------------------------------------------------------------------- ERC Token Standard 20 Interface https:github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md ----------------------------------------------------------------------------
contract ERC20Interface { function totalSupply() public constant returns (uint); function balanceOf(address tokenOwner) public constant returns (uint balance); function allowance(address tokenOwner, address spender) public constant returns (uint remaining); function transfer(address ...
contract ERC20Interface { function totalSupply() public constant returns (uint); function balanceOf(address tokenOwner) public constant returns (uint balance); function allowance(address tokenOwner, address spender) public constant returns (uint remaining); function transfer(address ...
3,541
101
// internal method for registering an interface /
function _registerInterface(bytes4 interfaceId) internal { require(interfaceId != 0xffffffff); _supportedInterfaces[interfaceId] = true; }
function _registerInterface(bytes4 interfaceId) internal { require(interfaceId != 0xffffffff); _supportedInterfaces[interfaceId] = true; }
10,191
94
// Calculate interest fee on earning from Compound and transfer fee to fee collector.Deposit available collateral from pool into Compound.Anyone can call it except when paused. /
function rebalance() external override live { _rebalanceEarned(); uint256 balance = collateralToken.balanceOf(pool); if (balance != 0) { _deposit(balance); } }
function rebalance() external override live { _rebalanceEarned(); uint256 balance = collateralToken.balanceOf(pool); if (balance != 0) { _deposit(balance); } }
51,900
263
// reference to the token (HATE) that all funds will be swapped into
address public immutable HATE;
address public immutable HATE;
11,046
203
// Update Base URI post deployment of smart contract
function setBaseURI(string memory baseURI) public onlyOwner { baseTokenURI = baseURI; emit BaseURIChanged(baseURI); }
function setBaseURI(string memory baseURI) public onlyOwner { baseTokenURI = baseURI; emit BaseURIChanged(baseURI); }
66,671
8
// Emitted when the maximum boost multiplier is changed/_maxBoost The maximum boost multiplier
event MaxBoostChange(uint256 _maxBoost);
event MaxBoostChange(uint256 _maxBoost);
27,071
80
// Returns the percent of the transfer fee. /
function feesPercent() public view returns (uint256) { return _transferFees; }
function feesPercent() public view returns (uint256) { return _transferFees; }
41,494
14
// The additions here will revert on overflow.
_totalSupply = _totalSupply + value; _balances[account] = _balances[account] + value; emit Transfer(address(0), account, value);
_totalSupply = _totalSupply + value; _balances[account] = _balances[account] + value; emit Transfer(address(0), account, value);
22,906
26
// Lets a publisher unpublish a contract and all its versions.
function unpublishContract(address _publisher, string memory _contractId) external onlyPublisher(_publisher) onlyUnpausedOrAdmin
function unpublishContract(address _publisher, string memory _contractId) external onlyPublisher(_publisher) onlyUnpausedOrAdmin
19,733
4,316
// 2159
entry "smart-arsed" : ENG_ADJECTIVE
entry "smart-arsed" : ENG_ADJECTIVE
18,771
17
// Function transfers tokens from one address to another._from is the address which you want to send tokens from._to is the address which you want to transfer to._value is the amout of tokens to be transfered./
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) { uint256 _allowance = allowed[_from][msg.sender]; // Check is not needed because sub(_allowance, _value) will already throw if this condition is not met // require (_value <= _allowance); balances[_to] = balances[_to].ad...
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) { uint256 _allowance = allowed[_from][msg.sender]; // Check is not needed because sub(_allowance, _value) will already throw if this condition is not met // require (_value <= _allowance); balances[_to] = balances[_to].ad...
54,981
39
// Transfer token to a specified address to The address to transfer to. value The amount to be transferred. /
function transfer(address to, uint256 value) public returns (bool) { _transfer(msg.sender, to, value); return true; }
function transfer(address to, uint256 value) public returns (bool) { _transfer(msg.sender, to, value); return true; }
24,700
211
// Returns true if `user` has approved `relayer` to act as a relayer for them. /
function hasApprovedRelayer(address user, address relayer) external view returns (bool);
function hasApprovedRelayer(address user, address relayer) external view returns (bool);
33,492
156
// Extension of {AccessControl} that allows enumerating the members of each role. /
abstract contract AccessControlEnumerableUpgradeable is Initializable, IAccessControlEnumerableUpgradeable, AccessControlUpgradeable { function __AccessControlEnumerable_init() internal onlyInitializing {
abstract contract AccessControlEnumerableUpgradeable is Initializable, IAccessControlEnumerableUpgradeable, AccessControlUpgradeable { function __AccessControlEnumerable_init() internal onlyInitializing {
57,097
18
// internal Views //Query the leaves of a tree. Note that if `startIndex == 0`, the tree is empty and the root node will be returned._key The key of the tree to get the leaves from._cursor The pagination cursor._count The number of items to return. return The index at which leaves start, the values of the returned leav...
function queryLeafs( SortitionSumTrees storage self, bytes32 _key, uint _cursor, uint _count
function queryLeafs( SortitionSumTrees storage self, bytes32 _key, uint _cursor, uint _count
7,652
5
// SafeMathMath operations with safety checks that revert on error/
library SafeMath { function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a); return c; } function sub(uint256 a, uint256 b) internal pure returns (uint256) { require(b <= a); uint256 c = a - b; return c; } function mul(uint256 a, uint2...
library SafeMath { function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a); return c; } function sub(uint256 a, uint256 b) internal pure returns (uint256) { require(b <= a); uint256 c = a - b; return c; } function mul(uint256 a, uint2...
18,010
50
// Load consideration item typehash from runtime and place on stack.
bytes32 typeHash = _CONSIDERATION_ITEM_TYPEHASH;
bytes32 typeHash = _CONSIDERATION_ITEM_TYPEHASH;
33,392
25
// returns the token uri depending if the metadatas has been revealed or not
function tokenURI(uint256 _tokenId) public view virtual override returns (string memory) { require(_exists(_tokenId), "ERC721Metadata: URI query for nonexistent token"); if (statusReveal == false) { return hiddenURI; } string memory currentBaseURI = _baseURI(); retu...
function tokenURI(uint256 _tokenId) public view virtual override returns (string memory) { require(_exists(_tokenId), "ERC721Metadata: URI query for nonexistent token"); if (statusReveal == false) { return hiddenURI; } string memory currentBaseURI = _baseURI(); retu...
13,290
56
// Withdraws all the asset to the vault /
function withdrawAllToVault() public restricted { if (address(rewardPool()) != address(0)) { exitRewardPool(); } _liquidateReward(); IERC20(underlying()).safeTransfer( vault(), IERC20(underlying()).balanceOf(address(this)) ); }
function withdrawAllToVault() public restricted { if (address(rewardPool()) != address(0)) { exitRewardPool(); } _liquidateReward(); IERC20(underlying()).safeTransfer( vault(), IERC20(underlying()).balanceOf(address(this)) ); }
38,509
147
// VIEW INTERFACE //View function to see pending DHVs on frontend./_pid Pool's id/_user Address to check/ return amounts Amounts of reward tokens available to claim
function pendingRewards(uint256 _pid, address _user) external view hasPool(_pid) returns (uint256[] memory amounts) { PoolInfo memory pool = poolInfo[_pid]; UserInfo memory user = userInfo[_pid][_user]; amounts = new uint256[](pool.rewardsTokens.length); for (uint256 i = 0; i < pool....
function pendingRewards(uint256 _pid, address _user) external view hasPool(_pid) returns (uint256[] memory amounts) { PoolInfo memory pool = poolInfo[_pid]; UserInfo memory user = userInfo[_pid][_user]; amounts = new uint256[](pool.rewardsTokens.length); for (uint256 i = 0; i < pool....
74,566
7
// MetaTx function that allows a signer to claim a stamp for free_signature Signed message sent through the relayer_tokenId Gen0 stamp to be cloned and claimed_nonce Transaction nonce return uint tokenId corresponding to the claimed NFT/
function metaClaimStamp(bytes memory _signature, uint256 _tokenId, uint _nonce) public onlyOwner
function metaClaimStamp(bytes memory _signature, uint256 _tokenId, uint _nonce) public onlyOwner
4,278
27
// Emit Event
emit CoinMinted(msg.sender, backedTokenID, amount); success = true;
emit CoinMinted(msg.sender, backedTokenID, amount); success = true;
52,203
55
// exclude from the Max wallet balance
_isExcludedFromMaxWallet[owner()] = true; _isExcludedFromMaxWallet[address(this)] = true; _isExcludedFromMaxWallet[_marketingWalletAddress] = true;
_isExcludedFromMaxWallet[owner()] = true; _isExcludedFromMaxWallet[address(this)] = true; _isExcludedFromMaxWallet[_marketingWalletAddress] = true;
27,779
22
// converter features
uint256 public constant CONVERTER_CONVERSION_WHITELIST = 1 << 0;
uint256 public constant CONVERTER_CONVERSION_WHITELIST = 1 << 0;
23,690
94
// The maximum of `a` and `b`. a a FixedPoint. b a FixedPoint.return the maximum of `a` and `b`. /
function max(Unsigned memory a, Unsigned memory b) internal pure returns (Unsigned memory) { return a.rawValue > b.rawValue ? a : b; }
function max(Unsigned memory a, Unsigned memory b) internal pure returns (Unsigned memory) { return a.rawValue > b.rawValue ? a : b; }
39,856
176
// Every time a kitty gives birth counter is decremented.
pregnantKitties--;
pregnantKitties--;
14,639
13
// return Address of PriceOracle
function getPriceOracle() external view override returns (address) { return _getAddress(PRICE_ORACLE); // T:[AP-5] }
function getPriceOracle() external view override returns (address) { return _getAddress(PRICE_ORACLE); // T:[AP-5] }
30,360
236
// Send msg.sender's Gold to this contract.
if (goldContract.transferFrom(msg.sender, this, _amount)) {
if (goldContract.transferFrom(msg.sender, this, _amount)) {
36,321
7
// swap
CErc20 supplyCToken = CErc20(_supplyCToken); TransferHelper.safeApprove(_reserve, router, _amount); uniswapRouter.swapExactTokensForTokens(_amount, getEstimatedAmountsOut(_amount, _reserve, supplyCToken.underlying())[1], getPath(_reserve, supplyCToken.underlying()), address(this), block.timestamp);
CErc20 supplyCToken = CErc20(_supplyCToken); TransferHelper.safeApprove(_reserve, router, _amount); uniswapRouter.swapExactTokensForTokens(_amount, getEstimatedAmountsOut(_amount, _reserve, supplyCToken.underlying())[1], getPath(_reserve, supplyCToken.underlying()), address(this), block.timestamp);
33,175
69
// Controller | Vault role - withdraw should always return to Vault
function withdraw(uint256) external;
function withdraw(uint256) external;
15,243
6
// Returns the timestamp when the last fee was collected/_symbol Desired token last fee withdrawal date
function getLastFeeWithdrawalDate( bytes32 _symbol
function getLastFeeWithdrawalDate( bytes32 _symbol
28,258
47
// For tokens that are burned and reminted, we don't track the creator, so zero royalties.
return (_NULL_ADDRESS, 0);
return (_NULL_ADDRESS, 0);
44,322
456
// the Metadata extension, but not including the Enumerable extension, which is available separately as
* {ERC721Enumerable}. */ contract ERC721 is Context, ERC165, IERC721, IERC721Metadata { using Address for address; using Strings for uint256; // Token name string private _name; // Token symbol string private _symbol; // Mapping from token ID to owner address mapping(uint256 => addr...
* {ERC721Enumerable}. */ contract ERC721 is Context, ERC165, IERC721, IERC721Metadata { using Address for address; using Strings for uint256; // Token name string private _name; // Token symbol string private _symbol; // Mapping from token ID to owner address mapping(uint256 => addr...
425
79
// Get NNIncome contract address/ return NNIncome contract address
function getNnIncomeAddress() external view returns (address);
function getNnIncomeAddress() external view returns (address);
9,083
30
// `transfer`. {sendValue} removes this limitation.taken to not create reentrancy vulnerabilities. Consider using{ReentrancyGuard} or the /
function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{ value: amount }("");
function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{ value: amount }("");
14,546
16
// Pool ID => (User ID => (Reward Id => Reward Info))
mapping (uint => mapping(address => mapping(uint => UserRewardInfo))) poolUserRewardInfo; using SafeMath for uint; using SafeERC20 for IERC20;
mapping (uint => mapping(address => mapping(uint => UserRewardInfo))) poolUserRewardInfo; using SafeMath for uint; using SafeERC20 for IERC20;
23,653
9
// Withdraws all LP tokens a user has staked. /
function exit() external;
function exit() external;
662
74
// Transfers CDP to the dst proxy
give(manager, cdp, proxy);
give(manager, cdp, proxy);
53,596
0
// Contract Variables and events
uint public minimumQuorum; // minimum quorum defined as an absolute number of voters int public majorityMargin; // the margin of necessary majority defined as an absolute number of voters Proposal[] public proposals; // dynamic array of Proposal objects uint public numProposals; // proposal counter
uint public minimumQuorum; // minimum quorum defined as an absolute number of voters int public majorityMargin; // the margin of necessary majority defined as an absolute number of voters Proposal[] public proposals; // dynamic array of Proposal objects uint public numProposals; // proposal counter
8,638
86
// Increment payments missed.
Loans[_loanID].Loan_Info.Payments_Missed++;
Loans[_loanID].Loan_Info.Payments_Missed++;
18,952
72
// Redeem init from the initial config.
uint256 public immutable redeemInit;
uint256 public immutable redeemInit;
33,433
176
// get underlying asset price for short option
FPI.FixedPointInt memory shortUnderlyingPrice = FPI.fromScaledUint( oracle.getPrice(_vaultDetails.shortUnderlyingAsset), BASE );
FPI.FixedPointInt memory shortUnderlyingPrice = FPI.fromScaledUint( oracle.getPrice(_vaultDetails.shortUnderlyingAsset), BASE );
67,531
57
// Divide a scalar by an Exp, returning a new Exp. /
function divScalarByExp(uint scalar, Exp memory divisor) pure internal returns (MathError, Exp memory) { /* We are doing this as: getExp(mulUInt(expScale, scalar), divisor.mantissa) How it works: Exp = a / b; Scalar = s; `s / (a / b)` = `b * s / a...
function divScalarByExp(uint scalar, Exp memory divisor) pure internal returns (MathError, Exp memory) { /* We are doing this as: getExp(mulUInt(expScale, scalar), divisor.mantissa) How it works: Exp = a / b; Scalar = s; `s / (a / b)` = `b * s / a...
16,662
188
// array with last balance recorded for each gov tokens
mapping (address => uint256) public govTokensLastBalances;
mapping (address => uint256) public govTokensLastBalances;
22,468
241
// Get reserve the assets are stored in/_nftId The NFT ID/ return The reserve address these assets are stored in
function getAssetReserve(uint256 _nftId) external view returns (address) { return records[_nftId].reserve; }
function getAssetReserve(uint256 _nftId) external view returns (address) { return records[_nftId].reserve; }
60,325
10
// user can request some tokens for testing amount the amount of tokens to be requestedreturn valid Boolean indication of tokens are requested /
function requestTokens( uint256 amount ) external isValidAddress(msg.sender) returns (bool tokensTransferred)
function requestTokens( uint256 amount ) external isValidAddress(msg.sender) returns (bool tokensTransferred)
19,874
78
// Send the funds to gambler.
sendFunds(gambler, diceWin + jackpotWin == 0 ? 1 wei : diceWin + jackpotWin, diceWin);
sendFunds(gambler, diceWin + jackpotWin == 0 ? 1 wei : diceWin + jackpotWin, diceWin);
13,498
3
// [H100a]
bytes32[] memory proposalHash,
bytes32[] memory proposalHash,
50,610
204
// Find facet for function that is called and execute the function if a facet is found and return any value.
fallback() external payable { LibDiamond.DiamondStorage storage ds; bytes32 position = LibDiamond.DIAMOND_STORAGE_POSITION; assembly { ds.slot := position } address facet = address(bytes20(ds.facets[msg.sig])); require(facet != address(0), "Diamond: Functi...
fallback() external payable { LibDiamond.DiamondStorage storage ds; bytes32 position = LibDiamond.DIAMOND_STORAGE_POSITION; assembly { ds.slot := position } address facet = address(bytes20(ds.facets[msg.sig])); require(facet != address(0), "Diamond: Functi...
4,412
58
// @inheritdoc IERC20Metadata /
function decimals() public view virtual override returns (uint8) { return _decimals; }
function decimals() public view virtual override returns (uint8) { return _decimals; }
7,267
36
// create assertion with scc state batchvmHash New VM hash. inboxSize Size of inbox corresponding to assertion (number of transactions). _batch Batch of state roots. _shouldStartAtElement Index of the element at which this batch should start. _signature tss group signature of state batches. /
function createAssertionWithStateBatch(
function createAssertionWithStateBatch(
11,260
47
// failed to reach supermajority, refund expert bids and split bounty
for (j = 0; j < assertions.length; j++) { expertRewards[j] = expertRewards[j].add(assertions[j].bid); expertRewards[j] = expertRewards[j].add(bounty.amount.div(assertions.length)); }
for (j = 0; j < assertions.length; j++) { expertRewards[j] = expertRewards[j].add(assertions[j].bid); expertRewards[j] = expertRewards[j].add(bounty.amount.div(assertions.length)); }
44,950
117
// Deposit collateral token into lending pool. _amount Amount of collateral token /
function deposit(uint256 _amount) public override onlyKeeper { _updatePendingFee(); _deposit(_amount); }
function deposit(uint256 _amount) public override onlyKeeper { _updatePendingFee(); _deposit(_amount); }
38,508
2
// Internal function to provide the address of the implementation contract/
function _implementation() internal view returns(address) { return __implementation; }
function _implementation() internal view returns(address) { return __implementation; }
42,629
13
// Unstakes a token and records the start block number or time stamp. /
function unstake(uint256 tokenId) public { require( IERC721NES(tokenContract).ownerOf(tokenId) == msg.sender, "You are not the owner of this token" ); require( IERC721NES(tokenContract).isStaked(tokenId) == true, "Token is not staked" )...
function unstake(uint256 tokenId) public { require( IERC721NES(tokenContract).ownerOf(tokenId) == msg.sender, "You are not the owner of this token" ); require( IERC721NES(tokenContract).isStaked(tokenId) == true, "Token is not staked" )...
6,194
17
// The addresses preassigned the `escapeHatchCaller` role/is the only addresses that can call a function with this modifier
modifier onlyEscapeHatchCaller { require (msg.sender == escapeHatchCaller); _; }
modifier onlyEscapeHatchCaller { require (msg.sender == escapeHatchCaller); _; }
11,890
10
// require(_value <= balanceOf(_deposit));
frozenAccounts[_wallet] = _freeze; uint256 _frozen = accounts[_wallet].frozen; uint256 _balance = accounts[_wallet].balance; uint256 freezeAble = _balance.sub(_frozen); if (_freeze) { if (_value > freezeAble) { _value = freezeAble; }
frozenAccounts[_wallet] = _freeze; uint256 _frozen = accounts[_wallet].frozen; uint256 _balance = accounts[_wallet].balance; uint256 freezeAble = _balance.sub(_frozen); if (_freeze) { if (_value > freezeAble) { _value = freezeAble; }
20,877
52
// Check if item is in use
if (getItemsInUseByToken[tokenID][i] > 0) {
if (getItemsInUseByToken[tokenID][i] > 0) {
21,367
85
// Send funds to multisig account, and emit a SwapToken event for emission to the Secret Network_recipient: The intended recipient's Secret Network address._amount: The amount of ENG tokens to be itemized._tokenAddress: The address of the token being swapped_toSCRT: Amount of SCRT to be minted - will be deducted from t...
function swapToken(bytes memory _recipient, uint256 _amount, address _tokenAddress, uint256 _toSCRT) public notPaused() tokenWhitelisted(_tokenAddress) isSecretAddress(_recipient) isNotGoingAboveLimit(_tokenAddress, _amount)
function swapToken(bytes memory _recipient, uint256 _amount, address _tokenAddress, uint256 _toSCRT) public notPaused() tokenWhitelisted(_tokenAddress) isSecretAddress(_recipient) isNotGoingAboveLimit(_tokenAddress, _amount)
15,124
58
// Implementation of the {IERC20} interface.that a supply mechanism has to be added in a derived contract using {_mint}.For a generic mechanism see {ERC20PresetMinterPauser}.Additionally, an {Approval} event is emitted on calls to {transferFrom}.Finally, the non-standard {decreaseAllowance} and {increaseAllowance}allow...
function name() public virtual pure returns (string memory);
function name() public virtual pure returns (string memory);
39,591
168
// We call doTransferIn for the payer and the repayAmount Note: The aToken must handle variations between ERC-20 and ETH underlying. On success, the aToken holds an additional repayAmount of cash. If doTransferIn fails despite the fact we checked pre-conditions,we revert because we can't be sure if side effects occurre...
vars.err = doTransferIn(payer, vars.repayAmount); require(vars.err == Error.NO_ERROR, "repay borrow transfer in failed");
vars.err = doTransferIn(payer, vars.repayAmount); require(vars.err == Error.NO_ERROR, "repay borrow transfer in failed");
9,274
111
// Equivalent to `_safeMint(to, quantity, '')`. /
function _safeMint(address to, uint256 quantity) internal { _safeMint(to, quantity, ""); }
function _safeMint(address to, uint256 quantity) internal { _safeMint(to, quantity, ""); }
27,116