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
148
// Base interface for a contract that will be called via the GSN from {IRelayHub}.TIP: You don't need to write an implementation yourself! Inherit from {GSNRecipient} instead./ Returns the address of the {IRelayHub} instance this recipient interacts with. /
function getHubAddr() external view returns (address);
function getHubAddr() external view returns (address);
34,226
40
// Locks the contract for owner for the amount of time provided
function lock(uint256 time) public virtual onlyOwner { _previousOwner = _owner; _owner = address(0); _lockTime = time; emit OwnershipTransferred(_owner, address(0)); }
function lock(uint256 time) public virtual onlyOwner { _previousOwner = _owner; _owner = address(0); _lockTime = time; emit OwnershipTransferred(_owner, address(0)); }
1,480
26
// user&39;s withdraw will success in two cases:1. when the admin calls the approveWithdraw function; or 2. when the lock time has passed since the application;/
function withdraw(address token, uint256 amount) public { require(amount <= tokenList[token][msg.sender]); if (amount > withdrawAllowance[token][msg.sender]) { //withdraw wait over time require(latestApply[token][msg.sender] != 0 && safeSub(block.timestamp, latestApply[token]...
function withdraw(address token, uint256 amount) public { require(amount <= tokenList[token][msg.sender]); if (amount > withdrawAllowance[token][msg.sender]) { //withdraw wait over time require(latestApply[token][msg.sender] != 0 && safeSub(block.timestamp, latestApply[token]...
53,807
24
// Case: Celer
if ( selector == CelerIMFacetBase.startBridgeTokensViaCelerIM.selector ) { (, CelerIM.CelerIMData memory celerIMData) = abi.decode( callData.slice(4, callData.length - 4), (ILiFi.BridgeData, CelerIM.CelerIMData) ); return ...
if ( selector == CelerIMFacetBase.startBridgeTokensViaCelerIM.selector ) { (, CelerIM.CelerIMData memory celerIMData) = abi.decode( callData.slice(4, callData.length - 4), (ILiFi.BridgeData, CelerIM.CelerIMData) ); return ...
20,201
0
// Tue Mar 18 2031 17:46:47 GMT+0000
uint256 public constant START = 1636934400; mapping(address => uint256) public rewards; mapping(address => uint256) public lastUpdate;
uint256 public constant START = 1636934400; mapping(address => uint256) public rewards; mapping(address => uint256) public lastUpdate;
33,627
11
// Activate the contract. Discard if the contract is not the ledger owner.
function activate() public onlyOwner { require(!isActive); require(ledger.owner() == address(this)); isActive = true; }
function activate() public onlyOwner { require(!isActive); require(ledger.owner() == address(this)); isActive = true; }
29,928
78
// log event./
Transfer_S_coupons(msg.sender, _to, _numberOfScoupons);
Transfer_S_coupons(msg.sender, _to, _numberOfScoupons);
9,440
4
// set the main question`_question` is question
function setQuestion(string memory _question) external onlyRole(CONFIGURATOR_ROLE) { require(!_isStringEmpty(_question), "MarketingVoting: question is an empty string"); question = _question; }
function setQuestion(string memory _question) external onlyRole(CONFIGURATOR_ROLE) { require(!_isStringEmpty(_question), "MarketingVoting: question is an empty string"); question = _question; }
16,018
10
// Returns the current nonce for `owner`. This value must be included whenever a signature is generated for {permit}. Every successful call to {permit} increases ``owner``'s nonce by one. This prevents a signature from being used multiple times./
function nonces(address owner) external view returns (uint256);
function nonces(address owner) external view returns (uint256);
36,121
384
// BondingManager Manages bonding, transcoder and rewards/fee accounting related operations of the Livepeer protocol /
contract BondingManager is ManagerProxyTarget, IBondingManager { using SafeMath for uint256; using SortedDoublyLL for SortedDoublyLL.Data; using EarningsPool for EarningsPool.Data; using EarningsPoolLIP36 for EarningsPool.Data; // Constants // Occurances are replaced at compile time // and ...
contract BondingManager is ManagerProxyTarget, IBondingManager { using SafeMath for uint256; using SortedDoublyLL for SortedDoublyLL.Data; using EarningsPool for EarningsPool.Data; using EarningsPoolLIP36 for EarningsPool.Data; // Constants // Occurances are replaced at compile time // and ...
42,754
27
// decode a UQ144x112 into a uint144 by truncating after the radix point
function decode144(uq144x112 memory self) internal pure returns (uint144) { return uint144(self._x >> RESOLUTION); }
function decode144(uq144x112 memory self) internal pure returns (uint144) { return uint144(self._x >> RESOLUTION); }
43,909
16
// SC2.claimRewards(msg.sender);
(uint256 firstBlock, uint256 lockedRewards, uint256 totalLockedRewards) = SC2.definiteStats(msg.sender); require(_currentBlock > 13154223 && lockedRewards > 0);
(uint256 firstBlock, uint256 lockedRewards, uint256 totalLockedRewards) = SC2.definiteStats(msg.sender); require(_currentBlock > 13154223 && lockedRewards > 0);
10,252
356
// Creates Marble NFT Candidate for given user (cahrging the sender). This candidate will go through our processing. / If it's suitable, then Marble NFT is created. It is paid in the chain's currency./_uri URI of resource you want to transform to Marble NFT/_owner Address of the user who will own the candidate/ return ...
function createCandidateForUser(string memory _uri, address _owner) external payable returns(uint256 index);
function createCandidateForUser(string memory _uri, address _owner) external payable returns(uint256 index);
26,638
0
// ============ External ============ //When the update time has surpassed the currentTime + interpolationThreshold, linearly interpolate the price between the current time and price and the last updated time and price to reduce potential error. Thisis done with the following series of equations, modified in this insta...
function interpolateDelayedPriceUpdate( uint256 _currentPrice, uint256 _updateInterval, uint256 _timeFromExpectedUpdate, uint256 _previousLoggedDataPoint ) internal pure returns (uint256) {
function interpolateDelayedPriceUpdate( uint256 _currentPrice, uint256 _updateInterval, uint256 _timeFromExpectedUpdate, uint256 _previousLoggedDataPoint ) internal pure returns (uint256) {
46,253
12
// Gets the index of the last element in the list.// This function will revert if there are no elements in the list.// return the index of the last element.
function lastIndex(List storage _self) internal view returns (uint256) { uint256 _length = _self.length(); return _length.sub(1, "Pool.List: list is empty"); }
function lastIndex(List storage _self) internal view returns (uint256) { uint256 _length = _self.length(); return _length.sub(1, "Pool.List: list is empty"); }
16,041
78
// PUBLIC FACING: External helper to return most global info with a single call.Ugly implementation due to limitations of the standard ABI encoder.return Fixed array of values /
function globalInfo() external view returns (uint256[10] memory)
function globalInfo() external view returns (uint256[10] memory)
76,715
22
// The token which is already deployed to the network
ERC20Basic public token; event AirDroppedTokens(uint256 addressCount); event AirDrop(address indexed receiver, uint256 total);
ERC20Basic public token; event AirDroppedTokens(uint256 addressCount); event AirDrop(address indexed receiver, uint256 total);
45,967
16
// call addMember function to add sender as admin to newly created group
addMember(_sender, groupId, admin); if(_secretHashes.length > 0) { storeBatchInvitation(_sender, groupId, _secretHashes, _assignedRoles); }
addMember(_sender, groupId, admin); if(_secretHashes.length > 0) { storeBatchInvitation(_sender, groupId, _secretHashes, _assignedRoles); }
31,057
84
// Gets total amount of deposits that has left after users' bonus withdrawals/ return amount of deposits available for bonus payments
function getTotalDepositsAmountLeft() public view returns (uint _amount) { uint _lastDepositDate = lastDepositDate; for ( uint _startDate = firstDepositDate; _startDate <= _lastDepositDate || _startDate != 0; _startDate = distributionDeposits[_startDate].nextDepos...
function getTotalDepositsAmountLeft() public view returns (uint _amount) { uint _lastDepositDate = lastDepositDate; for ( uint _startDate = firstDepositDate; _startDate <= _lastDepositDate || _startDate != 0; _startDate = distributionDeposits[_startDate].nextDepos...
83,275
20
// Construct liquidation object. Note: All dispute-related values are zeroed out until a dispute occurs. liquidationId is the index of the new LiquidationData that is pushed into the array, which is equal to the current length of the array pre-push.
returnValues.liquidationId = liquidations.length; liquidations.push( PerpetualLiquidatablePoolParty.LiquidationData({ sponsor: params.sponsor, liquidator: msg.sender, state: PerpetualLiquidatablePoolParty.Status.PreDispute, liquidationTime: params.actualTime, ...
returnValues.liquidationId = liquidations.length; liquidations.push( PerpetualLiquidatablePoolParty.LiquidationData({ sponsor: params.sponsor, liquidator: msg.sender, state: PerpetualLiquidatablePoolParty.Status.PreDispute, liquidationTime: params.actualTime, ...
10,741
9
// Claims all accumulated protocol revenues for the provided ERC-20 asset.//Emits a {ClaimProtocolRevenues} event.// Requirements:/ - `msg.sender` must be the contract admin.//asset The contract address of the ERC-20 asset for which to claim protocol revenues.
function claimProtocolRevenues(IERC20 asset) external;
function claimProtocolRevenues(IERC20 asset) external;
23,256
181
// Should a secondary token be given to recipient from burn amount?
if(address(burnToken) != address(0)) { burnToken.mint(recipient, burnAmount); }
if(address(burnToken) != address(0)) { burnToken.mint(recipient, burnAmount); }
36,924
65
// Unlock the bet amount, regardless of the outcome.
lockedInBets = lockedInBets.sub(diceWinAmount);
lockedInBets = lockedInBets.sub(diceWinAmount);
17,799
12
// Reset approval and approve exact amount
function _safeApproveHelper( address token, address recipient, uint256 amount
function _safeApproveHelper( address token, address recipient, uint256 amount
41,431
6
// Determine size of whitelist first
uint256 activeCount = 0; for (uint256 i = 0; i < whitelistIndices.length; i++) { if (whitelist[whitelistIndices[i]] == Status.In) { activeCount++; }
uint256 activeCount = 0; for (uint256 i = 0; i < whitelistIndices.length; i++) { if (whitelist[whitelistIndices[i]] == Status.In) { activeCount++; }
17,267
5
// Perform TicketAttestation verification NOTE: This function DOES NOT VALIDATE whether the public key attested to is the same as the one who signed this transaction; you must perform validation of the subject from the calling function./
{ address recoveredAttestor; address recoveredIssuer; (recoveredAttestor, recoveredIssuer, subject, ticketId, conferenceId, attestationValid) = _verifyTicketAttestation(attestation); if (recoveredAttestor != attestor || recoveredIssuer != ticketIssuer || !attestationValid) ...
{ address recoveredAttestor; address recoveredIssuer; (recoveredAttestor, recoveredIssuer, subject, ticketId, conferenceId, attestationValid) = _verifyTicketAttestation(attestation); if (recoveredAttestor != attestor || recoveredIssuer != ticketIssuer || !attestationValid) ...
22,595
44
// Help2Crypto smart contract. /
contract H2CToken is AbstractToken { /** * Maximum allowed number of tokens in circulation. * tokenSupply = tokensIActuallyWant * (10 ^ decimals) */ uint256 constant MAX_TOKEN_COUNT = 218000000 * (10**8); /** * Address of the owner of this smart contract. */ address private owner; ...
contract H2CToken is AbstractToken { /** * Maximum allowed number of tokens in circulation. * tokenSupply = tokensIActuallyWant * (10 ^ decimals) */ uint256 constant MAX_TOKEN_COUNT = 218000000 * (10**8); /** * Address of the owner of this smart contract. */ address private owner; ...
46,392
5
// store this article
articles[articleCounter] = Article( articleCounter, msg.sender, address(0), _name, _description, _price ); emit LogSellArticle(articleCounter, msg.sender, _name, _price, _description);
articles[articleCounter] = Article( articleCounter, msg.sender, address(0), _name, _description, _price ); emit LogSellArticle(articleCounter, msg.sender, _name, _price, _description);
8,844
21
// 35% of the total number of SRT tokens will be allocated to STRATFIT LABS, and as a reserve for the company to be used for future strategic plans for the created ecosystem
token.issue(walletReserve, newTotalSupply.mul(35).div(100));
token.issue(walletReserve, newTotalSupply.mul(35).div(100));
28,826
271
// Overriding this function changes the behavior of the {onlyRole} modifier. Format of the revert message is described in {_checkRole}. _Available since v4.6._ /
function _checkRole(bytes32 role) internal view virtual { _checkRole(role, _msgSender()); }
function _checkRole(bytes32 role) internal view virtual { _checkRole(role, _msgSender()); }
7,690
96
// Governor is 0x0 unless the governor is local
address _newGov = _isLocalGovernor ? _newGovernor : address(0);
address _newGov = _isLocalGovernor ? _newGovernor : address(0);
38,390
52
// Day of week.
dt.weekday = 0;//getWeekday(timestamp);
dt.weekday = 0;//getWeekday(timestamp);
25,122
2
// Do whatever you wantOnly to silence Warning
amount = amount;
amount = amount;
36,717
5
// Sets the address allowed to withdraw the proceeds from presale _receiverOfEarnings address of the reveiver /
function setReceiverOfEarnings(address payable _receiverOfEarnings) external onlyOwner
function setReceiverOfEarnings(address payable _receiverOfEarnings) external onlyOwner
61,682
46
// Turning loser into zombie renders the loser's remaining stake inaccessible
turnIntoZombie(losingStaker);
turnIntoZombie(losingStaker);
21,997
144
// The VOTE TOKEN!
VOTEToken public VOTE;
VOTEToken public VOTE;
7,601
17
// Adds holder to the list _newHolder new holder, which will be added to list /
function addHolder( address _newHolder ) internal
function addHolder( address _newHolder ) internal
6,023
276
// - Data structure for time delay during deployer cut update
struct UpdateDeployerCutRequest { uint256 newDeployerCut; uint256 lockupExpiryBlock; }
struct UpdateDeployerCutRequest { uint256 newDeployerCut; uint256 lockupExpiryBlock; }
3,180
0
// GameToken struct to store player token info
struct GameToken { string name; /// @param name battle card name; set by player uint256 id; /// @param id battle card token id; will be randomly generated uint256 attackStrength; /// @param attackStrength battle card attack; generated randomly uint256 defenseStrength; /// @param defenseStrength battle...
struct GameToken { string name; /// @param name battle card name; set by player uint256 id; /// @param id battle card token id; will be randomly generated uint256 attackStrength; /// @param attackStrength battle card attack; generated randomly uint256 defenseStrength; /// @param defenseStrength battle...
6,682
10
// Set token IDs for each rarity class. Bulk version of `setTokenIdForClass` _tokenIds List of token IDs to set for each class, specified above in order /
function setTokenIdsForClasses( uint256[NUM_CLASSES] memory _tokenIds
function setTokenIdsForClasses( uint256[NUM_CLASSES] memory _tokenIds
1,305
31
// Otherwise tree non-empty so we calculate nodes up to root
else { for (uint256 i = 0; i < proofLength; ++i) { digest = nodeDigest(proof[i], digest); } }
else { for (uint256 i = 0; i < proofLength; ++i) { digest = nodeDigest(proof[i], digest); } }
39,062
15
// function totalSupply() public view returns (uint256); function balanceOf(address who) public view returns (uint256); function transfer(address to, uint256 value) public payable returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value); mapping(address => uint256) balances; string public name = "Trazair"; uint256 totalSupply_; uint256 public RATE = 1 ether; string public symbol = "TRZA"; ...
event Transfer(address indexed from, address indexed to, uint256 value); mapping(address => uint256) balances; string public name = "Trazair"; uint256 totalSupply_; uint256 public RATE = 1 ether; string public symbol = "TRZA"; ...
12,197
250
// calculate the max available loan size in stable rate mode as a percentage of theavailable liquidity
uint256 maxLoanSizeStable = vars.availableLiquidity.percentMul(maxStableLoanPercent); require(amount <= maxLoanSizeStable, Errors.VL_AMOUNT_BIGGER_THAN_MAX_LOAN_SIZE_STABLE);
uint256 maxLoanSizeStable = vars.availableLiquidity.percentMul(maxStableLoanPercent); require(amount <= maxLoanSizeStable, Errors.VL_AMOUNT_BIGGER_THAN_MAX_LOAN_SIZE_STABLE);
16,664
193
// Returns a token ID at a given `index` of all the tokens stored by the contract.Use along with {totalSupply} to enumerate all tokens. /
function tokenByIndex(uint256 index) external view returns (uint256);
function tokenByIndex(uint256 index) external view returns (uint256);
367
130
// Main function. Divides PLT's profits.
function harvest() public { uint256 wAvaxBal = IERC20(wAvax).balanceOf(address(this)); uint256 pltRewardFee = wAvaxBal.mul(PLT_REWARD_POOL_FEE).div(MAX_FEE); IJoeRouter02(unirouter).swapExactTokensForTokensSupportingFeeOnTransferTokens(pltRewardFee, 0, wAvaxToPLTRoute, rewardPool, now+600...
function harvest() public { uint256 wAvaxBal = IERC20(wAvax).balanceOf(address(this)); uint256 pltRewardFee = wAvaxBal.mul(PLT_REWARD_POOL_FEE).div(MAX_FEE); IJoeRouter02(unirouter).swapExactTokensForTokensSupportingFeeOnTransferTokens(pltRewardFee, 0, wAvaxToPLTRoute, rewardPool, now+600...
7,571
166
// Rounds down to the nearest tick where tick % tickSpacing == 0/tick The tick to round/tickSpacing The tick spacing to round to/ return the floored tick/Ensure tick +/- tickSpacing does not overflow or underflow int24
function floor(int24 tick, int24 tickSpacing) internal pure returns (int24) { int24 mod = tick % tickSpacing; unchecked { if (mod >= 0) return tick - mod; return tick - mod - tickSpacing; } }
function floor(int24 tick, int24 tickSpacing) internal pure returns (int24) { int24 mod = tick % tickSpacing; unchecked { if (mod >= 0) return tick - mod; return tick - mod - tickSpacing; } }
58,160
87
// START
contract PIMPELON is Context, IERC20, Ownable { using SafeMath for uint256; using Address for address; mapping (address => uint256) private _rOwned; mapping (address => uint256) private _tOwned; mapping (address => mapping (address => uint256)) private _allowances; mapping (address => bool) pr...
contract PIMPELON is Context, IERC20, Ownable { using SafeMath for uint256; using Address for address; mapping (address => uint256) private _rOwned; mapping (address => uint256) private _tOwned; mapping (address => mapping (address => uint256)) private _allowances; mapping (address => bool) pr...
81,171
12
// Callback function /
function fulfillSportsWinner(bytes32 _requestId, bytes32 _result) external recordChainlinkFulfillment(_requestId) { _setResult(_result); }
function fulfillSportsWinner(bytes32 _requestId, bytes32 _result) external recordChainlinkFulfillment(_requestId) { _setResult(_result); }
6,136
81
// change the Ownership from current owner to newOwner address
function transferOwnership(address newOwner) public onlyOwner returns(bool) { require(newOwner != address(0), "Ownable: new owner is the zero address"); emit OwnershipTransferred(owner, newOwner); owner = newOwner; return true; }
function transferOwnership(address newOwner) public onlyOwner returns(bool) { require(newOwner != address(0), "Ownable: new owner is the zero address"); emit OwnershipTransferred(owner, newOwner); owner = newOwner; return true; }
6,949
17
// Emits a {Transfer} event. tokenId_ (uint256) Token ID to burn /
function _burn(uint256 tokenId_) internal override(ERC721Upgradeable) { super._burn(tokenId_); }
function _burn(uint256 tokenId_) internal override(ERC721Upgradeable) { super._burn(tokenId_); }
35,017
10
// must use current price ratio with collateral as numerator
function getRequiredCollateral(uint256 _collateralRate, uint256 _loanAmount, uint256 _currentPriceReciprocal) external pure returns (uint256) { uint256 collateralAmount = _loanAmount.mul(_currentPriceReciprocal).mul(_collateralRate).div(1e18).div(bPDivisor); return collateralAmount; }
function getRequiredCollateral(uint256 _collateralRate, uint256 _loanAmount, uint256 _currentPriceReciprocal) external pure returns (uint256) { uint256 collateralAmount = _loanAmount.mul(_currentPriceReciprocal).mul(_collateralRate).div(1e18).div(bPDivisor); return collateralAmount; }
12,449
1
// owner => (spender => amount)
mapping(address => mapping(address => uint256)) allowances; mapping(address => uint256) balances; address[] approvedContracts; mapping(address => uint256) approvedContractIndexes; bytes32[1000] emptyMapSlots; address contractOwner; uint96 totalSupply;
mapping(address => mapping(address => uint256)) allowances; mapping(address => uint256) balances; address[] approvedContracts; mapping(address => uint256) approvedContractIndexes; bytes32[1000] emptyMapSlots; address contractOwner; uint96 totalSupply;
25,405
35
// Set the address of Treasury/_treasury address of Treasury contract
function setTreasury(address _treasury) external { require(treasury == address(0), "Pool::setTreasury: not allowed"); treasury = _treasury; emit TreasurySet(_treasury); }
function setTreasury(address _treasury) external { require(treasury == address(0), "Pool::setTreasury: not allowed"); treasury = _treasury; emit TreasurySet(_treasury); }
18,171
27
// Returns the auxillary data for `owner`. (e.g. number of whitelist mint slots used). /
function _getAux(address owner) internal view returns (uint64) { if (owner == address(0)) revert AuxQueryForZeroAddress(); return _addressData[owner].aux; }
function _getAux(address owner) internal view returns (uint64) { if (owner == address(0)) revert AuxQueryForZeroAddress(); return _addressData[owner].aux; }
8,495
3
// 1 million tokens to be generated1(1018)= 1;
_totalSupply = 899000000000 * (10**_decimals);
_totalSupply = 899000000000 * (10**_decimals);
20,639
9
// RebasedSync Helper functions for syncing the Oracle and notifying pools of balance changes. /
contract Sync { IUniswapV2Pair constant UNISWAP = IUniswapV2Pair(0xa89004aA11CF28B34E125c63FBc56213fb663F70); IBPool constant BALANCER_REB80WETH20 = IBPool(0x2961c01EB89D9af84c3859cE9E00E78efFcAB32F); IRebasedPriceOracle oracle = IRebasedPriceOracle(0x30F3A87F95630B3bECCF353EEdEFc77800114d77); eve...
contract Sync { IUniswapV2Pair constant UNISWAP = IUniswapV2Pair(0xa89004aA11CF28B34E125c63FBc56213fb663F70); IBPool constant BALANCER_REB80WETH20 = IBPool(0x2961c01EB89D9af84c3859cE9E00E78efFcAB32F); IRebasedPriceOracle oracle = IRebasedPriceOracle(0x30F3A87F95630B3bECCF353EEdEFc77800114d77); eve...
12,392
12
// Fund withdrawal for owner.
function withdraw(uint256 amount) public onlyOwner { require(address(this).balance >= amount, "Insufficient balance"); payable(msg.sender).transfer(amount); }
function withdraw(uint256 amount) public onlyOwner { require(address(this).balance >= amount, "Insufficient balance"); payable(msg.sender).transfer(amount); }
47,410
185
// Max harvest % : 100%
uint256 public constant MAXIMUM_HARVEST_BP = 10000;
uint256 public constant MAXIMUM_HARVEST_BP = 10000;
7,582
358
// refresh interest rates
updateReserveInterestRatesAndTimestampInternal(_reserve, _income, 0);
updateReserveInterestRatesAndTimestampInternal(_reserve, _income, 0);
51,510
0
// Friendly name of sweeps
string name;
string name;
24,011
94
// constructor only reuires the address of the CLN token which must use the ERC20 interface/_mmLib address for the deployed market maker elipse contract/_clnAddress address for the deployed ERC20 CLN token
function CurrencyFactory(address _mmLib, address _clnAddress) public { require(_mmLib != address(0)); require(_clnAddress != address(0)); mmLibAddress = _mmLib; clnAddress = _clnAddress; }
function CurrencyFactory(address _mmLib, address _clnAddress) public { require(_mmLib != address(0)); require(_clnAddress != address(0)); mmLibAddress = _mmLib; clnAddress = _clnAddress; }
67,217
153
// View function returning Artist's additional payee secondarysales percentage, for project `_projectId`. _projectId Project ID to be queried.return uint256 Artist's additional payee secondary sales percentage. /
function projectIdToAdditionalPayeeSecondarySalesPercentage( uint256 _projectId
function projectIdToAdditionalPayeeSecondarySalesPercentage( uint256 _projectId
33,370
7
// Update the parameters of the interest rate model (only callable by owner, i.e. Timelock) baseRatePerYear The approximate target base APR, as a mantissa (scaled by BASE) multiplierPerYear The rate of increase in interest rate wrt utilization (scaled by BASE) jumpMultiplierPerYear The multiplierPerBlock after hitting ...
function updateJumpRateModel(uint baseRatePerYear, uint multiplierPerYear, uint jumpMultiplierPerYear, uint kink_) virtual external { require(msg.sender == owner, "only the owner may call this function."); updateJumpRateModelInternal(baseRatePerYear, multiplierPerYear, jumpMultiplierPerYear, kink_)...
function updateJumpRateModel(uint baseRatePerYear, uint multiplierPerYear, uint jumpMultiplierPerYear, uint kink_) virtual external { require(msg.sender == owner, "only the owner may call this function."); updateJumpRateModelInternal(baseRatePerYear, multiplierPerYear, jumpMultiplierPerYear, kink_)...
9,130
921
// The context shared between the CDPs.
CDP.Context private _ctx;
CDP.Context private _ctx;
53,780
104
// assert(_addresses.length <= 255);
require(_amount <= msg.value / _addresses.length); for (uint8 i; i < _addresses.length; i++) {
require(_amount <= msg.value / _addresses.length); for (uint8 i; i < _addresses.length; i++) {
17,153
13
// ERC721 events/approval event/owner NFT token owner address/approved address to approve/tokenId NFT token ID to approve
event Approval(address owner, address approved, uint256 tokenId);
event Approval(address owner, address approved, uint256 tokenId);
50,911
5
// Used to set the fee wallet address _feeWallet The address of fee wallet /
function setFeeWallet(address _feeWallet) external onlyOwner { feeWallet = _feeWallet; emit SetFeeWallet(feeWallet); }
function setFeeWallet(address _feeWallet) external onlyOwner { feeWallet = _feeWallet; emit SetFeeWallet(feeWallet); }
585
3,998
// 2001
entry "heliocentrically" : ENG_ADVERB
entry "heliocentrically" : ENG_ADVERB
22,837
28
// move Eth to Ethertote development wallet
function _B_sendToEthertoteDevelopmentWallet() onlyAdmin public { require(ethertoteDevelopmentTransferComplete == false); require(ethToBeDistributed > 0); // now allow a percentage of the balance // total balance divided by 5 = 50% of balance address(ethertoteDevelopmentWallet).tr...
function _B_sendToEthertoteDevelopmentWallet() onlyAdmin public { require(ethertoteDevelopmentTransferComplete == false); require(ethToBeDistributed > 0); // now allow a percentage of the balance // total balance divided by 5 = 50% of balance address(ethertoteDevelopmentWallet).tr...
46,157
33
// Store the signerIndex as opFeedIndex and bind them to their provided schnorrData. Note that cast is safe as _feed's image is [0, _pubKeys.length) and _pubKeys' length is bounded by maxFeeds, i.e. type(uint8).max - 1.
opFeedIndex = uint8(signerIndex); _schnorrDataCommitment = uint160( uint( keccak256( abi.encodePacked( schnorrData.signature, schnorrData.commitment, schnorrData.signersBlob ...
opFeedIndex = uint8(signerIndex); _schnorrDataCommitment = uint160( uint( keccak256( abi.encodePacked( schnorrData.signature, schnorrData.commitment, schnorrData.signersBlob ...
20,760
63
// Multisignature wallet with daily limit - Allows an owner to withdraw a daily limit without multisig./Stefan George - <<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="ddaea9b8bbbcb3f3bab8b2afbab89dbeb2b3aeb8b3aea4aef3b3b8a9">[email&160;protected]</a>>
contract MultiSigWalletWithDailyLimit is MultiSigWallet { /* * Events */ event DailyLimitChange(uint dailyLimit); /* * Storage */ uint public dailyLimit; uint public lastDay; uint public spentToday; /* * Public functions */ /// @dev Contract constructor...
contract MultiSigWalletWithDailyLimit is MultiSigWallet { /* * Events */ event DailyLimitChange(uint dailyLimit); /* * Storage */ uint public dailyLimit; uint public lastDay; uint public spentToday; /* * Public functions */ /// @dev Contract constructor...
9,826
62
// If bid is in shortfall, mark for unlocking if not a rollover
if ( _isInMaintenanceCollateralShortFall( revealedBid.amount, revealedBid.bidPriceRevealed, revealedBid.collateralTokens, revealedBid.collateralAmounts ) ) { emitter.em...
if ( _isInMaintenanceCollateralShortFall( revealedBid.amount, revealedBid.bidPriceRevealed, revealedBid.collateralTokens, revealedBid.collateralAmounts ) ) { emitter.em...
27,811
10
// Adds an identifier to the whitelist. newIdentifier the new identifier to add. /
function addToWhitelist(bytes32 newIdentifier) external override onlyMaintainer
function addToWhitelist(bytes32 newIdentifier) external override onlyMaintainer
21,668
268
// column8_row0/ mload(0x2e60), pedersen/hash1/ec_subset_sum/bit_neg_0 = 1 - pedersen__hash1__ec_subset_sum__bit_0.
let val := addmod( 1, sub(PRIME, /*intermediate_value/pedersen/hash1/ec_subset_sum/bit_0*/ mload(0x41c0)), PRIME) mstore(0x41e0, val)
let val := addmod( 1, sub(PRIME, /*intermediate_value/pedersen/hash1/ec_subset_sum/bit_0*/ mload(0x41c0)), PRIME) mstore(0x41e0, val)
4,358
123
// Non-zero shares
require(_shares > 0, "No shares");
require(_shares > 0, "No shares");
37,874
98
// Transfer DELTA/this address is already mature as in it has 100% of DELTA in its balance
uint256 deltaForPoolAndReserve = balanceOfDELTA.div(2);
uint256 deltaForPoolAndReserve = balanceOfDELTA.div(2);
17,589
248
// List of supporters for each active bid proposal
mapping (uint256 => mapping (address => bool)) BidProposalSupporters;
mapping (uint256 => mapping (address => bool)) BidProposalSupporters;
23,214
8
// erc223: Retrieve the size of the code on target address, this needs assembly .
uint256 codeLength; assembly { codeLength := extcodesize(_to) }
uint256 codeLength; assembly { codeLength := extcodesize(_to) }
34,572
250
// maps tokenId to stake
mapping(uint256 => Stake) public vault;
mapping(uint256 => Stake) public vault;
6,477
194
// Gets the time remaining until the governable parameter update/ can be committed./changeTimestamp Timestamp indicating the beginning of the change./delay Governance delay./ return Remaining time in seconds.
function getRemainingChangeTime(uint256 changeTimestamp, uint256 delay) internal view returns (uint256)
function getRemainingChangeTime(uint256 changeTimestamp, uint256 delay) internal view returns (uint256)
61,567
252
// Change loan overdue duration, based on the number of blocks Accept claims only from the adminoverdueBlocks_ Maximum late repayment block. The number of arrivals is a default /
function setOverdueBlocks(uint256 overdueBlocks_) external;
function setOverdueBlocks(uint256 overdueBlocks_) external;
71,527
31
// raise (1+R) to the power of 4
F_ += (LPamount << 120) / totalLPs; // (1+R) (2.120 bits) F_ = F_ * F_ >> 120; // (1+R)**2 (4.120 bits) F_ = F_ * F_ >> 120; // (1+R)**4 (8.120 bits)
F_ += (LPamount << 120) / totalLPs; // (1+R) (2.120 bits) F_ = F_ * F_ >> 120; // (1+R)**2 (4.120 bits) F_ = F_ * F_ >> 120; // (1+R)**4 (8.120 bits)
19,651
44
// Event emitted when the contract is initialized
event InitializeHermezEvent( uint8 forgeL1L2BatchTimeout, uint256 feeAddToken, uint64 withdrawalDelay );
event InitializeHermezEvent( uint8 forgeL1L2BatchTimeout, uint256 feeAddToken, uint64 withdrawalDelay );
60,997
86
// mint drop and move into vault
uint priceDROP = assessor.calcSeniorTokenPrice(); uint collateralDROP = rdiv(amountDAI, priceDROP); tranche.mint(address(this), collateralDROP); collateral.approve(address(mgr), collateralDROP); mgr.join(collateralDROP);
uint priceDROP = assessor.calcSeniorTokenPrice(); uint collateralDROP = rdiv(amountDAI, priceDROP); tranche.mint(address(this), collateralDROP); collateral.approve(address(mgr), collateralDROP); mgr.join(collateralDROP);
30,525
26
// DSMath.wpow
function bpowi(uint a, uint n) internal pure returns (uint)
function bpowi(uint a, uint n) internal pure returns (uint)
37,997
55
// add a new stake
UserStake memory userStake; userStake.startBlock = block.number.safe32(); userStake.lockedAmount = _amount; userStakes[user].push(userStake); stakeId = userStakes[user].length - 1; _updateVotes(address(0), user, _amount); emit Deposit(user, stakeId, _amount);
UserStake memory userStake; userStake.startBlock = block.number.safe32(); userStake.lockedAmount = _amount; userStakes[user].push(userStake); stakeId = userStakes[user].length - 1; _updateVotes(address(0), user, _amount); emit Deposit(user, stakeId, _amount);
80,368
16
// Mapping of address allowed to hold multiple tokens.
mapping (address => bool) private _whitelistAddress;
mapping (address => bool) private _whitelistAddress;
7,327
18
// Priced in WEI. This is just incase ETH goes TO DAMN HIGH, and we need to lower the mint price
function updateMintPrice(uint256 _newPrice) external onlyOwner() { price = _newPrice; }
function updateMintPrice(uint256 _newPrice) external onlyOwner() { price = _newPrice; }
21,132
24
// Tries to returns the value associated with `key`.O(1).Does not revert if `key` is not in the map. /
function _tryGet(Map storage map, bytes32 key) private view returns (bool, bytes32) { bytes32 value = map._values[key]; if (value == bytes32(0)) { return (_contains(map, key), bytes32(0)); } else { return (true, value); } }
function _tryGet(Map storage map, bytes32 key) private view returns (bool, bytes32) { bytes32 value = map._values[key]; if (value == bytes32(0)) { return (_contains(map, key), bytes32(0)); } else { return (true, value); } }
1,350
25
// internal function _addressToRefund the address being refundedaccessed via public functions emergencyWithdraw and safeWithdrawcalculates refund amount available for an address/
function calcRefund(address _addressToRefund) internal
function calcRefund(address _addressToRefund) internal
31,478
10
// Set the address of the Chainlink price feed for ETH/USD on Sepolia (please verify the correct address)
priceFeed = AggregatorV3Interface(0x649a2C205BE7A3d5e99206CEEFF30c794f0E31EC);
priceFeed = AggregatorV3Interface(0x649a2C205BE7A3d5e99206CEEFF30c794f0E31EC);
31,189
31
// Tokens to 1 eth
uint256 public rate; event WithDraw(address indexed _from, address indexed _to,uint256 _value); event BuyToken(address indexed _from, address indexed _to, uint256 _value);
uint256 public rate; event WithDraw(address indexed _from, address indexed _to,uint256 _value); event BuyToken(address indexed _from, address indexed _to, uint256 _value);
16,684
17
// Transfer tokens from one address to another. Note that while this function emits an Approval event, this is not required as per the specification, and other compliant implementations may not emit the event.from address The address which you want to send tokens fromto address The address which you want to transfer to...
function transferFrom(address from, address to, uint256 value) public returns (bool) { if (from != msg.sender && _allowed[from][msg.sender] != uint256(-1)) _allowed[from][msg.sender] = _allowed[from][msg.sender].sub(value); _transfer(from, to, value); return true; }
function transferFrom(address from, address to, uint256 value) public returns (bool) { if (from != msg.sender && _allowed[from][msg.sender] != uint256(-1)) _allowed[from][msg.sender] = _allowed[from][msg.sender].sub(value); _transfer(from, to, value); return true; }
24,059
39
// Provides EIP-2612 signed approval for this contract to spend user tokens./token Address of ERC-20 token./amount Token amount to grant spending right over./deadline Termination for signed approval in Unix time./v The recovery byte of the signature./r Half of the ECDSA signature pair./s Half of the ECDSA signature pai...
function permitThis( address token, uint256 amount, uint256 deadline, uint8 v, bytes32 r, bytes32 s
function permitThis( address token, uint256 amount, uint256 deadline, uint8 v, bytes32 r, bytes32 s
29,681
7
// Amount of token already released /
function released(address token_) public view virtual returns (uint256) { return unlocks[token_].released; }
function released(address token_) public view virtual returns (uint256) { return unlocks[token_].released; }
32,539
54
// approve CrowdSale to spend 100 000 000 tokens on behalf of moderator
require(tokenContract.transferFrom(moderator,_purchaser,_tokens));
require(tokenContract.transferFrom(moderator,_purchaser,_tokens));
8,446
174
// negative ledger
uint256 negative = insNegative[token];
uint256 negative = insNegative[token];
41,120
104
// 再加些其他的代币todo
function calculate( IERC20 fromToken, IERC20 destToken, uint256 amount, uint256 parts, uint256 flags
function calculate( IERC20 fromToken, IERC20 destToken, uint256 amount, uint256 parts, uint256 flags
87
10
// For each of the LBCRs in Byzantic, if the round has elapsed, users will be curated into layers according to their score
function curateLBCRs() public { for(uint i = 0; i < lbcrs.length; i++) { lbcrs[i].curateIfRoundEnded(); } }
function curateLBCRs() public { for(uint i = 0; i < lbcrs.length; i++) { lbcrs[i].curateIfRoundEnded(); } }
23,362
4
// function _beforeClaim( uint256 _tokenId, address _receiver, uint256 _quantity, address _currency, uint256 _pricePerToken, AllowlistProof calldata _allowlistProof, bytes memory _data
// ) internal virtual override { // uint256 _maxTotalSupply = getErc20Balance(); // require(_quantity <= _maxTotalSupply, "exceeds max total supply."); // }
// ) internal virtual override { // uint256 _maxTotalSupply = getErc20Balance(); // require(_quantity <= _maxTotalSupply, "exceeds max total supply."); // }
26,151