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 |
|---|---|---|---|---|
111 | // Counts the number of nonoverlapping occurrences of `needle` in `self`. self The slice to search. needle The text to search for in `self`.return The number of occurrences of `needle` found in `self`. / | function count(slice memory self, slice memory needle) internal pure returns (uint cnt) {
uint ptr = findPtr(self._len, self._ptr, needle._len, needle._ptr) + needle._len;
while (ptr <= self._ptr + self._len) {
cnt++;
ptr = findPtr(self._len - (ptr - self._ptr), ptr, needle._... | function count(slice memory self, slice memory needle) internal pure returns (uint cnt) {
uint ptr = findPtr(self._len, self._ptr, needle._len, needle._ptr) + needle._len;
while (ptr <= self._ptr + self._len) {
cnt++;
ptr = findPtr(self._len - (ptr - self._ptr), ptr, needle._... | 11,170 |
74 | // allow stage0 token trading (run by admin ) / | function start_Stage0_Trade() internal
onlyAdmin
| function start_Stage0_Trade() internal
onlyAdmin
| 46,100 |
48 | // mint OHM needed and store amount of rewards for distribution | send_ = value.sub( _profit );
IERC20Mintable( Time ).mint( msg.sender, send_ );
totalReserves = totalReserves.add( value );
emit ReservesUpdated( totalReserves );
emit Deposit( _token, _amount, value );
| send_ = value.sub( _profit );
IERC20Mintable( Time ).mint( msg.sender, send_ );
totalReserves = totalReserves.add( value );
emit ReservesUpdated( totalReserves );
emit Deposit( _token, _amount, value );
| 7,861 |
9 | // PublishingData updated for this edition/admin function indexer feedback | event PublishingDataUpdated(
address indexed target,
address sender,
string title,
string description,
string recordLabel,
string publisher,
string locationCreated,
string releaseDate
);
| event PublishingDataUpdated(
address indexed target,
address sender,
string title,
string description,
string recordLabel,
string publisher,
string locationCreated,
string releaseDate
);
| 24,137 |
109 | // Whitelist Mint | function setWhitelistMint(bool bool_, uint256 time_) external onlyOwner {
_setWhitelistMint(bool_, time_);
}
| function setWhitelistMint(bool bool_, uint256 time_) external onlyOwner {
_setWhitelistMint(bool_, time_);
}
| 16,491 |
38 | // Allows minion to withdraw funds from Aavedestination is limited to the DAO or the minion for security uses the proposeWithdrawCollateral() function in order to submit a proposal for the withdraw action checks health factory at point of execution token The underlying token to be withdrawn from Aaveamount The amount t... | ) external memberOnly returns (uint256) {
(uint256 aTokenBal,,,,) = getOurCompactReserveData(token);
//Check health before collateral withdraw proposal
require(isHealthy(), "AP::not healthy enough");
//Check aTokens available is <= amount being withdrawn
require(aTokenBal <= ... | ) external memberOnly returns (uint256) {
(uint256 aTokenBal,,,,) = getOurCompactReserveData(token);
//Check health before collateral withdraw proposal
require(isHealthy(), "AP::not healthy enough");
//Check aTokens available is <= amount being withdrawn
require(aTokenBal <= ... | 19,583 |
193 | // ensure EIP-3009 transfers are enabled | require(isFeatureEnabled(FEATURE_EIP3009_TRANSFERS), "EIP3009 transfers are disabled");
| require(isFeatureEnabled(FEATURE_EIP3009_TRANSFERS), "EIP3009 transfers are disabled");
| 50,111 |
25 | // ------------------------------------------------------------------------ Don't accept ethers - no payable modifier ------------------------------------------------------------------------ | function () {
}
| function () {
}
| 28,763 |
150 | // Provably Rare Gems/Sorawit Suriyakarn (swit.eth / https:twitter.com/nomorebear) | contract ProvablyRareGemV2 is Initializable, ERC1155Supply {
event Create(uint indexed kind);
event Mine(address indexed miner, uint indexed kind);
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
string public name;
struct Gem {
string name; // Gem name
string col... | contract ProvablyRareGemV2 is Initializable, ERC1155Supply {
event Create(uint indexed kind);
event Mine(address indexed miner, uint indexed kind);
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
string public name;
struct Gem {
string name; // Gem name
string col... | 32,241 |
6 | // address of UBI token. | address private constant UBI = 0xDd1Ad9A21Ce722C151A836373baBe42c868cE9a4;
| address private constant UBI = 0xDd1Ad9A21Ce722C151A836373baBe42c868cE9a4;
| 43,961 |
29 | // execute raw order on registered marketplace solhint-disable-next-line avoid-low-level-calls | (bool success, ) = marketplace.call(tradeData);
if (!success) {
revert Errors.MartketplaceFailedToTrade();
}
| (bool success, ) = marketplace.call(tradeData);
if (!success) {
revert Errors.MartketplaceFailedToTrade();
}
| 13,765 |
10 | // Ban a citizen for a limited or unlimited amount of time. Only callable by Banning Auhoritiescitizen Citizen account to be bannedduration Duration of the bannishment. If it's null, the citizen is banned for an unlimited amount of time. / | function Ban_Citizen(address citizen, uint duration)external{
require(Citizens_Banning_Authorities.contains(msg.sender), "Banning Authority Only");
require(Citizens_List.contains(citizen), "Not Registered Citizen");
Citizens[citizen].Active=false;
if(duration>0){
Ci... | function Ban_Citizen(address citizen, uint duration)external{
require(Citizens_Banning_Authorities.contains(msg.sender), "Banning Authority Only");
require(Citizens_List.contains(citizen), "Not Registered Citizen");
Citizens[citizen].Active=false;
if(duration>0){
Ci... | 6,562 |
43 | // if ether is sent to this address, send it back. | revert();
| revert();
| 27,340 |
74 | // 进行审核的警方用户获得积分+2 | _transfer(administrator, msg.sender, 2);
| _transfer(administrator, msg.sender, 2);
| 50,951 |
29 | // Payment to the seller after royalties. // Number of primary royalty receivers (only used in primary sale). //Payments to the royalty receivers, in the same order as royaltySplits.(only used in primary sale) / | uint256[] memory royaltyPayments;
uint256 marketplaceFee;
| uint256[] memory royaltyPayments;
uint256 marketplaceFee;
| 36,505 |
51 | // Adds token to whitelist and approvedTokens / associates aToken / max approves aave deposit for underlying | if(proposal.tributeToken != address(0)){
require(approvedTokens.length < MAX_TOKEN_WHITELIST_COUNT, "too many tokens already");
approvedTokens.push(proposal.tributeToken);
tokenWhitelist[proposal.tributeToken] = true;
aTokenAssignments[proposal... | if(proposal.tributeToken != address(0)){
require(approvedTokens.length < MAX_TOKEN_WHITELIST_COUNT, "too many tokens already");
approvedTokens.push(proposal.tributeToken);
tokenWhitelist[proposal.tributeToken] = true;
aTokenAssignments[proposal... | 32,104 |
63 | // Calculate the effective value by going from source -> USD -> destination | destinationRate = _getRate(destinationCurrencyKey);
| destinationRate = _getRate(destinationCurrencyKey);
| 38,622 |
109 | // given an input amount of an asset and pair reserves, returns the maximum output amount of the other assetamountIn input amount of the asset reserveIn reserves of the asset being sold reserveOut reserves if the asset being purchased / |
function getAmountOut(
uint amountIn,
uint reserveIn,
uint reserveOut
)
internal
pure
returns (uint amountOut)
|
function getAmountOut(
uint amountIn,
uint reserveIn,
uint reserveOut
)
internal
pure
returns (uint amountOut)
| 10,248 |
3 | // _validateDomainName() is very expensive, can't do anything without tvm.accept() first; if the deployment is done by internal message, tvm.accept() is not needed, but if deployment is via external message, can't help it; Be sure that you use a valid "_domainName", otherwise you will loose your Crystals; | tvm.accept();
_nameIsValid = _validateDomainName(_domainName);
require(_nameIsValid, ERROR_DOMAIN_NAME_NOT_VALID);
(string[] segments, string parentName) = _parseDomainName(_domainName);
_whoisInfo.segmentsCount = uint8(segments.length);
_whoisInfo.domainNam... | tvm.accept();
_nameIsValid = _validateDomainName(_domainName);
require(_nameIsValid, ERROR_DOMAIN_NAME_NOT_VALID);
(string[] segments, string parentName) = _parseDomainName(_domainName);
_whoisInfo.segmentsCount = uint8(segments.length);
_whoisInfo.domainNam... | 18,242 |
3 | // If the page extends past the end of the list, truncate it. | if (endIndex > set.elements.length) {
endIndex = set.elements.length;
}
| if (endIndex > set.elements.length) {
endIndex = set.elements.length;
}
| 11,554 |
56 | // Records that an edition has been created artist - the edition artist totalAvailable - the edition size priceInWei - the edition price in wei / | function recordSuccessfulMint(address artist, uint256 totalAvailable, uint256 priceInWei) external returns (bool);
| function recordSuccessfulMint(address artist, uint256 totalAvailable, uint256 priceInWei) external returns (bool);
| 50,811 |
44 | // Our DividendDistributor contract responsible for distributing the earn token / | contract DividendDistributor is IDividendDistributor {
using SafeMath for uint256;
address _token;
struct Share {
uint256 amount;
uint256 totalExcluded;
uint256 totalRealised;
}
// EARN
IBEP20 BTCB = IBEP20(0x7130d2A12B9BCbFAe4f2634d864A1Ee1Ce3Ead9c);
address WBNB... | contract DividendDistributor is IDividendDistributor {
using SafeMath for uint256;
address _token;
struct Share {
uint256 amount;
uint256 totalExcluded;
uint256 totalRealised;
}
// EARN
IBEP20 BTCB = IBEP20(0x7130d2A12B9BCbFAe4f2634d864A1Ee1Ce3Ead9c);
address WBNB... | 29,899 |
170 | // minimum reserve price in wei | uint256 reserve;
| uint256 reserve;
| 34,645 |
4 | // map of legacyChainid => v2 chainId. allows lookup thru to RelayerV2 contract (which is updated frequently) | mapping(uint16 => uint16) public legacyToV2ChainId; // legacy ChainId => v2 chainId
| mapping(uint16 => uint16) public legacyToV2ChainId; // legacy ChainId => v2 chainId
| 35,046 |
47 | // Guaranteed to run at least once because of the prior if statements. | while (pos != 0 && _isPricedLtOrEq(id, pos)) {
oldPos = pos;
pos = rank[pos].prev;
}
| while (pos != 0 && _isPricedLtOrEq(id, pos)) {
oldPos = pos;
pos = rank[pos].prev;
}
| 13,004 |
65 | // Get functing info of user/address. It will return how much funding the user has made in terms of wei / | function getFundingInfoForUser(address _user)public view nonZeroAddress(_user) returns(uint256){
return vault.deposited(_user);
}
| function getFundingInfoForUser(address _user)public view nonZeroAddress(_user) returns(uint256){
return vault.deposited(_user);
}
| 32,537 |
137 | // Addresses that can control all users accounts | mapping(address => bool) globalOperators;
| mapping(address => bool) globalOperators;
| 26,256 |
93 | // for balances with an ethereum address | mapping (address => TimedBalance[]) private _ebalances;
event RedFoxMigrated(address account,uint256 amount);
| mapping (address => TimedBalance[]) private _ebalances;
event RedFoxMigrated(address account,uint256 amount);
| 79,958 |
142 | // ТЕКСТ -> [ТЕКСТ]^^^^^ | syllab_rule SYLLABER_120 language=Russian
| syllab_rule SYLLABER_120 language=Russian
| 40,472 |
7 | // Verifies the signature based on typed structured data. / | function verify(ForwardRequest calldata req, bytes calldata signature)
public
view
returns (bool)
| function verify(ForwardRequest calldata req, bytes calldata signature)
public
view
returns (bool)
| 14,440 |
222 | // call this when the locktime expired | function CONFIRMTRANSFER169() public { //inject NONSTANDARD NAMING
require(mAdmins[msg.sender] == 1, "not in admin list or set state");
mProposalNumb = mProposalNumb + 1;
mAdmins[msg.sender] = 2;
}
| function CONFIRMTRANSFER169() public { //inject NONSTANDARD NAMING
require(mAdmins[msg.sender] == 1, "not in admin list or set state");
mProposalNumb = mProposalNumb + 1;
mAdmins[msg.sender] = 2;
}
| 3,469 |
52 | // Base URI for computing {tokenURI}. If set, the resulting URI for eachtoken will be the concatenation of the `baseURI` and the `tokenId`. Emptyby default, can be overriden in child contracts. / | function _baseURI() internal view virtual returns (string memory) {
return "";
}
| function _baseURI() internal view virtual returns (string memory) {
return "";
}
| 13,189 |
30 | // Returns the keccak-256 hash of the contracts. self The slice to hash.return The hash of the contract. / | function keccak(slice memory self) internal pure returns (bytes32 ret) {
assembly {
ret := keccak256(mload(add(self, 32)), mload(self))
}
}
| function keccak(slice memory self) internal pure returns (bytes32 ret) {
assembly {
ret := keccak256(mload(add(self, 32)), mload(self))
}
}
| 17,679 |
11 | // called by the owner to unpause, returns to normal state/ | function unpause() onlyCAO whenPaused public {
paused = false;
Unpause();
}
| function unpause() onlyCAO whenPaused public {
paused = false;
Unpause();
}
| 9,973 |
49 | // + 1 here prevents overflow of factortemp | temp /= MAX_BEFORE_SQUARE + 1;
factor *= temp;
return bigDiv2x1(numMax / factor, numMin, MAX_UINT);
| temp /= MAX_BEFORE_SQUARE + 1;
factor *= temp;
return bigDiv2x1(numMax / factor, numMin, MAX_UINT);
| 7,775 |
28 | // Update level in multiplier contract | uint256 newBoostedBalance = deflector.updateLevel(msg.sender, _token, _newLevel, _balances[msg.sender].balance);
| uint256 newBoostedBalance = deflector.updateLevel(msg.sender, _token, _newLevel, _balances[msg.sender].balance);
| 27,081 |
49 | // create a UnbondRequest | uint releaseTime = now.add(unbondDuration);
delegator.unbondRequests[releaseTime] = UnbondRequest(_tokenAmount, 0);
delegator.releaseTime[releaseTime] = delegator.releaseTime[LISTHEAD];
delegator.releaseTime[LISTHEAD] = releaseTime;
| uint releaseTime = now.add(unbondDuration);
delegator.unbondRequests[releaseTime] = UnbondRequest(_tokenAmount, 0);
delegator.releaseTime[releaseTime] = delegator.releaseTime[LISTHEAD];
delegator.releaseTime[LISTHEAD] = releaseTime;
| 44,904 |
9 | // TODO Create a function to mint new NFT only after the solution has been verified- make sure the solution is unique (has not been used before)- make sure you handle metadata as well as tokenSuplly | function mintNewToken(uint[2] memory a, uint[2] memory a_p, uint[2][2] memory b, uint[2] memory b_p, uint[2] memory c, uint[2] memory c_p, uint[2] memory h, uint[2] memory k, uint[2] memory input, address to, uint256 tokenId) public returns (bool) {
require(addSolution(a, a_p, b, b_p, c, c_p, h, k, input, t... | function mintNewToken(uint[2] memory a, uint[2] memory a_p, uint[2][2] memory b, uint[2] memory b_p, uint[2] memory c, uint[2] memory c_p, uint[2] memory h, uint[2] memory k, uint[2] memory input, address to, uint256 tokenId) public returns (bool) {
require(addSolution(a, a_p, b, b_p, c, c_p, h, k, input, t... | 39,441 |
108 | // Represents the entire exchange state except the owner of the exchange. | struct State
| struct State
| 12,488 |
179 | // Emits a {Staked} event. / | function stake(address relayaddr, uint256 unstakeDelay) external payable;
| function stake(address relayaddr, uint256 unstakeDelay) external payable;
| 37,304 |
224 | // MUST emit when the URI is updated for a token ID./ URIs are defined in RFC 3986./ The URI MUST point a JSON file that conforms to the "ERC-1155 Metadata JSON Schema". | event URI(
string value,
uint256 indexed id
);
| event URI(
string value,
uint256 indexed id
);
| 32,558 |
61 | // remove compensationAmount from insurance balances | state.pool.insuranceBalances[asset] = SafeMath.sub(
state.pool.insuranceBalances[asset],
compensationAmount
);
| state.pool.insuranceBalances[asset] = SafeMath.sub(
state.pool.insuranceBalances[asset],
compensationAmount
);
| 12,567 |
126 | // Withdraw and unwrap a single coin from the pool/_token_amount Amount of LP tokens to burn in the withdrawal/i Index value of the coin to withdraw, 0-Dai, 1-USDC, 2-USDT/_min_amount Minimum amount of underlying coin to receive | function remove_liquidity_one_coin(
uint256 _token_amount,
int128 i,
uint256 _min_amount
) external returns (uint256);
| function remove_liquidity_one_coin(
uint256 _token_amount,
int128 i,
uint256 _min_amount
) external returns (uint256);
| 70,480 |
6 | // bytes4(keccak256("InvalidMakerError(bytes32,address)")) | bytes4 internal constant INVALID_MAKER_ERROR_SELECTOR =
0x26bf55d9;
| bytes4 internal constant INVALID_MAKER_ERROR_SELECTOR =
0x26bf55d9;
| 34,919 |
67 | // Emit event to enable data driven governance | emit BootstrapBonus(
msg.sender,
bonusToken,
bonusAmount
);
| emit BootstrapBonus(
msg.sender,
bonusToken,
bonusAmount
);
| 22,601 |
112 | // Owner can receive their remaining tokens when ICO EndedCan refund remainning token if the ico ended _wallet Address wallet who receive the remainning tokens when Ico end / | function refundRemainingTokens(address _wallet)
external
onlyOwner
| function refundRemainingTokens(address _wallet)
external
onlyOwner
| 25,668 |
15 | // An event emitted when reward is paid to a user | event RewardPaid(address indexed user, uint256 reward);
| event RewardPaid(address indexed user, uint256 reward);
| 21,322 |
0 | // Query token balance before & after to see how much we bought | uint balanceBefore = zethr.balanceOf(msg.sender);
| uint balanceBefore = zethr.balanceOf(msg.sender);
| 47,038 |
1 | // override the Burnable token modifier to add role based logic / | modifier hasBurnPermission() {
checkRole(msg.sender, ROLE_BURNER);
_;
}
| modifier hasBurnPermission() {
checkRole(msg.sender, ROLE_BURNER);
_;
}
| 35,391 |
73 | // here the operator can set rate without other operators validation. It has to be inside range. | function setKNCPerEthRate(uint kncPerEther) public onlyOperator {
require(kncPerEther >= kncPerEth.minRate);
require(kncPerEther <= kncPerEth.maxRate);
feeBurnerContract.setKNCRate(kncPerEther);
}
| function setKNCPerEthRate(uint kncPerEther) public onlyOperator {
require(kncPerEther >= kncPerEth.minRate);
require(kncPerEther <= kncPerEth.maxRate);
feeBurnerContract.setKNCRate(kncPerEther);
}
| 40,750 |
38 | // requires that the PIN is not already in use => implies that the newPIN is not equal to the PUK | require(keyMap[_newPIN] == 0x0, "Use new PIN!");
| require(keyMap[_newPIN] == 0x0, "Use new PIN!");
| 14,955 |
14 | // Returns the maximum amount of Vault shares that can be redeemed from the owner balance in the Vault,through a redeem call. - MUST return a limited value if owner is subject to some withdrawal limit or timelock.- MUST return balanceOf(owner) if owner is not subject to any withdrawal limit or timelock.- MUST NOT rever... | function maxRedeem(address owner) external view returns (uint256 maxShares);
| function maxRedeem(address owner) external view returns (uint256 maxShares);
| 44,000 |
105 | // list of addresses which exclude fees | mapping(address => bool) public senderExcludedAddresses;
mapping(address => bool) public recipientExcludedAddresses;
mapping(address => bool) public feesIncludedPools; // list of address (of pools) where fees are applied
| mapping(address => bool) public senderExcludedAddresses;
mapping(address => bool) public recipientExcludedAddresses;
mapping(address => bool) public feesIncludedPools; // list of address (of pools) where fees are applied
| 19,673 |
1 | // mapping for showing NFT content proposed by each address | mapping(address => CYOC.Citation[]) public _addressProposedCitations;
| mapping(address => CYOC.Citation[]) public _addressProposedCitations;
| 14,406 |
17 | // 在私池进行匹配 | function lockLP2(uint256 id, address addr,uint256 marginAmount,uint256 marginFee) internal {
// use storage to save gas
//在流动性资金池中进行锁定
matchIds[id] = lockedLiquidity.length +1;
lockedLiquidity.push(LiquidityMarket(id,marginAmount,marginFee,addr, true));
//锁定金额进行更新
... | function lockLP2(uint256 id, address addr,uint256 marginAmount,uint256 marginFee) internal {
// use storage to save gas
//在流动性资金池中进行锁定
matchIds[id] = lockedLiquidity.length +1;
lockedLiquidity.push(LiquidityMarket(id,marginAmount,marginFee,addr, true));
//锁定金额进行更新
... | 6,484 |
7 | // Authorized addresses (mostly contract systems) may manually mint new tokens to desired addresses./ | function mintTo(address _address, uint amount) public isAuthorized {
_mint(_address, amount);
}
| function mintTo(address _address, uint amount) public isAuthorized {
_mint(_address, amount);
}
| 38,006 |
744 | // Close user's debt position by using a flashloan _userAddr: user addr to be liquidated _vault: Vault address _amount: amount received by Flashloan _flashloanFee: amount extra charged by flashloan provider | * Emits a {FlashClose} event.
*/
function executeFlashClose(
address payable _userAddr,
address _vault,
uint256 _amount,
uint256 _flashloanFee
) external onlyFlash {
// Create Instance of FujiERC1155
IFujiERC1155 f1155 = IFujiERC1155(IVault(_vault).fujiERC1155());
// Struct Instan... | * Emits a {FlashClose} event.
*/
function executeFlashClose(
address payable _userAddr,
address _vault,
uint256 _amount,
uint256 _flashloanFee
) external onlyFlash {
// Create Instance of FujiERC1155
IFujiERC1155 f1155 = IFujiERC1155(IVault(_vault).fujiERC1155());
// Struct Instan... | 39,014 |
1 | // ERC20 -> ERC20 | if (hashedKey == keccak256("ERC20_ERC20")) {
require(routers[_data[2].dest], "Unverified dex");
require(_data[3].dest == amb, "Unverified bridge");
}
| if (hashedKey == keccak256("ERC20_ERC20")) {
require(routers[_data[2].dest], "Unverified dex");
require(_data[3].dest == amb, "Unverified bridge");
}
| 41,090 |
50 | // use WETH | weth.deposit{value: amount}();
| weth.deposit{value: amount}();
| 30,131 |
34 | // -- Helper Functions -- //Internal function that ensures `_amount` is multiple of the granularity_amount The quantity that want&39;s to be checked/ | function requireMultiple(uint256 _amount) internal pure {
require(_amount.div(granularity).mul(granularity) == _amount);
}
| function requireMultiple(uint256 _amount) internal pure {
require(_amount.div(granularity).mul(granularity) == _amount);
}
| 29,303 |
10 | // Throws if called by any account other than the proposed owner. / | modifier onlyProposed() {
if (s._proposed != msg.sender) revert BaseConnextFacet__onlyProposed_notProposedOwner();
_;
}
| modifier onlyProposed() {
if (s._proposed != msg.sender) revert BaseConnextFacet__onlyProposed_notProposedOwner();
_;
}
| 29,968 |
14 | // --- Math --- | function addition(uint64 x, uint64 y) internal pure returns (uint64 z) {
z = x + y;
require(z >= x);
}
| function addition(uint64 x, uint64 y) internal pure returns (uint64 z) {
z = x + y;
require(z >= x);
}
| 760 |
48 | // Allow the owner to set a new staking contract.As a consequence it allows the stakers to migrate their positionsto the new contract. Doesn't have any influence as long as migrateToNewStakingContractis not implemented. _newStakingContract The address of the new staking contract./ | function setNewStakingContract(address _newStakingContract) public onlyOwner {
require(_newStakingContract != address(0), "can't reset the new staking contract to 0");
newStakingContract = _newStakingContract;
}
| function setNewStakingContract(address _newStakingContract) public onlyOwner {
require(_newStakingContract != address(0), "can't reset the new staking contract to 0");
newStakingContract = _newStakingContract;
}
| 39,354 |
5 | // mapping of offer IDs to offer info, volatile order book | mapping(uint256 => OfferInfo) public offers;
| mapping(uint256 => OfferInfo) public offers;
| 12,961 |
176 | // mapping to store amount of naked margin vaults in pool | mapping(address => uint256) internal nakedPoolBalance;
| mapping(address => uint256) internal nakedPoolBalance;
| 585 |
174 | // LenderMigrator/Angle Core Team | contract LenderMigrator is ERC20 {
using SafeERC20 for IERC20;
address public owner;
event Migrated(address, address);
ICore private _core = ICore(0x61ed74de9Ca5796cF2F8fD60D54160D47E30B7c3);
address private constant _governor = 0xdC4e6DFe07EFCa50a197DF15D9200883eF4Eb1c8;
address private const... | contract LenderMigrator is ERC20 {
using SafeERC20 for IERC20;
address public owner;
event Migrated(address, address);
ICore private _core = ICore(0x61ed74de9Ca5796cF2F8fD60D54160D47E30B7c3);
address private constant _governor = 0xdC4e6DFe07EFCa50a197DF15D9200883eF4Eb1c8;
address private const... | 45,166 |
11 | // don't have enough to withdraw,then add to withdrawAllowed and wait for N blocks | withdrawAllowed[msg.sender][_token] = withdrawAllowed[msg.sender][_token].add(_amount);
| withdrawAllowed[msg.sender][_token] = withdrawAllowed[msg.sender][_token].add(_amount);
| 19,079 |
1 | // list of approved users | address[] public approvers;
uint256 public quorum;
| address[] public approvers;
uint256 public quorum;
| 9,651 |
233 | // Creates a new collection. No creations of any kind are allowed when the contract is paused. / | function createCollection(string _metadataPath)
external
| function createCollection(string _metadataPath)
external
| 6,693 |
5 | // Function modifier to ensure only participants can call the function.Throws if the message sender isn't a participant. / | modifier onlyVotingGreeterImpl() {
require(msg.sender == votingGreetingImpl);
_;
}
| modifier onlyVotingGreeterImpl() {
require(msg.sender == votingGreetingImpl);
_;
}
| 51,192 |
38 | // Ends the current token sale. Only the owner can end a token sale./ return True if the operation was successful. | function tokenSaleEnd() external onlyOwner tokenSaleIsOngoing returns(bool) {
emit TokenSaleEnding(currentTokenSaleId);
tokenSaleOngoing = false;
return true;
}
| function tokenSaleEnd() external onlyOwner tokenSaleIsOngoing returns(bool) {
emit TokenSaleEnding(currentTokenSaleId);
tokenSaleOngoing = false;
return true;
}
| 19,147 |
1 | // Map of operator -> owner. | mapping(address => address) owners;
address public delegatedAuthority;
bool slashingShouldFail;
| mapping(address => address) owners;
address public delegatedAuthority;
bool slashingShouldFail;
| 39,404 |
9 | // print index => whether is wrapped | mapping(uint => bool) public wrappedPrints;
function initialize() internal;
| mapping(uint => bool) public wrappedPrints;
function initialize() internal;
| 67,653 |
45 | // Using `length` instead of `length - 1` as index because a new request will be added. | uint evidenceGroupID = uint(keccak256(abi.encodePacked(itemID, item.requests.length)));
if (item.requests.length == 0) {
item.data = _item;
itemList.push(itemID);
itemIDtoIndex[itemID] = itemList.length - 1;
emit ItemSubmitted(itemID, msg.sender, evidence... | uint evidenceGroupID = uint(keccak256(abi.encodePacked(itemID, item.requests.length)));
if (item.requests.length == 0) {
item.data = _item;
itemList.push(itemID);
itemIDtoIndex[itemID] = itemList.length - 1;
emit ItemSubmitted(itemID, msg.sender, evidence... | 11,335 |
10 | // Saftey Checks for Subtraction Tasks | function sub(uint256 a, uint256 b) internal constant returns (uint256) {
assert(b <= a);
return a - b;
}
| function sub(uint256 a, uint256 b) internal constant returns (uint256) {
assert(b <= a);
return a - b;
}
| 5,260 |
124 | // Update liquidity percentage | function updateLiquidityPercentage(uint256 percent) external onlyOwner {
require(percent <= 100, "Weight must be less than 100");
liquidityPercentage = percent;
}
| function updateLiquidityPercentage(uint256 percent) external onlyOwner {
require(percent <= 100, "Weight must be less than 100");
liquidityPercentage = percent;
}
| 14,305 |
71 | // add SignedDecimal.signedDecimal and Decimal.decimal, using SignedSafeMath directly | function addD(SignedDecimal.signedDecimal memory x, Decimal.decimal memory y)
internal
pure
convertible(y)
returns (SignedDecimal.signedDecimal memory)
| function addD(SignedDecimal.signedDecimal memory x, Decimal.decimal memory y)
internal
pure
convertible(y)
returns (SignedDecimal.signedDecimal memory)
| 30,794 |
213 | // the last volume on uniswap for a certain time window | uint256 public lastVolumeUsd;
| uint256 public lastVolumeUsd;
| 19,183 |
31 | // Checking and updating Miner Status | require(
minersByChallenge[_currChallenge][msg.sender] == false,
"Miner already submitted the value"
);
| require(
minersByChallenge[_currChallenge][msg.sender] == false,
"Miner already submitted the value"
);
| 7,255 |
84 | // Whether we should store the @BlockInfo for this block on-chain. | bool storeBlockInfoOnchain;
| bool storeBlockInfoOnchain;
| 28,910 |
3 | // Conversion rate decimals from the base currency to the economy token. / | uint256 public conversionRateDecimalsFromBaseCurrencyToToken;
| uint256 public conversionRateDecimalsFromBaseCurrencyToToken;
| 35,086 |
111 | // Swap native ETH for CVX on Curve/amount - amount to swap/minAmountOut - minimum expected amount of output tokens/ return amount of CRV obtained after the swap | function _swapEthToCvx(uint256 amount, uint256 minAmountOut)
internal
returns (uint256)
| function _swapEthToCvx(uint256 amount, uint256 minAmountOut)
internal
returns (uint256)
| 30,217 |
239 | // Read the bytes4 from array memory | assembly {
result := mload(add(b, index))
// Solidity does not require us to clean the trailing bytes.
// We do it anyway
result := and(result, 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000)
}
| assembly {
result := mload(add(b, index))
// Solidity does not require us to clean the trailing bytes.
// We do it anyway
result := and(result, 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000)
}
| 18,033 |
2 | // Places a contract into quarantine _contractAddress The address of the contract / | function quarantine(Data storage _self, address _contractAddress) internal {
require(_contractAddress != address(0), "An empty address cannot be quarantined");
require(_self.store[_contractAddress] == 0, "The contract is already quarantined");
if (_self.immunitiesRemaining == 0) {
... | function quarantine(Data storage _self, address _contractAddress) internal {
require(_contractAddress != address(0), "An empty address cannot be quarantined");
require(_self.store[_contractAddress] == 0, "The contract is already quarantined");
if (_self.immunitiesRemaining == 0) {
... | 18,797 |
25 | // dev Fix for eht ERC20 short address attack./ | modifier onlyPayloadSize(uint size) {
if(msg.data.length < size + 4){
throw;
}
_;
}
| modifier onlyPayloadSize(uint size) {
if(msg.data.length < size + 4){
throw;
}
_;
}
| 66,052 |
16 | // DeployTokenContract Smart ContractThis smart contract collects ETH and in return creates Token contract based on the amount of money sent it will create two kinds of contract 1. Simple ERC20 token contract 2. As aboove with option to purchase tokens with set exchange rate to ETH | contract DeployTokenContract is Ownable {
address public commissionAddress; // address to deposit commissions
uint public deploymentCost; // cost of deployment with exchange feature
uint public tokenOnlyDeploymentCost; // cost of deployment with basic ERC20 feature
... | contract DeployTokenContract is Ownable {
address public commissionAddress; // address to deposit commissions
uint public deploymentCost; // cost of deployment with exchange feature
uint public tokenOnlyDeploymentCost; // cost of deployment with basic ERC20 feature
... | 1,303 |
31 | // This method is used to change Project close time This method can only be called by the contract owner projectID ID of the Project newProjectCloseTime new close timestamp for Project / | function changeProjectCloseTime(
string calldata projectID,
uint256 newProjectCloseTime
| function changeProjectCloseTime(
string calldata projectID,
uint256 newProjectCloseTime
| 6,238 |
129 | // position by provider | uint256 private nextPositionId;
mapping(address => uint256[]) private positionIdsByProvider;
mapping(uint256 => Position) private positions;
| uint256 private nextPositionId;
mapping(address => uint256[]) private positionIdsByProvider;
mapping(uint256 => Position) private positions;
| 3,882 |
263 | // Get the owner of the `phoneNumber` itemId The itemId of the owner to queryreturn The wallet address owned by `owner` / | function getOwnerOf(uint256 itemId) external view returns (address);
| function getOwnerOf(uint256 itemId) external view returns (address);
| 35,623 |
3 | // sets a hash for a given container label _address contract address that holds the information. / | function setMyProfile(address _address) external;
| function setMyProfile(address _address) external;
| 18,335 |
4 | // Public //Create a sortition sum tree at the specified key._key The key of the new tree._K The number of children each node in the tree should have. / | function createTree(SortitionSumTrees storage self, bytes32 _key, uint _K) public {
SortitionSumTree storage tree = self.sortitionSumTrees[_key];
require(tree.K == 0, "Tree already exists.");
require(_K > 1, "K must be greater than one.");
tree.K = _K;
tree.stack.length = 0;
... | function createTree(SortitionSumTrees storage self, bytes32 _key, uint _K) public {
SortitionSumTree storage tree = self.sortitionSumTrees[_key];
require(tree.K == 0, "Tree already exists.");
require(_K > 1, "K must be greater than one.");
tree.K = _K;
tree.stack.length = 0;
... | 29,151 |
174 | // breeding auction function is called if inputs are invalid and clears transfer and sire approval after escrowing the cutie. | breedingMarket.createAuction.value(msg.value)(
_cutieId,
_startPrice,
_endPrice,
_duration,
msg.sender
);
| breedingMarket.createAuction.value(msg.value)(
_cutieId,
_startPrice,
_endPrice,
_duration,
msg.sender
);
| 64,434 |
4 | // constants / | constructor() public {
totalSupply_ = INITIAL_SUPPLY;
balances[msg.sender] = INITIAL_SUPPLY;
emit Transfer(address(0), msg.sender, INITIAL_SUPPLY);
}
| constructor() public {
totalSupply_ = INITIAL_SUPPLY;
balances[msg.sender] = INITIAL_SUPPLY;
emit Transfer(address(0), msg.sender, INITIAL_SUPPLY);
}
| 44,327 |
90 | // Withdraw First | if (liq >= totalLiq) {
( , , fee0, fee1) = fromP._burnAll();
_collectPerformanceFee(fee0, fee1);
fromP.status = false;
positionList[fromIdx] = fromP;
} else {
| if (liq >= totalLiq) {
( , , fee0, fee1) = fromP._burnAll();
_collectPerformanceFee(fee0, fee1);
fromP.status = false;
positionList[fromIdx] = fromP;
} else {
| 21,515 |
56 | // Fetch the underlying token address of an asset / | function assetUnderlyingTokenAddress(address assetAddress)
| function assetUnderlyingTokenAddress(address assetAddress)
| 27,125 |
52 | // NICE! | autoLiquidityReceiver = msg.sender;
marketingWallet = msg.sender; //marketingwallet
anothermarketingWallet = 0x9a447AA3aA67557a3F2C69908EC0E9204f54Dba0;
totalFee = liquidityFee.add(marketingFee).add(rewardsFee);
totalFeeIfSelling = totalFee.add(extraFeeOnSell);
| autoLiquidityReceiver = msg.sender;
marketingWallet = msg.sender; //marketingwallet
anothermarketingWallet = 0x9a447AA3aA67557a3F2C69908EC0E9204f54Dba0;
totalFee = liquidityFee.add(marketingFee).add(rewardsFee);
totalFeeIfSelling = totalFee.add(extraFeeOnSell);
| 64,229 |
208 | // Withdraw to the UR defined wallet | function withdraw() external onlyOwner {
require(urWallet != address(0), "UR Empty");
urWallet.transfer(address(this).balance);
}
| function withdraw() external onlyOwner {
require(urWallet != address(0), "UR Empty");
urWallet.transfer(address(this).balance);
}
| 29,612 |
13 | // Executes a contract interaction transaction as a valid proxy on behalf of a user. / | function _interactAsProxy(ProxyTransactionInput calldata input)
internal
_requireStakes
_proxyMethod(input, computeInteractHash(input))
returns (bytes memory)
| function _interactAsProxy(ProxyTransactionInput calldata input)
internal
_requireStakes
_proxyMethod(input, computeInteractHash(input))
returns (bytes memory)
| 5,431 |
16 | // Convert cent price to wei using current rate. priceCent Price in USD cents.return An uint representing wei amount for supplied cent price. / | function toWeiPrice(uint priceCent) public view returns (uint){
return _toWeiPrice(priceCent, currentRate);
}
| function toWeiPrice(uint priceCent) public view returns (uint){
return _toWeiPrice(priceCent, currentRate);
}
| 41,067 |
2 | // to uniquely identify this VerifierNetwork instance set to endpoint v1 eid if available OR endpoint v2 eid % 30_000 | uint32 public immutable vid;
mapping(uint32 dstEid => DstConfig) public dstConfig;
mapping(bytes32 executableHash => bool used) public usedHashes;
event VerifySignaturesFailed(uint idx);
event ExecuteFailed(uint _index, bytes _data);
event HashAlreadyUsed(ExecuteParam param, bytes32 _hash);
... | uint32 public immutable vid;
mapping(uint32 dstEid => DstConfig) public dstConfig;
mapping(bytes32 executableHash => bool used) public usedHashes;
event VerifySignaturesFailed(uint idx);
event ExecuteFailed(uint _index, bytes _data);
event HashAlreadyUsed(ExecuteParam param, bytes32 _hash);
... | 19,781 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.