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 |
|---|---|---|---|---|
7 | // EIP2981 royalties implementation. / Maintain flexibility to modify royalties recipient (could also add basis points). | function _setRoyalties(address newRecipient) internal {
require(
newRecipient != address(0),
"Royalties: new recipient is the zero address"
);
_recipient = newRecipient;
}
| function _setRoyalties(address newRecipient) internal {
require(
newRecipient != address(0),
"Royalties: new recipient is the zero address"
);
_recipient = newRecipient;
}
| 34,736 |
22 | // Multiplies two exponentials given their mantissas, returning a new exponential. / | function mulExp(uint a, uint b) pure internal returns (MathError, Exp memory) {
return mulExp(Exp({mantissa: a}), Exp({mantissa: b}));
}
| function mulExp(uint a, uint b) pure internal returns (MathError, Exp memory) {
return mulExp(Exp({mantissa: a}), Exp({mantissa: b}));
}
| 48,327 |
277 | // stakable/burnable for x | slot = 15;
o = uint16(seq[sp++] % n1[slot]);
for (uint i=p1[slot][o];t1[slot][i] != '|';i++) s[p++] = t1[slot][i];
slot = 6;
o = uint16(seq[sp++] % n1[slot]);
for (uint i=p1[slot][o];t1[slot][i] != '|';i++) s[p++] = t1[slot][i];
| slot = 15;
o = uint16(seq[sp++] % n1[slot]);
for (uint i=p1[slot][o];t1[slot][i] != '|';i++) s[p++] = t1[slot][i];
slot = 6;
o = uint16(seq[sp++] % n1[slot]);
for (uint i=p1[slot][o];t1[slot][i] != '|';i++) s[p++] = t1[slot][i];
| 77,732 |
61 | // Forward funds to wallet address | vault.close();
| vault.close();
| 77,393 |
7 | // Redeems asset tokens from the yield source./redeemAmount The amount of yield-bearing tokens to be redeemed/ return The actual amount of tokens that were redeemed. | function _redeem(uint256 redeemAmount) internal override returns (uint256) {
return redeemAmount;
}
| function _redeem(uint256 redeemAmount) internal override returns (uint256) {
return redeemAmount;
}
| 38,582 |
10 | // Transfer ownership of an article./Lets you to transfer ownership of an article. This is useful when you want to change owner account without withdrawing and resubmitting./_articleStorageAddress The address of article in the storage./_newOwner The new owner of the article which resides in the storage address, provide... | function transferOwnership(uint80 _articleStorageAddress, address payable _newOwner) external virtual;
| function transferOwnership(uint80 _articleStorageAddress, address payable _newOwner) external virtual;
| 24,703 |
104 | // Used for percentage maths / | uint256 public constant BASE = 10**18;
| uint256 public constant BASE = 10**18;
| 13,428 |
31 | // calculateSecondarySaleFee// Utility function for calculating the secondary sale fee for given amount of wei _contractAddress address ERC721Contract address. _amount uint256 wei amount.return uint256 wei fee. / | function calculateSecondarySaleFee(address _contractAddress, uint256 _amount)
external
override
view
returns (uint256)
| function calculateSecondarySaleFee(address _contractAddress, uint256 _amount)
external
override
view
returns (uint256)
| 10,847 |
4 | // Count of partners | uint public partnerCount;
| uint public partnerCount;
| 20,196 |
12 | // ========== RESTRICTED FUNCTIONS ========== / | function notifyRewardAmount(uint256 reward) external onlyRewardsDistribution updateReward(address(0)) {
require(block.timestamp >= periodFinish, "cannot notify reward until period ended");
rewardRate = reward.div(rewardsDuration);
// Ensure the provided reward amount is not more than the b... | function notifyRewardAmount(uint256 reward) external onlyRewardsDistribution updateReward(address(0)) {
require(block.timestamp >= periodFinish, "cannot notify reward until period ended");
rewardRate = reward.div(rewardsDuration);
// Ensure the provided reward amount is not more than the b... | 4,891 |
30 | // IMPORTANT: The same issues {IERC20-approve} has related to transactionordering also apply here. Emits an {Approval} event. Requirements: - `owner` cannot be the zero address.- `spender` cannot be the zero address.- `deadline` must be a timestamp in the future.- `v`, `r` and `s` must be a valid `secp256k1` signature ... | function permit(address owner, address spender, uint256 amount, uint256 deadline, uint8 v, bytes32 r, bytes32 s) external;
| function permit(address owner, address spender, uint256 amount, uint256 deadline, uint8 v, bytes32 r, bytes32 s) external;
| 23,991 |
70 | // Required Events | event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
event TransferWithQuantity(address indexed from, address indexed to, uint256 indexed tokenId, uint256 quantity);
event ApprovalForAll(address indexed _owner, address indexed _operator, bool _approved);
event BatchTransfer(address... | event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
event TransferWithQuantity(address indexed from, address indexed to, uint256 indexed tokenId, uint256 quantity);
event ApprovalForAll(address indexed _owner, address indexed _operator, bool _approved);
event BatchTransfer(address... | 32,118 |
0 | // Payment Queue Interface. / | interface IPaymentQueue {
/**
* @dev Retrieve the current number of payments.
* @return The current number of payments.
*/
function getNumOfPayments() external view returns (uint256);
/**
* @dev Retrieve the sum of all payments.
* @return The sum of all payments.
*/
functi... | interface IPaymentQueue {
/**
* @dev Retrieve the current number of payments.
* @return The current number of payments.
*/
function getNumOfPayments() external view returns (uint256);
/**
* @dev Retrieve the sum of all payments.
* @return The sum of all payments.
*/
functi... | 14,151 |
48 | // Gets the information of a round of a question. _arbitrationID The ID of the arbitration. _round The round to query.return paidFees The amount of fees paid for each fully funded answer.return feeRewards The amount of fees that will be used as rewards.return fundedAnswers IDs of fully funded answers. / | function getRoundInfo(uint256 _arbitrationID, uint256 _round)
external
view
returns (
uint256[] memory paidFees,
uint256 feeRewards,
uint256[] memory fundedAnswers
)
| function getRoundInfo(uint256 _arbitrationID, uint256 _round)
external
view
returns (
uint256[] memory paidFees,
uint256 feeRewards,
uint256[] memory fundedAnswers
)
| 53,299 |
228 | // allow the curator to change their fee/_fee the new fee | function updateFee(uint256 _fee) external {
require(msg.sender == curator, "update:not curator");
require(_fee <= ISettings(settings).maxCuratorFee(), "update:cannot increase fee this high");
_claimFees();
fee = _fee;
}
| function updateFee(uint256 _fee) external {
require(msg.sender == curator, "update:not curator");
require(_fee <= ISettings(settings).maxCuratorFee(), "update:cannot increase fee this high");
_claimFees();
fee = _fee;
}
| 65,502 |
10 | // Confirm a transaction by providing just the hash. We use the previous transactions map,txs, in order to determine the body of the transaction from the hash provided. _h The transaction hash to approve. / | function confirm(bytes32 _h) onlymanyowners(_h) returns (bool) {
if (txs[_h].to != 0) {
assert(txs[_h].to.call.value(txs[_h].value)(txs[_h].data));
MultiTransact(msg.sender, _h, txs[_h].value, txs[_h].to, txs[_h].data);
delete txs[_h];
return true;
}
}
| function confirm(bytes32 _h) onlymanyowners(_h) returns (bool) {
if (txs[_h].to != 0) {
assert(txs[_h].to.call.value(txs[_h].value)(txs[_h].data));
MultiTransact(msg.sender, _h, txs[_h].value, txs[_h].to, txs[_h].data);
delete txs[_h];
return true;
}
}
| 29,621 |
32 | // 把合约余额转出 | function sendleftmoney(address _to, uint _value) public onlyadmin{
_transfer(this, _to, _value);
}
| function sendleftmoney(address _to, uint _value) public onlyadmin{
_transfer(this, _to, _value);
}
| 7,904 |
3 | // only log donations larger than 1 szabo to prevent spam | if(msg.value > 1 szabo) {
emit Deposit(msg.sender, msg.value);
}
| if(msg.value > 1 szabo) {
emit Deposit(msg.sender, msg.value);
}
| 28,252 |
69 | // set the costManager for all future calls to produce()/ | function setCostManager(address costManager_) public onlyOwner {
costManager = costManager_;
}
| function setCostManager(address costManager_) public onlyOwner {
costManager = costManager_;
}
| 23,764 |
206 | // PRIVELEGED MODULE FUNCTION. Low level function that edits a component's external position virtual unit. Takes a real unit and converts it to virtual before committing. / | function editExternalPositionUnit(
address _component,
address _positionModule,
int256 _realUnit
)
external
onlyModule
whenLockedOnlyLocker
| function editExternalPositionUnit(
address _component,
address _positionModule,
int256 _realUnit
)
external
onlyModule
whenLockedOnlyLocker
| 39,203 |
646 | // solhint-disable // Exponentiation and logarithm functions for 18 decimal fixed point numbers (both base and exponent/argument). Exponentiation and logarithm with arbitrary bases (x^y and log_x(y)) are implemented by conversion to naturalexponentiation and logarithm (where the base is Euler's number).Fernando Martine... | library LogExpMath {
// All fixed point multiplications and divisions are inlined. This means we need to divide by ONE when multiplying
// two numbers, and multiply by ONE when dividing them.
// All arguments and return values are 18 decimal fixed point numbers.
int256 constant ONE_18 = 1e18;
// I... | library LogExpMath {
// All fixed point multiplications and divisions are inlined. This means we need to divide by ONE when multiplying
// two numbers, and multiply by ONE when dividing them.
// All arguments and return values are 18 decimal fixed point numbers.
int256 constant ONE_18 = 1e18;
// I... | 5,170 |
17 | // The total deposits and winnings for each user. / | mapping (address => uint256) balances;
| mapping (address => uint256) balances;
| 27,248 |
63 | // Get the internal balance of the contract return The internal balance of the contract in Wei/ | function getContractBalance() public view onlyOwner returns(uint) {
return address(this).balance;
}
| function getContractBalance() public view onlyOwner returns(uint) {
return address(this).balance;
}
| 29,312 |
105 | // DemeterCrowdsale construction. _startTime beginning of crowdsale. _endTime end of crowdsale. _whiteListRegistrationEndTime time until which whitelist registration is still possible. _whiteListEndTime time until which only whitelist purchases are accepted. _rate how many tokens per ether in case of no whitelist or re... | function DemeterCrowdsale(
| function DemeterCrowdsale(
| 25,769 |
66 | // transfer ownership of the token to the owner of the presale contract | function transferTokenContractOwnership(address _address) public onlyOwner {
token.transferOwnership(_address);
}
| function transferTokenContractOwnership(address _address) public onlyOwner {
token.transferOwnership(_address);
}
| 62,971 |
39 | // src/osm.sol/ pragma solidity >=0.5.10; // import "ds-value/value.sol"; / | contract LibNote {
event LogNote(
bytes4 indexed sig,
address indexed usr,
bytes32 indexed arg1,
bytes32 indexed arg2,
bytes data
) anonymous;
modifier note {
_;
assembly {
// log an 'anonymous' event with a constant 6... | contract LibNote {
event LogNote(
bytes4 indexed sig,
address indexed usr,
bytes32 indexed arg1,
bytes32 indexed arg2,
bytes data
) anonymous;
modifier note {
_;
assembly {
// log an 'anonymous' event with a constant 6... | 31,539 |
117 | // Delegate call to get balance who Address to get balance forreturn balance of account / | function delegateBalanceOf(address who) public view returns (uint256) {
return balanceOf(who);
}
| function delegateBalanceOf(address who) public view returns (uint256) {
return balanceOf(who);
}
| 11,615 |
223 | // ------------------------------------------------------------------------------ [BondOperation contract] The BondOperation contract increases / decreases the total coin supply by redeeming / issuing bonds. The bond budget is updated by the ACB every epoch. Permission: Except public getters, only the ACB can call the ... | contract BondOperation_v2 is OwnableUpgradeable {
using SafeCast for uint;
using SafeCast for int;
// Constants. The values are defined in initialize(). The values never change
// during the contract execution but use 'public' (instead of 'constant')
// because tests want to override the values.
uint publi... | contract BondOperation_v2 is OwnableUpgradeable {
using SafeCast for uint;
using SafeCast for int;
// Constants. The values are defined in initialize(). The values never change
// during the contract execution but use 'public' (instead of 'constant')
// because tests want to override the values.
uint publi... | 20,881 |
50 | // https:etherscan.io/address/0x07Fa3744FeC271F80c2EA97679823F65c13CCDf4 | address internal constant WBTC_INTEREST_RATE_STRATEGY =
0x07Fa3744FeC271F80c2EA97679823F65c13CCDf4;
| address internal constant WBTC_INTEREST_RATE_STRATEGY =
0x07Fa3744FeC271F80c2EA97679823F65c13CCDf4;
| 15,747 |
133 | // workaround for a solidity bug | function _myEthBalance() private view returns(uint256) {
address self = address(this);
return self.balance;
}
| function _myEthBalance() private view returns(uint256) {
address self = address(this);
return self.balance;
}
| 38,844 |
26 | // Show proof of stake, and mint a token. First an off-chain validation of staking must be made, and signed by the notary wallet. proof Signature made by the notary wallet, proving validity of stake. tokens The total number of tokens staked by wallet. tokenId The id of token to mint. tokenData The complete data for the... | function proofOfStakeAndMint (Verification calldata proof, uint256 tokens, uint256 tokenId, TokenData[] calldata tokenData, Verification calldata verification) public payable {
require(block.timestamp >= _tier2, "CXIP: too early to stake");
require(msg.value >= _tokenStakePrice, "CXIP: payment amoun... | function proofOfStakeAndMint (Verification calldata proof, uint256 tokens, uint256 tokenId, TokenData[] calldata tokenData, Verification calldata verification) public payable {
require(block.timestamp >= _tier2, "CXIP: too early to stake");
require(msg.value >= _tokenStakePrice, "CXIP: payment amoun... | 28,312 |
49 | // Get all NFT collection addresses supported by this contract | function getNftAddresses() external view returns (address[] memory) {
return nftAddresses;
}
| function getNftAddresses() external view returns (address[] memory) {
return nftAddresses;
}
| 32,967 |
32 | // 2) Mutiply our dollar value by that to get our value in wei: | uint256 valueInWei = oneUSDInWei * _value;
| uint256 valueInWei = oneUSDInWei * _value;
| 3,272 |
66 | // Allow now actual store to deposit | if (!Token(_tokenGet).approve(_store, totalValue)) {
revert();
}
| if (!Token(_tokenGet).approve(_store, totalValue)) {
revert();
}
| 31,068 |
97 | // Same as a standards-compliant ERC20.approve() that never reverts (returns false).Note that this makes an external call to the token./ | function safeApprove(ERC20 _token, address _spender, uint256 _amount) internal returns (bool) {
bytes memory approveCallData = abi.encodeWithSelector(
_token.approve.selector,
_spender,
_amount
);
return invokeAndCheckSuccess(_token, approveCallData);
... | function safeApprove(ERC20 _token, address _spender, uint256 _amount) internal returns (bool) {
bytes memory approveCallData = abi.encodeWithSelector(
_token.approve.selector,
_spender,
_amount
);
return invokeAndCheckSuccess(_token, approveCallData);
... | 6,215 |
11 | // Function to claim a token _to The address that will receive the minted tokens./ | function claim(
address _to
| function claim(
address _to
| 11,162 |
12 | // allows a user to withdraw their unlocked tokens amount the uint256 amount of native token being withdrawn / | function withdraw(uint256 amount) external override {
if(!shutdown){
require(_unlockTimes[msg.sender] < block.number, "Tokens not unlocked yet");
}
require(
_stakedBalances[msg.sender] >= amount,
"Insufficient staked balance"
);
require(tot... | function withdraw(uint256 amount) external override {
if(!shutdown){
require(_unlockTimes[msg.sender] < block.number, "Tokens not unlocked yet");
}
require(
_stakedBalances[msg.sender] >= amount,
"Insufficient staked balance"
);
require(tot... | 25,593 |
83 | // File: contracts/gluon/AppGovernance.sol |
pragma solidity 0.7.1;
|
pragma solidity 0.7.1;
| 5,551 |
1 | // `SignatureMint1155` is an ERC 1155 contract. It lets anyone mint NFTs by producing a mint request and a signature (produced by an account with MINTER_ROLE, signing the mint request). / | interface ISignatureMintERC1155 is IERC1155Upgradeable, ISignatureMintWithParams {
struct MintRequestWithParams {
BaseMintRequest baseMintRequest;
uint256 tokenId;
uint256 pricePerToken;
address currency;
bytes param;
}
/// @dev Emitted when tokens are minted.
e... | interface ISignatureMintERC1155 is IERC1155Upgradeable, ISignatureMintWithParams {
struct MintRequestWithParams {
BaseMintRequest baseMintRequest;
uint256 tokenId;
uint256 pricePerToken;
address currency;
bytes param;
}
/// @dev Emitted when tokens are minted.
e... | 23,888 |
44 | // Artwork | struct Artwork {
// owner
address owner;
// nftcontract address
address nftcontract;
// tokenId
uint256 tokenId;
ArtState status;
// time artwork start register or start auction
uint256 started;
// l... | struct Artwork {
// owner
address owner;
// nftcontract address
address nftcontract;
// tokenId
uint256 tokenId;
ArtState status;
// time artwork start register or start auction
uint256 started;
// l... | 28,191 |
129 | // Indexed | assetSymbol
);
return nonce;
| assetSymbol
);
return nonce;
| 43,711 |
200 | // MasterChef is the master of Sushi. He can make Sushi and he is a fair guy. Note that it's ownable and the owner wields tremendous power. The ownership will be transferred to a governance smart contract once SUSHI is sufficiently distributed and the community can show to govern itself. Have fun reading it. Hopefully ... | contract MasterChef is Ownable {
using SafeMath for uint256;
using SafeERC20 for IERC20;
// Info of each user.
struct UserInfo {
uint256 amount; // How many LP tokens the user has provided.
uint256 rewardDebt; // Reward debt. See explanation below.
//
// We do some f... | contract MasterChef is Ownable {
using SafeMath for uint256;
using SafeERC20 for IERC20;
// Info of each user.
struct UserInfo {
uint256 amount; // How many LP tokens the user has provided.
uint256 rewardDebt; // Reward debt. See explanation below.
//
// We do some f... | 39,947 |
24 | // Last block number when cumulative funding rate was recorded | uint256 private _cumuFundingRateBlock;
| uint256 private _cumuFundingRateBlock;
| 48,718 |
42 | // Allows merchant or Monetha to initiate exchange of funds by withdrawing funds to deposit address of the exchange / | function withdrawToExchange(address depositAccount, uint amount) external onlyMerchantOrMonetha whenNotPaused {
doWithdrawal(depositAccount, amount);
}
| function withdrawToExchange(address depositAccount, uint amount) external onlyMerchantOrMonetha whenNotPaused {
doWithdrawal(depositAccount, amount);
}
| 61,345 |
147 | // adapted from t-nicci solution https:ethereum.stackexchange.com/a/31470 | function subString(string memory str, uint startIndex, uint endIndex) internal pure returns (string memory) {
bytes memory strBytes = bytes(str);
bytes memory result = new bytes(endIndex-startIndex);
for(uint i = startIndex; i < endIndex; i++) {
result[i-startIndex] = strBytes[i]... | function subString(string memory str, uint startIndex, uint endIndex) internal pure returns (string memory) {
bytes memory strBytes = bytes(str);
bytes memory result = new bytes(endIndex-startIndex);
for(uint i = startIndex; i < endIndex; i++) {
result[i-startIndex] = strBytes[i]... | 39,709 |
42 | // Constructor that sends msg.sender the initial token supply / | constructor(
address _wallet
| constructor(
address _wallet
| 21,385 |
141 | // Retrieves an object from the container. _index Index of the particular object to access.return 32 byte object value. / | function get(uint256 _index) external view returns (bytes32);
| function get(uint256 _index) external view returns (bytes32);
| 18,377 |
28 | // keccak256("ProxyAdmin"); | bytes32 internal constant KEY_PROXY_ADMIN =
0x96ed0203eb7e975a4cbcaa23951943fa35c5d8288117d50c12b3d48b0fab48d1;
| bytes32 internal constant KEY_PROXY_ADMIN =
0x96ed0203eb7e975a4cbcaa23951943fa35c5d8288117d50c12b3d48b0fab48d1;
| 30,700 |
10 | // Returns boolean indicating if voting is enabled. _vault - The target vault.return true if voting is enabled, else returns false. / | function votingEnabled(address _vault) external view returns (bool);
| function votingEnabled(address _vault) external view returns (bool);
| 27,175 |
12 | // 0 TO 100 DRAGONS : 0.01 100 TO 1.000 DRAGONS : 0.1 1.000 TO 10.000 DRAGONS : 1 10.000 TO 100.000 DRAGONS : 10 >100.000 DRAGONS : 100 |
return _createRandomDragonEgg(msg.sender);
|
return _createRandomDragonEgg(msg.sender);
| 20,055 |
226 | // activating contact events | function setPresaleLive(bool live) external onlyOwner {
presaleLive = live;
}
| function setPresaleLive(bool live) external onlyOwner {
presaleLive = live;
}
| 40,636 |
223 | // get vault short otoken if available | if (vaultDetails.hasShort) {
OtokenInterface short = OtokenInterface(_vault.shortOtokens[0]);
(
vaultDetails.shortCollateralAsset,
vaultDetails.shortUnderlyingAsset,
vaultDetails.shortStrikeAsset,
vaultDetails.shortStrikePri... | if (vaultDetails.hasShort) {
OtokenInterface short = OtokenInterface(_vault.shortOtokens[0]);
(
vaultDetails.shortCollateralAsset,
vaultDetails.shortUnderlyingAsset,
vaultDetails.shortStrikeAsset,
vaultDetails.shortStrikePri... | 22,661 |
172 | // get token amount which has a max price impact according to MAGIC_NUMBER for sells !!IMPORTANT!! => Any functions using return value from this MUST call `sync` on the pair before calling this function! | function getMaxSwappableAmount() public view returns (uint) {
uint tokensAvailable = IERC20(trustedRewardTokenAddress).balanceOf(trustedDepositTokenAddress);
uint maxSwappableAmount = tokensAvailable.mul(MAGIC_NUMBER).div(1e18);
return maxSwappableAmount;
}
| function getMaxSwappableAmount() public view returns (uint) {
uint tokensAvailable = IERC20(trustedRewardTokenAddress).balanceOf(trustedDepositTokenAddress);
uint maxSwappableAmount = tokensAvailable.mul(MAGIC_NUMBER).div(1e18);
return maxSwappableAmount;
}
| 57,550 |
10 | // Convert WETH to ETH | IWETH(WETH).withdraw(decoded.repayAmount);
| IWETH(WETH).withdraw(decoded.repayAmount);
| 13,395 |
42 | // Settings in RP which the DAO will have full control over This settings contract enables storage using setting paths with namespaces, rather than explicit set methods | abstract contract RocketDAONodeTrustedSettings is RocketBase, RocketDAONodeTrustedSettingsInterface {
// The namespace for a particular group of settings
bytes32 settingNameSpace;
// Only allow updating from the DAO proposals contract
modifier onlyDAONodeTrustedProposal() {
// If this contra... | abstract contract RocketDAONodeTrustedSettings is RocketBase, RocketDAONodeTrustedSettingsInterface {
// The namespace for a particular group of settings
bytes32 settingNameSpace;
// Only allow updating from the DAO proposals contract
modifier onlyDAONodeTrustedProposal() {
// If this contra... | 29,830 |
9 | // Returns the bin step of the Liquidity Book Pair The bin step is the increase in price between two consecutive bins, in basis points.For example, a bin step of 1 means that the price of the next bin is 0.01% higher than the price of the previous bin.return binStep The bin step of the Liquidity Book Pair, in 10_000th ... | function getBinStep() external pure override returns (uint16) {
return _binStep();
}
| function getBinStep() external pure override returns (uint16) {
return _binStep();
}
| 12,843 |
161 | // Fail if borrow not allowed // Verify market's block number equals current block number // Fail gracefully if protocol has insufficient underlying cash //We calculate the new borrower and total borrow balances, failing on overflow: accountBorrowsNew = accountBorrows + borrowAmount totalBorrowsNew = totalBorrows + bor... | (vars.mathErr, vars.accountBorrows) = borrowBalanceStoredInternal(borrower);
if (vars.mathErr != MathError.NO_ERROR) {
return failOpaque(Error.MATH_ERROR, FailureInfo.BORROW_ACCUMULATED_BALANCE_CALCULATION_FAILED, uint(vars.mathErr));
}
| (vars.mathErr, vars.accountBorrows) = borrowBalanceStoredInternal(borrower);
if (vars.mathErr != MathError.NO_ERROR) {
return failOpaque(Error.MATH_ERROR, FailureInfo.BORROW_ACCUMULATED_BALANCE_CALCULATION_FAILED, uint(vars.mathErr));
}
| 10,699 |
621 | // Address of the known and trusted Margin contract on the blockchain | address public DYDX_MARGIN;
| address public DYDX_MARGIN;
| 72,432 |
0 | // Gets the tokenId of the next NFT minted. / | function getNextTokenId() public view returns (uint256) {
return nextTokenId;
}
| function getNextTokenId() public view returns (uint256) {
return nextTokenId;
}
| 24,953 |
583 | // Set joetroller's oracle to newOracle | oracle = newOracle;
| oracle = newOracle;
| 33,364 |
0 | // ==================================================================================================================== STRUCTS and ENUMS===================================================================================================================== / Configuation options for this primary sale module. | struct PublicMintConfig {
uint256 phaseMaxSupply;
uint256 phaseStart;
uint256 phaseEnd;
uint256 metadropPerMintFee;
uint256 metadropPrimaryShareInBasisPoints;
uint256 publicPrice;
uint256 maxPublicQuantity;
bool reservedAllocationPhase;
}
| struct PublicMintConfig {
uint256 phaseMaxSupply;
uint256 phaseStart;
uint256 phaseEnd;
uint256 metadropPerMintFee;
uint256 metadropPrimaryShareInBasisPoints;
uint256 publicPrice;
uint256 maxPublicQuantity;
bool reservedAllocationPhase;
}
| 40,970 |
2 | // balances in the lock-ups | mapping(address => uint256) public balances;
| mapping(address => uint256) public balances;
| 5,764 |
8 | // Standard SafeMath, stripped down to just add/sub/mul/div / | library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction... | library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction... | 7,229 |
99 | // returnaddress: The address of the creator of this project./ | function creator() external view returns(address);
| function creator() external view returns(address);
| 1,670 |
371 | // Events | event SaleActivation(bool isActive);
event HolderSaleActivation(bool isActive);
| event SaleActivation(bool isActive);
event HolderSaleActivation(bool isActive);
| 4,688 |
49 | // Returns an address of a given node. / | function getNodeAddress(uint nodeIndex)
external
view
override
checkNodeExists(nodeIndex)
returns (address)
| function getNodeAddress(uint nodeIndex)
external
view
override
checkNodeExists(nodeIndex)
returns (address)
| 9,982 |
177 | // Function that lets a seller get their deposited day tokens (minBalanceToSell) back, if no buyer turns up. Allowed only after expiryBlockNumber Throws if any other state other than EXPIRED/ | function refundFailedAuctionAmount() onlyContributor(idOf[msg.sender]) public returns(bool){
uint id = idOf[msg.sender];
if(block.number > contributors[id].expiryBlockNumber && contributors[id].status == sellingStatus.ONSALE)
{
contributors[id].status = sellingStatus.EXPIRED;
... | function refundFailedAuctionAmount() onlyContributor(idOf[msg.sender]) public returns(bool){
uint id = idOf[msg.sender];
if(block.number > contributors[id].expiryBlockNumber && contributors[id].status == sellingStatus.ONSALE)
{
contributors[id].status = sellingStatus.EXPIRED;
... | 14,703 |
36 | // Stores the oracle address to use when looking for the price of a given token/oracles are keyed by the pair of underlyingToken-priceToken, so for a BTCUSD oracle/ returning a price of $14_000, the pair would be the addresses corresponding to WBTC and USDC | mapping(address => mapping(address => address)) internal oracles;
| mapping(address => mapping(address => address)) internal oracles;
| 32,505 |
104 | // Update dividend trackers | payoutsTo_[_customerAddress] -= (int256) (profitPerDivToken * _amountOfDivTokens);
payoutsTo_[_toAddress] += (int256) (profitPerDivToken * _amountOfDivTokens);
gamePayoutsTo_[_customerAddress] -= (int256) (gameProfitPerDivToken * _amountOfDivTokens);
gamePayoutsTo_[_toAddress] += (int256) (... | payoutsTo_[_customerAddress] -= (int256) (profitPerDivToken * _amountOfDivTokens);
payoutsTo_[_toAddress] += (int256) (profitPerDivToken * _amountOfDivTokens);
gamePayoutsTo_[_customerAddress] -= (int256) (gameProfitPerDivToken * _amountOfDivTokens);
gamePayoutsTo_[_toAddress] += (int256) (... | 36,386 |
48 | // Read / | function isAdmin (address _admin) public view returns (bool _isAdmin) {
return admins[_admin];
}
| function isAdmin (address _admin) public view returns (bool _isAdmin) {
return admins[_admin];
}
| 25,874 |
78 | // retorna o saldo remanescente permitidoallowance(_owner, from); |
transferFrom(from, to, valor);
|
transferFrom(from, to, valor);
| 35,009 |
63 | // Perform call, placing first word of return data in scratch space. | success := call(gas(), conduit, 0, callDataOffset, callDataSize, 0, OneWord)
| success := call(gas(), conduit, 0, callDataOffset, callDataSize, 0, OneWord)
| 17,062 |
13 | // TODO: ADD a _birthNewDragon here | return
createNewDragon(
_motherGender,
_fatherColor,
_motherGeneration,
_motherId,
_fatherId,
_motherGenes,
_motherGenes,
_fatherGenes,
| return
createNewDragon(
_motherGender,
_fatherColor,
_motherGeneration,
_motherId,
_fatherId,
_motherGenes,
_motherGenes,
_fatherGenes,
| 726 |
36 | // May enable/disable transfers on Neumark | bytes32 internal constant ROLE_TRANSFER_ADMIN = 0xb6527e944caca3d151b1f94e49ac5e223142694860743e66164720e034ec9b19;
| bytes32 internal constant ROLE_TRANSFER_ADMIN = 0xb6527e944caca3d151b1f94e49ac5e223142694860743e66164720e034ec9b19;
| 18,739 |
6 | // Campaign configuration | mapping(uint256 => CampaignConfig) public campaignConfigs;
| mapping(uint256 => CampaignConfig) public campaignConfigs;
| 44,563 |
348 | // the fixed interest accrued on this swap | uint256 protocol0VariableInterestAccrued = _calculateVariableInterestAccrued(_swap.notional, protocol0, _swap.underlierProtocol0BorrowIndex);
| uint256 protocol0VariableInterestAccrued = _calculateVariableInterestAccrued(_swap.notional, protocol0, _swap.underlierProtocol0BorrowIndex);
| 75,782 |
23 | // encode a uint112 as a UQ112x112 | function encode(uint112 y) internal pure returns (uint224 z) {
z = uint224(y) * Q112; // never overflows
}
| function encode(uint112 y) internal pure returns (uint224 z) {
z = uint224(y) * Q112; // never overflows
}
| 10,581 |
246 | // Cap at newSupply | newRedeemable = newRedeemable > newSupply ? newSupply : newRedeemable;
| newRedeemable = newRedeemable > newSupply ? newSupply : newRedeemable;
| 4,815 |
16 | // == Governor | function governor() external override view returns (address) {
return _governor;
}
| function governor() external override view returns (address) {
return _governor;
}
| 2,215 |
26 | // Only allow access to strategist or owner / | function _onlyStrategistOrOwner() internal view {
require(hasRole(STRATEGIST, msg.sender) || hasRole(DEFAULT_ADMIN_ROLE, msg.sender), "Not authorized");
}
| function _onlyStrategistOrOwner() internal view {
require(hasRole(STRATEGIST, msg.sender) || hasRole(DEFAULT_ADMIN_ROLE, msg.sender), "Not authorized");
}
| 17,190 |
165 | // Units up for cooldown | uint88 cooldownUnits;
| uint88 cooldownUnits;
| 23,759 |
84 | // add y^08(20! / 08!) | z = (z * y) / FIXED_1;
res += z * 0x00000618fee9f800;
| z = (z * y) / FIXED_1;
res += z * 0x00000618fee9f800;
| 31,297 |
34 | // Input validation | require(tab > 0, "Clipper/zero-tab");
require(lot > 0, "Clipper/zero-lot");
require(usr != address(0), "Clipper/zero-usr");
id = ++kicks;
require(id > 0, "Clipper/overflow");
active.push(id);
sales[id].pos = active.length - 1;
| require(tab > 0, "Clipper/zero-tab");
require(lot > 0, "Clipper/zero-lot");
require(usr != address(0), "Clipper/zero-usr");
id = ++kicks;
require(id > 0, "Clipper/overflow");
active.push(id);
sales[id].pos = active.length - 1;
| 8,631 |
0 | // Iterable map of (address => Proposal) index = ordinals[a]-1 keys[index].maker = a | using map for ProposalMap;
| using map for ProposalMap;
| 27,465 |
5 | // Allows only the (immutable) owner to call a function. | modifier onlyOwner() virtual {
if (msg.sender != owner) {
LibOwnableRichErrorsV06.OnlyOwnerError(
msg.sender,
owner
).rrevert();
}
_;
}
| modifier onlyOwner() virtual {
if (msg.sender != owner) {
LibOwnableRichErrorsV06.OnlyOwnerError(
msg.sender,
owner
).rrevert();
}
_;
}
| 47,880 |
5,740 | // 2871 | entry "gonadectomized" : ENG_ADJECTIVE
| entry "gonadectomized" : ENG_ADJECTIVE
| 19,483 |
12 | // ------------------------------------------------------------------------ Implementation of basic token interface ------------------------------------------------------------------------ | contract ERC20 is IERC20 {
using SafeMath for uint256;
mapping(address => uint256) public balances;
// ------------------------------------------------------------------------
// Get balance of user
// ------------------------------------------------------------------------
function balanceOf(address... | contract ERC20 is IERC20 {
using SafeMath for uint256;
mapping(address => uint256) public balances;
// ------------------------------------------------------------------------
// Get balance of user
// ------------------------------------------------------------------------
function balanceOf(address... | 17,135 |
7 | // Fixed window oracle that recomputes the average price for the entire period once every period/Oracle/note that the price average is only guaranteed to be over at least 1 period, but may be over a longer period | contract Oracle is Debouncable, Timeboundable, IOracle, ReentrancyGuard {
using FixedPoint for *;
IUniswapV2Pair public immutable override pair;
address public immutable override token0;
address public immutable override token1;
uint256 public price0CumulativeLast;
uint256 public price1Cumulat... | contract Oracle is Debouncable, Timeboundable, IOracle, ReentrancyGuard {
using FixedPoint for *;
IUniswapV2Pair public immutable override pair;
address public immutable override token0;
address public immutable override token1;
uint256 public price0CumulativeLast;
uint256 public price1Cumulat... | 86,088 |
22 | // Temporarily leave the set of collator candidates without unbonding/ @custom:selector a6485ccd | function goOffline() external;
| function goOffline() external;
| 32,311 |
96 | // Allows an owner to stop or countinue deposits./_isActive Whether the deposits are allowed. | function setActive(bool _isActive) public onlyOwner {
isActive = _isActive;
}
| function setActive(bool _isActive) public onlyOwner {
isActive = _isActive;
}
| 21,264 |
82 | // Math: since feeBasisPoints is <= BASIS_POINTS_DEN, this will never underflow. | _transferCurrency(beneficiary, reserve - fee);
_transferCurrency(feeCollector, fee);
| _transferCurrency(beneficiary, reserve - fee);
_transferCurrency(feeCollector, fee);
| 4,227 |
40 | // Seed User List | function seedUserList(address[] memory _userAddrs, UserInfo[] memory _userList, bool _transferToken) public onlyOwner {
for (uint i=0; i<_userAddrs.length; i++) {
setUserInfo(_userAddrs[i], _userList[i].vestingIndex, _userList[i].depositedAmount, _userList[i].purchasedAmount, _userList[i].withdr... | function seedUserList(address[] memory _userAddrs, UserInfo[] memory _userList, bool _transferToken) public onlyOwner {
for (uint i=0; i<_userAddrs.length; i++) {
setUserInfo(_userAddrs[i], _userList[i].vestingIndex, _userList[i].depositedAmount, _userList[i].purchasedAmount, _userList[i].withdr... | 66,027 |
12 | // Minted counter for current Token and totalSupply() | Counters.Counter private tokenCounter;
| Counters.Counter private tokenCounter;
| 17,568 |
5 | // Add an allowed administrator_allowedAdministrator address/ | function addAllowedModifier(address _allowedAdministrator)
public
onlyOwner
nonEmptyAddress(_allowedAdministrator)
| function addAllowedModifier(address _allowedAdministrator)
public
onlyOwner
nonEmptyAddress(_allowedAdministrator)
| 31,994 |
8 | // keccak256("MultiSigTransaction(address destination,uint256 value,bytes data,uint256 nonce,address txOrigin)") | bytes32 constant TXTYPE_HASH = 0x81336c6b66e18c614f29c0c96edcbcbc5f8e9221f35377412f0ea5d6f428918e;
| bytes32 constant TXTYPE_HASH = 0x81336c6b66e18c614f29c0c96edcbcbc5f8e9221f35377412f0ea5d6f428918e;
| 4,913 |
43 | // Aggregating total wETH debt from protocols | totalDebt_ =
assets_.aaveV2.wETH +
assets_.aaveV3.wETH +
assets_.compoundV3.wETH +
assets_.morphoAaveV2.wETH +
assets_.euler.wETH;
netAssets_ = totalAssets_ - totalDebt_ - revenue; // Assuming wETH 1:1 stETH
aggregatedRatio_ = totalAss... | totalDebt_ =
assets_.aaveV2.wETH +
assets_.aaveV3.wETH +
assets_.compoundV3.wETH +
assets_.morphoAaveV2.wETH +
assets_.euler.wETH;
netAssets_ = totalAssets_ - totalDebt_ - revenue; // Assuming wETH 1:1 stETH
aggregatedRatio_ = totalAss... | 12,807 |
3 | // duration of a slice period for the vesting in seconds. | uint256 public immutable vestingSlicePeriod;
| uint256 public immutable vestingSlicePeriod;
| 6,322 |
31 | // Royalty / | function setApprovalForAll(address operator, bool approved) public override onlyAllowedOperatorApproval(operator) {
super.setApprovalForAll(operator, approved);
}
| function setApprovalForAll(address operator, bool approved) public override onlyAllowedOperatorApproval(operator) {
super.setApprovalForAll(operator, approved);
}
| 15,296 |
25 | // EVM assembler of runtime portion of child contract: ;; Pseudocode: if (msg.sender != 0x000000000000cb2d80a37898be43579c7b616844) { throw; } ;; suicide(msg.sender) PUSH14 0xcb2d80a37898be43579c7b616856 ;; hardcoded address of this contract CALLER XOR JUMP JUMPDEST CALLER SELFDESTRUCT Or in binary: 6dcb2d80a37898be435... |
let end := add(offset, value)
mstore(callvalue(), 0x746dcb2d80a37898be43579c7b6168563318565b33ff6000526015600bf30000)
|
let end := add(offset, value)
mstore(callvalue(), 0x746dcb2d80a37898be43579c7b6168563318565b33ff6000526015600bf30000)
| 17,177 |
14 | // Proof of work is called by the miner when they submit the solution (proof of work and value)_nonce uint submitted by miner_requestId the apiId being mined_value of api query/ | function submitMiningSolution(TellorStorage.TellorStorageStruct storage self, string memory _nonce, uint256 _requestId, uint256 _value)
public
| function submitMiningSolution(TellorStorage.TellorStorageStruct storage self, string memory _nonce, uint256 _requestId, uint256 _value)
public
| 13,092 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.