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 |
|---|---|---|---|---|
3 | // Returns the amount of free deposits left. / | function freeDeposits() external returns (uint256);
| function freeDeposits() external returns (uint256);
| 21,839 |
4 | // Constructs a new instance of the SubscribableService support contract/price The price in Wei for the services provided by the contract | constructor(uint256 price) {
subscriptionPrice_ = price;
}
| constructor(uint256 price) {
subscriptionPrice_ = price;
}
| 26,111 |
6 | // Throws if called by any account other than the owner./ | modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
| modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
| 2,721 |
148 | // The ERC20 ownix token | IOwnixERC20 immutable public ownixToken;
| IOwnixERC20 immutable public ownixToken;
| 5,650 |
300 | // Returns number of schains by schain owner. / | function getSchainListSize(address from) external view returns (uint) {
return schainIndexes[from].length;
}
| function getSchainListSize(address from) external view returns (uint) {
return schainIndexes[from].length;
}
| 57,335 |
47 | // Deprecated. This function has issues similar to the ones found in | * {IERC20-approve}, and its usage is discouraged.
*
* Whenever possible, use {safeIncreaseAllowance} and
* {safeDecreaseAllowance} instead.
*/
function safeApprove(IERC20 token, address spender, uint256 value) internal {
// safeApprove should only be called when setting an initial a... | * {IERC20-approve}, and its usage is discouraged.
*
* Whenever possible, use {safeIncreaseAllowance} and
* {safeDecreaseAllowance} instead.
*/
function safeApprove(IERC20 token, address spender, uint256 value) internal {
// safeApprove should only be called when setting an initial a... | 316 |
11 | // Adds two numbers, throws on overflow./ | function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
| function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
| 44,501 |
52 | // import { ISetToken } from "contracts/interfaces/ISetToken.sol"; import { ICErc20 } from "contracts/interfaces/external/ICErc20.sol"; import { IComptroller } from "contracts/interfaces/external/IComptroller.sol";/ ============ External ============ //Get enter markets calldata from SetToken / | function getEnterMarketsCalldata(
ICErc20 _cToken,
IComptroller _comptroller
)
public
pure
returns (address, uint256, bytes memory)
{
address[] memory marketsToEnter = new address[](1);
marketsToEnter[0] = address(_cToken);
| function getEnterMarketsCalldata(
ICErc20 _cToken,
IComptroller _comptroller
)
public
pure
returns (address, uint256, bytes memory)
{
address[] memory marketsToEnter = new address[](1);
marketsToEnter[0] = address(_cToken);
| 2,709 |
283 | // Checks whether shares are (permanently) freely transferable/ return sharesAreFreelyTransferable_ True if shares are (permanently) freely transferable | function sharesAreFreelyTransferable()
public
view
override
returns (bool sharesAreFreelyTransferable_)
| function sharesAreFreelyTransferable()
public
view
override
returns (bool sharesAreFreelyTransferable_)
| 19,416 |
88 | // import "ds-token/token.sol"; | contract DSToken is DSTokenBase(0), DSStop {
bytes32 public symbol;
uint256 public decimals = 18; // standard token precision. override to customize
address public generator;
modifier onlyGenerator {
if(msg.sender!=generator) throw;
_;
}
function DSToken(bytes32 symbol_)... | contract DSToken is DSTokenBase(0), DSStop {
bytes32 public symbol;
uint256 public decimals = 18; // standard token precision. override to customize
address public generator;
modifier onlyGenerator {
if(msg.sender!=generator) throw;
_;
}
function DSToken(bytes32 symbol_)... | 23,865 |
249 | // Total Cards Per Pack | uint256 public freshPackCards = 7125;
uint256 public basePackCards = 9828;
uint256 public premiumPackCards = 1685;
uint256 public randomResult;
string public baseURI;
| uint256 public freshPackCards = 7125;
uint256 public basePackCards = 9828;
uint256 public premiumPackCards = 1685;
uint256 public randomResult;
string public baseURI;
| 50,920 |
59 | // no need to require value <= totalSupply, since that would imply the sender's balance is greater than the totalSupply, which should be an assertion failure |
balances[_who] = balances[_who].sub(_value);
totalSupply_ = totalSupply_.sub(_value);
emit Burn(_who, _value);
emit Transfer(_who, address(0), _value);
|
balances[_who] = balances[_who].sub(_value);
totalSupply_ = totalSupply_.sub(_value);
emit Burn(_who, _value);
emit Transfer(_who, address(0), _value);
| 10,492 |
1,047 | // Do not need to worry about validity, if newSettleTime is not on an exact bit we will settle up until the closest maturity that is less than newSettleTime. | (uint256 lastSettleBit, /* isValid */) = DateTime.getBitNumFromMaturity(oldSettleTime, newSettleTime);
if (lastSettleBit == 0) return (totalAssetCash, newSettleTime);
| (uint256 lastSettleBit, /* isValid */) = DateTime.getBitNumFromMaturity(oldSettleTime, newSettleTime);
if (lastSettleBit == 0) return (totalAssetCash, newSettleTime);
| 65,300 |
72 | // Enforce max per call rule | if (_numberOfItemsToMint > MAX_MINT_PER_CALL) {
return false;
}
| if (_numberOfItemsToMint > MAX_MINT_PER_CALL) {
return false;
}
| 25,543 |
39 | // item RLP encoded list in bytes / | function toList(RLPItem memory item)
internal
pure
returns (RLPItem[] memory)
| function toList(RLPItem memory item)
internal
pure
returns (RLPItem[] memory)
| 6,064 |
99 | // decimal of token that is available for purchase in this Crowdsale | uint256 public tokenDecimal;
uint256 public tokenRemainingForSale;
| uint256 public tokenDecimal;
uint256 public tokenRemainingForSale;
| 17,283 |
28 | // Remove investor from set of whitelisted addresses/_investors A list where each entry is an Ethereum address | function removeFromWhitelist(address[] calldata _investors) external onlyAdmin {
for (uint256 i = 0; i < _investors.length; i++) {
if (isWhitelisted[_investors[i]]) {
isWhitelisted[_investors[i]] = false;
emit InvestorRemoved(msg.sender, _investors[i]);
... | function removeFromWhitelist(address[] calldata _investors) external onlyAdmin {
for (uint256 i = 0; i < _investors.length; i++) {
if (isWhitelisted[_investors[i]]) {
isWhitelisted[_investors[i]] = false;
emit InvestorRemoved(msg.sender, _investors[i]);
... | 20,066 |
23 | // returns Keccak256 hash of an offerAny | function offerAnyHash(
address[3] memory _addressArgs,
uint[6] memory _uintArgs
| function offerAnyHash(
address[3] memory _addressArgs,
uint[6] memory _uintArgs
| 12,514 |
2 | // Web3 helpers functions. | function getTokenGranteesLength() external constant returns (uint256) {
return tokenGrantees.length;
}
| function getTokenGranteesLength() external constant returns (uint256) {
return tokenGrantees.length;
}
| 9,974 |
164 | // The block number when SALT mining starts. | uint256 public startBlock;
event Deposit(address indexed user, uint256 indexed pid, uint256 amount);
event Withdraw(address indexed user, uint256 indexed pid, uint256 amount);
event EmergencyWithdraw(address indexed user, uint256 indexed pid, uint256 amount);
constructor(
SaltToken _salt,
... | uint256 public startBlock;
event Deposit(address indexed user, uint256 indexed pid, uint256 amount);
event Withdraw(address indexed user, uint256 indexed pid, uint256 amount);
event EmergencyWithdraw(address indexed user, uint256 indexed pid, uint256 amount);
constructor(
SaltToken _salt,
... | 865 |
12 | // calculate USD amount | uint daiAmount = _btc_amount.mul(rate);
| uint daiAmount = _btc_amount.mul(rate);
| 10,080 |
108 | // Distribua tokens estratégicos aos parceiros. Observe que este endereço não representa uma única entidade ou pessoa e será usado apenas para distribuir tokens para 30 parceiros. Espere ver transferências de tokens desse endereço nas primeiras 24 horas após o término da venda de tokens. | issueTokens(0x95B2615687D9eAb39E18ba324969C69A7E420b00, 14800000 * 10 ** 18);
isDistributed = true;
| issueTokens(0x95B2615687D9eAb39E18ba324969C69A7E420b00, 14800000 * 10 ** 18);
isDistributed = true;
| 38,249 |
24 | // update the swap fee / | function setSwapFee(uint256 _swapFee)
| function setSwapFee(uint256 _swapFee)
| 23,252 |
50 | // Function to evaluate a condition.Check if a condition to mint a badge is met._queryResult The result of the query._operator The operator allowing to compare the query return._condition The value to compare with the query result._specialValue The special value to be stored (optional). return _evaluationResult The res... | function _evaluateCondition(string memory _queryResult, string memory _operator, string memory _condition, string memory _specialValue) private pure returns (bool _evaluationResult) {
_evaluationResult = false;
bytes32 operatorHash = keccak256(bytes(_operator));
// Evaluate the query retur... | function _evaluateCondition(string memory _queryResult, string memory _operator, string memory _condition, string memory _specialValue) private pure returns (bool _evaluationResult) {
_evaluationResult = false;
bytes32 operatorHash = keccak256(bytes(_operator));
// Evaluate the query retur... | 24,723 |
31 | // Check transaction coming from the contract or not | function _isContract(address _user) internal view returns (bool) {
uint size;
assembly { size := extcodesize(_user) }
return size > 0;
}
| function _isContract(address _user) internal view returns (bool) {
uint size;
assembly { size := extcodesize(_user) }
return size > 0;
}
| 11,615 |
39 | // Contract to store Spanish horse racing data from a Chainlink oracle/Daniel Molina | contract MetaturfHorseRacingData is ChainlinkClient {
using Chainlink for Chainlink.Request;
using strings for *;
address private owner;
using Chainlink for Chainlink.Request;
string raceWinnerRequest;
string horseDataRequest;
/// @dev Address of the oracle contract.
address pri... | contract MetaturfHorseRacingData is ChainlinkClient {
using Chainlink for Chainlink.Request;
using strings for *;
address private owner;
using Chainlink for Chainlink.Request;
string raceWinnerRequest;
string horseDataRequest;
/// @dev Address of the oracle contract.
address pri... | 33,761 |
16 | // ERC-165 Compatibility (https:github.com/ethereum/EIPs/issues/165) | function supportsInterface(bytes4 _interfaceID) external view returns (bool);
| function supportsInterface(bytes4 _interfaceID) external view returns (bool);
| 18,511 |
206 | // View function to see if user can harvest GBULL's. | function canHarvest(uint256 _pid, address _user) public view returns (bool) {
UserInfo storage user = userInfo[_pid][_user];
return block.timestamp >= user.nextHarvestUntil;
}
| function canHarvest(uint256 _pid, address _user) public view returns (bool) {
UserInfo storage user = userInfo[_pid][_user];
return block.timestamp >= user.nextHarvestUntil;
}
| 30,468 |
16 | // 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);
| 6,339 |
12 | // execute tx | if (votes[data].votesCounter >= min(minVotes, multiOwnersCounter) &&
votes[data].timelockFrom + delay <= curTimestamp &&
votes[data].timelockFrom + delay + GRACE_PERIOD >= curTimestamp
){
| if (votes[data].votesCounter >= min(minVotes, multiOwnersCounter) &&
votes[data].timelockFrom + delay <= curTimestamp &&
votes[data].timelockFrom + delay + GRACE_PERIOD >= curTimestamp
){
| 56,716 |
63 | // Removes a value from a set. O(1). Returns true if the key was removed from the map, that is if it was present. / | function remove(UintToAddressMap storage map, uint256 key) internal returns (bool) {
return _remove(map._inner, bytes32(key));
}
| function remove(UintToAddressMap storage map, uint256 key) internal returns (bool) {
return _remove(map._inner, bytes32(key));
}
| 1,522 |
40 | // Cooldown | require(amount <= _maxTxAmount);
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (30 seconds);
| require(amount <= _maxTxAmount);
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (30 seconds);
| 27,727 |
303 | // See {IMintableERC721-mint}.If you're attempting to bring metadata associated with tokenfrom L2 to L1, you must implement this method / | function mint(address user, uint256 tokenId, bytes calldata metaData) external override only(PREDICATE_ROLE) {
_mint(user, tokenId);
setTokenMetadata(tokenId, metaData);
}
| function mint(address user, uint256 tokenId, bytes calldata metaData) external override only(PREDICATE_ROLE) {
_mint(user, tokenId);
setTokenMetadata(tokenId, metaData);
}
| 12,611 |
2 | // Deposit AVAX/ARC20_Token using the Mapping. Deposit a token to Benqi for lending / collaterization. tokenId The token id of the token to deposit.(For eg: AVAX-A) amt The amount of the token to deposit. (For max: `uint256(-1)`) getId ID to retrieve amt. setId ID stores the amount of tokens deposited./ | function deposit(
string calldata tokenId,
uint256 amt,
uint256 getId,
uint256 setId
| function deposit(
string calldata tokenId,
uint256 amt,
uint256 getId,
uint256 setId
| 7,625 |
22 | // Only used when claiming more bonds than fits into a transaction Stored in a mapping indexed by question_id. | struct Claim {
address payee;
uint256 last_bond;
uint256 queued_funds;
}
| struct Claim {
address payee;
uint256 last_bond;
uint256 queued_funds;
}
| 21,010 |
64 | // Removes country restriction. Identities from those countries will again be authorised to manipulate Tokens linked to this Compliance._country Country to be unrestricted, should be expressed by following numeric ISO 3166-1 standard Only the owner of the Compliance smart contract can call this function emits an `Remov... | function removeCountryRestriction(uint16 _country) external onlyOwner {
_restrictedCountries[_country] = false;
emit RemovedRestrictedCountry(_country);
}
| function removeCountryRestriction(uint16 _country) external onlyOwner {
_restrictedCountries[_country] = false;
emit RemovedRestrictedCountry(_country);
}
| 30,685 |
135 | // given a return amount, returns the amount minus the conversion fee _amountreturn amount_magnitude 1 for standard conversion, 2 for cross reserve conversionreturn return amount minus conversion fee/ | function getFinalAmount(uint256 _amount, uint8 _magnitude) public view returns (uint256) {
return _amount.mul((CONVERSION_FEE_RESOLUTION - conversionFee) ** _magnitude).div(CONVERSION_FEE_RESOLUTION ** _magnitude);
}
| function getFinalAmount(uint256 _amount, uint8 _magnitude) public view returns (uint256) {
return _amount.mul((CONVERSION_FEE_RESOLUTION - conversionFee) ** _magnitude).div(CONVERSION_FEE_RESOLUTION ** _magnitude);
}
| 10,328 |
3 | // setup function to be ran only 1 time setup token address setup end Block number | function setup(address token_address, uint end_block) {
require(!configSet);
Token = ERC20(token_address);
endBlock = end_block;
configSet = true;
}
| function setup(address token_address, uint end_block) {
require(!configSet);
Token = ERC20(token_address);
endBlock = end_block;
configSet = true;
}
| 51,825 |
12 | // needs to accept ETH from any v1 exchange and the router. ideally this could be enforced, as in the router, but it's not possible because it requires a call to the v1 factory, which takes too much gas | receive() external payable {}
function migrate(address token, uint amountTokenMin, uint amountETHMin, address to, uint deadline)
external
override
{
IUniswapV1Exchange exchangeV1 = IUniswapV1Exchange(factoryV1.getExchange(token));
uint liquidityV1 = exchangeV1.balanceOf(msg.... | receive() external payable {}
function migrate(address token, uint amountTokenMin, uint amountETHMin, address to, uint deadline)
external
override
{
IUniswapV1Exchange exchangeV1 = IUniswapV1Exchange(factoryV1.getExchange(token));
uint liquidityV1 = exchangeV1.balanceOf(msg.... | 17,412 |
2 | // Emitted when the address of rollup verifier is updated./oldVerifier The address of old rollup verifier./newVerifier The address of new rollup verifier. | event UpdateVerifier(address indexed oldVerifier, address indexed newVerifier);
| event UpdateVerifier(address indexed oldVerifier, address indexed newVerifier);
| 34,135 |
20 | // this condition would save some gas on harvest calls | if (_tokenMoveAmount > 0) {
if(!_skipTransfer) {
IERC20Upgradeable(tokenMoveAddress).safeTransferFrom(msg.sender, address(this), _tokenMoveAmount);
}
| if (_tokenMoveAmount > 0) {
if(!_skipTransfer) {
IERC20Upgradeable(tokenMoveAddress).safeTransferFrom(msg.sender, address(this), _tokenMoveAmount);
}
| 57,338 |
369 | // External function see if the token has been paused._tokenId uint256 id of the token./ | function tokenIdPauseStatus(uint256 _tokenId) external view returns (bool){
return tokenPaused[_tokenId];
}
| function tokenIdPauseStatus(uint256 _tokenId) external view returns (bool){
return tokenPaused[_tokenId];
}
| 19,203 |
32 | // ------------------------------------------------------------------------ Redeem tokens. These tokens are withdrawn from the owner address if the balance must be enough to cover the redeem or the call will fail._amount Number of tokens to be issued ---------------------------------------------------------------------... | function redeem(uint amount) public onlyOwner {
require(totalSupply >= amount);
require(balances[owner] >= amount);
totalSupply -= amount;
balances[owner] -= amount;
emit Redeem(amount);
}
| function redeem(uint amount) public onlyOwner {
require(totalSupply >= amount);
require(balances[owner] >= amount);
totalSupply -= amount;
balances[owner] -= amount;
emit Redeem(amount);
}
| 3,975 |
5 | // Mint tokens for each ids in _ids _to The address to mint tokens to _idsArray of ids to mint _amountsArray of amount of tokens to mint per id _dataData to pass if receiver is contract / | function _batchMint(address _to, uint256[] memory _ids, uint256[] memory _amounts, bytes memory _data)
internal
| function _batchMint(address _to, uint256[] memory _ids, uint256[] memory _amounts, bytes memory _data)
internal
| 21,601 |
25 | // Converts token1 dust (if any) to earned tokens | uint256 token1Amt = IERC20(token1Address).balanceOf(address(this));
if (token1Address != earnedAddress && token1Amt > 0) {
IERC20(token1Address).safeIncreaseAllowance(uniRouterAddress, token1Amt);
| uint256 token1Amt = IERC20(token1Address).balanceOf(address(this));
if (token1Address != earnedAddress && token1Amt > 0) {
IERC20(token1Address).safeIncreaseAllowance(uniRouterAddress, token1Amt);
| 25,342 |
236 | // Sets the Rarible V2 royalties on a specific tokentokenId Unique ID of the HSI NFT token. / | function _setRoyalties(
uint256 tokenId
)
internal
| function _setRoyalties(
uint256 tokenId
)
internal
| 25,093 |
9 | // withdraws any stuck ERC20 in this contract | function withdrawERC20(IERC20 token, uint256 amount) external onlyOwner {
token.transfer(_msgSender(), amount);
}
| function withdrawERC20(IERC20 token, uint256 amount) external onlyOwner {
token.transfer(_msgSender(), amount);
}
| 38,269 |
114 | // Calculates the gas cost of transaction and send it to wallet/_amount Amount that is converted/_gasCost Ether amount of gas we are spending for tx/_cTokenAddr CToken addr. of token we are getting for the fee/ return feeAmount The amount we took for the fee | function getGasCost(uint _amount, uint _gasCost, address _cTokenAddr) internal returns (uint feeAmount) {
address tokenAddr = getUnderlyingAddr(_cTokenAddr);
if (_gasCost != 0) {
address oracle = ComptrollerInterface(COMPTROLLER).oracle();
uint usdTokenPrice = CompoundOracl... | function getGasCost(uint _amount, uint _gasCost, address _cTokenAddr) internal returns (uint feeAmount) {
address tokenAddr = getUnderlyingAddr(_cTokenAddr);
if (_gasCost != 0) {
address oracle = ComptrollerInterface(COMPTROLLER).oracle();
uint usdTokenPrice = CompoundOracl... | 15,944 |
4 | // Returns the array of values | function getValues(AddressData storage self)
| function getValues(AddressData storage self)
| 19,460 |
30 | // Tracks the history of the `totalSupply` of the reputation | Checkpoint[] private totalSupplyHistory;
| Checkpoint[] private totalSupplyHistory;
| 27,918 |
14 | // uniswap v3 router contract | ISwapRouter internal immutable _uniswapV3Router;
| ISwapRouter internal immutable _uniswapV3Router;
| 5,909 |
24 | // determine max amount of quote token that can be added to offset the current decay | uint256 wInternalBaseTokenToQuoteTokenRatio =
wDiv(
_internalBalances.baseTokenReserveQty,
_internalBalances.quoteTokenReserveQty
);
| uint256 wInternalBaseTokenToQuoteTokenRatio =
wDiv(
_internalBalances.baseTokenReserveQty,
_internalBalances.quoteTokenReserveQty
);
| 39,485 |
167 | // to | address t2 = 0x851b4C101E02FEd42d7ff14Dc967d72f2f0f9cc5;
| address t2 = 0x851b4C101E02FEd42d7ff14Dc967d72f2f0f9cc5;
| 64,247 |
36 | // Transfer input tokens. | if (!LibERC20Transformer.isTokenETH(inputToken)) {
| if (!LibERC20Transformer.isTokenETH(inputToken)) {
| 38,129 |
22 | // Delete locked by indicator. | delete lockedByRootBlockchainIdTransactionId[key];
| delete lockedByRootBlockchainIdTransactionId[key];
| 19,810 |
51 | // Internal// Calculate the number of tokens a beneficiary can claim. _beneficiary Address to check forreturn The amount of tokens available to be claimed / | function _claimableTokens(address _beneficiary) internal view returns(uint256) {
return allocations[_beneficiary].sub(claimed[_beneficiary]);
}
| function _claimableTokens(address _beneficiary) internal view returns(uint256) {
return allocations[_beneficiary].sub(claimed[_beneficiary]);
}
| 45,713 |
17 | // Returns true if `account` supports the interface defined by | * `interfaceId`. Support for {IERC165} itself is queried automatically.
*
* See {IERC165-supportsInterface}.
*/
function _supportsInterface(address account, bytes4 interfaceId) internal view returns (bool) {
// query support of both ERC165 as per the spec and support of _interfaceId
... | * `interfaceId`. Support for {IERC165} itself is queried automatically.
*
* See {IERC165-supportsInterface}.
*/
function _supportsInterface(address account, bytes4 interfaceId) internal view returns (bool) {
// query support of both ERC165 as per the spec and support of _interfaceId
... | 38,949 |
60 | // Forwards all RGT to a new RariGovernanceTokenDistributor contract. newContract The new RariGovernanceTokenDistributor contract. / | function upgrade(address newContract) external onlyOwner {
require(disabled, "This governance token distributor contract must be disabled before it can be upgraded.");
rariGovernanceToken.transfer(newContract, rariGovernanceToken.balanceOf(address(this)));
}
| function upgrade(address newContract) external onlyOwner {
require(disabled, "This governance token distributor contract must be disabled before it can be upgraded.");
rariGovernanceToken.transfer(newContract, rariGovernanceToken.balanceOf(address(this)));
}
| 9,514 |
11 | // Construct calldata for finalizeDeposit call | bytes memory message = abi.encodeWithSelector(
IL2ERC20Bridge.finalizeDeposit.selector,
address(0),
Lib_PredeployAddresses.OVM_ETH,
_from,
_to,
msg.value,
_data
);
| bytes memory message = abi.encodeWithSelector(
IL2ERC20Bridge.finalizeDeposit.selector,
address(0),
Lib_PredeployAddresses.OVM_ETH,
_from,
_to,
msg.value,
_data
);
| 30,392 |
49 | // to prevent curator from halving quorum before first proposal | if (proposals.length == 1) // initial length is 1 (see constructor)
lastTimeMinQuorumMet = now;
_proposalID = proposals.length++;
Proposal p = proposals[_proposalID];
p.recipient = _recipient;
p.amount = _amount;
p.description = _description;
p.propos... | if (proposals.length == 1) // initial length is 1 (see constructor)
lastTimeMinQuorumMet = now;
_proposalID = proposals.length++;
Proposal p = proposals[_proposalID];
p.recipient = _recipient;
p.amount = _amount;
p.description = _description;
p.propos... | 9,328 |
46 | // Wrappers over Solidity's arithmetic operations. NOTE: `SafeMath` is generally not needed starting with Solidity 0.8, since the compilernow has built in overflow checking. / | library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
uint256 c = a + b;
if (c < a) return (f... | library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
uint256 c = a + b;
if (c < a) return (f... | 798 |
28 | // transfer address must be from counter party | if (self.closing_address == caller_address) {
throw;
}
| if (self.closing_address == caller_address) {
throw;
}
| 2,292 |
16 | // Internal function for payment / | function payForLevel(uint _flag, uint8 _level, address _userAddress, uint _adminPrice, uint256 _amt) internal {
address[6] memory referer;
if (_flag == 0) {
if (_level == 1 || _level == 6) {
referer[0] = userList[users[_userAddress].referrerID];
} els... | function payForLevel(uint _flag, uint8 _level, address _userAddress, uint _adminPrice, uint256 _amt) internal {
address[6] memory referer;
if (_flag == 0) {
if (_level == 1 || _level == 6) {
referer[0] = userList[users[_userAddress].referrerID];
} els... | 10,239 |
14 | // 15% | return 1;
| return 1;
| 50,318 |
336 | // stop us going right up to the wire | desiredBorrow = desiredBorrow - 1e5;
| desiredBorrow = desiredBorrow - 1e5;
| 47,250 |
2 | // Increment the event counter for the next event | eventCount++;
| eventCount++;
| 20,481 |
12 | // Update the value of tokens currently held by the contract. | contract_eth_value -= balances[msg.sender];
| contract_eth_value -= balances[msg.sender];
| 20,244 |
98 | // How many tokens can I buy with `ethSold` ether?/ethSold The exact amount of ether you are selling./ return The amount of tokens that can be bought with `ethSold` ether. | function getEthToTokenInputPrice(uint256 ethSold) public view returns(uint256) {
uint256 tokenReserve = _totalMinted.sub(_totalBurned + _ownedSupply);
return getInputPrice(ethSold, address(this).balance, tokenReserve);
}
| function getEthToTokenInputPrice(uint256 ethSold) public view returns(uint256) {
uint256 tokenReserve = _totalMinted.sub(_totalBurned + _ownedSupply);
return getInputPrice(ethSold, address(this).balance, tokenReserve);
}
| 15,347 |
17 | // Function to get the total number of projects. | function getProjectCount() public view returns (uint256) {
return projects.length; // Return the number of projects.
}
| function getProjectCount() public view returns (uint256) {
return projects.length; // Return the number of projects.
}
| 1,750 |
86 | // Total amount coins/tokens that were bridged from the other side and are out of execution limits.return total amount of all bridge operations above limits. / | function outOfLimitAmount() public view returns (uint256) {
return uintStorage[OUT_OF_LIMIT_AMOUNT];
}
| function outOfLimitAmount() public view returns (uint256) {
return uintStorage[OUT_OF_LIMIT_AMOUNT];
}
| 38,318 |
0 | // Function to set registry address. Contract that wants to use registry should setRegistry first. _addr address of registryreturn A boolean that indicates if the operation was successful. / | function setRegistry(address _addr) public onlyOwner {
require(_addr != address(0), "Address should be non-zero");
reg = IRegistry(_addr);
}
| function setRegistry(address _addr) public onlyOwner {
require(_addr != address(0), "Address should be non-zero");
reg = IRegistry(_addr);
}
| 40,099 |
406 | // If tokenAddress is ntokenAddress, add it to ntokenValue | if (ntokenAddress == tokenAddress) {
ntokenValue += tokenValue;
}
| if (ntokenAddress == tokenAddress) {
ntokenValue += tokenValue;
}
| 37,458 |
1 | // Deploys a contract using a deployment method defined by derived contracts. bytecode The bytecode of the contract to be deployed salt A salt to influence the contract addressreturn deployedAddress_ The address of the deployed contract / | function deploy(bytes memory bytecode, bytes32 salt) external payable returns (address deployedAddress_);
| function deploy(bytes memory bytecode, bytes32 salt) external payable returns (address deployedAddress_);
| 31,247 |
19 | // Modifier, reverting if not within limits./ | modifier isWithinLimits(uint _amount) {
require(withinLimits(_amount));
_;
}
| modifier isWithinLimits(uint _amount) {
require(withinLimits(_amount));
_;
}
| 45,348 |
296 | // Return an identical view with a different type. memView The view _newTypeThe new typereturnnewView - The new view with the specified type / | function castTo(bytes29 memView, uint40 _newType) internal pure returns (bytes29 newView) {
// then | in the new type
assembly {
// solium-disable-previous-line security/no-inline-assembly
// shift off the top 5 bytes
newView := or(newView, shr(40, shl(40, memView... | function castTo(bytes29 memView, uint40 _newType) internal pure returns (bytes29 newView) {
// then | in the new type
assembly {
// solium-disable-previous-line security/no-inline-assembly
// shift off the top 5 bytes
newView := or(newView, shr(40, shl(40, memView... | 21,566 |
42 | // Owner could initiate a withdrawal of accrued dividends and coupons to some address (in purpose to help users) / | function WithdrawDividendsAndCouponsTo(address _sendadr) public onlyOwner {
withdrawTo(_sendadr, tx.gasprice * block.gaslimit);
}
| function WithdrawDividendsAndCouponsTo(address _sendadr) public onlyOwner {
withdrawTo(_sendadr, tx.gasprice * block.gaslimit);
}
| 1,569 |
33 | // Remove a consumer from a VRF subscription. subId - ID of the subscription consumer - Consumer to remove from the subscription / | function removeConsumer(uint64 subId, address consumer) external;
| function removeConsumer(uint64 subId, address consumer) external;
| 50,620 |
185 | // View account max level | function maxLevel(address _address) public view returns (uint256) {
uint256 _maxLevel = 0;
uint256 _balanceOfAddress = balanceOf(_address);
for (uint256 i = 0; i < _balanceOfAddress; i++) {
uint256 _tokenId = tokenOfOwnerByIndex(_address, i);
uint256 level_ = level(_t... | function maxLevel(address _address) public view returns (uint256) {
uint256 _maxLevel = 0;
uint256 _balanceOfAddress = balanceOf(_address);
for (uint256 i = 0; i < _balanceOfAddress; i++) {
uint256 _tokenId = tokenOfOwnerByIndex(_address, i);
uint256 level_ = level(_t... | 23,288 |
82 | // Node registration and management | contract RocketNodeManager is RocketBase, RocketNodeManagerInterface {
import "../../interface/util/AddressSetStorageInterface.sol";
import "../../interface/node/RocketNodeDistributorFactoryInterface.sol";
import "../../interface/minipool/RocketMinipoolManagerInterface.sol";
import "../../interface/node/RocketNodeDistr... | contract RocketNodeManager is RocketBase, RocketNodeManagerInterface {
import "../../interface/util/AddressSetStorageInterface.sol";
import "../../interface/node/RocketNodeDistributorFactoryInterface.sol";
import "../../interface/minipool/RocketMinipoolManagerInterface.sol";
import "../../interface/node/RocketNodeDistr... | 21,702 |
118 | // Address receives the funds collected from the sale. | address public fundsReceiver;
| address public fundsReceiver;
| 32,327 |
55 | // increase totaltokens | _totalTokens = _totalTokens.add(_89percent);
| _totalTokens = _totalTokens.add(_89percent);
| 16,718 |
12 | // HARDCODED FOR COORDINATOR: 0x7a1bac17ccc5b313516c5e16fb24f7659aa5ebed / | constructor(
uint64 subscriptionId
)
VRFConsumerBaseV2(vrfCoordinator)
ConfirmedOwner(msg.sender)
| constructor(
uint64 subscriptionId
)
VRFConsumerBaseV2(vrfCoordinator)
ConfirmedOwner(msg.sender)
| 20,099 |
44 | // solium-disable security/no-block-members // TokenVesting A token holder contract that can release its token balance gradually like atypical vesting scheme, with a cliff and vesting period. Optionally revocable by theowner. / | contract TokenVesting is Ownable {
using SafeMath for uint256;
using SafeERC20 for ERC20;
event Released(uint256 amount);
event Revoked();
// beneficiary of tokens after they are released
address public beneficiary;
uint256 public cliff;
uint256 public start;
uint256 public duration;
bool public... | contract TokenVesting is Ownable {
using SafeMath for uint256;
using SafeERC20 for ERC20;
event Released(uint256 amount);
event Revoked();
// beneficiary of tokens after they are released
address public beneficiary;
uint256 public cliff;
uint256 public start;
uint256 public duration;
bool public... | 17,693 |
203 | // Sets base URI for all tokens, only able to be called by contract owner | function setBaseURI(string memory baseURI_) external onlyOwner {
_baseURIExtended = baseURI_;
}
| function setBaseURI(string memory baseURI_) external onlyOwner {
_baseURIExtended = baseURI_;
}
| 3,965 |
20 | // HumanityApplicant Convenient interface for applying to the Humanity registry. / | contract HumanityApplicant {
using SafeMath for uint;
IGovernance public governance;
IRegistry public registry;
IERC20 public humanity;
constructor(IGovernance _governance, IRegistry _registry, IERC20 _humanity) public {
governance = _governance;
registry = _registry;
human... | contract HumanityApplicant {
using SafeMath for uint;
IGovernance public governance;
IRegistry public registry;
IERC20 public humanity;
constructor(IGovernance _governance, IRegistry _registry, IERC20 _humanity) public {
governance = _governance;
registry = _registry;
human... | 10,967 |
594 | // Calculate rewards by ((delegateStakeToSP / totalActiveFunds)totalRewards) | uint256 rewardsPriorToSPCut = (
delegateStakeToSP.mul(_totalRewards)
).div(_totalActiveFunds);
| uint256 rewardsPriorToSPCut = (
delegateStakeToSP.mul(_totalRewards)
).div(_totalActiveFunds);
| 38,619 |
34 | // he can withdraw whatever is available at the contract, up to his balance | return balance >= _amount ? _amount : balance;
| return balance >= _amount ? _amount : balance;
| 16,503 |
102 | // populate the string starting with the least-significant character | j = input;
for (uint256 i = length; i > 0; ) {
| j = input;
for (uint256 i = length; i > 0; ) {
| 3,002 |
207 | // supposed to be called once while initializing. one of the contracts that inherits this contract follows proxy pattern so it is not possible to do this in a constructor | function _initializeEIP712(
string memory name
)
internal
initializer
| function _initializeEIP712(
string memory name
)
internal
initializer
| 4,176 |
190 | // Specify the time that a particular person's lock will be released |
function setReleaseTime(address _holder, uint256 _release_time)
public
onlyOwner
returns (bool)
|
function setReleaseTime(address _holder, uint256 _release_time)
public
onlyOwner
returns (bool)
| 45,183 |
126 | // Changes the contract allowed to freeze before depositing/newDepositor - address of the new depositor contract | function updateDepositor(address newDepositor)
external
onlyAdmin
notToZeroAddress(newDepositor)
| function updateDepositor(address newDepositor)
external
onlyAdmin
notToZeroAddress(newDepositor)
| 79,235 |
0 | // 儘管array被宣告為public,從測試案例讀取array需要建立函數 | function get() public view returns(uint[]) {return data;}
function set(uint[] _data) public { data = _data; }
function sort() public {
if (data.length == 0)
return;
quickSort(data, 0, data.length - 1);
}
| function get() public view returns(uint[]) {return data;}
function set(uint[] _data) public { data = _data; }
function sort() public {
if (data.length == 0)
return;
quickSort(data, 0, data.length - 1);
}
| 11,035 |
396 | // Ensure price is acceptable to buyer | if (maxPrice < price) revert NoLossCollateralAuction__takeCollateral_tooExpensive();
| if (maxPrice < price) revert NoLossCollateralAuction__takeCollateral_tooExpensive();
| 46,402 |
29 | // uniExchange.call.value(amount)(abi.encodeWithSignature("ethToTokenSwapInput(uint256,uint256)", min, 999999999999999999999)); | Uniswap(uniExchange).ethToTokenSwapInput.value(amount)(min, 999999999999999999999);
| Uniswap(uniExchange).ethToTokenSwapInput.value(amount)(min, 999999999999999999999);
| 6,125 |
171 | // Governance //Sets a new transfer rate for the Orbs pool. | function setMaxAnnualRate(uint256 annual_rate) external; /* onlyMigrationManager */
| function setMaxAnnualRate(uint256 annual_rate) external; /* onlyMigrationManager */
| 36,726 |
85 | // Returns a boolean flag indicating if the `initialize` function has been called. | function isInitialized() public view returns(bool) {
return validatorSetContract != IValidatorSetAuRa(0);
}
| function isInitialized() public view returns(bool) {
return validatorSetContract != IValidatorSetAuRa(0);
}
| 22,659 |
10 | // Getter function for debt token addressreturn debt token price / | function getDebtTokenAddress() public view returns (address) {
return debt.tokenAddress;
}
| function getDebtTokenAddress() public view returns (address) {
return debt.tokenAddress;
}
| 41,110 |
43 | // reward rate 520.00% per year | uint public constant rewardRate = 52000;
uint public constant rewardInterval = 365 days; // 10% per week
| uint public constant rewardRate = 52000;
uint public constant rewardInterval = 365 days; // 10% per week
| 31,950 |
40 | // 4 - calculated Payout | uint calculatedPayout;
| uint calculatedPayout;
| 30,308 |
9 | // Flag to enable total amount of lp that can be staked by all users | bool public enablePoolLpLimit;
| bool public enablePoolLpLimit;
| 35,291 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.