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 |
|---|---|---|---|---|
91 | // Approve the passed address to spend the specified amount of tokens on behalf of msg.senderand then call `onApprovalReceived` on spender.Beware that changing an allowance with this method brings the risk that someone may use both the oldand the new allowance by unfortunate transaction ordering. One possible solution ... | function approveAndCall(address spender, uint256 value) external returns (bool);
| function approveAndCall(address spender, uint256 value) external returns (bool);
| 21,719 |
174 | // MINT | function mintKITTEN(uint256 _mintAmount)
public
payable
notPaused
saleStarted
minimumMintAmount(_mintAmount)
| function mintKITTEN(uint256 _mintAmount)
public
payable
notPaused
saleStarted
minimumMintAmount(_mintAmount)
| 8,483 |
3 | // Return a `wei` value in units of Gwei and serialize as a (LE) `bytes8`. | function serializeAmount(uint amount) private pure returns (bytes memory) {
uint depositAmount = amount / WEI_PER_GWEI;
bytes memory encodedAmount = new bytes(8);
for (uint i = 0; i < 8; i++) {
encodedAmount[i] = byte(uint8(depositAmount / (2**(8*i))));
}
retur... | function serializeAmount(uint amount) private pure returns (bytes memory) {
uint depositAmount = amount / WEI_PER_GWEI;
bytes memory encodedAmount = new bytes(8);
for (uint i = 0; i < 8; i++) {
encodedAmount[i] = byte(uint8(depositAmount / (2**(8*i))));
}
retur... | 31,407 |
54 | // If Chainlink is live but deviated >50% from it's previous price and Tellor is still untrusted, switch to bothOraclesUntrusted and return last good price | if (_chainlinkPriceChangeAboveMax(chainlinkResponse, prevChainlinkResponse)) {
_changeStatus(Status.bothOraclesUntrusted);
return lastGoodPrice;
}
| if (_chainlinkPriceChangeAboveMax(chainlinkResponse, prevChainlinkResponse)) {
_changeStatus(Status.bothOraclesUntrusted);
return lastGoodPrice;
}
| 18,719 |
92 | // val | uint8(state.stack.pop())
);
| uint8(state.stack.pop())
);
| 40,004 |
20 | // Total length of the auction | uint48 public totalAuctionLength = 2 days; // [seconds]
| uint48 public totalAuctionLength = 2 days; // [seconds]
| 54,229 |
176 | // sends eth from contract balance to specified address sendTo address to send amount amount - amount to send (should be less than current balance) / | function withdraw(
address payable sendTo,
uint256 amount
)
external
onlyOwner
| function withdraw(
address payable sendTo,
uint256 amount
)
external
onlyOwner
| 31,713 |
188 | // Record referral. / | function recordReferral(address user, address referrer) external;
| function recordReferral(address user, address referrer) external;
| 10,078 |
12 | // This creates an array with all balances // This generates a public event on the blockchain that will notify clients // notify about transfer to client// notify about approval to client// notify about basisPointsRate to client/ Called when new token are issued | event Issue(
uint amount
);
| event Issue(
uint amount
);
| 29,375 |
228 | // start with the mythical CobeFriend 0 - so we don't have generation-0 parent issues | _createCobeFriend(0, 0, 0, uint256(-1), address(0));
| _createCobeFriend(0, 0, 0, uint256(-1), address(0));
| 26,493 |
83 | // The account bundles of locked tokens grouped by release date |
mapping (uint8 => AccountsBundle) public bundles;
|
mapping (uint8 => AccountsBundle) public bundles;
| 48,337 |
191 | // Change guardian address/Can only be changed by governance | function setGuardian(address _guardian) external whenNotPaused {
_onlyGovernance();
guardian = _guardian;
}
| function setGuardian(address _guardian) external whenNotPaused {
_onlyGovernance();
guardian = _guardian;
}
| 41,564 |
209 | // getBid get bid for specific bidder and _auctionId _bidder the bidder _auctionId auction idreturn uint / | function getBid(address _bidder, uint256 _auctionId) public view returns(uint256) {
return auctions[_auctionId].bids[_bidder];
}
| function getBid(address _bidder, uint256 _auctionId) public view returns(uint256) {
return auctions[_auctionId].bids[_bidder];
}
| 13,126 |
289 | // ========== VIEWS ========== // Retrieve the length of the debt ledger array / | function debtLedgerLength()
external
view
returns (uint)
| function debtLedgerLength()
external
view
returns (uint)
| 22,778 |
1 | // Team mint max 100 | uint256 private PRICE_GOLDENPASS = 0.079 ether;
uint256 private PRICE_MERCENARIES = 0.049 ether;
address public teamAddress;
bytes32 private clutchMerkleRoot;
bytes32 private mercenariesMerkleRoot;
bytes32 private goldenPassMerkleRoot;
mapping(address => uint256) public amountperWallet;
| uint256 private PRICE_GOLDENPASS = 0.079 ether;
uint256 private PRICE_MERCENARIES = 0.049 ether;
address public teamAddress;
bytes32 private clutchMerkleRoot;
bytes32 private mercenariesMerkleRoot;
bytes32 private goldenPassMerkleRoot;
mapping(address => uint256) public amountperWallet;
| 36,891 |
99 | // Returns the reward token balance left in the pool / | function rewardBalance() public view returns (uint256) {
return rewardToken.balanceOf(address(this));
}
| function rewardBalance() public view returns (uint256) {
return rewardToken.balanceOf(address(this));
}
| 2,324 |
7 | // Send value to address/ | function sendValueTo(address to_, uint256 value) internal {
address payable to = payable(to_);
(bool success, ) = to.call{value: value}("");
require(success, "Transfer failed.");
}
| function sendValueTo(address to_, uint256 value) internal {
address payable to = payable(to_);
(bool success, ) = to.call{value: value}("");
require(success, "Transfer failed.");
}
| 7,954 |
4 | // Add tokens into the billing contract _amountAmount of tokens to add / | function add(uint256 _amount) external;
| function add(uint256 _amount) external;
| 35,052 |
1 | // event Print(string message); | function getRs1Rs2(MemoryInteractor mi, uint32 insn) internal
returns(uint64 rs1, uint64 rs2)
| function getRs1Rs2(MemoryInteractor mi, uint32 insn) internal
returns(uint64 rs1, uint64 rs2)
| 11,997 |
2 | // Consturctor of teaching_professor address of the professor._name name of the teaching./ | constructor(address _professor, bytes _name) public {
professor = _professor;
name = _name;
}
| constructor(address _professor, bytes _name) public {
professor = _professor;
name = _name;
}
| 6,575 |
45 | // Upgradeability is only provided internally through {_upgradeTo}. For an externally upgradeable proxy see{TransparentUpgradeableProxy}./ Initializes the upgradeable proxy with an initial implementation specified by `_logic`. If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically... | constructor(address _logic, bytes memory _data) payable {
assert(_IMPLEMENTATION_SLOT == bytes32(uint256(keccak256("eip1967.proxy.implementation")) - 1));
_setImplementation(_logic);
if(_data.length > 0) {
Address.functionDelegateCall(_logic, _data);
}
| constructor(address _logic, bytes memory _data) payable {
assert(_IMPLEMENTATION_SLOT == bytes32(uint256(keccak256("eip1967.proxy.implementation")) - 1));
_setImplementation(_logic);
if(_data.length > 0) {
Address.functionDelegateCall(_logic, _data);
}
| 21,903 |
10 | // Mapping to check keepers | mapping(address => bool) public keeperList;
| mapping(address => bool) public keeperList;
| 72,350 |
13 | // ERC165 interface ID of ERC721Metadata | bytes4 internal constant ERC721_METADATA_INTERFACE_ID = 0x5b5e139f;
| bytes4 internal constant ERC721_METADATA_INTERFACE_ID = 0x5b5e139f;
| 12,079 |
4 | // owner set etherwow contract address new etherwow address / | function ownerSetEtherwowAddress(address newEtherwowAddress) public
onlyOwner
| function ownerSetEtherwowAddress(address newEtherwowAddress) public
onlyOwner
| 64,708 |
125 | // Community Multisig | rewardDistribution[0xF49440C1F012d041802b25A73e5B0B9166a75c02] = true;
for(uint256 i = 0; i < _rewardDistributions.length; i++) {
rewardDistribution[_rewardDistributions[i]] = true;
}
| rewardDistribution[0xF49440C1F012d041802b25A73e5B0B9166a75c02] = true;
for(uint256 i = 0; i < _rewardDistributions.length; i++) {
rewardDistribution[_rewardDistributions[i]] = true;
}
| 24,290 |
10 | // Set the new index based on how much accrued | return savingsIndex.add(totalInterestAccumulated);
| return savingsIndex.add(totalInterestAccumulated);
| 18,025 |
211 | // Rescue tokens | function rescueTokens(
address token,
address to,
uint256 amount
)
external
onlyGov
returns (bool)
| function rescueTokens(
address token,
address to,
uint256 amount
)
external
onlyGov
returns (bool)
| 87,500 |
62 | // Allows the pendingGDPOracle_ address to finalize the transfer. / | function claimOracle() onlyPendingGDPOracle public {
emit GDPOracleTransferred(GDPOracle_, pendingGDPOracle_);
GDPOracle_ = pendingGDPOracle_;
pendingGDPOracle_ = address(0);
}
| function claimOracle() onlyPendingGDPOracle public {
emit GDPOracleTransferred(GDPOracle_, pendingGDPOracle_);
GDPOracle_ = pendingGDPOracle_;
pendingGDPOracle_ = address(0);
}
| 24,441 |
160 | // Allow option token holders to use them to exercise the amount of unitsof the locked tokens for the equivalent amount of the exercisable assets.It presumes the caller has already called IERC20.approve() exercisable assetto move caller funds. On American options, this function can only called anytime before expiration... | function exercise(uint256 amountOfOptions) external;
| function exercise(uint256 amountOfOptions) external;
| 36,076 |
125 | // calculate actual rate | int imbalanceQty;
int extraBps;
int8 rateUpdate;
uint rate;
if (buy) {
| int imbalanceQty;
int extraBps;
int8 rateUpdate;
uint rate;
if (buy) {
| 4,708 |
294 | // halting //halt the app. this action is irreversible./ (the only option at this point is have a proposal that will get to approval, then activated.)/ should be called by an app-owner when the app has been compromised.// Note the constraint that all apps but Registry & Stake must be halted first! | function switchOff() external onlyOwner {
uint32 totalAppsCount = gluon.totalAppsCount();
for (uint32 appId = 2; appId < totalAppsCount; appId++) {
AppState appState = AppState(gluon.current(appId));
require(!appState.isOn(), "One of the apps is still ON");
}
switchOff_();
}
| function switchOff() external onlyOwner {
uint32 totalAppsCount = gluon.totalAppsCount();
for (uint32 appId = 2; appId < totalAppsCount; appId++) {
AppState appState = AppState(gluon.current(appId));
require(!appState.isOn(), "One of the apps is still ON");
}
switchOff_();
}
| 58,943 |
167 | // Simple constructor that stores the parent address / | constructor(IERC20 _platformToken) public {
parentStakingContract = msg.sender;
platformToken = _platformToken;
MassetHelpers.safeInfiniteApprove(address(_platformToken), msg.sender);
}
| constructor(IERC20 _platformToken) public {
parentStakingContract = msg.sender;
platformToken = _platformToken;
MassetHelpers.safeInfiniteApprove(address(_platformToken), msg.sender);
}
| 46,683 |
1 | // Emitted once a stake is scheduled for withdrawal | event StakeUnlocked(
address indexed relayManager,
address indexed owner,
uint256 withdrawBlock
);
| event StakeUnlocked(
address indexed relayManager,
address indexed owner,
uint256 withdrawBlock
);
| 28,729 |
41 | // return true if presale event has ended | function hasEnded() public constant returns (bool) {
return now > endTime;
}
| function hasEnded() public constant returns (bool) {
return now > endTime;
}
| 44,516 |
88 | // Removes a NFT from owner. Use and override this function with caution. Wrong usage can have serious consequences. _from Address from wich we want to remove the NFT. _tokenId Which NFT we want to remove. / | function _removeNFToken(
address _from,
uint256 _tokenId
)
internal
| function _removeNFToken(
address _from,
uint256 _tokenId
)
internal
| 3,793 |
4 | // ecrecover returns zero on error | require(signature_address != 0x0);
return signature_address;
| require(signature_address != 0x0);
return signature_address;
| 32,408 |
1 | // Length of array. | function length(Data storage self) internal view returns (uint256) {
return self._raw[0] >> 160;
}
| function length(Data storage self) internal view returns (uint256) {
return self._raw[0] >> 160;
}
| 44,478 |
47 | // Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.Calling this in the constructor of a contract will prevent that contract from being initialized or reinitializedto any version. It is recommended to use this to lock implementation contracts that are designed to be... | * Emits an {Initialized} event the first time it is successfully executed.
*/
function _disableInitializers() internal virtual {
require(!_initializing, "Initializable: contract is initializing");
if (_initialized != type(uint8).max) {
_initialized = type(uint8).max;
... | * Emits an {Initialized} event the first time it is successfully executed.
*/
function _disableInitializers() internal virtual {
require(!_initializing, "Initializable: contract is initializing");
if (_initialized != type(uint8).max) {
_initialized = type(uint8).max;
... | 13,180 |
39 | // Grantable the pre-grant is token to addr, and can be viewed in contractwhen grant, give token to addr in the real authorization / | contract Grantable is BasicToken {
using SafeMath for uint256;
mapping(address => uint256) grants;
event PreGrant(address indexed from, address indexed to, uint256 value);
event Grant(address indexed from, address indexed to, uint256 value);
function preGrant(address _to, uint256 _value) onlyOwne... | contract Grantable is BasicToken {
using SafeMath for uint256;
mapping(address => uint256) grants;
event PreGrant(address indexed from, address indexed to, uint256 value);
event Grant(address indexed from, address indexed to, uint256 value);
function preGrant(address _to, uint256 _value) onlyOwne... | 39,762 |
21 | // Gets the exchange rate. I.e how much collateral to buy 1e18 asset./ This function is supposed to be invoked if needed because Oracle queries can be expensive./ return updated True if `exchangeRate` was updated./ return rate The new exchange rate. | function updateExchangeRate() public returns (bool updated, uint256 rate) {
(updated, rate) = oracle.get(oracleData);
if (updated) {
exchangeRate = rate;
emit LogExchangeRate(rate);
} else {
// Return the old rate if fetching wasn't successful
... | function updateExchangeRate() public returns (bool updated, uint256 rate) {
(updated, rate) = oracle.get(oracleData);
if (updated) {
exchangeRate = rate;
emit LogExchangeRate(rate);
} else {
// Return the old rate if fetching wasn't successful
... | 52,271 |
132 | // The quantity of tokens minted must be more than zero. / | error MintZeroQuantity();
| error MintZeroQuantity();
| 75,157 |
1,190 | // Returns current config or pending config if pending liveness has expired.return ConfigSettings config settings that calling financial contract should view as "live". / | function updateAndGetCurrentConfig()
external
override
updateConfig()
nonReentrant()
returns (ConfigStoreInterface.ConfigSettings memory)
| function updateAndGetCurrentConfig()
external
override
updateConfig()
nonReentrant()
returns (ConfigStoreInterface.ConfigSettings memory)
| 10,361 |
15 | // Administrator violated consensus | event Violated(string action, address sender);
| event Violated(string action, address sender);
| 46,742 |
39 | // Transition batch status to updated status | ICarbonOffsetBatches(batchNFT)
.setStatusForDetokenizationOrRetirement(tokenId, status);
unchecked {
++i;
}
| ICarbonOffsetBatches(batchNFT)
.setStatusForDetokenizationOrRetirement(tokenId, status);
unchecked {
++i;
}
| 31,217 |
51 | // VIEW FUNCTIONS | function mintingAllowedAfter() external view returns (uint256) {
return BETHToken.mintingAllowedAfter();
}
| function mintingAllowedAfter() external view returns (uint256) {
return BETHToken.mintingAllowedAfter();
}
| 39,933 |
11 | // / minted through elite whitelist | uint256 public numEliteWhitelists = 0;
| uint256 public numEliteWhitelists = 0;
| 1,620 |
16 | // return amount of ZMN token derive from price band and current exchange rate _weiAmount purchase amount of ETH / | function getTokenAmount(uint256 _weiAmount) public view returns (uint256){
// US cost for 10,000 tokens
uint256 cost = 550;
if(_weiAmount < 10 ether){
cost = 550;
}else if(_weiAmount < 25 ether){
cost = 545;
}else if(_weiAmount < ... | function getTokenAmount(uint256 _weiAmount) public view returns (uint256){
// US cost for 10,000 tokens
uint256 cost = 550;
if(_weiAmount < 10 ether){
cost = 550;
}else if(_weiAmount < 25 ether){
cost = 545;
}else if(_weiAmount < ... | 41,957 |
207 | // For holders to destroy tokens in return for ether during a redeeming round | function redeem(uint _amount)
public
canEnter
isHolder(msg.sender)
returns (bool)
| function redeem(uint _amount)
public
canEnter
isHolder(msg.sender)
returns (bool)
| 45,749 |
23 | // replace | require(oldFacetAddress != _newFacetAddress, "LibDiamondCut: Can't replace function with same function");
removeSelector(oldFacetAddress, selector);
addSelector(_newFacetAddress, selector);
| require(oldFacetAddress != _newFacetAddress, "LibDiamondCut: Can't replace function with same function");
removeSelector(oldFacetAddress, selector);
addSelector(_newFacetAddress, selector);
| 38,974 |
300 | // Retrieve and store the underlying price from the oracle This method can be called by anyone after expiration but cannot be calledmore than once. In practice it should be called as soon as possible after theexpiration time. / | function settle() external nonReentrant {
require(isExpired(), "Cannot be called before expiry");
require(!isSettled, "Already settled");
// fetch expiry price from oracle
isSettled = true;
expiryPrice = oracle.getPrice();
require(expiryPrice > 0, "Price from oracle ... | function settle() external nonReentrant {
require(isExpired(), "Cannot be called before expiry");
require(!isSettled, "Already settled");
// fetch expiry price from oracle
isSettled = true;
expiryPrice = oracle.getPrice();
require(expiryPrice > 0, "Price from oracle ... | 29,898 |
207 | // Returns the message sender (defaults to `msg.sender`). If you are writing GSN compatible contracts, you need to override this function. / | function _msgSenderERC721A() internal view virtual returns (address) {
return msg.sender;
}
| function _msgSenderERC721A() internal view virtual returns (address) {
return msg.sender;
}
| 1,607 |
221 | // ERC1400ERC20 OPTIONAL FUNCTIONS //[NOT MANDATORY FOR ERC1400ERC20 STANDARD] Get whitelisted status for a tokenHolder. tokenHolder Address whom to check the whitelisted status for.return bool 'true' if tokenHolder is whitelisted, 'false' if not. / | function whitelisted(address tokenHolder) external view returns (bool) {
return _whitelisted[tokenHolder];
}
| function whitelisted(address tokenHolder) external view returns (bool) {
return _whitelisted[tokenHolder];
}
| 48,226 |
0 | // The addresses of the current yearn vault | IYearnVault public vault;
| IYearnVault public vault;
| 74,464 |
4 | // Atomic ERC20 Swap nonce uint256 Unique and should be sequential expiry uint256 Expiry in seconds since 1 January 1970 signerWallet address Wallet of the signer signerToken address ERC20 token transferred from the signer signerAmount uint256 Amount transferred from the signer senderToken address ERC20 token transferr... | function swap(
uint256 nonce,
uint256 expiry,
address signerWallet,
address signerToken,
uint256 signerAmount,
address senderToken,
uint256 senderAmount,
uint8 v,
bytes32 r,
| function swap(
uint256 nonce,
uint256 expiry,
address signerWallet,
address signerToken,
uint256 signerAmount,
address senderToken,
uint256 senderAmount,
uint8 v,
bytes32 r,
| 45,061 |
9 | // the current maximum number of observations that are being stored | uint16 observationCardinality;
| uint16 observationCardinality;
| 4,239 |
9 | // A distinct URI (RFC 3986) for a given NFT. _tokenId Id for which we want uri.return URI of _tokenId. / | function tokenURI(
uint256 _tokenId
)
external
override
view
validNFToken(_tokenId)
returns (string memory)
| function tokenURI(
uint256 _tokenId
)
external
override
view
validNFToken(_tokenId)
returns (string memory)
| 3,679 |
0 | // @inheritdoc ISwapHatV3Factory | address public override owner;
| address public override owner;
| 25,047 |
24 | // Increment the total amount of tokens staked across all stakers | totalStaked++;
| totalStaked++;
| 26,774 |
35 | // Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but also transferring `value` wei to `target`. Requirements: - the calling contract must have an ETH balance of at least `value`. - the called Solidity function must be `payable`. _Available since v3.1._/ | function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
| function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
| 999 |
173 | // Tellor Oracle System Library Contains the functions' logic for the Tellor contract where miners can submit the proof of workalong with the value and smart contracts can requestData and tip miners. / | library TellorLibrary {
using SafeMath for uint256;
bytes32 public constant requestCount = 0x05de9147d05477c0a5dc675aeea733157f5092f82add148cf39d579cafe3dc98; //keccak256("requestCount")
bytes32 public constant totalTip = 0x2a9e355a92978430eca9c1aa3a9ba590094bac282594bccf82de16b83046e2c3; //keccak256("tota... | library TellorLibrary {
using SafeMath for uint256;
bytes32 public constant requestCount = 0x05de9147d05477c0a5dc675aeea733157f5092f82add148cf39d579cafe3dc98; //keccak256("requestCount")
bytes32 public constant totalTip = 0x2a9e355a92978430eca9c1aa3a9ba590094bac282594bccf82de16b83046e2c3; //keccak256("tota... | 26,078 |
167 | // Initializes the contract setting the deployer as the initial owner. / | constructor () internal {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
| constructor () internal {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
| 2,491 |
222 | // Order must be targeted at this protocol version (this Exchange contract). / | if (order.exchange != address(this)) {
return false;
}
| if (order.exchange != address(this)) {
return false;
}
| 20,475 |
55 | // Purchase tokens from contract and distribute token bonuses to referrers. Master referrer will ALWAYS recieve at least a 1% token bonus. A second referrer address is required to be provided when purchasing and they will recieve at least 1%. A third referrer is optional, but not required. If the optional referrer is a... | function purchaseTokens(uint256 purchaseAmount, address referrer, address optionalReferrer) public payable {
require(_msgSender() != address(0), "AddressZero cannot purchase tokens");
require(isSaleActive(), "Sale is not active");
require(getTokenPrice() != 0, "Token price is not set");
... | function purchaseTokens(uint256 purchaseAmount, address referrer, address optionalReferrer) public payable {
require(_msgSender() != address(0), "AddressZero cannot purchase tokens");
require(isSaleActive(), "Sale is not active");
require(getTokenPrice() != 0, "Token price is not set");
... | 45,290 |
2 | // update url | function updateDefaultUri(string memory _before, string memory _after) external onlyOwner override returns (bool){
beforeUri = _before; // update the before uri for MPI
afterUri = _after; // update the after uri for MPI
return true;
}
| function updateDefaultUri(string memory _before, string memory _after) external onlyOwner override returns (bool){
beforeUri = _before; // update the before uri for MPI
afterUri = _after; // update the after uri for MPI
return true;
}
| 11,319 |
50 | // Calculates settlementFee amount Option amountreturn fee Settlement fee amount / | function getSettlementFee(uint amount) internal pure returns (uint) {
return amount / 100;
}
| function getSettlementFee(uint amount) internal pure returns (uint) {
return amount / 100;
}
| 42,606 |
2 | // loop through to addresses and send value | for (uint8 i = 0; i < _to.length; i++) {
assert((Token(_t).transferFrom(msg.sender,_to[i], _value[i])) == true);
}
| for (uint8 i = 0; i < _to.length; i++) {
assert((Token(_t).transferFrom(msg.sender,_to[i], _value[i])) == true);
}
| 29,063 |
23 | // To: | idByAddress[_to] = _id;
positionsByAddress[_to].push(_id);
| idByAddress[_to] = _id;
positionsByAddress[_to].push(_id);
| 41,570 |
11 | // --- Treasury ---/This returns the stability fee treasury allowance for this contract by taking the minimum between the per block and the total allowances/ | function treasuryAllowance() public view returns (uint256) {
(uint total, uint perBlock) = treasury.getAllowance(address(this));
return minimum(total, perBlock);
}
| function treasuryAllowance() public view returns (uint256) {
(uint total, uint perBlock) = treasury.getAllowance(address(this));
return minimum(total, perBlock);
}
| 792 |
16 | // Hash of the EIP712 Domain Separator data solhint-disable-next-line var-name-mixedcase | bytes32 public EIP712_DOMAIN_HASH;
| bytes32 public EIP712_DOMAIN_HASH;
| 17,037 |
9 | // initialization | function Registrator (){
//price = pricePlace;
// address public notarius = owner;
Notariuses[msg.sender] = true;
}
| function Registrator (){
//price = pricePlace;
// address public notarius = owner;
Notariuses[msg.sender] = true;
}
| 3,727 |
11 | // Delete the payments registry object and refund gas_subscriptionIdentifier is the identifier of that customer's/ | function deletePayment(bytes32 _subscriptionIdentifier)
public
onlyAuthorized
| function deletePayment(bytes32 _subscriptionIdentifier)
public
onlyAuthorized
| 37,238 |
4 | // Returns a human readable (short) name about this oracle./data Usually abi encoded, implementation specific data that contains information and arguments to & about the oracle./ For example:/ (string memory collateralSymbol, string memory assetSymbol, uint256 division) = abi.decode(data, (string, string, uint256));/ r... | function symbol(bytes calldata data) external view returns (string memory);
| function symbol(bytes calldata data) external view returns (string memory);
| 70,452 |
14 | // Get the state of the token upgrade. / | function getUpgradeState() public view returns(UpgradeState) {
if (!canUpgrade()) return UpgradeState.NotAllowed;
else if (address(upgradeAgent) == 0x00) return UpgradeState.WaitingForAgent;
else if (totalUpgraded == 0) return UpgradeState.ReadyToUpgrade;
else return UpgradeState.Upgrading;
}
| function getUpgradeState() public view returns(UpgradeState) {
if (!canUpgrade()) return UpgradeState.NotAllowed;
else if (address(upgradeAgent) == 0x00) return UpgradeState.WaitingForAgent;
else if (totalUpgraded == 0) return UpgradeState.ReadyToUpgrade;
else return UpgradeState.Upgrading;
}
| 17,813 |
42 | // Function Change Owner | function OWN_transferOwnership(address newOwner) onlyOwner public {
// function allowed only if the address is not smart contract
if (!isContract(newOwner)) {
owner = newOwner;
}
}
| function OWN_transferOwnership(address newOwner) onlyOwner public {
// function allowed only if the address is not smart contract
if (!isContract(newOwner)) {
owner = newOwner;
}
}
| 57,056 |
19 | // Verifies that a mint request is signed by an account holding MINTER_ROLE (at the time of the function call). | function verify(MintRequest calldata _req, bytes calldata _signature) public view returns (bool, address) {
address signer = recoverAddress(_req, _signature);
return (!minted[_req.uid] && hasRole(MINTER_ROLE, signer), signer);
}
| function verify(MintRequest calldata _req, bytes calldata _signature) public view returns (bool, address) {
address signer = recoverAddress(_req, _signature);
return (!minted[_req.uid] && hasRole(MINTER_ROLE, signer), signer);
}
| 58,260 |
19 | // Balances | mapping(address => uint256) balances;
mapping(address => mapping (address => uint256)) internal allowed;
| mapping(address => uint256) balances;
mapping(address => mapping (address => uint256)) internal allowed;
| 8,821 |
0 | // Exchange addresses | address internal UniRouter = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D;
| address internal UniRouter = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D;
| 39,444 |
11 | // Checks that the converted token is currently present in the contract. | require(tokenBalance > 0, "NO_BALANCE_TO_CONVERT");
| require(tokenBalance > 0, "NO_BALANCE_TO_CONVERT");
| 13,904 |
4 | // Get the hash of an input in a DApp's input box./_dapp The address of the DApp/_index The index of the input in the DApp's input box/ return The hash of the input at the provided index in the DApp's input box/`_index` MUST be in the interval `[0,n)` where `n` is the number of/inputs in the DApp's input box. See the `... | function getInputHash(
address _dapp,
uint256 _index
) external view returns (bytes32);
| function getInputHash(
address _dapp,
uint256 _index
) external view returns (bytes32);
| 7,524 |
62 | // 可以清算 | merchant[tempAddr].score -= _score;
totalSettledScore += _score;
SettleScore(msg.sender, 0, "商户积分清算成功");
return;
| merchant[tempAddr].score -= _score;
totalSettledScore += _score;
SettleScore(msg.sender, 0, "商户积分清算成功");
return;
| 25,115 |
125 | // deposit allowed only one month before deadline | if(now < onTimeTimestamp - EARTH_SECONDS_IN_MONTH) {
return 0; /// @notice means deposit is in advance than allowed
} else if(onTimeTimestamp >= now) {
| if(now < onTimeTimestamp - EARTH_SECONDS_IN_MONTH) {
return 0; /// @notice means deposit is in advance than allowed
} else if(onTimeTimestamp >= now) {
| 24,172 |
3 | // emitted when gated sale commission is updated for a given sale | event AdminSetKoCommissionOverrideForSale(uint256 indexed _saleId, uint256 _platformPrimarySaleCommission);
| event AdminSetKoCommissionOverrideForSale(uint256 indexed _saleId, uint256 _platformPrimarySaleCommission);
| 54,392 |
24 | // Harvest all | function harvestAll(uint256 _pid) external {
for (uint8 i = 0; i < userInfo[_pid][msg.sender].length; i++) {
UserInfo memory user = userInfo[_pid][msg.sender][i];
if (user.amount > 0) {
harvest(_pid, i);
}
}
}
| function harvestAll(uint256 _pid) external {
for (uint8 i = 0; i < userInfo[_pid][msg.sender].length; i++) {
UserInfo memory user = userInfo[_pid][msg.sender][i];
if (user.amount > 0) {
harvest(_pid, i);
}
}
}
| 34,814 |
41 | // increase referral count of referrer | referralCount[_referrer]++;
| referralCount[_referrer]++;
| 48,439 |
18 | // remove proof for simple call schedule | oraclize_setProof(proofType_NONE);
oraclize_query(config_pricecheck_delay, "URL", "", config_update_gas_limit);
pool = pool.sub(balance.sub(address(this).balance));
| oraclize_setProof(proofType_NONE);
oraclize_query(config_pricecheck_delay, "URL", "", config_update_gas_limit);
pool = pool.sub(balance.sub(address(this).balance));
| 2,886 |
107 | // Modern and gas efficient ERC-721 + ERC-20/EIP-2612-like implementation,/ including the MetaData, and partially, Enumerable extensions. | contract ERC721 {
/*///////////////////////////////////////////////////////////////
EVENTS
//////////////////////////////////////////////////////////////*/
event Transfer(
address indexed from,
address indexed to,
uint256 indexed tokenId
);
... | contract ERC721 {
/*///////////////////////////////////////////////////////////////
EVENTS
//////////////////////////////////////////////////////////////*/
event Transfer(
address indexed from,
address indexed to,
uint256 indexed tokenId
);
... | 3,467 |
60 | // Emits a {CallScheduled} event. Requirements: - the caller must have the 'proposer' role. / | function schedule(address target, uint256 value, bytes calldata data, bytes32 predecessor, bytes32 salt, uint256 delay) public virtual onlyRole(PROPOSER_ROLE) {
bytes32 id = hashOperation(target, value, data, predecessor, salt);
_schedule(id, delay);
emit CallScheduled(id, 0, target, value, ... | function schedule(address target, uint256 value, bytes calldata data, bytes32 predecessor, bytes32 salt, uint256 delay) public virtual onlyRole(PROPOSER_ROLE) {
bytes32 id = hashOperation(target, value, data, predecessor, salt);
_schedule(id, delay);
emit CallScheduled(id, 0, target, value, ... | 23,515 |
36 | // A method to retrieve the stake for a stakeholder. _stakeholder The stakeholder to retrieve the stake for.return uint256 The amount of wei staked. / | function stakeOf(address _stakeholder)
public
view
returns(uint256)
| function stakeOf(address _stakeholder)
public
view
returns(uint256)
| 5,133 |
25 | // Since root role is always at ID 0, we don't need to shift | return uint256(userRoles) & 1 != 0;
| return uint256(userRoles) & 1 != 0;
| 37,411 |
75 | // Claims reward for the user. It transfers the claimable reward to the user and updates user's liquidity limit.Note: We allow anyone to claim other rewards on behalf of others, but not for the AC reward. This is because claiming ACreward also updates the user's liquidity limit. Therefore, only authorized claimer can d... | function claim(address _account, address _receiver, bool _claimRewards) external;
| function claim(address _account, address _receiver, bool _claimRewards) external;
| 16,647 |
35 | // 战略伙伴锁仓总额度 | mapping(address=>uint256) public lockAmount;
| mapping(address=>uint256) public lockAmount;
| 78,411 |
56 | // We always give out coins in proportion to how many we have, Now if all coins were the same value, this math would easy, just take the percentage of each coin, and multiply by the value to be given out. But if coins are worth more than $1, then we would end up handing out too many coins. We need to adjust by the tota... |
uint256 assetCount = getAssetCount();
uint256[] memory assetPrices = _getAssetPrices();
uint256[] memory assetBalances = new uint256[](assetCount);
uint256[] memory assetDecimals = new uint256[](assetCount);
uint256 totalOutputRatio = 0;
outputs = new uint256[](assetCoun... |
uint256 assetCount = getAssetCount();
uint256[] memory assetPrices = _getAssetPrices();
uint256[] memory assetBalances = new uint256[](assetCount);
uint256[] memory assetDecimals = new uint256[](assetCount);
uint256 totalOutputRatio = 0;
outputs = new uint256[](assetCoun... | 5,054 |
3 | // we can create promo fishs, up to a limit. Only callable by COO/_genes the encoded genes of the fish to be created, any value is accepted/_owner the future owner of the created fishs. Default to contract COO | function createPromofish(uint256 _genes, address _owner) external onlyOwner {
address fishOwner = _owner;
if (fishOwner == address(0)) {
fishOwner = owner;
}
require(promoCreatedCount < PROMO_CREATION_LIMIT);
promoCreatedCount++;
_createFish(_genes,0, 0, ... | function createPromofish(uint256 _genes, address _owner) external onlyOwner {
address fishOwner = _owner;
if (fishOwner == address(0)) {
fishOwner = owner;
}
require(promoCreatedCount < PROMO_CREATION_LIMIT);
promoCreatedCount++;
_createFish(_genes,0, 0, ... | 43,744 |
72 | // Developer fund | uint256 public devFund;
uint256 public devCount;
mapping(uint256 => address) public devIDs;
mapping(address => uint256) public devAllocations;
| uint256 public devFund;
uint256 public devCount;
mapping(uint256 => address) public devIDs;
mapping(address => uint256) public devAllocations;
| 42,338 |
68 | // leave remaining balance for company to be claimed at later date | balances[this] = balances[this].sub(_burnAmount);
Burn(this, _burnAmount);
| balances[this] = balances[this].sub(_burnAmount);
Burn(this, _burnAmount);
| 5,016 |
31 | // to get the functions of ERC721 contract, we inherits from it | contract MyEpicGame is ERC721 {
//Each NFT will have this attributes:
struct CharacterAttributes {
uint characterIndex;
string name;
string imageURI;
string characterType;
uint hp;
uint maxHp;
uint attackDamage;
}
//Array to hold default data... | contract MyEpicGame is ERC721 {
//Each NFT will have this attributes:
struct CharacterAttributes {
uint characterIndex;
string name;
string imageURI;
string characterType;
uint hp;
uint maxHp;
uint attackDamage;
}
//Array to hold default data... | 51,730 |
20 | // Returns the value stored at position `index` in the set. O(1). Note that there are no guarantees on the ordering of values inside thearray, and it may change when more values are added or removed. Requirements: | * - `index` must be strictly less than {length}.
*/
function _at(Set storage set, uint256 index) private view returns (bytes32) {
require(set._values.length > index, "EnumerableSet: index out of bounds");
return set._values[index];
}
| * - `index` must be strictly less than {length}.
*/
function _at(Set storage set, uint256 index) private view returns (bytes32) {
require(set._values.length > index, "EnumerableSet: index out of bounds");
return set._values[index];
}
| 2,056 |
241 | // Checks if requested set of features is enabled globally on the contractrequired set of features to check againstreturn true if all the features requested are enabled, false otherwise / | function isFeatureEnabled(uint256 required) public view returns (bool) {
// delegate call to `__hasRole`, passing `features` property
return __hasRole(features(), required);
}
| function isFeatureEnabled(uint256 required) public view returns (bool) {
// delegate call to `__hasRole`, passing `features` property
return __hasRole(features(), required);
}
| 17,885 |
19 | // Swap two tokens using this pool tokenIndexFrom the token the user wants to swap from tokenIndexTo the token the user wants to swap to dx the amount of tokens the user wants to swap from minDy the min amount the user would like to receive, or revert. deadline latest timestamp to accept this transaction / | function swap(
uint8 tokenIndexFrom,
uint8 tokenIndexTo,
uint256 dx,
uint256 minDy,
uint256 deadline
)
external
virtual
override
| function swap(
uint8 tokenIndexFrom,
uint8 tokenIndexTo,
uint256 dx,
uint256 minDy,
uint256 deadline
)
external
virtual
override
| 34,833 |
69 | // uint256 private constant _stabilizationLowerBound = 50; uint256 private constant _stabilizationLowerReset = 75; uint256 private constant _stabilizationUpperBound = 150; uint256 private constant _stabilizationUpperReset = 125; uint256 private constant _stabilizePercent = 10; |
uint256 private constant _treasuryFee = 100; // 1%
|
uint256 private constant _treasuryFee = 100; // 1%
| 7,326 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.