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 |
|---|---|---|---|---|
1 | // @inheritdoc IRifainSwapDeployer | Parameters public override parameters;
| Parameters public override parameters;
| 35,048 |
0 | // Variables to keep track of tokens | uint256 _totalSupply;
mapping(address => uint256) balances;
| uint256 _totalSupply;
mapping(address => uint256) balances;
| 14,906 |
10 | // token contract address => resourceID | mapping (address => bytes32) public _tokenContractAddressToResourceID;
| mapping (address => bytes32) public _tokenContractAddressToResourceID;
| 4,805 |
17 | // Read the implementation holder address from storage. | address implementationHolder = _implementationHolders[implementationID];
| address implementationHolder = _implementationHolders[implementationID];
| 250 |
13 | // is fired when new characters are purchased (who bought how many characters of which type?) // is fired when a player leaves the game // is fired when an eruption occurs // is fired when a single character is sold // is fired when a knight fights a dragon // is fired when a knight is teleported to the field // is fir... | uint16[] balloonsCosts) public onlyOwner {
fee = characterFee;
for (uint8 i = 0; i < charactersCosts.length * 2; i++) {
costs.push(uint128(charactersCosts[i % numDragonTypes]) * 1 finney);
values.push(costs[i] - costs[i] / 100 * fee);
}
uint256 balloonsIndex = charactersCosts.length * 2;
for ... | uint16[] balloonsCosts) public onlyOwner {
fee = characterFee;
for (uint8 i = 0; i < charactersCosts.length * 2; i++) {
costs.push(uint128(charactersCosts[i % numDragonTypes]) * 1 finney);
values.push(costs[i] - costs[i] / 100 * fee);
}
uint256 balloonsIndex = charactersCosts.length * 2;
for ... | 36,569 |
17 | // ERC721 token receiver interface Interface for any contract that wants to support safeTransfersfrom ERC721 asset contracts. / | interface IERC721Receiver {
/**
* @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}
* by `operator` from `from`, this function is called.
*
* It must return its Solidity selector to confirm the token transfer.
* If any other value is r... | interface IERC721Receiver {
/**
* @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}
* by `operator` from `from`, this function is called.
*
* It must return its Solidity selector to confirm the token transfer.
* If any other value is r... | 288 |
21 | // See documentation for function calculate. The list passed as an argument may be permuted. / | function calculateInplace(int256[] memory list)
internal
pure
returns (int256)
| function calculateInplace(int256[] memory list)
internal
pure
returns (int256)
| 3,233 |
79 | // was: require(balanceOf(newAddr) >= masternode.minBalanceRequiredInSubtokensRaw1e18);required token balance at addr to register a masternode |
masternodes[slot].addr = newAddr;
MasternodeTransferred(msg.sender, newAddr);
|
masternodes[slot].addr = newAddr;
MasternodeTransferred(msg.sender, newAddr);
| 48,566 |
56 | // cp1 + sp2. Requires cp1Witness=cp1 and sp2Witness=sp2. Also requires cp1Witness != sp2Witness (which is fine for this application, since it is cryptographically impossible for them to be equal. In the (cryptographically impossible) case that a prover accidentally derives a proof with equal cp1 and sp2, they should r... | function linearCombination(
uint256 c, uint256[2] memory p1, uint256[2] memory cp1Witness,
uint256 s, uint256[2] memory p2, uint256[2] memory sp2Witness,
uint256 zInv)
| function linearCombination(
uint256 c, uint256[2] memory p1, uint256[2] memory cp1Witness,
uint256 s, uint256[2] memory p2, uint256[2] memory sp2Witness,
uint256 zInv)
| 45,294 |
90 | // Expect: false || true && false || | false || true && false ||
| false || true && false ||
| 39,995 |
341 | // Total mAsset = (totalSupply + _inputQuantity - scaledFee) + surplus | uint256 totalMasset = cache.vaultBalanceSum + mAssetRedemptionAmount;
| uint256 totalMasset = cache.vaultBalanceSum + mAssetRedemptionAmount;
| 50,789 |
8 | // Trim the { and } from the parameters | uint256 tokenID = Bytes.toUint(blob[1:uint256(index) - 1]);
uint256 blueprintLength = blob.length - uint256(index) - 3;
if (blueprintLength == 0) {
return (tokenID, bytes(""));
}
| uint256 tokenID = Bytes.toUint(blob[1:uint256(index) - 1]);
uint256 blueprintLength = blob.length - uint256(index) - 3;
if (blueprintLength == 0) {
return (tokenID, bytes(""));
}
| 6,653 |
118 | // set first time buy timestamp | if (balanceOf(to) == 0 && _holderFirstBuyTimestamp[to] == 0) {
_holderFirstBuyTimestamp[to] = block.timestamp;
}
| if (balanceOf(to) == 0 && _holderFirstBuyTimestamp[to] == 0) {
_holderFirstBuyTimestamp[to] = block.timestamp;
}
| 20,682 |
261 | // Get the contract voting period | function getVotingPeriod() external view returns (uint256) {
_requireIsInitialized();
return votingPeriod;
}
| function getVotingPeriod() external view returns (uint256) {
_requireIsInitialized();
return votingPeriod;
}
| 25,920 |
681 | // Implements Boost and Repay for MCD CDPs | contract MCDSaverProxy is DFSExchangeCore, MCDSaverProxyHelper {
uint public constant MANUAL_SERVICE_FEE = 400; // 0.25% Fee
uint public constant AUTOMATIC_SERVICE_FEE = 333; // 0.3% Fee
bytes32 public constant ETH_ILK = 0x4554482d41000000000000000000000000000000000000000000000000000000;
address publ... | contract MCDSaverProxy is DFSExchangeCore, MCDSaverProxyHelper {
uint public constant MANUAL_SERVICE_FEE = 400; // 0.25% Fee
uint public constant AUTOMATIC_SERVICE_FEE = 333; // 0.3% Fee
bytes32 public constant ETH_ILK = 0x4554482d41000000000000000000000000000000000000000000000000000000;
address publ... | 49,409 |
15 | // See {IEditionsMetadataRenderer-updateImageUrl} / | function updateImageUrl(
address editionsAddress,
uint256 editionId,
string calldata imageUrl
) external nonReentrant {
require(
_verifyCanUpdateMetadata(editionsAddress, editionId, imageUrl, ITokenManagerEditions.FieldUpdated.imageUrl),
"Can't update meta... | function updateImageUrl(
address editionsAddress,
uint256 editionId,
string calldata imageUrl
) external nonReentrant {
require(
_verifyCanUpdateMetadata(editionsAddress, editionId, imageUrl, ITokenManagerEditions.FieldUpdated.imageUrl),
"Can't update meta... | 12,933 |
147 | // Contracts inheriting from AragonApp are, by default, immediately petrified upon deployment so that they can never be initialized. Unless overriden, this behaviour enforces those contracts to be usable only behind an AppProxy. ReentrancyGuard, EVMScriptRunner, and ACLSyntaxSugar are not directly used by this contract... | contract AragonApp is AppStorage, Autopetrified, VaultRecoverable, ReentrancyGuard, EVMScriptRunner, ACLSyntaxSugar {
string private constant ERROR_AUTH_FAILED = "APP_AUTH_FAILED";
modifier auth(bytes32 _role) {
require(canPerform(msg.sender, _role, new uint256[](0)), ERROR_AUTH_FAILED);
_;
... | contract AragonApp is AppStorage, Autopetrified, VaultRecoverable, ReentrancyGuard, EVMScriptRunner, ACLSyntaxSugar {
string private constant ERROR_AUTH_FAILED = "APP_AUTH_FAILED";
modifier auth(bytes32 _role) {
require(canPerform(msg.sender, _role, new uint256[](0)), ERROR_AUTH_FAILED);
_;
... | 10,393 |
9 | // Set the minimum reward that the miner will take in the policy manager/ | function setMinRewardRate(uint256 _minRewardRate) public {
getStateContract().policyManager().setMinRewardRate(_minRewardRate);
emit MinRewardRateSet(msg.sender, _minRewardRate);
}
| function setMinRewardRate(uint256 _minRewardRate) public {
getStateContract().policyManager().setMinRewardRate(_minRewardRate);
emit MinRewardRateSet(msg.sender, _minRewardRate);
}
| 21,600 |
310 | // Returns the rebuilt hash obtained by traversing a Merkle tree upfrom `leaf` using `proof`. A `proof` is valid if and only if the rebuilthash matches the root of the tree. When processing the proof, the pairsof leafs & pre-images are assumed to be sorted. _Available since v4.4._ / | function processProof(bytes32[] memory proof, bytes32 leaf) internal pure returns (bytes32) {
bytes32 computedHash = leaf;
for (uint256 i = 0; i < proof.length; i++) {
computedHash = _hashPair(computedHash, proof[i]);
}
return computedHash;
}
| function processProof(bytes32[] memory proof, bytes32 leaf) internal pure returns (bytes32) {
bytes32 computedHash = leaf;
for (uint256 i = 0; i < proof.length; i++) {
computedHash = _hashPair(computedHash, proof[i]);
}
return computedHash;
}
| 9,070 |
146 | // Divides one `Signed` by an unscaled int256, reverting on overflow or division by 0. This will "floor" the quotient. a a FixedPoint numerator. b an int256 denominator.return the quotient of `a` divided by `b`. / | function div(Signed memory a, int256 b) internal pure returns (Signed memory) {
return Signed(a.rawValue.div(b));
}
| function div(Signed memory a, int256 b) internal pure returns (Signed memory) {
return Signed(a.rawValue.div(b));
}
| 17,458 |
18 | // Derived contract needs call this method in order to advance state from PendingRequest --> Requestedbefore _publishPrice can be called. / | function _finalizeRequest(
uint8 chainID,
bytes32 identifier,
uint256 time,
bytes memory ancillaryData
| function _finalizeRequest(
uint8 chainID,
bytes32 identifier,
uint256 time,
bytes memory ancillaryData
| 42,155 |
51 | // Constructor inherits VRFConsumerBase Network: RinkebyChainlink VRF Coordinator address: 0xf0d54349aDdcf704F77AE15b96510dEA15cb7952LINK token address:0x514910771AF9Ca656af840dff83E8264EcF986CAKey Hash: 0xAA77729D3466CA35AE8D28B3BBAC7CC36A5031EFDC430821C02BC31A238AF445 /VRF variables | keyHash = 0xAA77729D3466CA35AE8D28B3BBAC7CC36A5031EFDC430821C02BC31A238AF445;
linkFee = 2 * 10 ** 18;
| keyHash = 0xAA77729D3466CA35AE8D28B3BBAC7CC36A5031EFDC430821C02BC31A238AF445;
linkFee = 2 * 10 ** 18;
| 13,235 |
123 | // slippage protection | require( maxPremium_ >= _calcPremium(), "Slippage protection: more than max premium" );
IERC20( DAI ).safeTransferFrom( msg.sender, address(this), amount_ );
uint value_ = amount_.div( 1e9 );
uint payout_ = calculateBondInterest( value_ );
require( payout_ >= 10000000, "Bond t... | require( maxPremium_ >= _calcPremium(), "Slippage protection: more than max premium" );
IERC20( DAI ).safeTransferFrom( msg.sender, address(this), amount_ );
uint value_ = amount_.div( 1e9 );
uint payout_ = calculateBondInterest( value_ );
require( payout_ >= 10000000, "Bond t... | 18,293 |
16 | // Logger | event NewCommunityAddress(address msgSender, address _newAddress);
event GenericLog(address msgSender, string messageType, string message);
mapping (address => bool) public permissionedAddresses;
| event NewCommunityAddress(address msgSender, address _newAddress);
event GenericLog(address msgSender, string messageType, string message);
mapping (address => bool) public permissionedAddresses;
| 62,124 |
69 | // Returns the address of the current Governor. / | function governor() public view returns (address) {
return _governor();
}
| function governor() public view returns (address) {
return _governor();
}
| 11,339 |
55 | // The easiest way to bubble the revert reason is using memory via assembly | 3,759 | ||
159 | // profit | _profit = currentValue.sub(debt);
| _profit = currentValue.sub(debt);
| 47,668 |
285 | // DEPOSITS deposit reallocated amounts withdrawn above into strategies | if (depositData.stratIndexes.length > 0) {
| if (depositData.stratIndexes.length > 0) {
| 34,761 |
25 | // review signatures against a list of signersSignatures must be provided in the same order as the list of signersAll provided signatures must be valid and correspond to one of the signersreturns the number of valid signaturesreturns 0 if the inputs are inconsistent / | function reviewSignaturesInternal(
bytes[] memory _signatures,
address _destination, uint256 _value, bytes memory _data, uint256 _validity,
address[] memory _signers)
internal view returns (uint256)
| function reviewSignaturesInternal(
bytes[] memory _signatures,
address _destination, uint256 _value, bytes memory _data, uint256 _validity,
address[] memory _signers)
internal view returns (uint256)
| 49,446 |
110 | // 0.1% pool | if (_amount > _reserve0.div(1000)) {
_amount = _reserve0.div(1000);
}
| if (_amount > _reserve0.div(1000)) {
_amount = _reserve0.div(1000);
}
| 34,250 |
2 | // address public proxyRegistry; | address public proxyImplementationERC1155;
| address public proxyImplementationERC1155;
| 26,394 |
76 | // Toggle the special status of a wallet between true and false. / | function toggleSpecialWalletStatus(address wallet) external onlyOwner {
specialWallets[wallet] = !specialWallets[wallet];
}
| function toggleSpecialWalletStatus(address wallet) external onlyOwner {
specialWallets[wallet] = !specialWallets[wallet];
}
| 49,921 |
24 | // Returns the data for a sell deposit.They are identified andqueried by vault ID.If the vault does not exist or is not a selldeposit, then a null struct will be returned. / | function getSellDeposit (uint vaultId)
public view returns (CompleteSellDeposit memory)
| function getSellDeposit (uint vaultId)
public view returns (CompleteSellDeposit memory)
| 7,296 |
79 | // Check if the sender approved the operator owner The address of the owner operator The address of the operatorreturn The status of the approval / | function isApprovedForAll(address owner, address operator)
external
view
returns (bool isOperator)
| function isApprovedForAll(address owner, address operator)
external
view
returns (bool isOperator)
| 59,201 |
194 | // require new unlock time to be longer than old one | require(newUnlockTime>_liquidityUnlockTime,
"Error: New unlock time is shorter than old one.");
_liquidityUnlockTime=newUnlockTime;
emit ContractChanged(_liquidityUnlockTime);
| require(newUnlockTime>_liquidityUnlockTime,
"Error: New unlock time is shorter than old one.");
_liquidityUnlockTime=newUnlockTime;
emit ContractChanged(_liquidityUnlockTime);
| 29,498 |
13 | // Revoke approval for a piece of media / | function revokeApproval(uint256 tokenId) external;
| function revokeApproval(uint256 tokenId) external;
| 31,032 |
143 | // Otherwise, get the stored cToken exchange rate. | cTokenExchangeRate = CTokenInterface(_getCToken()).exchangeRateStored();
| cTokenExchangeRate = CTokenInterface(_getCToken()).exchangeRateStored();
| 50,125 |
188 | // Deposit committed event. | event DepositCommit(
uint32 indexed zkSyncBlockId,
uint32 indexed accountId,
address owner,
uint16 indexed tokenId,
uint128 amount
);
| event DepositCommit(
uint32 indexed zkSyncBlockId,
uint32 indexed accountId,
address owner,
uint16 indexed tokenId,
uint128 amount
);
| 29,765 |
8 | // Checkout account balance | require(totalAmount > 0 && balances[msg.sender] >= totalAmount);
| require(totalAmount > 0 && balances[msg.sender] >= totalAmount);
| 35,499 |
46 | // Creates `amount` tokens and assigns them to `account`, increasingthe total supply. If `requireReceptionAck` is set to true, and if a send hook isregistered for `account`, the corresponding function will be called with`operator`, `data` and `operatorData`. | * See {IERC777Sender} and {IERC777Recipient}.
*
* Emits {Minted} and {IERC20-Transfer} events.
*
* Requirements
*
* - `account` cannot be the zero address.
* - if `account` is a contract, it must implement the {IERC777Recipient}
* interface.
*/
function _mint(
... | * See {IERC777Sender} and {IERC777Recipient}.
*
* Emits {Minted} and {IERC20-Transfer} events.
*
* Requirements
*
* - `account` cannot be the zero address.
* - if `account` is a contract, it must implement the {IERC777Recipient}
* interface.
*/
function _mint(
... | 15,515 |
12 | // @inheritdocERC721 | function _burn(uint256 tokenId)
internal
override(ERC721, ERC721URIStorage)
| function _burn(uint256 tokenId)
internal
override(ERC721, ERC721URIStorage)
| 16,223 |
7 | // Distribute tokens through the index. token Super token address. indexId Id of the index. amount The amount of tokens desired to be distributed. NOTE:- This is a convenient version of updateIndex. It adds to the indexa delta that equals to `amount / totalUnits`.- The actual amount distributed could be obtained via`ca... | function distribute(
| function distribute(
| 7,900 |
15 | // Owner address to Vault Id | mapping(address => uint256) public userToVault;
| mapping(address => uint256) public userToVault;
| 17,889 |
35 | // Purchase function allows incoming payments when not paused - requires payment code | function purchase(bytes8 paymentCode) whenNotPaused public payable {
// Verify they have sent ETH in
require(msg.value != 0);
// Verify the payment code was included
require(paymentCode != 0);
// If payment from addresses are being enforced, ensure the code matches the sender address
if (en... | function purchase(bytes8 paymentCode) whenNotPaused public payable {
// Verify they have sent ETH in
require(msg.value != 0);
// Verify the payment code was included
require(paymentCode != 0);
// If payment from addresses are being enforced, ensure the code matches the sender address
if (en... | 49,328 |
10 | // account.requireNotNullAndNotEqual(spender); |
return allowances()[account][spender];
|
return allowances()[account][spender];
| 40,969 |
93 | // Equivalent to `_burn(tokenId, false)`. / | function _burn(uint256 tokenId) internal virtual {
_burn(tokenId, false);
}
| function _burn(uint256 tokenId) internal virtual {
_burn(tokenId, false);
}
| 23,332 |
366 | // Has enough support? | uint256 totalVotes = vote_.yea.add(vote_.nay);
if (!_isValuePct(vote_.yea, totalVotes, vote_.supportRequiredPct)) {
return false;
}
| uint256 totalVotes = vote_.yea.add(vote_.nay);
if (!_isValuePct(vote_.yea, totalVotes, vote_.supportRequiredPct)) {
return false;
}
| 62,656 |
92 | // 拿到已完成的次数 | function get_finished_number(address user)
public
view
returns(uint256)
| function get_finished_number(address user)
public
view
returns(uint256)
| 4,357 |
22 | // can't get company fee amount | IERC20(t.nativeToken).approve(address(smartSwap), uint256(amount));
| IERC20(t.nativeToken).approve(address(smartSwap), uint256(amount));
| 17,605 |
22 | // do it for parent 2 | swap = genesArray2[traitPos];
genesArray2[traitPos] = genesArray2[traitPos - 1];
genesArray2[traitPos - 1] = swap;
| swap = genesArray2[traitPos];
genesArray2[traitPos] = genesArray2[traitPos - 1];
genesArray2[traitPos - 1] = swap;
| 48,673 |
22 | // Get the terminal for this contract's project. | ITerminal _terminal = terminalDirectory.terminalOf(projectId);
| ITerminal _terminal = terminalDirectory.terminalOf(projectId);
| 79,927 |
33 | // The minimum overbid increment % (expressed in basis points, which is 1/100 of a percent) For basis points, values 0-10,000 map to 0%-100% | uint256 public minimumPriceIncrement;
| uint256 public minimumPriceIncrement;
| 20,942 |
13 | // Gives an individual token an unique URI/ Emits an event so there's provenance/ tokenIdToken Index that will be given an URI/ newURINew URI to be given | function setUniqueURI(uint tokenId, string calldata newURI) public onlyRole(CREATOR) {
uniqueTokenURI[tokenId] = newURI;
emit TokenURIChanged(tokenId, newURI);
}
| function setUniqueURI(uint tokenId, string calldata newURI) public onlyRole(CREATOR) {
uniqueTokenURI[tokenId] = newURI;
emit TokenURIChanged(tokenId, newURI);
}
| 21,813 |
115 | // get reward claimable for current epoch | currentEpoch.rewardsClaimed = currentEpoch.rewardsClaimed.add(currentEpochRewardsClaimable[user]);
reward = reward.add(currentEpochRewardsClaimable[user]);
currentEpochRewardsClaimable[user] = 0;
if (reward > 0) {
want.safeTransfer(user, reward);
emit RewardPaid(... | currentEpoch.rewardsClaimed = currentEpoch.rewardsClaimed.add(currentEpochRewardsClaimable[user]);
reward = reward.add(currentEpochRewardsClaimable[user]);
currentEpochRewardsClaimable[user] = 0;
if (reward > 0) {
want.safeTransfer(user, reward);
emit RewardPaid(... | 3,770 |
160 | // Remove fee and refund eth in case final purchase needed to end sale without dust errors | if (address(this).balance > hardcap) {
fee = 0;
excess = address(this).balance.sub(hardcap);
depositEther = depositEther.sub(excess);
}
| if (address(this).balance > hardcap) {
fee = 0;
excess = address(this).balance.sub(hardcap);
depositEther = depositEther.sub(excess);
}
| 40,236 |
45 | // Check if there was enough gas./_contract The address of the contract to check./interfaceId The id of the interface we want to test./ return Whether or not this check succeeded. | function _checkInterfaceWith10000Gas(address _contract, bytes4 interfaceId) internal view returns (bool) {
bool success;
bool result;
bytes memory callData = abi.encodeWithSelector(ERC165ID, interfaceId);
// solhint-disable-next-line no-inline-assembly
assembly {
... | function _checkInterfaceWith10000Gas(address _contract, bytes4 interfaceId) internal view returns (bool) {
bool success;
bool result;
bytes memory callData = abi.encodeWithSelector(ERC165ID, interfaceId);
// solhint-disable-next-line no-inline-assembly
assembly {
... | 42,237 |
152 | // Performs signature verification. Throws or reverts if unable to verify the record.name The name of the RRSIG record, in DNS label-sequence format. data The original data to verify. sig The signature data. / | function verifySignature(bytes memory name, bytes memory data, bytes memory sig, bytes memory proof) internal view {
uint signerNameLength = data.nameLength(RRSIG_SIGNER_NAME);
// o The RRSIG RR's Signer's Name field MUST be the name of the zone
// that contains the RRset.
requi... | function verifySignature(bytes memory name, bytes memory data, bytes memory sig, bytes memory proof) internal view {
uint signerNameLength = data.nameLength(RRSIG_SIGNER_NAME);
// o The RRSIG RR's Signer's Name field MUST be the name of the zone
// that contains the RRset.
requi... | 30,070 |
31 | // Checks max transaction limit | require((amount <= _maxTxAmount) || isTxLimitExempt[sender] || isTxLimitExempt[recipient], "Max TX Limit Exceeded");
| require((amount <= _maxTxAmount) || isTxLimitExempt[sender] || isTxLimitExempt[recipient], "Max TX Limit Exceeded");
| 750 |
9 | // events for token purchase during sale and claiming tokens after sale | event TokenClaimed(address indexed _claimer, address indexed _beneficiary, uint256 _stake, uint256 _amount);
event TokenPurchase(address indexed _purchaser, address indexed _beneficiary, uint256 _value, uint256 _stake, uint256 _amount, uint256 _participants, uint256 _weiRaised);
event TokenGoalReached();
... | event TokenClaimed(address indexed _claimer, address indexed _beneficiary, uint256 _stake, uint256 _amount);
event TokenPurchase(address indexed _purchaser, address indexed _beneficiary, uint256 _value, uint256 _stake, uint256 _amount, uint256 _participants, uint256 _weiRaised);
event TokenGoalReached();
... | 33,429 |
27 | // get the staking epoch | function _stakingEpochId(uint128 epochId) pure internal returns (uint128) {
return epochId + EPOCHS_DELAYED_FROM_STAKING_CONTRACT;
}
| function _stakingEpochId(uint128 epochId) pure internal returns (uint128) {
return epochId + EPOCHS_DELAYED_FROM_STAKING_CONTRACT;
}
| 7,620 |
10 | // The pool id of the MCV2 mock token pool in MCV1. | uint256 public immutable MASTER_PID;
| uint256 public immutable MASTER_PID;
| 27,775 |
80 | // Last time the pool distribute rewards to all stakeholders | uint256 internal _lastRewardDistributionOn;
uint256 public _poolRewardHalvingAt = 0;
| uint256 internal _lastRewardDistributionOn;
uint256 public _poolRewardHalvingAt = 0;
| 71,288 |
357 | // Subtract the `closeBorrowAmount_TargetUnderwaterAsset` from the `currentBorrowBalance_TargetUnderwaterAsset` to get `updatedBorrowBalance_TargetUnderwaterAsset` | (err, localResults.updatedBorrowBalance_TargetUnderwaterAsset) = sub(
localResults.currentBorrowBalance_TargetUnderwaterAsset,
localResults.closeBorrowAmount_TargetUnderwaterAsset
);
| (err, localResults.updatedBorrowBalance_TargetUnderwaterAsset) = sub(
localResults.currentBorrowBalance_TargetUnderwaterAsset,
localResults.closeBorrowAmount_TargetUnderwaterAsset
);
| 21,094 |
10 | // mints the boosters can only be called by owner. could be a smart contract | function mintBooster(address _owner, uint32 _duration, uint8 _type, uint8 _strength, uint32 _amount, uint24 _raiseValue) onlyChest public {
boosters.length ++;
Booster storage tempBooster = boosters[boosters.length - 1];
tempBooster.owner = _owner;
tempBooster.duration = _duration;... | function mintBooster(address _owner, uint32 _duration, uint8 _type, uint8 _strength, uint32 _amount, uint24 _raiseValue) onlyChest public {
boosters.length ++;
Booster storage tempBooster = boosters[boosters.length - 1];
tempBooster.owner = _owner;
tempBooster.duration = _duration;... | 7,005 |
94 | // Decrease amount of claim | function subtractFromClaimAmount(
uint256 tranche,
address recipient,
uint256 subtractAmount
| function subtractFromClaimAmount(
uint256 tranche,
address recipient,
uint256 subtractAmount
| 16,694 |
13 | // the negative slope of the distribution line scaled by SCALE, how much starting distribution rate / unit time scaled by SCALE | uint256 public immutable startDistribution;
| uint256 public immutable startDistribution;
| 16,798 |
54 | // SWEEPABLE CONFIG | modifier onlyPair() {
require(
msg.sender == pair,
"Empire::onlyPair: Insufficient Privileges"
);
_;
}
| modifier onlyPair() {
require(
msg.sender == pair,
"Empire::onlyPair: Insufficient Privileges"
);
_;
}
| 19,314 |
28 | // Deploy using the BentoBox factory. | newMarket = bentoBox.deploy(auctionTemplate, "", false);
auctionInfo[address(newMarket)] = Auction(true, BoringMath.to64(_templateId), BoringMath.to128(auctions.length));
auctions.push(address(newMarket));
emit MarketCreated(msg.sender, address(newMarket), auctionTemplate);
if (m... | newMarket = bentoBox.deploy(auctionTemplate, "", false);
auctionInfo[address(newMarket)] = Auction(true, BoringMath.to64(_templateId), BoringMath.to128(auctions.length));
auctions.push(address(newMarket));
emit MarketCreated(msg.sender, address(newMarket), auctionTemplate);
if (m... | 21,574 |
145 | // require that any funds locked are not leaving the account in question. | require(_balance.sub(_amountUnderlyingToSend) >= _lockedAmt, "FARMTREASURYV1: requested funds are temporarily locked");
| require(_balance.sub(_amountUnderlyingToSend) >= _lockedAmt, "FARMTREASURYV1: requested funds are temporarily locked");
| 26,588 |
16 | // |------------------ The following functions are overrides required by Solidity. ------------------| |
function _beforeTokenTransfer(address from, address to, uint256 tokenId)
internal
override(ERC721, ERC721Enumerable)
|
function _beforeTokenTransfer(address from, address to, uint256 tokenId)
internal
override(ERC721, ERC721Enumerable)
| 4,105 |
28 | // Haltable Abstract contract that allows children to implement anemergency stop mechanism. Differs from Pausable by causing a throw when in halt mode.Originally envisioned in FirstBlood ICO contract. / | contract Haltable is Ownable {
bool public halted;
modifier stopInEmergency {
if (halted) throw;
_;
}
modifier stopNonOwnersInEmergency {
if (halted && msg.sender != owner) throw;
_;
}
modifier onlyInEmergency {
if (!halted) throw;
_;
}
// called by the owner on emergency, tr... | contract Haltable is Ownable {
bool public halted;
modifier stopInEmergency {
if (halted) throw;
_;
}
modifier stopNonOwnersInEmergency {
if (halted && msg.sender != owner) throw;
_;
}
modifier onlyInEmergency {
if (!halted) throw;
_;
}
// called by the owner on emergency, tr... | 13,829 |
23 | // Iterates through _owners array, returns balance of addressIt is not recommended to call this function from another smart contractas it can become quite expensive -- call this function off chain instead. / | function balanceOf(address owner) public view virtual returns (uint256) {
if (owner == address(0)) revert BalanceQueryForZeroAddress();
uint256 count;
uint256 qty = _owners.length;
// Cannot realistically overflow, since we are using uint256
unchecked {
for (uint... | function balanceOf(address owner) public view virtual returns (uint256) {
if (owner == address(0)) revert BalanceQueryForZeroAddress();
uint256 count;
uint256 qty = _owners.length;
// Cannot realistically overflow, since we are using uint256
unchecked {
for (uint... | 40,603 |
51 | // cannot send funds to IdiotToken directly | function() payable {
revert();
}
| function() payable {
revert();
}
| 23,892 |
20 | // represents amount of tokens in percentage put on investing strategies | struct Strategy {
uint8 autopilot;
uint8 uniswap;
uint8 aave;
uint8 anchor;
}
| struct Strategy {
uint8 autopilot;
uint8 uniswap;
uint8 aave;
uint8 anchor;
}
| 73,647 |
3 | // return voting address/ | function getVoting() public view returns(IVoting) {
return voting;
}
| function getVoting() public view returns(IVoting) {
return voting;
}
| 15,443 |
521 | // For the purposes of liquidation or vaporization, get the value-equivalent amount of heldWeigiven owedWei and the (spread-adjusted) prices of each asset. / | function _owedWeiToHeldWei(
Types.Wei memory owedWei,
Monetary.Price memory heldPrice,
Monetary.Price memory owedPrice
)
private
pure
returns (Types.Wei memory)
| function _owedWeiToHeldWei(
Types.Wei memory owedWei,
Monetary.Price memory heldPrice,
Monetary.Price memory owedPrice
)
private
pure
returns (Types.Wei memory)
| 23,916 |
145 | // The block number when VBIT mining starts. | uint256 public startBlock;
event Deposit(address indexed user, uint256 indexed pid, uint256 amount);
event Withdraw(address indexed user, uint256 indexed pid, uint256 amount);
event EmergencyWithdraw(address indexed user, uint256 indexed pid, uint256 amount);
constructor(
VALOBIT _vbi... | uint256 public startBlock;
event Deposit(address indexed user, uint256 indexed pid, uint256 amount);
event Withdraw(address indexed user, uint256 indexed pid, uint256 amount);
event EmergencyWithdraw(address indexed user, uint256 indexed pid, uint256 amount);
constructor(
VALOBIT _vbi... | 63,228 |
6 | // Owned To verify ownership / | contract owned {
address public owner;
function owned() public {
owner = msg.sender;
}
modifier onlyOwner {
require(msg.sender == owner);
_;
}
}
| contract owned {
address public owner;
function owned() public {
owner = msg.sender;
}
modifier onlyOwner {
require(msg.sender == owner);
_;
}
}
| 47,792 |
14 | // The provided passcode must hash to one of the initialized hashes. | require(knownHashes_[keccak256(_passcode)] == true);
_;
| require(knownHashes_[keccak256(_passcode)] == true);
_;
| 39,044 |
55 | // Issue token based on Ether received./_beneficiary Address that newly issued token will be sent to. | function purchaseTokens(address _beneficiary) public payable inProgress{
// only accept a minimum amount of ETH?
require(msg.value >= 0.01 ether);
uint _tokens = computeTokenAmount(msg.value);
doIssueTokens(_beneficiary, _tokens);
/// forward the raised funds to the contrac... | function purchaseTokens(address _beneficiary) public payable inProgress{
// only accept a minimum amount of ETH?
require(msg.value >= 0.01 ether);
uint _tokens = computeTokenAmount(msg.value);
doIssueTokens(_beneficiary, _tokens);
/// forward the raised funds to the contrac... | 26,713 |
21 | // --- Interface for ERC20 --- | interface IERC20 {
function totalSupply() external view returns (uint256);
function decimals() external view returns (uint8);
function symbol() external view returns (string memory);
function name() external view returns (string memory);
function getOwner() external view returns (address);
funct... | interface IERC20 {
function totalSupply() external view returns (uint256);
function decimals() external view returns (uint8);
function symbol() external view returns (string memory);
function name() external view returns (string memory);
function getOwner() external view returns (address);
funct... | 20,206 |
393 | // The rate at which the flywheel distributes PAR, per block | uint public parRate;
| uint public parRate;
| 30,465 |
178 | // An event emitted when a reward is added | event RewardAdded(uint256 reward);
| event RewardAdded(uint256 reward);
| 83,547 |
0 | // Declare an Event | event Set(uint x);
| event Set(uint x);
| 10,982 |
23 | // poolRatio is used for a gas efficient round-robbin distribution of rewards.Pack a number of uint8s in poolRatios. Maximum number of pools is 14.Sum of ratios must add to 100. / | function updateRewardDistributionForPools(bytes calldata poolRatios)
onlyOwner()
| function updateRewardDistributionForPools(bytes calldata poolRatios)
onlyOwner()
| 48,689 |
59 | // Get the name of the Module / | function getName() public view returns(bytes32);
| function getName() public view returns(bytes32);
| 50,107 |
69 | // 2b. if levering up borrow and deposit | lp.borrow(want, amount, 2, _referral, address(this));
lp.deposit(want, IERC20(want).balanceOf(address(this)), address(this), _referral);
| lp.borrow(want, amount, 2, _referral, address(this));
lp.deposit(want, IERC20(want).balanceOf(address(this)), address(this), _referral);
| 55,496 |
11 | // function getMKCard(uint24 uid) external view returns (marketCard memory); | function getMKCard(uint8 Epoch, uint8 Collection, uint16 CardId) external view returns (marketCard memory);
function getItem(uint40 itemId) external view returns (NFTItem memory);
function RewardNFT(uint24 MissionId, address sender, uint24 RewardId) external;
| function getMKCard(uint8 Epoch, uint8 Collection, uint16 CardId) external view returns (marketCard memory);
function getItem(uint40 itemId) external view returns (NFTItem memory);
function RewardNFT(uint24 MissionId, address sender, uint24 RewardId) external;
| 26,196 |
104 | // токены распределяются пропорционально | tokensToMint = tokensToMint * _totalMaxTokens / _totalCurrentTokens;
_mint(userAddress, tokensToMint);
| tokensToMint = tokensToMint * _totalMaxTokens / _totalCurrentTokens;
_mint(userAddress, tokensToMint);
| 12,326 |
125 | // Liquidate the loan if it has defaulted / | function liquidate() external override onlyDefaulted onlyLiquidator {
status = Status.Liquidated;
emit Liquidated(status);
}
| function liquidate() external override onlyDefaulted onlyLiquidator {
status = Status.Liquidated;
emit Liquidated(status);
}
| 46,174 |
7 | // Owner withdrawal of fees. / | function withdrawFees() external {
require(tx.origin == owner && electionResult != 0, "Election not complete!");
owner.transfer(fees);
fees = 0;
}
| function withdrawFees() external {
require(tx.origin == owner && electionResult != 0, "Election not complete!");
owner.transfer(fees);
fees = 0;
}
| 44,408 |
115 | // Deploys all tokens to all integrations according to configured weights | function deploy(DeployRequest[] calldata deployments) external;
| function deploy(DeployRequest[] calldata deployments) external;
| 15,976 |
65 | // do not change this => disburse 100% rewards over `disburseDuration` | uint public disbursePercentX100 = 100e2;
uint public contractDeployTime;
uint public adminClaimableTime;
uint public lastDisburseTime;
| uint public disbursePercentX100 = 100e2;
uint public contractDeployTime;
uint public adminClaimableTime;
uint public lastDisburseTime;
| 3,669 |
675 | // Reads the uint216 at `rdPtr` in returndata. | function readUint216(
ReturndataPointer rdPtr
| function readUint216(
ReturndataPointer rdPtr
| 40,392 |
5 | // change to a new lpAssetThreshold lpAssetThreshold should be set to the minimum number _lpAssetThreshold new lpAssetThreshold / | function changeThreshold(uint256 _lpAssetThreshold) external onlyOwner {
lpAssetThreshold = _lpAssetThreshold;
emit ThresholdChanged(lpAssetThreshold);
}
| function changeThreshold(uint256 _lpAssetThreshold) external onlyOwner {
lpAssetThreshold = _lpAssetThreshold;
emit ThresholdChanged(lpAssetThreshold);
}
| 51,604 |
184 | // Total allocation poitns. Must be the sum of all allocation points in all pools.uint256 public totalAllocPoint = 0; | AreaInfo[] public areaInfo;
uint256 public totalRate = 0;
| AreaInfo[] public areaInfo;
uint256 public totalRate = 0;
| 73,333 |
28 | // ------------------------------------------------------------------------ Returns the amount of tokens approved by the owner that can be transferred to the spender&39;s account ------------------------------------------------------------------------ | function allowance(address tokenOwner, address spender) public constant returns (uint remaining) {
return allowed[tokenOwner][spender];
}
| function allowance(address tokenOwner, address spender) public constant returns (uint remaining) {
return allowed[tokenOwner][spender];
}
| 6,672 |
125 | // check if tokens exceed the amount of tokens that can be minted | if (tokenRaised.add(tokens) > currentCap)
{
tokens = currentCap.sub(tokenRaised);
weiAmount = tokens.div(currentPrice);
weiBack = msg.value - weiAmount;
}
| if (tokenRaised.add(tokens) > currentCap)
{
tokens = currentCap.sub(tokenRaised);
weiAmount = tokens.div(currentPrice);
weiBack = msg.value - weiAmount;
}
| 8,118 |
271 | // paid tokens will always go to the mintertokens bought using $GOLD have a 10% chance to be given to a random staked viking tokenId the token IDreturn the owner of the viking, or blackhole if not stolen / | function _rollTokenSteal(uint256 tokenId, uint256 seed) internal view returns (address) {
if (tokenId <= vandv.getPaidTokens() || ((seed >> 245) % 10) != 0) {
return address(0x0);
}
return village.randomVikingOwner(seed);
}
| function _rollTokenSteal(uint256 tokenId, uint256 seed) internal view returns (address) {
if (tokenId <= vandv.getPaidTokens() || ((seed >> 245) % 10) != 0) {
return address(0x0);
}
return village.randomVikingOwner(seed);
}
| 46,889 |
148 | // project max info | uint16 constant private _maxSupply = 8888;
uint16 constant private _maxFreeSupply = 4440;
uint8 constant private _maxPerTnx = 20;
| uint16 constant private _maxSupply = 8888;
uint16 constant private _maxFreeSupply = 4440;
uint8 constant private _maxPerTnx = 20;
| 74,113 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.