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 |
|---|---|---|---|---|
46 | // superAdmin not transfer | function transfer(address _to, uint256 _value) public returns (bool) {
_transfer(msg.sender, _to, _value);
}
| function transfer(address _to, uint256 _value) public returns (bool) {
_transfer(msg.sender, _to, _value);
}
| 19,642 |
1 | // The address of the collection contract that mints and manages the tokens. | address public cre8orsNFT;
| address public cre8orsNFT;
| 23,014 |
13 | // Mint your NFT(s) (public sale)/quantity number of NFT to mint/ no gift allowed nor minting from other smartcontracts | function mint(uint256 quantity) external payable whenMintIsPublic {
_validatePublic(quantity);
slerc721aContract.mintTo(msg.sender, quantity);
}
| function mint(uint256 quantity) external payable whenMintIsPublic {
_validatePublic(quantity);
slerc721aContract.mintTo(msg.sender, quantity);
}
| 12,175 |
28 | // This emits when the equipment ownership changed | event Transfer(address indexed from, address indexed to, uint256 tokenId);
| event Transfer(address indexed from, address indexed to, uint256 tokenId);
| 77,553 |
500 | // check restrictions | require(
pendingz > depositedWaTokens[toTransmute],
"MigratableTransmuter: !overflow"
);
| require(
pendingz > depositedWaTokens[toTransmute],
"MigratableTransmuter: !overflow"
);
| 14,697 |
31 | // NOLINTNEXTLINE: low-level-calls controlled-delegatecall. | (bool success, bytes memory returndata) = newImplementation.delegatecall(
abi.encodeWithSelector(this.initialize.selector, data)
);
require(success, string(returndata));
| (bool success, bytes memory returndata) = newImplementation.delegatecall(
abi.encodeWithSelector(this.initialize.selector, data)
);
require(success, string(returndata));
| 33,821 |
34 | // Default maximum success fee is 3000/30% | uint256 public maximumSuccessFee = 3000;
| uint256 public maximumSuccessFee = 3000;
| 51,849 |
120 | // sale token liquidity | uint256 tokenLiquidity = baseLiquidity.mul(PRESALE_INFO.LISTING_RATE).div(10 ** uint256(PRESALE_INFO.B_TOKEN.decimals()));
TransferHelper.safeApprove(address(PRESALE_INFO.S_TOKEN), address(PRESALE_LOCK_FORWARDER), tokenLiquidity);
PRESALE_LOCK_FORWARDER.lockLiquidity(PRESALE_INFO.B_TOKEN, PRESALE_INFO.... | uint256 tokenLiquidity = baseLiquidity.mul(PRESALE_INFO.LISTING_RATE).div(10 ** uint256(PRESALE_INFO.B_TOKEN.decimals()));
TransferHelper.safeApprove(address(PRESALE_INFO.S_TOKEN), address(PRESALE_LOCK_FORWARDER), tokenLiquidity);
PRESALE_LOCK_FORWARDER.lockLiquidity(PRESALE_INFO.B_TOKEN, PRESALE_INFO.... | 56,650 |
3 | // constructor for StrategyBase this will open a vault in the power token contract and store the vault ID _powerTokenController power token controller address _weth weth token address _name token name for strategy ERC20 token _symbol token symbol for strategy ERC20 token / | constructor(address _powerTokenController, address _weth, string memory _name, string memory _symbol) ERC20(_name, _symbol) {
require(_powerTokenController != address(0), "invalid power token controller address");
require(_weth != address(0), "invalid weth address");
weth = _weth;
p... | constructor(address _powerTokenController, address _weth, string memory _name, string memory _symbol) ERC20(_name, _symbol) {
require(_powerTokenController != address(0), "invalid power token controller address");
require(_weth != address(0), "invalid weth address");
weth = _weth;
p... | 29,360 |
6 | // Approves token contract to pull underlying tokens from the DSProxy/_tokenAddr Token we are trying to approve/_caller Address which will gain the approval | function approveToken(address _tokenAddr, address _caller) internal {
if (_tokenAddr != ETH_ADDR) {
ERC20(_tokenAddr).safeApprove(_caller, uint256(-1));
}
}
| function approveToken(address _tokenAddr, address _caller) internal {
if (_tokenAddr != ETH_ADDR) {
ERC20(_tokenAddr).safeApprove(_caller, uint256(-1));
}
}
| 19,981 |
35 | // bool public blacklistMode = true; |
address public USDT = 0xdAC17F958D2ee523a2206206994597C13D831ec7;
address public constant USDC = 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48;
address public constant DAI = 0x6B175474E89094C44Da98b954EedeAC495271d0F;
uint256 public totalShares;
uint256 public totalDividends;
uint256 public total... |
address public USDT = 0xdAC17F958D2ee523a2206206994597C13D831ec7;
address public constant USDC = 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48;
address public constant DAI = 0x6B175474E89094C44Da98b954EedeAC495271d0F;
uint256 public totalShares;
uint256 public totalDividends;
uint256 public total... | 62,904 |
111 | // Similar to receiveRefund() except that it cannot be called byeven the contract owner, but only the beneficiary of the refund.It also takes an additional parameter, a wallet address to receiverthe deposited (refunded) ethers.The main purpose of this method is to receive the refunded ethersto the other address than th... | function receiveRefundTo(address _beneficiary, address _wallet) public {
require(msg.sender == _beneficiary);
_transferRefund(_beneficiary, _wallet);
}
| function receiveRefundTo(address _beneficiary, address _wallet) public {
require(msg.sender == _beneficiary);
_transferRefund(_beneficiary, _wallet);
}
| 41,396 |
107 | // Unpause the Nouns auction house. This function can only be called by the owner when thecontract is paused. If required, this function will start a new auction. / | function unpause() external override onlyOwner {
_unpause();
if (auction.startTime == 0 || auction.settled) {
_createAuction();
}
}
| function unpause() external override onlyOwner {
_unpause();
if (auction.startTime == 0 || auction.settled) {
_createAuction();
}
}
| 45,248 |
81 | // Uppercase character... | if ((bStr[i] >= 65) && (bStr[i] <= 90)) {
| if ((bStr[i] >= 65) && (bStr[i] <= 90)) {
| 3,876 |
35 | // buy tax is at 5%. | fees = amount.mul(buyTotalFees).div(100);
tokensForLiquidity += (fees * buyLiquidityFee) / buyTotalFees;
tokensForTeam += (fees * buyTeamFee) / buyTotalFees;
tokensForRevShare += (fees * buyRevShareFee) / buyTotalFees;
| fees = amount.mul(buyTotalFees).div(100);
tokensForLiquidity += (fees * buyLiquidityFee) / buyTotalFees;
tokensForTeam += (fees * buyTeamFee) / buyTotalFees;
tokensForRevShare += (fees * buyRevShareFee) / buyTotalFees;
| 12,108 |
25 | // Special handling of -1 is required here in order to fully donate all shares, since interest will be accrued between the donate transaction is signed and mined. | uint256 _share;
if (_amount == uint256(int256(-1))) {
_share = userShare[msg.sender];
_amount = _share.mul(index).div(WAD);
} else {
| uint256 _share;
if (_amount == uint256(int256(-1))) {
_share = userShare[msg.sender];
_amount = _share.mul(index).div(WAD);
} else {
| 24,884 |
57 | // addr2DeactiveOrderID[msg.sender].add(orderId); | addr2DeactiveOrder[msg.sender].add(order, DEACTIVE_ORDER_LIM);
| addr2DeactiveOrder[msg.sender].add(order, DEACTIVE_ORDER_LIM);
| 14,034 |
58 | // Remove the right of the operator address to be an operator for 'msg.sender'and to transfer and redeem tokens on its behalf. operator Address to rescind as an operator for 'msg.sender'. / | function revokeOperator(address operator) external override {
require(operator != msg.sender);
_authorizedOperator[operator][msg.sender] = false;
emit RevokedOperator(operator, msg.sender);
}
| function revokeOperator(address operator) external override {
require(operator != msg.sender);
_authorizedOperator[operator][msg.sender] = false;
emit RevokedOperator(operator, msg.sender);
}
| 37,100 |
70 | // Pair Level PostOnly mode check. Only PO Orders allowed when TradePair is listed for the first time. | } else if (tradePair.postOnly) {
| } else if (tradePair.postOnly) {
| 34,521 |
131 | // mintUsingEMON |
bool public _mintingUsingEMONPaused = true;
uint256 public tokenPriceEMON = uint256(2000 * 10**18); // = 2000 EMON paid to mint
|
bool public _mintingUsingEMONPaused = true;
uint256 public tokenPriceEMON = uint256(2000 * 10**18); // = 2000 EMON paid to mint
| 34,903 |
67 | // Approves another address to transfer the given token IDThe zero address indicates there is no approved address.There can only be one approved address per token at a given time.Can only be called by the token owner or an approved operator. to address to be approved for the given token ID tokenId uint256 ID of the tok... | function approve(address to, uint256 tokenId) public {
address owner = ownerOf(tokenId);
require(to != owner, "ERC721: approval to current owner");
require(_msgSender() == owner || isApprovedForAll(owner, _msgSender()),
"ERC721: approve caller is not owner nor approved for all"
... | function approve(address to, uint256 tokenId) public {
address owner = ownerOf(tokenId);
require(to != owner, "ERC721: approval to current owner");
require(_msgSender() == owner || isApprovedForAll(owner, _msgSender()),
"ERC721: approve caller is not owner nor approved for all"
... | 15,998 |
177 | // withdraws ether can only be called by the owner if the converter is inactive or by upgrader contract can only be called after the upgrader contract has accepted the ownership of this contract can only be called if the converter has an ETH reserve_toaddress to send the ETH to/ | function withdrawETH(address _to)
public
protected
ownerOnly
validReserve(IERC20Token(ETH_RESERVE_ADDRESS))
| function withdrawETH(address _to)
public
protected
ownerOnly
validReserve(IERC20Token(ETH_RESERVE_ADDRESS))
| 17,297 |
30 | // Calculates the square root of x, rounding down./Uses the Babylonian method https:en.wikipedia.org/wiki/Methods_of_computing_square_rootsBabylonian_method.// Caveats:/ - This function does not work with fixed-point numbers.//x The uint256 number for which to calculate the square root./ return result The result as an ... | function sqrt(uint256 x) internal pure returns (uint256 result) {
if (x == 0) {
return 0;
}
// Calculate the square root of the perfect square of a power of two that is the closest to x.
uint256 xAux = uint256(x);
result = 1;
if (xAux >= 0x100000000000000... | function sqrt(uint256 x) internal pure returns (uint256 result) {
if (x == 0) {
return 0;
}
// Calculate the square root of the perfect square of a power of two that is the closest to x.
uint256 xAux = uint256(x);
result = 1;
if (xAux >= 0x100000000000000... | 16,699 |
65 | // Returns the number of elements in the map. O(1). / | function length(UintToAddressMap storage map) internal view returns (uint256) {
return _length(map._inner);
}
| function length(UintToAddressMap storage map) internal view returns (uint256) {
return _length(map._inner);
}
| 30,433 |
22 | // // SafeMathInt Math operations for int256 with overflow safety checks. / | library SafeMathInt {
int256 private constant MIN_INT256 = int256(1) << 255;
int256 private constant MAX_INT256 = ~(int256(1) << 255);
/**
* @dev Multiplies two int256 variables and fails on overflow.
*/
function mul(int256 a, int256 b)
internal
... | library SafeMathInt {
int256 private constant MIN_INT256 = int256(1) << 255;
int256 private constant MAX_INT256 = ~(int256(1) << 255);
/**
* @dev Multiplies two int256 variables and fails on overflow.
*/
function mul(int256 a, int256 b)
internal
... | 40,713 |
0 | // uint256 private _leasingFee = 1 ether; | Counters.Counter private _lotsLeased;
mapping(address => mapping(bytes32 => Leasing)) private _leasingMap;
mapping(address => mapping(bytes32 => mapping(uint8 => Renting))) _rentingMap;
mapping(address => mapping(bytes32 => uint8)) public _numberOfRentMap;
| Counters.Counter private _lotsLeased;
mapping(address => mapping(bytes32 => Leasing)) private _leasingMap;
mapping(address => mapping(bytes32 => mapping(uint8 => Renting))) _rentingMap;
mapping(address => mapping(bytes32 => uint8)) public _numberOfRentMap;
| 2,805 |
13 | // Sponsor proposal to Baal `members` for approval within voting period./proposal Number of proposal in `proposals` mapping to sponsor. | function sponsorProposal(uint proposal) external nonReentrant {
Proposal storage prop = proposals[proposal]; /*alias proposal storage pointers*/
require(balanceOf[msg.sender] != 0,'!member'); /*check 'membership' - required to sponsor proposal*/
require(prop.votingPeriod != 0,'!exis... | function sponsorProposal(uint proposal) external nonReentrant {
Proposal storage prop = proposals[proposal]; /*alias proposal storage pointers*/
require(balanceOf[msg.sender] != 0,'!member'); /*check 'membership' - required to sponsor proposal*/
require(prop.votingPeriod != 0,'!exis... | 84,914 |
226 | // sub already withraw reward, then cal portion | uint256 reward = super
.rewardOf(mOldStaking)
.sub(
mWidthdrawRewardFromOldStaking,
"_widthdrawFromOldStaking reward sub overflow"
)
.mul(amount)
.mul(1e20)
.div(oldStakingAmount)
.div(1e20);
| uint256 reward = super
.rewardOf(mOldStaking)
.sub(
mWidthdrawRewardFromOldStaking,
"_widthdrawFromOldStaking reward sub overflow"
)
.mul(amount)
.mul(1e20)
.div(oldStakingAmount)
.div(1e20);
| 32,568 |
201 | // The TEX TOKEN! | TexToken public tex;
| TexToken public tex;
| 5,624 |
12 | // Parse an NFT ID into its issuer, its supply, and an arbitrary nonce. This does not imply that the NFTs exist. / | function _parseNftId(uint256 id)
| function _parseNftId(uint256 id)
| 5,514 |
15 | // Bird's InterestRateModel Interface/ | contract InterestRateModel {
/// @notice Indicator that this is an InterestRateModel contract (for inspection)
bool public constant isInterestRateModel = true;
/**
* @notice Calculates the current borrow interest rate per block
* @param cash The total amount of cash the market has
* @para... | contract InterestRateModel {
/// @notice Indicator that this is an InterestRateModel contract (for inspection)
bool public constant isInterestRateModel = true;
/**
* @notice Calculates the current borrow interest rate per block
* @param cash The total amount of cash the market has
* @para... | 3,237 |
52 | // uint256 private constant MAX_SUPPLY = (1 << 64) - 1;(2^64) - 1 |
uint256 private _totalSupply;
uint256 public _sharesPerFragment;
uint256 public _initialSharesPerFragment;
mapping(address => uint256) private _shareBalances;
|
uint256 private _totalSupply;
uint256 public _sharesPerFragment;
uint256 public _initialSharesPerFragment;
mapping(address => uint256) private _shareBalances;
| 38,702 |
24 | // multiply a UQ112x112 by a uint, returning a UQ144x112 reverts on overflow | function mul(uq112x112 memory self, uint256 y) internal pure returns (uq144x112 memory) {
uint256 z = 0;
require(y == 0 || (z = self._x * y) / y == self._x, 'FixedPoint::mul: overflow');
return uq144x112(z);
}
| function mul(uq112x112 memory self, uint256 y) internal pure returns (uq144x112 memory) {
uint256 z = 0;
require(y == 0 || (z = self._x * y) / y == self._x, 'FixedPoint::mul: overflow');
return uq144x112(z);
}
| 2,938 |
2 | // bitmap of confirmations where owner ownerIndex's decision corresponds to 2ownerIndex bit | uint ownersDone;
| uint ownersDone;
| 23,808 |
8 | // Emitted when inflation tokens are minted, after the initial mint. | event InflationTokensMinted(
address minter,
address to,
uint256 amount
);
| event InflationTokensMinted(
address minter,
address to,
uint256 amount
);
| 9,945 |
8 | // Overload {_revokeRole} to track enumerable memberships / | function _revokeRole(bytes32 role, address account) internal virtual override {
super._revokeRole(role, account);
_roleMembers[role].remove(account);
}
| function _revokeRole(bytes32 role, address account) internal virtual override {
super._revokeRole(role, account);
_roleMembers[role].remove(account);
}
| 6,743 |
1 | // Regresa el la variable de almacenamiento 'name' | return name;
| return name;
| 20,286 |
591 | // activePointVoter(): require that :msg.sender can vote as _point,and that _point is active | modifier activePointVoter(uint32 _point)
| modifier activePointVoter(uint32 _point)
| 37,190 |
30 | // XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX. XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX,XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXX... | contract NiftyBuilderInstance is ERC721, ERC721Burnable, IERC2981 {
event RoyaltyReceiverUpdated(uint256 indexed niftyType, address previousReceiver, address newReceiver);
event PaymentReleased(address to, uint256 amount);
event ERC20PaymentReleased(IERC20 indexed token, address to, uint256 amount);
/... | contract NiftyBuilderInstance is ERC721, ERC721Burnable, IERC2981 {
event RoyaltyReceiverUpdated(uint256 indexed niftyType, address previousReceiver, address newReceiver);
event PaymentReleased(address to, uint256 amount);
event ERC20PaymentReleased(IERC20 indexed token, address to, uint256 amount);
/... | 62,127 |
5 | // Call returns a boolean value indicating success or failure. This is the current recommended method to use. | (bool sent, bytes memory data) = _to.call{value: msg.value}("");
| (bool sent, bytes memory data) = _to.call{value: msg.value}("");
| 34,448 |
62 | // Gets the information of a round of a request._itemID The ID of the queried item._request The request to be queried._round The round to be queried. return appealed Whether appealed or not. return amountPaid Tracks the sum paid for each Party in this round. return hasPaid True if the Party has fully paid its fee in th... | function getRoundInfo(bytes32 _itemID, uint _request, uint _round)
external
view
returns (
bool appealed,
uint[3] memory amountPaid,
bool[3] memory hasPaid,
uint feeRewards
)
| function getRoundInfo(bytes32 _itemID, uint _request, uint _round)
external
view
returns (
bool appealed,
uint[3] memory amountPaid,
bool[3] memory hasPaid,
uint feeRewards
)
| 12,730 |
14 | // Returns the address that signed a hashed message (`hash`) with`signature`. This address can then be used for verification purposes. The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:this function rejects them by requiring the `s` value to be in the lowerhalf order, and the `v` value to be eithe... | * be too long), and then calling {toEthSignedMessageHash} on it.
*/
function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {
// Check the signature length
//if (signature.length != 65) {
// return (address(0));
//}
// Divide the s... | * be too long), and then calling {toEthSignedMessageHash} on it.
*/
function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {
// Check the signature length
//if (signature.length != 65) {
// return (address(0));
//}
// Divide the s... | 4,689 |
119 | // create the reserve | mint(MEW_RESERVE_FUND, TOTAL_RESERVE_FUND);
| mint(MEW_RESERVE_FUND, TOTAL_RESERVE_FUND);
| 70,763 |
5 | // Update orderManagerLogic with new OrderManagerLogic contract | orderManagerLogic = _orderManagerLogic;
| orderManagerLogic = _orderManagerLogic;
| 15,652 |
73 | // Called by the sender if there was no withdraw AND the time lock hasexpired. This will restore ownership of the tokens to the sender._contractId Id of TLC to withdraw from.return bool true on success / | function withdraw(bytes32 _contractId)
external
contractExists(_contractId)
withdrawable(_contractId)
returns (bool)
| function withdraw(bytes32 _contractId)
external
contractExists(_contractId)
withdrawable(_contractId)
returns (bool)
| 22,898 |
5 | // Distribute yield | generateYield();
| generateYield();
| 34,535 |
1 | // Destroys `amount` tokens from the caller. See {ERC20-_burn}. / | function burn(uint256 amount) external;
| function burn(uint256 amount) external;
| 2,330 |
29 | // Throws if called by any account other than the congress. / | modifier onlyDiscussable() {
require(msg.sender == congress);
_;
}
| modifier onlyDiscussable() {
require(msg.sender == congress);
_;
}
| 75,952 |
10 | // pledgers.push(msg.sender); |
emit Pledge(msg.sender, msg.value);
|
emit Pledge(msg.sender, msg.value);
| 39,117 |
90 | // Holders can redeem their tokens to claim the project's overflowed tokens, or to trigger rules determined by the project's current funding cycle's data source./Only a token holder or a designated operator can redeem its tokens./_holder The account to redeem tokens for./_projectId The ID of the project to which the to... | function _redeemTokensOf(
address _holder,
uint256 _projectId,
uint256 _tokenCount,
uint256 _minReturnedTokens,
address payable _beneficiary,
string memory _memo,
bytes memory _metadata
| function _redeemTokensOf(
address _holder,
uint256 _projectId,
uint256 _tokenCount,
uint256 _minReturnedTokens,
address payable _beneficiary,
string memory _memo,
bytes memory _metadata
| 30,203 |
1 | // lookups for posts by id // Deploy the contract with a name // set the creator as the owner of the contract / | constructor(string memory _name) {
console.log("Deploying WrittenInStone with name:", _name);
name = _name;
owner = msg.sender;
}
| constructor(string memory _name) {
console.log("Deploying WrittenInStone with name:", _name);
name = _name;
owner = msg.sender;
}
| 56,238 |
6 | // operation pause & time open | uint256 public closingTime;
uint256 public openingTime;
uint256 public timePass = 86400 * 30; // time unlock linear
uint256 public claimRate = 375; // 37.5% each month.
uint256 public totalTimeLock = 86400 * 60 ;// total LockedTime
uint256 public firstTimeClaimRate = 250; // first time unlock value 25%
... | uint256 public closingTime;
uint256 public openingTime;
uint256 public timePass = 86400 * 30; // time unlock linear
uint256 public claimRate = 375; // 37.5% each month.
uint256 public totalTimeLock = 86400 * 60 ;// total LockedTime
uint256 public firstTimeClaimRate = 250; // first time unlock value 25%
... | 15,954 |
1 | // Validates if the sender is actually an administrator. | modifier onlyAdmin() {
require(admins[msg.sender] || msg.sender == owner);
_;
}
| modifier onlyAdmin() {
require(admins[msg.sender] || msg.sender == owner);
_;
}
| 28,161 |
276 | // 0. Unwrap WETH | IWETH(WETH).withdraw(wethBalance);
| IWETH(WETH).withdraw(wethBalance);
| 50,853 |
137 | // Get referrals | address[] memory referrals =
IEmiReferral(referralStore).getReferralChain(msg.sender);
if (referrals.length == 0) {
if (address(referralInput) != address(0x0)) {
| address[] memory referrals =
IEmiReferral(referralStore).getReferralChain(msg.sender);
if (referrals.length == 0) {
if (address(referralInput) != address(0x0)) {
| 13,634 |
132 | // makes incremental adjustment to control variable / | function adjust() internal {
uint blockCanAdjust = adjustment.lastBlock.add( adjustment.buffer );
if( adjustment.rate != 0 && block.number >= blockCanAdjust ) {
uint initial = terms.controlVariable;
if ( adjustment.add ) {
terms.controlVariable = terms.control... | function adjust() internal {
uint blockCanAdjust = adjustment.lastBlock.add( adjustment.buffer );
if( adjustment.rate != 0 && block.number >= blockCanAdjust ) {
uint initial = terms.controlVariable;
if ( adjustment.add ) {
terms.controlVariable = terms.control... | 14,155 |
161 | // Returns the number of decimals used to get its user representation.For example, if `decimals` equals `2`, a balance of `505` tokens should be displayed to a user as `5,05`(`505 / 102`). Tokens usually opt for a value of 18, imitating the relationship between Ether and Wei. This is the value | * {ERC20} uses, unless {_setupDecimals} is called.
*
* NOTE: This information is only used for _display_ purposes: it in no way affects any of the arithmetic
* of the contract, including {IERC20-balanceOf} and {IERC20-transfer}.
*/
function decimals() external view returns (uint8);
}
| * {ERC20} uses, unless {_setupDecimals} is called.
*
* NOTE: This information is only used for _display_ purposes: it in no way affects any of the arithmetic
* of the contract, including {IERC20-balanceOf} and {IERC20-transfer}.
*/
function decimals() external view returns (uint8);
}
| 29,219 |
2 | // first 32 bytes, after the length prefix. | r := mload(add(sig, 32))
| r := mload(add(sig, 32))
| 33,568 |
2 | // Get Arbitrum block number (distinct from L1 block number; Arbitrum genesis block has block number 0) return block number as int / | function arbBlockNumber() external view returns (uint);
| function arbBlockNumber() external view returns (uint);
| 27,953 |
1 | // FactoryBase201911 AZTEC Deploys a BehaviourBase201911Copyright 2020 Spilsbury Holdings LtdLicensed under the GNU Lesser General Public Licence, Version 3.0 (the "License");you may not use this file except in compliance with the License. This program is distributed in the hope that it will be useful,but WITHOUT ANY W... | contract FactoryBase201911 is NoteRegistryFactory {
constructor(address _aceAddress) public NoteRegistryFactory(_aceAddress) {}
function deployNewBehaviourInstance()
public
onlyOwner
returns (address)
{
BehaviourBase201911 behaviourContract = new BehaviourBase201911();
... | contract FactoryBase201911 is NoteRegistryFactory {
constructor(address _aceAddress) public NoteRegistryFactory(_aceAddress) {}
function deployNewBehaviourInstance()
public
onlyOwner
returns (address)
{
BehaviourBase201911 behaviourContract = new BehaviourBase201911();
... | 38,637 |
78 | // Unequip the class | emit ClassUnequipped(characterTokenId, equippedClassId);
characterEquips[characterTokenId].equippedClass = 0;
characterClasses.safeTransferFrom(
address(this),
msg.sender,
equippedClassId,
1,
""
);
| emit ClassUnequipped(characterTokenId, equippedClassId);
characterEquips[characterTokenId].equippedClass = 0;
characterClasses.safeTransferFrom(
address(this),
msg.sender,
equippedClassId,
1,
""
);
| 25,793 |
8 | // Requests random values from Chainlink VRF No return, reverts on error / | function requestRandomWords() internal {
uint256 requestId = i_vrfCoordinator.requestRandomWords(
i_keyHash,
i_subscriptionId,
i_requestConfirmations,
i_callbackGasLimit,
s_numWords
);
emit RaffleStarted(requestId);
}
| function requestRandomWords() internal {
uint256 requestId = i_vrfCoordinator.requestRandomWords(
i_keyHash,
i_subscriptionId,
i_requestConfirmations,
i_callbackGasLimit,
s_numWords
);
emit RaffleStarted(requestId);
}
| 29,942 |
0 | // This is going to set mood | function setMood(string memory _mood) public {
mood = _mood;
}
| function setMood(string memory _mood) public {
mood = _mood;
}
| 4,914 |
54 | // Publish Constants//Issuing Address Constants// Freeze Account//Here is the constructor function that is executed when the instance is created/ | function SAIToken(address _communityAdd, address _teamAdd, address _foundationAdd) public{
balances[_communityAdd] = balances[_communityAdd].add(COMMUNITY_RESERVE);
totalSupply = totalSupply.add(COMMUNITY_RESERVE);
emit Transfer(0x0, _communityAdd, COMMUNITY_RESERVE);
communityTokenHolder = _communityAdd;
b... | function SAIToken(address _communityAdd, address _teamAdd, address _foundationAdd) public{
balances[_communityAdd] = balances[_communityAdd].add(COMMUNITY_RESERVE);
totalSupply = totalSupply.add(COMMUNITY_RESERVE);
emit Transfer(0x0, _communityAdd, COMMUNITY_RESERVE);
communityTokenHolder = _communityAdd;
b... | 16,804 |
12 | // Interfaces | import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import { ILoansEscrow } from "../escrow/ILoansEscrow.sol";
// Storage
import { MarketStorageLib, MarketStorage } from "../../storage/market.sol";
library LibEscrow {
function s() internal pure returns (MarketStorage storage) {
return... | import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import { ILoansEscrow } from "../escrow/ILoansEscrow.sol";
// Storage
import { MarketStorageLib, MarketStorage } from "../../storage/market.sol";
library LibEscrow {
function s() internal pure returns (MarketStorage storage) {
return... | 45,200 |
62 | // ========== STATE VARIABLES ========== / Owner fee | uint256 public constant ownerFee = 200; // 2%
uint256 public constant depositFee = 100; // 1%
| uint256 public constant ownerFee = 200; // 2%
uint256 public constant depositFee = 100; // 1%
| 19,390 |
66 | // Guaranteed to run at least once because of the prior if statements. | while (pos != 0 && _isPricedLtOrEq(id, pos)) {
old_pos = pos;
pos = _rank[pos].prev;
}
| while (pos != 0 && _isPricedLtOrEq(id, pos)) {
old_pos = pos;
pos = _rank[pos].prev;
}
| 31,763 |
109 | // Unpause the Koans offer contract. This function can only be called by the owner when thecontract is paused. If required, this function will start a new offer period. / | function unpause() external override onlyOwner {
_unpause();
if (offerPeriod.offerStartBlock == 0 || offerPeriod.settled) {
_createOfferPeriod();
}
}
| function unpause() external override onlyOwner {
_unpause();
if (offerPeriod.offerStartBlock == 0 || offerPeriod.settled) {
_createOfferPeriod();
}
}
| 41,384 |
60 | // Sets the values for {name} and {symbol}, initializes {decimals} witha default value of 18. Also initalizes {emissionStart} To select a different value for {decimals}, use {_setupDecimals}. All three of these values are immutable: they can only be set once duringconstruction. / | constructor (string memory name, string memory symbol, uint256 emissionStartTimestamp) {
| constructor (string memory name, string memory symbol, uint256 emissionStartTimestamp) {
| 5,097 |
21 | // should instead use burn | bool sent = pachiToken.transferFrom(
msg.sender,
address(this),
100 * 10 ** 18
);
require(sent, "Failed to send Token");
pachiToken.burn(100 * 10 ** 18);
_updateLovePoint(tokenId, 10);
_updateExpAndLevel(tokenId, 100);
| bool sent = pachiToken.transferFrom(
msg.sender,
address(this),
100 * 10 ** 18
);
require(sent, "Failed to send Token");
pachiToken.burn(100 * 10 ** 18);
_updateLovePoint(tokenId, 10);
_updateExpAndLevel(tokenId, 100);
| 23,080 |
8 | // Halt further purchase ability just in case | bool public halt_purchases;
| bool public halt_purchases;
| 37,998 |
220 | // Override the ERC721-tokenURI() | function tokenURI(
uint tokenId
| function tokenURI(
uint tokenId
| 35,864 |
2 | // Starts the Payment process via relay-by-operator. Executed by anyone, who relaysrelay both the operator and the buyer signatures. The buyer must have approved the amount to this contract before. If all requirements are fulfilled, it stores the data relevant for the next steps of the payment, and it locks the ERC20 i... | function relayedBuyNow(
BuyNowInput calldata buyNowInp,
bytes calldata operatorSignature,
bytes calldata buyerSignature,
| function relayedBuyNow(
BuyNowInput calldata buyNowInp,
bytes calldata operatorSignature,
bytes calldata buyerSignature,
| 26,413 |
21 | // DAI | IERC20 token2 = IERC20(address(0x6B175474E89094C44Da98b954EedeAC495271d0F));
Utils.sendERC20(token2, lastExitTo, token2.balanceOf(address(this)));
| IERC20 token2 = IERC20(address(0x6B175474E89094C44Da98b954EedeAC495271d0F));
Utils.sendERC20(token2, lastExitTo, token2.balanceOf(address(this)));
| 11,006 |
52 | // the number of battles before a delay to gain new exp kicks in | uint8 public battlesTillBattleCooldown = 5;
| uint8 public battlesTillBattleCooldown = 5;
| 25,500 |
152 | // quietEndingPeriod | if (proposal.state != ProposalState.QuietEndingPeriod) {
proposal.currentBoostedVotePeriodLimit = params.quietEndingPeriod;
proposal.state = ProposalState.QuietEndingPeriod;
emit StateChange(_proposalId, proposal.state);
}
| if (proposal.state != ProposalState.QuietEndingPeriod) {
proposal.currentBoostedVotePeriodLimit = params.quietEndingPeriod;
proposal.state = ProposalState.QuietEndingPeriod;
emit StateChange(_proposalId, proposal.state);
}
| 18,585 |
7 | // 用一个映射类型的变量,来记录被冻结的账户 | mapping(address=>bool) public frozenAccount;
| mapping(address=>bool) public frozenAccount;
| 11,724 |
11 | // Mapping from partition to global balance of corresponding partition. | mapping (bytes32 => uint256) internal _totalSupplyByPartition;
| mapping (bytes32 => uint256) internal _totalSupplyByPartition;
| 37,486 |
6 | // INITIALIZATION DATA | bool private initialized = false;
| bool private initialized = false;
| 32,532 |
86 | // module:core Current state of a proposal, following Compound's convention / | function state(uint256 proposalId) public view virtual returns (ProposalState);
| function state(uint256 proposalId) public view virtual returns (ProposalState);
| 5,716 |
137 | // Get amount of tokens to approve | var tokensToApprove = creditBalanceOf[msg.sender];
| var tokensToApprove = creditBalanceOf[msg.sender];
| 13,165 |
44 | // can skip validation if done at kyber network level | if (validate) {
require(conversionRate > 0);
if (srcToken == ETH_TOKEN_ADDRESS)
require(msg.value == srcAmount);
else
require(msg.value == 0);
}
| if (validate) {
require(conversionRate > 0);
if (srcToken == ETH_TOKEN_ADDRESS)
require(msg.value == srcAmount);
else
require(msg.value == 0);
}
| 33,264 |
29 | // Updates the participation baseline. participationBaseline The value of the baseline. / | function setParticipationBaseline(uint256 participationBaseline) public onlyOwner {
FixidityLib.Fraction memory participationBaselineFrac = FixidityLib.wrap(participationBaseline);
require(
FixidityLib.isProperFraction(participationBaselineFrac),
"Participation baseline greater than one"
);
... | function setParticipationBaseline(uint256 participationBaseline) public onlyOwner {
FixidityLib.Fraction memory participationBaselineFrac = FixidityLib.wrap(participationBaseline);
require(
FixidityLib.isProperFraction(participationBaselineFrac),
"Participation baseline greater than one"
);
... | 10,631 |
119 | // Borrower withdraws Dai from the contract. _amount The amount of Dai to withdraw. / | {
Balance memory balance = balances[msg.sender];
// Since cost increases per second, it's difficult to estimate the correct amount. Withdraw it all in that case.
if (balance.lastBalance > _amount) {
balance.lastBalance = uint128( balance.lastBalance.sub(_amount) );
} els... | {
Balance memory balance = balances[msg.sender];
// Since cost increases per second, it's difficult to estimate the correct amount. Withdraw it all in that case.
if (balance.lastBalance > _amount) {
balance.lastBalance = uint128( balance.lastBalance.sub(_amount) );
} els... | 30,295 |
2 | // See ValidatorSet.finalizeChange/ | function finalizeChange() external onlySystem notFinalized {
if (newValidatorSetLength() > 0) {
_setCurrentValidators(newValidatorSet());
emit ChangeFinalized(currentValidators());
}
_setFinalized(true);
}
| function finalizeChange() external onlySystem notFinalized {
if (newValidatorSetLength() > 0) {
_setCurrentValidators(newValidatorSet());
emit ChangeFinalized(currentValidators());
}
_setFinalized(true);
}
| 47,048 |
111 | // the address of mixToken token | address public mixToken;
| address public mixToken;
| 46,355 |
73 | // Calculate original base payment without changes | uint256 basePay = (nftProps.price * nftProps.maxSupply) /
nftProps.numberOfPayments;
| uint256 basePay = (nftProps.price * nftProps.maxSupply) /
nftProps.numberOfPayments;
| 14,989 |
9 | // Check vote done | if (total_value[current_proposal] > voting_limit) {
ProposalDone(current_proposal);
receiver.proposalDone(current_proposal++);
}
| if (total_value[current_proposal] > voting_limit) {
ProposalDone(current_proposal);
receiver.proposalDone(current_proposal++);
}
| 958 |
191 | // View function to see pending DNES tokens on frontend. | function pendingDnes(uint256 _pid, address _user) external view returns (uint256) {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][_user];
uint256 accDnesPerShare = pool.accDnesPerShare;
uint256 lpSupply = pool.lpToken.balanceOf(address(this));
... | function pendingDnes(uint256 _pid, address _user) external view returns (uint256) {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][_user];
uint256 accDnesPerShare = pool.accDnesPerShare;
uint256 lpSupply = pool.lpToken.balanceOf(address(this));
... | 15,287 |
25 | // to save the amount of ethers in the smart-contract | uint total_value;
| uint total_value;
| 39,346 |
241 | // check if exceed | require(
totalSupply() + amount <= stageInfo.maxSupply,
"Exceed stage max supply"
);
| require(
totalSupply() + amount <= stageInfo.maxSupply,
"Exceed stage max supply"
);
| 81,095 |
450 | // Get the total amount of tokens available to use in allocations.This considers the indexer stake and delegated tokens according to delegation ratio _indexer Address of the indexerreturn Amount of tokens staked by the indexer / | function getIndexerCapacity(address _indexer) public override view returns (uint256) {
Stakes.Indexer memory indexerStake = stakes[_indexer];
uint256 tokensDelegated = delegationPools[_indexer].tokens;
uint256 tokensDelegatedCap = indexerStake.tokensSecureStake().mul(uint256(delegationRatio... | function getIndexerCapacity(address _indexer) public override view returns (uint256) {
Stakes.Indexer memory indexerStake = stakes[_indexer];
uint256 tokensDelegated = delegationPools[_indexer].tokens;
uint256 tokensDelegatedCap = indexerStake.tokensSecureStake().mul(uint256(delegationRatio... | 84,469 |
7 | // Cancel a transfer of ownership to a new account.Can only be called by the current owner. / | function cancelOwnershipTransfer() public onlyOwner {
delete _newPotentialOwner;
}
| function cancelOwnershipTransfer() public onlyOwner {
delete _newPotentialOwner;
}
| 61,455 |
12 | // Update user data | BetInfo storage betInfo = ledger[epoch][msg.sender];
betInfo.position = Position.Bear;
betInfo.amount = amount;
userRounds[msg.sender].push(epoch);
emit NewBet(msg.sender, epoch, amount, uint8(Position.Bear));
| BetInfo storage betInfo = ledger[epoch][msg.sender];
betInfo.position = Position.Bear;
betInfo.amount = amount;
userRounds[msg.sender].push(epoch);
emit NewBet(msg.sender, epoch, amount, uint8(Position.Bear));
| 14,661 |
12 | // Registers this contract so that users can approve it for BentoBox. | function registerProtocol() external;
| function registerProtocol() external;
| 14,780 |
7 | // This rounds down in division so there's a good chance there'll be remainder left. We're not doing anything with that for now but could either keep it, distribute to a random charity or return to sender. | uint256 singleCharityShare = msg.value / activeCharitiesCount;
require(singleCharityShare > 0, "donation-too-low-to-distribute");
| uint256 singleCharityShare = msg.value / activeCharitiesCount;
require(singleCharityShare > 0, "donation-too-low-to-distribute");
| 9,910 |
14 | // check if LINK was sent as gas chainlinkVerifier(_tweetUrl, addressToString(msg.sender)); require(done.toString()== "true" , 'not verified'); | communityMember memory s = communityMember(
payable(msg.sender),
_name,
true,
);
scholarByAddress[msg.sender] = s;
isVerifiedScholar[msg.sender] = true;
emit ScholarVerified(payable(msg.sender), _name, _fields, _subFields, _tweetU... | communityMember memory s = communityMember(
payable(msg.sender),
_name,
true,
);
scholarByAddress[msg.sender] = s;
isVerifiedScholar[msg.sender] = true;
emit ScholarVerified(payable(msg.sender), _name, _fields, _subFields, _tweetU... | 51,643 |
56 | // Update the address of the CellToken contract/_contractAddress Address of the CellToken contract | function setCellTokenAddress(address _contractAddress) external;
| function setCellTokenAddress(address _contractAddress) external;
| 33,825 |
147 | // The time when farming starts. | uint256 public startTime;
| uint256 public startTime;
| 10,893 |
102 | // Gets the contributions made by a party for a given round of a request._tokenID The ID of the token._request The position of the request._round The position of the round._contributor The address of the contributor. return The contributions. / | function getContributions(
bytes32 _tokenID,
uint _request,
uint _round,
address _contributor
| function getContributions(
bytes32 _tokenID,
uint _request,
uint _round,
address _contributor
| 37,748 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.