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 |
|---|---|---|---|---|
0 | // Forging Events | event Minted(
address indexed minter,
address recipient,
uint256 mAssetQuantity,
address input,
uint256 inputQuantity
);
event MintedMulti(
address indexed minter,
address recipient,
| event Minted(
address indexed minter,
address recipient,
uint256 mAssetQuantity,
address input,
uint256 inputQuantity
);
event MintedMulti(
address indexed minter,
address recipient,
| 32,066 |
29 | // retrieves address of contract that is allowed to burn | function getBurnContract() public view returns (address) {
return _burnContract;
}
| function getBurnContract() public view returns (address) {
return _burnContract;
}
| 32,490 |
97 | // Before 0.5, solidity has a mismatch between `address.transfer()` and `token.transfer()`: https:github.com/ethereum/solidity/issues/3544 | bytes4 private constant TRANSFER_SELECTOR = 0xa9059cbb;
string private constant ERROR_TOKEN_BALANCE_REVERTED = "SAFE_ERC_20_BALANCE_REVERTED";
string private constant ERROR_TOKEN_ALLOWANCE_REVERTED = "SAFE_ERC_20_ALLOWANCE_REVERTED";
function invokeAndCheckSuccess(address _addr, bytes memory _calldata... | bytes4 private constant TRANSFER_SELECTOR = 0xa9059cbb;
string private constant ERROR_TOKEN_BALANCE_REVERTED = "SAFE_ERC_20_BALANCE_REVERTED";
string private constant ERROR_TOKEN_ALLOWANCE_REVERTED = "SAFE_ERC_20_ALLOWANCE_REVERTED";
function invokeAndCheckSuccess(address _addr, bytes memory _calldata... | 9,790 |
35 | // sale params | bool public started;
uint256 public price;
uint256 public cap;
uint256 public ends;
uint256 public maxEnds;
bool public paused;
uint256 public minimum;
uint256 public maximum;
| bool public started;
uint256 public price;
uint256 public cap;
uint256 public ends;
uint256 public maxEnds;
bool public paused;
uint256 public minimum;
uint256 public maximum;
| 16,136 |
39 | // update Jade via purchase | function updatePlayersCoinByPurchase(address player, uint256 purchaseCost) external onlyAccess {
uint256 unclaimedJade = balanceOfUnclaimed(player);
if (purchaseCost > unclaimedJade) {
uint256 jadeDecrease = SafeMath.sub(purchaseCost, unclaimedJade);
require(jadeBalance[player] >= jadeDec... | function updatePlayersCoinByPurchase(address player, uint256 purchaseCost) external onlyAccess {
uint256 unclaimedJade = balanceOfUnclaimed(player);
if (purchaseCost > unclaimedJade) {
uint256 jadeDecrease = SafeMath.sub(purchaseCost, unclaimedJade);
require(jadeBalance[player] >= jadeDec... | 14,251 |
0 | // Platform interface to integrate with lending platform like Compound, AAVE etc. / | interface IPlatformIntegration {
/**
* @dev Deposit the given bAsset to Lending platform
* @param _bAsset bAsset address
* @param _amount Amount to deposit
*/
function deposit(
address _bAsset,
uint256 _amount,
bool isTokenFeeCharged
) external returns (uint256 qu... | interface IPlatformIntegration {
/**
* @dev Deposit the given bAsset to Lending platform
* @param _bAsset bAsset address
* @param _amount Amount to deposit
*/
function deposit(
address _bAsset,
uint256 _amount,
bool isTokenFeeCharged
) external returns (uint256 qu... | 31,840 |
158 | // View function to see pending LAMBO on frontend. | function pendingLAMBO(uint256 _pid, address _user) external view returns (uint256) {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][_user];
uint256 accLAMBOPerShare = pool.accLAMBOPerShare;
uint256 lpSupply = pool.lpToken.balanceOf(address(this));
... | function pendingLAMBO(uint256 _pid, address _user) external view returns (uint256) {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][_user];
uint256 accLAMBOPerShare = pool.accLAMBOPerShare;
uint256 lpSupply = pool.lpToken.balanceOf(address(this));
... | 35,951 |
3 | // Mock withdraw function. Transfer LP Token to msg.sender.Send pending CAKE if any. / | function withdraw(uint256 _pid, uint256 _amount) public {
require(_pid != 0, "!pid");
require(amount >= _amount, "!amount");
uint256 pending = (block.number - lastBlock) * cakePerBlock;
lastBlock = block.number;
if (pending > 0) {
safeCakeTransfer(msg.sender, pen... | function withdraw(uint256 _pid, uint256 _amount) public {
require(_pid != 0, "!pid");
require(amount >= _amount, "!amount");
uint256 pending = (block.number - lastBlock) * cakePerBlock;
lastBlock = block.number;
if (pending > 0) {
safeCakeTransfer(msg.sender, pen... | 41,522 |
71 | // flip breaker to enable liquidations | DssExecLib.setValue(MCD_CLIP_USDT_A, "stopped", 0);
| DssExecLib.setValue(MCD_CLIP_USDT_A, "stopped", 0);
| 51,427 |
123 | // Event emitted when interestRateModel is changed / | event NewMarketInterestRateModel(InterestRateModel oldInterestRateModel, InterestRateModel newInterestRateModel);
| event NewMarketInterestRateModel(InterestRateModel oldInterestRateModel, InterestRateModel newInterestRateModel);
| 12,728 |
1 | // Value used for the L2 sender storage slot in both the OptimismPortal and the/ CrossDomainMessenger contracts before an actual sender is set. This value is/ non-zero to reduce the gas cost of message passing transactions. | address internal constant DEFAULT_L2_SENDER = 0x000000000000000000000000000000000000dEaD;
| address internal constant DEFAULT_L2_SENDER = 0x000000000000000000000000000000000000dEaD;
| 10,976 |
278 | // so we know what index to start generating random numbers from | randOffset = totalSupply();
| randOffset = totalSupply();
| 23,564 |
101 | // unstake LP token_index the index of stakes array | function unstake(uint256 _index, uint256 _amount) public whenNotPaused{
require(stakes[msg.sender][_index].exists == true, "stake index doesn't exist");
require(stakes[msg.sender][_index].amount == _amount, "stake amount doesn't match");
withdrawStake(msg.sender, _index);
}
| function unstake(uint256 _index, uint256 _amount) public whenNotPaused{
require(stakes[msg.sender][_index].exists == true, "stake index doesn't exist");
require(stakes[msg.sender][_index].amount == _amount, "stake amount doesn't match");
withdrawStake(msg.sender, _index);
}
| 51,938 |
169 | // administrator can whitelist an administrator | function setAdministrator(address _user) public {
require(administrators[msg.sender] == true);
administrators[_user] = true;
}
| function setAdministrator(address _user) public {
require(administrators[msg.sender] == true);
administrators[_user] = true;
}
| 47,781 |
10 | // Transfer Event: Emitted every time a card is transfered to a new address | event Transfer(address from, address to, uint256 tokenID);
| event Transfer(address from, address to, uint256 tokenID);
| 11,607 |
9 | // Internal function to set the sources for each asset assets The addresses of the assets sources The address of the source of each asset / | function _setAssetsSources(address[] memory assets, address[] memory sources) internal {
require(assets.length == sources.length, Errors.INCONSISTENT_PARAMS_LENGTH);
for (uint256 i = 0; i < assets.length; i++) {
assetsSources[assets[i]] = AggregatorInterface(sources[i]);
emit AssetSourceUpdated(as... | function _setAssetsSources(address[] memory assets, address[] memory sources) internal {
require(assets.length == sources.length, Errors.INCONSISTENT_PARAMS_LENGTH);
for (uint256 i = 0; i < assets.length; i++) {
assetsSources[assets[i]] = AggregatorInterface(sources[i]);
emit AssetSourceUpdated(as... | 15,089 |
127 | // Safe FOBO transfer function, just in case if rounding error causes pool to not have enough FOBOs. | function safeFoboTransfer(address _to, uint256 _amount) internal {
uint256 foboBal = fobo.balanceOf(address(this));
if (_amount > foboBal) {
fobo.transfer(_to, foboBal);
} else {
fobo.transfer(_to, _amount);
}
}
| function safeFoboTransfer(address _to, uint256 _amount) internal {
uint256 foboBal = fobo.balanceOf(address(this));
if (_amount > foboBal) {
fobo.transfer(_to, foboBal);
} else {
fobo.transfer(_to, _amount);
}
}
| 23,272 |
552 | // address for that NFT (if any) is reset to none. |
event Approval(
address indexed owner,
address indexed approved,
uint256 indexed tokenId
);
|
event Approval(
address indexed owner,
address indexed approved,
uint256 indexed tokenId
);
| 3,112 |
110 | // baseCpi_ update base cpi value. / | function setBaseCpi(uint256 baseCpi_) external onlyOwner {
baseCpi = baseCpi_;
}
| function setBaseCpi(uint256 baseCpi_) external onlyOwner {
baseCpi = baseCpi_;
}
| 40,721 |
93 | // Emitted when new burn bounds were set newMin new minimum burn amount newMax new maximum burn amount `newMin` should never be greater than `newMax` / | event SetBurnBounds(uint256 newMin, uint256 newMax);
| event SetBurnBounds(uint256 newMin, uint256 newMax);
| 46,200 |
259 | // Convert bytes32 to string. _x - to be converted to string.return string / | function bytes32ToString(bytes32 _x) internal pure returns (string memory) {
bytes memory bytesString = new bytes(32);
uint charCount = 0;
for (uint j = 0; j < 32; j++) {
byte char = byte(bytes32(uint(_x) * 2 ** (8 * j)));
if (char != 0) {
bytesString[... | function bytes32ToString(bytes32 _x) internal pure returns (string memory) {
bytes memory bytesString = new bytes(32);
uint charCount = 0;
for (uint j = 0; j < 32; j++) {
byte char = byte(bytes32(uint(_x) * 2 ** (8 * j)));
if (char != 0) {
bytesString[... | 27,006 |
1 | // Emitted when you supply too low of a fee. | error InsufficientFunds(uint256 _amount);
| error InsufficientFunds(uint256 _amount);
| 23,002 |
3 | // IERC20 token; | uint256 remainingMarginAmount;
uint256 marginAmount;
uint256 marginTotal;
address owner;
bytes32 salt;
| uint256 remainingMarginAmount;
uint256 marginAmount;
uint256 marginTotal;
address owner;
bytes32 salt;
| 31,800 |
27 | // reflect fee can never go below zero because rTxFee percentage of _rTotalSupply | _rTotalSupply = _rTotalSupply - rTxFee;
accumulatedFees += tTxFee;
| _rTotalSupply = _rTotalSupply - rTxFee;
accumulatedFees += tTxFee;
| 27,404 |
13 | // Reinvest rewards from staking contract to deposit tokens This internal function does not require mininmum tokens to be met / | function _reinvest(uint amount) internal {
stakingContract.deposit(PID, 0);
uint adminFee = amount.mul(ADMIN_FEE_BIPS).div(BIPS_DIVISOR);
if (adminFee > 0) {
require(rewardToken.transfer(owner(), adminFee), "admin fee transfer failed");
}
uint reinvestFee = amount.mul(REINVEST_REWARD_BIPS)... | function _reinvest(uint amount) internal {
stakingContract.deposit(PID, 0);
uint adminFee = amount.mul(ADMIN_FEE_BIPS).div(BIPS_DIVISOR);
if (adminFee > 0) {
require(rewardToken.transfer(owner(), adminFee), "admin fee transfer failed");
}
uint reinvestFee = amount.mul(REINVEST_REWARD_BIPS)... | 5,490 |
94 | // Set the stale period on the updated rate variables _time The new rateStalePeriod / | function setRateStalePeriod(uint _time)
external
onlyOwner
| function setRateStalePeriod(uint _time)
external
onlyOwner
| 52,506 |
2 | // The decimals of the erc20 token, should default to 18 for new tokens | uint8 public override decimals;
| uint8 public override decimals;
| 16,162 |
15 | // Performs a Uniswap v3 exact output swap/recipient The recipient of the output tokens/amountOut The amount of output tokens to receive for the trade/amountInMaximum The maximum desired amount of input tokens/path The path of the trade as a bytes string/payer The address that will be paying the input | function v3SwapExactOutput(
address recipient,
uint256 amountOut,
uint256 amountInMaximum,
bytes memory path,
address payer
| function v3SwapExactOutput(
address recipient,
uint256 amountOut,
uint256 amountInMaximum,
bytes memory path,
address payer
| 20,246 |
217 | // Admin functions | function setPoolsNewController(address _newController) external returns(bool);
function withdrawFromPool(address _pool, uint _amount, address _recipient) external returns(bool);
| function setPoolsNewController(address _newController) external returns(bool);
function withdrawFromPool(address _pool, uint _amount, address _recipient) external returns(bool);
| 38,704 |
14 | // When somebody tries to buy tokens for X wei, calculate how many weis they are allowed to use. _value - What is the value of the transaction sent in as wei. _weiRaised - How much money has been raised so far. _weiInvestedBySender - the investment made by the address that is sending the transaction. _weiFundingCap - t... | function weiAllowedToReceive(uint _value, uint _weiRaised, uint _weiInvestedBySender, uint _weiFundingCap) public constant returns (uint amount);
function isCrowdsaleFull(uint _weiRaised, uint _weiFundingCap) public constant returns (bool);
| function weiAllowedToReceive(uint _value, uint _weiRaised, uint _weiInvestedBySender, uint _weiFundingCap) public constant returns (uint amount);
function isCrowdsaleFull(uint _weiRaised, uint _weiFundingCap) public constant returns (bool);
| 37,288 |
52 | // getExpiration utility function to find out exact expiration time of a particular Deed for simple status check use `this.getDeedStatus(did)` if `status == 4` then Deed has expired _did Deed ID to be checkedreturn unix time stamp in seconds / | function getExpiration(uint256 _did) public view returns (uint40) {
return deeds[_did].expiration;
}
| function getExpiration(uint256 _did) public view returns (uint40) {
return deeds[_did].expiration;
}
| 41,627 |
106 | // Stop trasfer fee payment for tokens. return true if the operation was successful./ | function finishTransferFeePayment() public onlyOwner returns(bool finished) {
require(!transferFeePaymentFinished, "transfer fee finished");
transferFeePaymentFinished = true;
emit LogTransferFeePaymentFinished(msg.sender);
return true;
}
| function finishTransferFeePayment() public onlyOwner returns(bool finished) {
require(!transferFeePaymentFinished, "transfer fee finished");
transferFeePaymentFinished = true;
emit LogTransferFeePaymentFinished(msg.sender);
return true;
}
| 47,749 |
51 | // COMETUBUCOMETUBUCOMETUBU is an ERC223 Token with ERC20 functions and events Fully backward compatible with ERC20/ | contract COMETUBU is ERC223, Ownable {
using SafeMath for uint256;
string public name = "COMETUBU";
string public symbol = "TUBU";
uint8 public decimals = 0;
uint256 public totalSupply = 88e8 * 1e0;
uint256 public distributeAmount = 0;
bool public mintingFinished = false;
mapping(address => uint256) public balanceOf;... | contract COMETUBU is ERC223, Ownable {
using SafeMath for uint256;
string public name = "COMETUBU";
string public symbol = "TUBU";
uint8 public decimals = 0;
uint256 public totalSupply = 88e8 * 1e0;
uint256 public distributeAmount = 0;
bool public mintingFinished = false;
mapping(address => uint256) public balanceOf;... | 55,691 |
8 | // This flag should signal if this contract was deployed in TESTMODE;this means it is not suposed to be used with real money, and itenables some power user features useful for testing environments. On mainnet this flag should return always false. / | bool public isTestingDeployment;
| bool public isTestingDeployment;
| 35,061 |
204 | // NOTE: Buy back not working due to address(this) being the token that we're buying from uniswap - apparently they don't accept that. Leaving the code here however for anyone that wishes to adapt it and "fix" it | // function buyAndBurn(bool _burnTokens) public {
// // check minimum amount
// uint256 startingBbra = balanceOf(address(this));
// uint256 startingEth = address(this).balance;
//
// require(startingEth >= 5e16, 'Contract balance must be at least 0.05 eth before invoking buyAndBurn');
//
... | // function buyAndBurn(bool _burnTokens) public {
// // check minimum amount
// uint256 startingBbra = balanceOf(address(this));
// uint256 startingEth = address(this).balance;
//
// require(startingEth >= 5e16, 'Contract balance must be at least 0.05 eth before invoking buyAndBurn');
//
... | 36,942 |
2 | // Adds new Credential Item to the registry. _recordType Credential Item type _recordName Credential Item name _recordVersion Credential Item version _reference Credential Item reference URL _referenceType Credential Item reference type _referenceHash Credential Item reference hash / | function add(
string _recordType,
string _recordName,
string _recordVersion,
string _reference,
string _referenceType,
bytes32 _referenceHash
) external;
| function add(
string _recordType,
string _recordName,
string _recordVersion,
string _reference,
string _referenceType,
bytes32 _referenceHash
) external;
| 5,866 |
21 | // To keep this contract fully transparent, all `ifAdmin` functions must be payable. This helper is here toemulate some proxy functions being non-payable while still allowing value to pass through. / | function _requireZeroValue() private {
require(msg.value == 0);
}
| function _requireZeroValue() private {
require(msg.value == 0);
}
| 37,915 |
0 | // Public variables of the token | string public name = "Ino Coin";
string public symbol = "INO";
uint8 public decimals = 0;
| string public name = "Ino Coin";
string public symbol = "INO";
uint8 public decimals = 0;
| 76,858 |
19 | // TODO we may use batched lagrange compputation | state.t = evaluate_lagrange_poly_out_of_domain(i, vk.domain_size, vk.omega, state.z);
state.t.mul_assign(PairingsBn254.new_fr(proof.input_values[i]));
inputs_term.add_assign(state.t);
| state.t = evaluate_lagrange_poly_out_of_domain(i, vk.domain_size, vk.omega, state.z);
state.t.mul_assign(PairingsBn254.new_fr(proof.input_values[i]));
inputs_term.add_assign(state.t);
| 20,718 |
93 | // Sets a previously-passed-in destination in storage to the value | function to(bytes32, bytes32 _val) conditions(validStoreVal, validStoreDest) internal pure {
assembly {
// Get pointer to buffer length -
let ptr := add(0x20, mload(0xc0))
// Push storage value to the end of the buffer -
mstore(add(0x20, add(ptr, mload(ptr))), _val)
// Increment buff... | function to(bytes32, bytes32 _val) conditions(validStoreVal, validStoreDest) internal pure {
assembly {
// Get pointer to buffer length -
let ptr := add(0x20, mload(0xc0))
// Push storage value to the end of the buffer -
mstore(add(0x20, add(ptr, mload(ptr))), _val)
// Increment buff... | 74,514 |
198 | // transfer to the user an equivalent amount of each one of the reserve tokens | removeLiquidityFromPool(_reserveTokens, _reserveMinReturnAmounts, totalSupply, _amount);
| removeLiquidityFromPool(_reserveTokens, _reserveMinReturnAmounts, totalSupply, _amount);
| 36,851 |
11 | // Removes a malicious validator from the list | function reportMalicious(address _validator, uint256 _blockNum, bytes calldata) external {
address reportingValidator = msg.sender;
// Mark the `_validator` as reported by `reportingValidator` for the block `_blockNum`
_maliceReportedForBlock[_validator][_blockNum].push(reportingValidator);
_maliceReportedFor... | function reportMalicious(address _validator, uint256 _blockNum, bytes calldata) external {
address reportingValidator = msg.sender;
// Mark the `_validator` as reported by `reportingValidator` for the block `_blockNum`
_maliceReportedForBlock[_validator][_blockNum].push(reportingValidator);
_maliceReportedFor... | 32,348 |
10 | // Requests randomness from a user-provided seed/ | function startDraw(uint256 userProvidedSeed) public returns (bytes32 requestId) {
// TODO: Fix
require(currentDrawTimestamp <= (block.timestamp + 960 seconds), "The time period has not yet passed");
// Even though there can be exactly one participant we still use VRF to keep it "fair"
if(getParticipa... | function startDraw(uint256 userProvidedSeed) public returns (bytes32 requestId) {
// TODO: Fix
require(currentDrawTimestamp <= (block.timestamp + 960 seconds), "The time period has not yet passed");
// Even though there can be exactly one participant we still use VRF to keep it "fair"
if(getParticipa... | 29,163 |
38 | // Values 0-10,000 map to 0%-100% Author's share from the owner cut. | uint256 public authorShare;
| uint256 public authorShare;
| 27,965 |
23 | // Reverts if the caller wasn't the vetoer | error ONLY_VETOER();
| error ONLY_VETOER();
| 17,874 |
4 | // List SeedBlock Forest NFT for sell at specific price _id unsigned integer defines tokenID to list for sell_price unsigned integer defines sell price in SEED for the tokenID/ | function listTree(uint256 _id, uint256 _price, uint256 _burnPercent) public {
address _owner = tree.ownerOf(_id);
address _approved = tree.getApproved(_id);
require(
address(this) == _approved,
" SeedBlock: Contract is not approved to manage token of this ID "
);
require(
... | function listTree(uint256 _id, uint256 _price, uint256 _burnPercent) public {
address _owner = tree.ownerOf(_id);
address _approved = tree.getApproved(_id);
require(
address(this) == _approved,
" SeedBlock: Contract is not approved to manage token of this ID "
);
require(
... | 25,229 |
76 | // Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], butwith `errorMessage` as a fallback revert reason when `target` reverts. _Available since v3.1._ / | function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(
address(this).balance >= value,
"Address: insufficient balance for call"
);
| function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(
address(this).balance >= value,
"Address: insufficient balance for call"
);
| 60 |
31 | // ------------------------------------------------------------------------ Returns amount of tokens _spender is allowed to transfer or burn ------------------------------------------------------------------------ | function allowance(address _tokenHolder, address _spender)
public
view
| function allowance(address _tokenHolder, address _spender)
public
view
| 37,421 |
276 | // CryptoHodlers contract Extends ERC721 Non-Fungible Token Standard basic implementation / | contract CryptoHodlers is ERC721, Ownable {
using SafeMath for uint256;
string public PROV = "";
uint256 public constant hodlerPrice = 40000000000000000; // 0.04 ETH
uint public constant maxHodlerPurchase = 30;
uint256 public MAX_HODLERS = 10000;
bool public saleIsActive = false;
construct... | contract CryptoHodlers is ERC721, Ownable {
using SafeMath for uint256;
string public PROV = "";
uint256 public constant hodlerPrice = 40000000000000000; // 0.04 ETH
uint public constant maxHodlerPurchase = 30;
uint256 public MAX_HODLERS = 10000;
bool public saleIsActive = false;
construct... | 28,991 |
33 | // data | mapping(address => uint256) public fromAmountBooks;
mapping(address => mapping(address => uint256)) public toAmountBooks;
mapping(address => uint256) public forceOffsetBooks;
mapping(address => bool) public migrateBooks;
address[] public xpaAsset;
address public fundAccount;
uint256 public p... | mapping(address => uint256) public fromAmountBooks;
mapping(address => mapping(address => uint256)) public toAmountBooks;
mapping(address => uint256) public forceOffsetBooks;
mapping(address => bool) public migrateBooks;
address[] public xpaAsset;
address public fundAccount;
uint256 public p... | 34,776 |
6 | // preSaleTokenPrice = 1 ; stage2TokenPrice = 2 ; stage2TokenPrice = 3; stage3TokenPrice = 4; stage4TokenPrice = 5 ; | tokenDecimal = (Token(tokenAddress).decimals());
startTimestamp =block.timestamp;
| tokenDecimal = (Token(tokenAddress).decimals());
startTimestamp =block.timestamp;
| 4,622 |
42 | // function to change the minimum contributioncan only be called from owner wallet / | function changeMinimumContribution(uint256 minContribution) public onlyOwner {
minimumContribution = minContribution;
}
| function changeMinimumContribution(uint256 minContribution) public onlyOwner {
minimumContribution = minContribution;
}
| 25,924 |
12 | // checks if scaling factor is too high to compute balances for rebasing | function _maxScalingFactor() internal view returns (uint256) {
// can only go up to 2**256-1 = initSupply * dankScalingFactor
return uint256(int256(-1)) / initSupply;
}
| function _maxScalingFactor() internal view returns (uint256) {
// can only go up to 2**256-1 = initSupply * dankScalingFactor
return uint256(int256(-1)) / initSupply;
}
| 27,565 |
123 | // Returns the next token ID to be minted. / | function _nextTokenId() internal view returns (uint256) {
return _currentIndex;
}
| function _nextTokenId() internal view returns (uint256) {
return _currentIndex;
}
| 24,173 |
6 | // emitted at each emergency withdraw user address that emergency-withdrawn its funds amount amount emergency-withdrawn campaign campaingId on which the user has emergency-withdrawn funds / | event EmergencyWithdraw(address indexed user, uint256 amount, uint256 campaign);
| event EmergencyWithdraw(address indexed user, uint256 amount, uint256 campaign);
| 42,927 |
20 | // return true if the contract is paused, false otherwise. / | function paused() public view returns(bool) {
return _paused;
}
| function paused() public view returns(bool) {
return _paused;
}
| 10,197 |
2 | // Returns the subtraction of two unsigned integers, reverting with custom message onoverflow (when the result is negative). Counterpart to Solidity's `-` operator. Requirements:- Subtraction cannot overflow. NOTE: This is a feature of the next version of OpenZeppelin Contracts. Get it via `npm install @openzeppelin/co... | function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
| function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
| 295 |
89 | // return gysr balance available for withdrawal / | function gysrBalance() external view returns (uint256);
| function gysrBalance() external view returns (uint256);
| 59,780 |
17 | // buy & sell | H4Dcontract_.buy.value(_bal)(_pusher);
H4Dcontract_.sell(H4Dcontract_.balanceOf(address(this)));
| H4Dcontract_.buy.value(_bal)(_pusher);
H4Dcontract_.sell(H4Dcontract_.balanceOf(address(this)));
| 31,122 |
18 | // generates a unique hash for an order orderorder struct / | function getOrderHash(Order calldata order)
internal
pure
returns (bytes32)
| function getOrderHash(Order calldata order)
internal
pure
returns (bytes32)
| 16,315 |
238 | // Add a new cube token. Can only be called by governance. spotSymbol Symbol of underlying token. Used to fetch oracle price inverse True means 3x short token. False means 3x long token. depositWithdrawFee Fee on deposits and withdrawals in basis points maxPoolShare Limit on share of the pool in basis pointsreturn addr... | function addCubeToken(
string memory spotSymbol,
bool inverse,
uint256 depositWithdrawFee,
uint256 maxPoolShare
| function addCubeToken(
string memory spotSymbol,
bool inverse,
uint256 depositWithdrawFee,
uint256 maxPoolShare
| 13,466 |
36 | // Returns the supply claimed by claimer for active conditionId. | function getSupplyClaimedByWallet(address _claimer)
public
view
returns (uint256)
| function getSupplyClaimedByWallet(address _claimer)
public
view
returns (uint256)
| 12,082 |
8 | // Create escrow | address escrow =
AppStorageLib.store().collateralEscrowBeacon.cloneProxy("");
ICollateralEscrow(escrow).init(
token,
| address escrow =
AppStorageLib.store().collateralEscrowBeacon.cloneProxy("");
ICollateralEscrow(escrow).init(
token,
| 31,595 |
24 | // check for straights via sorted rank list if not 3 of a kind or pairs | if (handVal > HandEnum.ThreeOfAKind)
{
| if (handVal > HandEnum.ThreeOfAKind)
{
| 16,880 |
119 | // Check the proof of an address if valid for merkle root _to address to check for proof _merkleProof Proof of the address to validate against root and leaf / | function isAllowlisted(address _to, bytes32[] calldata _merkleProof) public view returns(bool) {
if(merkleRoot == 0) revert ValueCannotBeZero();
bytes32 leaf = keccak256(abi.encodePacked(_to));
return MerkleProof.verify(_merkleProof, merkleRoot, leaf);
}
| function isAllowlisted(address _to, bytes32[] calldata _merkleProof) public view returns(bool) {
if(merkleRoot == 0) revert ValueCannotBeZero();
bytes32 leaf = keccak256(abi.encodePacked(_to));
return MerkleProof.verify(_merkleProof, merkleRoot, leaf);
}
| 39,357 |
9 | // The most recent authenticated data from all sources. This is private because dynamic mapping keys preclude auto-generated getters. / | mapping(address => mapping(string => Datum)) private data;
| mapping(address => mapping(string => Datum)) private data;
| 43,914 |
22 | // You could use base-type id to store NF type balances if you wish. | balances[type_][dst] = balances[type_][dst].safeAdd(1);
emit TransferSingle(msg.sender, address(0x0), dst, id, 1);
| balances[type_][dst] = balances[type_][dst].safeAdd(1);
emit TransferSingle(msg.sender, address(0x0), dst, id, 1);
| 34,536 |
16 | // 'КОШКА сильнее СОБАКИ' | if context { @or( ПРИЛАГАТЕЛЬНОЕ:* { СТЕПЕНЬ:СРАВН }, Наречие:* { СТЕПЕНЬ:СРАВН } ) СУЩЕСТВИТЕЛЬНОЕ:*{ ПАДЕЖ:РОД } }
| if context { @or( ПРИЛАГАТЕЛЬНОЕ:* { СТЕПЕНЬ:СРАВН }, Наречие:* { СТЕПЕНЬ:СРАВН } ) СУЩЕСТВИТЕЛЬНОЕ:*{ ПАДЕЖ:РОД } }
| 34,122 |
178 | // id defined as above/version implementation version | function contractId() public pure returns (bytes32 id, uint256 version);
| function contractId() public pure returns (bytes32 id, uint256 version);
| 26,613 |
20 | // Adds a transaction to the queue. _target Target L2 contract to send the transaction to. _gasLimit Gas limit for the enqueued L2 transaction. _data Transaction data. / | function enqueue(
address _target,
uint256 _gasLimit,
bytes memory _data
| function enqueue(
address _target,
uint256 _gasLimit,
bytes memory _data
| 26,924 |
7 | // Hash address with parameter and calculation result | bytes32 hash = keccak256(abi.encodePacked(proofs.address_sender[i], proofs.smallerParameter[i], proofs.biggerParameter[i], comparison));
| bytes32 hash = keccak256(abi.encodePacked(proofs.address_sender[i], proofs.smallerParameter[i], proofs.biggerParameter[i], comparison));
| 40,610 |
4 | // The id of the token to be redeemed. Must be unique - if another token with this ID already exists, the redeem function will revert. | uint256 tokenId;
| uint256 tokenId;
| 20,117 |
48 | // Reference to grab the overall epoch totals | uint256 overallLastLiquidityAddedEpochReference = lastLiquidityAddedEpochReference;
uint256 lastEpochLiquidityWithdrawn = currentUser
.lastEpochLiquidityWithdrawn;
for (uint256 epoch = lastEpochClaimed; epoch <= currentEpoch; epoch++) {
| uint256 overallLastLiquidityAddedEpochReference = lastLiquidityAddedEpochReference;
uint256 lastEpochLiquidityWithdrawn = currentUser
.lastEpochLiquidityWithdrawn;
for (uint256 epoch = lastEpochClaimed; epoch <= currentEpoch; epoch++) {
| 19,341 |
14 | // Checks if the current phase is a whitelist phase and verifies the whitelist. _phase The current phase. user_ The user address. proof_ The Merkle proof for whitelist verification.return True if the user is whitelisted for the current phase, false otherwise. / | function _isWLPhase(
Phases _phase,
address user_,
bytes32[] memory proof_
| function _isWLPhase(
Phases _phase,
address user_,
bytes32[] memory proof_
| 10,427 |
133 | // Sets the inflation that's we mint every transfer _inflationPerMillion - The inflation amount from 0 to 999,999 / | function setInflationPerMillion(uint256 _inflationPerMillion) external;
| function setInflationPerMillion(uint256 _inflationPerMillion) external;
| 37,781 |
190 | // Create lighthouse smart contract _minimalFreeze Minimal freeze value of XRT token _timeoutBlocks Max time of lighthouse silence in blocks _name Lighthouse subdomain, example: for 'my-name' will created 'my-name.lighthouse.1.robonomics.eth' domain / | function createLighthouse(
uint256 _minimalFreeze,
uint256 _timeoutBlocks,
string _name
)
external
returns (address lighthouse)
| function createLighthouse(
uint256 _minimalFreeze,
uint256 _timeoutBlocks,
string _name
)
external
returns (address lighthouse)
| 8,530 |
139 | // Core Wallet/A basic smart contract wallet with cosigner functionality. The notion of "cosigner" is/the simplest possible multisig solution, a two-of-two signature scheme. It devolves nicely/to "one-of-one" (i.e. singlesig) by simply having the cosigner set to the same value as/the main signer./ /Most "advanced" func... | contract CoreWallet is ERC721Receivable, ERC223Receiver, ERC1271, ERC1155TokenReceiver {
using ECDSA for bytes;
/// @notice We require that presigned transactions use the EIP-191 signing format.
/// See that EIP for more info: https://github.com/ethereum/EIPs/blob/master/EIPS/eip-191.md
byte public c... | contract CoreWallet is ERC721Receivable, ERC223Receiver, ERC1271, ERC1155TokenReceiver {
using ECDSA for bytes;
/// @notice We require that presigned transactions use the EIP-191 signing format.
/// See that EIP for more info: https://github.com/ethereum/EIPs/blob/master/EIPS/eip-191.md
byte public c... | 62,604 |
19 | // perform static call | bool success;
uint256 returnSize;
uint256 returnValue;
assembly {
success := staticcall(30000, account, add(encodedParams, 0x20), mload(encodedParams), 0x00, 0x20)
returnSize := returndatasize()
returnValue := mload(0x00)
}
| bool success;
uint256 returnSize;
uint256 returnValue;
assembly {
success := staticcall(30000, account, add(encodedParams, 0x20), mload(encodedParams), 0x00, 0x20)
returnSize := returndatasize()
returnValue := mload(0x00)
}
| 24,963 |
166 | // Function to query number of (minted) bitbugs of the owner. / | function getdevIdTracker() public view onlyOwner returns (uint) {
return devMintTracker.current();
}
| function getdevIdTracker() public view onlyOwner returns (uint) {
return devMintTracker.current();
}
| 817 |
0 | // Initial token price | uint256 private _price = 0.3 ether;
uint256 DEVELOPER_TOKENS = 10;
uint256 MARKETING_TOKENS = 90;
uint256 TOTAL_SUPPLY = 3000;
| uint256 private _price = 0.3 ether;
uint256 DEVELOPER_TOKENS = 10;
uint256 MARKETING_TOKENS = 90;
uint256 TOTAL_SUPPLY = 3000;
| 11,206 |
293 | // ----------------- INTERNAL VIEW FUNCTIONS ----------------- // Checks if the portfolio or the opportunity has been paused.//Withdrawals are allowed on pauses, lending or accepting value isn't | function notPaused(bytes32 portfolioId) internal view returns (bool) {
// These are internal system contract calls
if (IStorage(rayStorage).getPausedMode(NAME) == false && IStorage(rayStorage).getPausedMode(portfolioId) == false) {
return true;
}
return false;
}
| function notPaused(bytes32 portfolioId) internal view returns (bool) {
// These are internal system contract calls
if (IStorage(rayStorage).getPausedMode(NAME) == false && IStorage(rayStorage).getPausedMode(portfolioId) == false) {
return true;
}
return false;
}
| 20,716 |
222 | // ICompoundPriceOracle Interface for interacting with Compound price oracle / | interface ICompoundPriceOracle {
function getUnderlyingPrice(address _asset) external view returns(uint256);
}
| interface ICompoundPriceOracle {
function getUnderlyingPrice(address _asset) external view returns(uint256);
}
| 57,660 |
0 | // ERC-1417 Poll Standard/See https:github.com/ethereum/EIPs/blob/master/EIPS/eip-1417.md/Note: the ERC-165 identifier for this interface is 0x4fad898b. | interface IPoll {
/// @dev This emits when a person tries to vote without permissions. Useful for auditing purposes.
/// E.g.: To prevent an admin to revoke permissions; calculate the result had they not been removed.
/// @param _from User who tried to vote
/// @param _to the index of the proposal he v... | interface IPoll {
/// @dev This emits when a person tries to vote without permissions. Useful for auditing purposes.
/// E.g.: To prevent an admin to revoke permissions; calculate the result had they not been removed.
/// @param _from User who tried to vote
/// @param _to the index of the proposal he v... | 25,368 |
195 | // only do something if users have different reserve price | if (toPrice != fromPrice) {
| if (toPrice != fromPrice) {
| 32,648 |
805 | // Returns the market that is immediately greater than the maturity | if (marketMaturity > maturity) return (i, true);
| if (marketMaturity > maturity) return (i, true);
| 6,271 |
197 | // Set Revealed | function setRevealed(bool _state) public onlyOwner {
revealed = _state;
}
| function setRevealed(bool _state) public onlyOwner {
revealed = _state;
}
| 11,679 |
8 | // Get the membership basis points This is the basis points that will be charged for a membershipreturn The membership basis points / | function getMembershipBps() external view returns (uint16);
| function getMembershipBps() external view returns (uint16);
| 10,975 |
39 | // Swift resolvers can call to update service status. Swift resolvers must first confirm and can continue with details / cancel service. details Context re: status update. confirmed If `true`, swift resolver can participate in LXL resolution. / | function updateSwiftResolverStatus(string calldata details, bool confirmed) external nonReentrant {
require(IERC20(swiftResolverToken).balanceOf(_msgSender()) >= swiftResolverTokenBalance, "!swiftResolverTokenBalance");
swiftResolverConfirmed[_msgSender()] = confirmed;
emit UpdateSwiftResolv... | function updateSwiftResolverStatus(string calldata details, bool confirmed) external nonReentrant {
require(IERC20(swiftResolverToken).balanceOf(_msgSender()) >= swiftResolverTokenBalance, "!swiftResolverTokenBalance");
swiftResolverConfirmed[_msgSender()] = confirmed;
emit UpdateSwiftResolv... | 8,948 |
128 | // for every 20 blocks after last event, speed increases | uint256 delta = block.number - lastBlock;
uint256 multiplier = delta / 20;
if (multiplier + distanceMap[tokenID].savedSpeed > 9) {
return 10;
}
| uint256 delta = block.number - lastBlock;
uint256 multiplier = delta / 20;
if (multiplier + distanceMap[tokenID].savedSpeed > 9) {
return 10;
}
| 23,050 |
13 | // Returns the balance for this address by each tier. / | function balanceOfByTier(address _owner) public view returns (uint256,uint256,uint256) {
return (balanceOf(_owner, uint256(Tier.BRONZE)),
balanceOf(_owner, uint256(Tier.SILVER)),
balanceOf(_owner, uint256(Tier.GOLD)));
}
| function balanceOfByTier(address _owner) public view returns (uint256,uint256,uint256) {
return (balanceOf(_owner, uint256(Tier.BRONZE)),
balanceOf(_owner, uint256(Tier.SILVER)),
balanceOf(_owner, uint256(Tier.GOLD)));
}
| 15,191 |
69 | // Get the deposit details of an user. Get the deposit details of an user. _userAddrs User address. / | function getUserDepositDetails(address _userAddrs) public view returns(uint256 _balance, uint256 _totalFdAmount) {
_balance = userInfo[_userAddrs].balance;
_totalFdAmount = userInfo[_userAddrs].totalUsrFD;
}
| function getUserDepositDetails(address _userAddrs) public view returns(uint256 _balance, uint256 _totalFdAmount) {
_balance = userInfo[_userAddrs].balance;
_totalFdAmount = userInfo[_userAddrs].totalUsrFD;
}
| 36,640 |
66 | // This contract gives up on being an authorized address inside a specific distributor contract/ | function dropDistributorAuth(uint256 id) external isAuthorized {
MerkleDistributor(distributors[id]).removeAuthorization(address(this));
}
| function dropDistributorAuth(uint256 id) external isAuthorized {
MerkleDistributor(distributors[id]).removeAuthorization(address(this));
}
| 55,525 |
15 | // The default APR for each pool will be 1,000% | uint256 internal constant DEFAULT_APR = 1000;
| uint256 internal constant DEFAULT_APR = 1000;
| 5,773 |
867 | // upgrades contract at a time | function upgradeContract(
bytes2 _contractsName,
address payable _contractsAddress
)
public
onlyAuthorizedToGovern
| function upgradeContract(
bytes2 _contractsName,
address payable _contractsAddress
)
public
onlyAuthorizedToGovern
| 29,168 |
187 | // distribute gen portion to key holders | round_[_rID].mask = _ppt.add(round_[_rID].mask);
| round_[_rID].mask = _ppt.add(round_[_rID].mask);
| 34,861 |
46 | // check our loose want | uint256 _wantBal = balanceOfWant();
if (_amountNeeded > _wantBal) {
uint256 _stakedBal = stakedBalance();
if (_stakedBal > 0) {
uint256 _neededFromStaked;
unchecked {
_neededFromStaked = _amountNeeded - _wantBal;
... | uint256 _wantBal = balanceOfWant();
if (_amountNeeded > _wantBal) {
uint256 _stakedBal = stakedBalance();
if (_stakedBal > 0) {
uint256 _neededFromStaked;
unchecked {
_neededFromStaked = _amountNeeded - _wantBal;
... | 4,230 |
206 | // Get the contract from ERC20. | Bozy.transfer(_to, _tokens);
| Bozy.transfer(_to, _tokens);
| 41,619 |
7 | // set the user and expires of an NFT in ERC20 preference USDC/The zero address indicates there is no user/ Throws if `tokenId` is not valid NFT/userThe new user of the NFT/expiresUNIX timestamp, The new user could use the NFT before expires | function setUser(uint256 tokenId, address user, uint64 expires) public virtual override{
require(expires <= maxMonthlyRent, "Exceeds max sub period");
require(ownerOf(tokenId) == owner(), "property sold, can't rent");
require(erc20Contract != address(0), "erc20 token not set!");
... | function setUser(uint256 tokenId, address user, uint64 expires) public virtual override{
require(expires <= maxMonthlyRent, "Exceeds max sub period");
require(ownerOf(tokenId) == owner(), "property sold, can't rent");
require(erc20Contract != address(0), "erc20 token not set!");
... | 18,542 |
163 | // [NOT MANDATORY FOR ERC1400Partition STANDARD][SHALL BE CALLED ONLY FROM ERC1400] Set list of token partition controllers. partition Name of the partition. operators Controller addresses. / | function _setPartitionControllers(bytes32 partition, address[] memory operators) internal {
for (uint i = 0; i<_controllersByPartition[partition].length; i++){
_isControllerByPartition[partition][_controllersByPartition[partition][i]] = false;
}
for (uint j = 0; j<operators.length; j++){
... | function _setPartitionControllers(bytes32 partition, address[] memory operators) internal {
for (uint i = 0; i<_controllersByPartition[partition].length; i++){
_isControllerByPartition[partition][_controllersByPartition[partition][i]] = false;
}
for (uint j = 0; j<operators.length; j++){
... | 4,117 |
158 | // ya = fyTokenReservesa | uint256 ya = fyTokenReserves.pow(a, ONE);
| uint256 ya = fyTokenReserves.pow(a, ONE);
| 52,166 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.