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 |
|---|---|---|---|---|
3 | // The exchange rate between total shares and BTC+ total supply. Express in WAD. It's equal to the amount of plus token per share. Note: The index will never decrease! | uint256 public index;
address public override governance;
mapping(address => bool) public override strategists;
address public override treasury;
| uint256 public index;
address public override governance;
mapping(address => bool) public override strategists;
address public override treasury;
| 7,621 |
101 | // wealth redistribution | referralBalance_[_referredBy] = SafeMath.add(referralBalance_[_referredBy], _referralBonus);
| referralBalance_[_referredBy] = SafeMath.add(referralBalance_[_referredBy], _referralBonus);
| 5,984 |
10 | // Get a reference to the first owner. | address _storedFirstOwner = store.firstOwnerOf(address(this), _tokenId);
| address _storedFirstOwner = store.firstOwnerOf(address(this), _tokenId);
| 11,767 |
78 | // Transfer the DUSK to this contract. | _token.safeTransferFrom(msg.sender, address(this), amount);
| _token.safeTransferFrom(msg.sender, address(this), amount);
| 51,799 |
3 | // 'Candidate({...})' creates a temporary Candidate object and 'candidates.push(...)' appends it to the end of 'candidates'. | candidates.push(Candidate({
name: CandidateNames[i],
voteCount: 0,
votersList: new address[](0)
}));
| candidates.push(Candidate({
name: CandidateNames[i],
voteCount: 0,
votersList: new address[](0)
}));
| 53,313 |
207 | // this view from the aggregator is the most gas efficient but it can throw when there's no data, so let's call it low-level to suppress any reverts | bytes memory payload = abi.encodeWithSignature("latestRoundData()");
| bytes memory payload = abi.encodeWithSignature("latestRoundData()");
| 75,852 |
155 | // Event emitted when controller is changed / | event NewController(KineControllerInterface oldController, KineControllerInterface newController);
| event NewController(KineControllerInterface oldController, KineControllerInterface newController);
| 70,457 |
4 | // The Balancer pool data Note we change style to match Balancer's custom getter | IVault private immutable _vault;
bytes32 private immutable _poolId;
| IVault private immutable _vault;
bytes32 private immutable _poolId;
| 23,485 |
24 | // Implements a security model with owner and ops. | contract OpsManaged is Owned() {
address public opsAddress;
event OpsAddressUpdated(address indexed _newAddress);
constructor() public
{
}
modifier onlyOwnerOrOps() {
require(isOwnerOrOps(msg.sender));
_;
}
function isOps(address _address) public view returns (bool) {
r... | contract OpsManaged is Owned() {
address public opsAddress;
event OpsAddressUpdated(address indexed _newAddress);
constructor() public
{
}
modifier onlyOwnerOrOps() {
require(isOwnerOrOps(msg.sender));
_;
}
function isOps(address _address) public view returns (bool) {
r... | 37,271 |
8 | // logs a new price after each change/_price token price, wei/aqo | event Price(uint256 _price);
| event Price(uint256 _price);
| 29,539 |
89 | // Collect the protocol fee accrued to the pool/recipient The address to which collected protocol fees should be sent/amount0Requested The maximum amount of token0 to send, can be 0 to collect fees in only token1/amount1Requested The maximum amount of token1 to send, can be 0 to collect fees in only token0/ return amou... | function collectProtocol(
address recipient,
uint128 amount0Requested,
uint128 amount1Requested
) external returns (uint128 amount0, uint128 amount1);
| function collectProtocol(
address recipient,
uint128 amount0Requested,
uint128 amount1Requested
) external returns (uint128 amount0, uint128 amount1);
| 27,073 |
12 | // Implements the basic logic to burn a scaled balance token. In some instances, a burn transaction will emit a mint eventif the amount to burn is less than the interest that the user accrued user The user which debt is burnt target The address that will receive the underlying, if any amount The amount getting burned i... | ) internal virtual {
uint256 amountScaled = amount.rayDiv(index);
require(amountScaled != 0, Errors.INVALID_BURN_AMOUNT);
uint256 scaledBalance = super.balanceOf(user);
uint256 balanceIncrease = scaledBalance.rayMul(index) -
scaledBalance.rayMul(_userState[user].addition... | ) internal virtual {
uint256 amountScaled = amount.rayDiv(index);
require(amountScaled != 0, Errors.INVALID_BURN_AMOUNT);
uint256 scaledBalance = super.balanceOf(user);
uint256 balanceIncrease = scaledBalance.rayMul(index) -
scaledBalance.rayMul(_userState[user].addition... | 23,998 |
58 | // @inheritdoc ERC4626Upgradeable | function totalAssets() public view override returns (uint256) {
return super.lendingAssets() - _lockedProfit();
}
| function totalAssets() public view override returns (uint256) {
return super.lendingAssets() - _lockedProfit();
}
| 15,206 |
470 | // Add asset to be included in account liquidity calculation cToken The address of the cToken market to be enabledreturn Success indicator for whether each corresponding market was entered / | function enterMarket(address cToken, address borrower) external returns (uint) {
require(msg.sender == cToken, "sender must be cToken");
return uint(addToMarketInternal(CToken(cToken), borrower));
}
| function enterMarket(address cToken, address borrower) external returns (uint) {
require(msg.sender == cToken, "sender must be cToken");
return uint(addToMarketInternal(CToken(cToken), borrower));
}
| 31,035 |
14 | // Set the metadata for a subgraph represented by `_tokenId`. `_tokenId` must exist. _tokenId ID of the NFT _subgraphMetadata IPFS hash for the metadata / | function setSubgraphMetadata(uint256 _tokenId, bytes32 _subgraphMetadata)
external
override
onlyMinter
| function setSubgraphMetadata(uint256 _tokenId, bytes32 _subgraphMetadata)
external
override
onlyMinter
| 31,074 |
120 | // ============ Create Bid ============ |
function createBid(bytes32 auctionId, uint256 amount)
external
payable
nonReentrant
whenNotPaused
auctionExists(auctionId)
auctionNotExpired(auctionId)
|
function createBid(bytes32 auctionId, uint256 amount)
external
payable
nonReentrant
whenNotPaused
auctionExists(auctionId)
auctionNotExpired(auctionId)
| 27,761 |
8 | // Allows the company to tokenize shares and transfer them e.g to the draggable contract and wrap them.If these shares are newly created, setTotalShares must be called first in order to adjust the total number of shares. / | function mintAndCall(address shareholder, address callee, uint256 amount, bytes calldata data) external {
mint(callee, amount);
require(IERC677Receiver(callee).onTokenTransfer(shareholder, amount, data));
}
| function mintAndCall(address shareholder, address callee, uint256 amount, bytes calldata data) external {
mint(callee, amount);
require(IERC677Receiver(callee).onTokenTransfer(shareholder, amount, data));
}
| 18,489 |
193 | // Search for the next available not minted token id | while (legendaryPositions[newTokenId-1]){
if (newTokenId >= legendaryAmount) {
newTokenId = 1;
} else {
| while (legendaryPositions[newTokenId-1]){
if (newTokenId >= legendaryAmount) {
newTokenId = 1;
} else {
| 33,344 |
0 | // Used to verify pending requests by transactee sending deposit to this contract | function () payable {
uint32 value = uint32(msg.value);
if (!_requestExists(msg.sender, value)) {
throw;
}
| function () payable {
uint32 value = uint32(msg.value);
if (!_requestExists(msg.sender, value)) {
throw;
}
| 10,321 |
3 | // Configuration. | string private baseURI;
uint256 public mintPrice = 0.04 ether;
uint256 public saleTime = 0;
bool private reservedNoundles = false;
uint256 public reserveMinted = 0;
bool public saleEnabled = false;
| string private baseURI;
uint256 public mintPrice = 0.04 ether;
uint256 public saleTime = 0;
bool private reservedNoundles = false;
uint256 public reserveMinted = 0;
bool public saleEnabled = false;
| 22,945 |
24 | // Override for extensions that require an internal state to check for validity (current user contributions,etc.) beneficiary Address receiving the tokens usdtAmount Value in wei involved in the purchase / | function _updatePurchasingState(address beneficiary, uint256 usdtAmount)
internal
| function _updatePurchasingState(address beneficiary, uint256 usdtAmount)
internal
| 17,863 |
33 | // TOTAL ALLOWED LEVERAGED POSITION | uint256 size = position.size;
uint256 collateralMasterWDecimals = _convertToTokenDecimals(position.collateral, position.price, tokenDecimals);
if(totalBalanceOfCollateralUSD > position.collateral){
| uint256 size = position.size;
uint256 collateralMasterWDecimals = _convertToTokenDecimals(position.collateral, position.price, tokenDecimals);
if(totalBalanceOfCollateralUSD > position.collateral){
| 43,916 |
41 | // MUST be valid photo pool ID | require(isValidPhotoId(_photoPoolId));
| require(isValidPhotoId(_photoPoolId));
| 39,842 |
149 | // Transfer Ether to receiving stealth address | _receiver.transfer(amount);
| _receiver.transfer(amount);
| 16,451 |
40 | // 安全关闭位置 close a given position ledgerType: ledger type epoch: epoch of the ledger positionIndex: position index of the user positionInfo: storage of the position info roundInfo: storage of the round info / | function _safeClosePosition(
uint256 ledgerType,
uint256 epoch,
uint256 positionIndex,
PositionInfo storage positionInfo,
RoundInfo storage roundInfo,
UserGlobalInfo storage userGlobalInfo
| function _safeClosePosition(
uint256 ledgerType,
uint256 epoch,
uint256 positionIndex,
PositionInfo storage positionInfo,
RoundInfo storage roundInfo,
UserGlobalInfo storage userGlobalInfo
| 9,319 |
18 | // WARNING: if you transfer to a contract that cannot handle incoming tokens you may lose them | balances[msg.sender] = sub(balanceOf(msg.sender), _value);
balances[_to] = add(balances[_to], _value);
Transfer(msg.sender, _to, _value);
| balances[msg.sender] = sub(balanceOf(msg.sender), _value);
balances[_to] = add(balances[_to], _value);
Transfer(msg.sender, _to, _value);
| 49,326 |
16 | // See '_setTickers()' in {OracleHouse}. restricted to admin only. / | function setTickers(
string memory _tickerUsdFiat,
string memory _tickerReserveAsset
) external override onlyRole(DEFAULT_ADMIN_ROLE) {
_setTickers(_tickerUsdFiat, _tickerReserveAsset);
}
| function setTickers(
string memory _tickerUsdFiat,
string memory _tickerReserveAsset
) external override onlyRole(DEFAULT_ADMIN_ROLE) {
_setTickers(_tickerUsdFiat, _tickerReserveAsset);
}
| 52,194 |
51 | // Tokens to bounty owner can be sent only after ICO | bool public sentTokensToBountyOwner = false;
uint public etherRaised = 0;
| bool public sentTokensToBountyOwner = false;
uint public etherRaised = 0;
| 4,742 |
11 | // ============================================================================== __ _|__|_ __ _.(_|(/_ || (/_| _\. (for UI & viewing things on etherscan)=====_|======================================================================= | function checkIfNameValid(string _nameStr)
public
view
returns(bool)
| function checkIfNameValid(string _nameStr)
public
view
returns(bool)
| 25,221 |
28 | // only owner view | function _onlyOwner() private view {
require(msg.sender == _owner, "Only the contract owner may perform this action");
}
| function _onlyOwner() private view {
require(msg.sender == _owner, "Only the contract owner may perform this action");
}
| 1,305 |
15 | // This is a virtual function that should be overridden so it returns the address to which the fallback function | * and {_fallback} should delegate.
*/
function _implementation() internal view virtual returns (address);
/**
* @dev Delegates the current call to the address returned by `_implementation()`.
*
* This function does not return to its internal call site, it will return directly to the external caller.
*/
... | * and {_fallback} should delegate.
*/
function _implementation() internal view virtual returns (address);
/**
* @dev Delegates the current call to the address returned by `_implementation()`.
*
* This function does not return to its internal call site, it will return directly to the external caller.
*/
... | 29,333 |
55 | // treasuryAmount += treasuryAmt; |
emit RewardsCalculated(
epoch,
rewardBaseCalAmount,
rewardAmount,
treasuryAmt
);
|
emit RewardsCalculated(
epoch,
rewardBaseCalAmount,
rewardAmount,
treasuryAmt
);
| 19,478 |
6 | // Returns true if blockchain of passed id is registered to swapblockchain number of blockchain/ | function getOtherBlockchainAvailableByNum(uint128 blockchain) external view returns (bool)
| function getOtherBlockchainAvailableByNum(uint128 blockchain) external view returns (bool)
| 46,045 |
45 | // address where funds are collected | address public wallet;
| address public wallet;
| 11,441 |
1 | // check caller balance ~~ | (, bytes memory data) = meow.staticcall(abi.encodeWithSelector(0x70a08231, msg.sender));
uint256 amount = abi.decode(data, (uint256));
require(amount >= 1_000_000 ether, "meow too quiet");
| (, bytes memory data) = meow.staticcall(abi.encodeWithSelector(0x70a08231, msg.sender));
uint256 amount = abi.decode(data, (uint256));
require(amount >= 1_000_000 ether, "meow too quiet");
| 31,402 |
405 | // Iterate over the number of spins and calculate totals:- player win amount- bankroll win amount- jackpot wins | (winAmount, lossAmount, jackpotAmount, jackpotWins) = getSpinResults(playerBet.blockNumber, playerBet.numSpins, playerBet.tokenValue.mul(1e14), _playerAddress);
| (winAmount, lossAmount, jackpotAmount, jackpotWins) = getSpinResults(playerBet.blockNumber, playerBet.numSpins, playerBet.tokenValue.mul(1e14), _playerAddress);
| 24,509 |
485 | // Apply the multiplier | fee = (fee * mint_fee_multiplier) / 1e6;
| fee = (fee * mint_fee_multiplier) / 1e6;
| 73,578 |
1 | // Price offered at the minimum amount. / | uint public price;
| uint public price;
| 30,274 |
1 | // Keeps track of the number of items sold on the marketplace | Counters.Counter private _itemsSold;
| Counters.Counter private _itemsSold;
| 7,349 |
58 | // Mint MDT tokens. (internal use only)_to address Address to send minted MDT to._amount uint256 Amount of MDT tokens to mint./ | function mint(address _to, uint256 _amount)
private
validRecipient(_to)
returns (bool)
| function mint(address _to, uint256 _amount)
private
validRecipient(_to)
returns (bool)
| 8,647 |
26 | // Get the specified trader's settlement value, including pending fee, funding payment,/ owed realized PnL and unrealized PnL/Note the difference between `settlementTokenBalanceX10_S`, `getSettlementTokenValue()` and `getBalance()`:/They are all settlement token balances but with or without/pending fee, funding payment... | function getSettlementTokenValue(address trader) external view returns (int256 balance);
| function getSettlementTokenValue(address trader) external view returns (int256 balance);
| 10,895 |
0 | // Use Horner's method to compute f(x). The idea is that a_0 + a_1x + a_2x^2 + ... + a_nx^n = (...(((a_nx) + a_{n-1})x + a_{n-2})x + ...) + a_0. Consequently we need to do deg(f) horner iterations that consist of: 1. Multiply the last result by x 2. Add the next coefficient (starting from the highest coefficient)We sli... | result :=
add(0x549a83d43c90aaf1a28c445c81abc883cb61e4353a84ea0fcb15ccee6d6482f, mulmod(
add(0x6f753527f0dec9b713d52f08e4556a3963a2f7e5e282b2e97ffde3e12569b76, mulmod(
add(0x233eff8cfcc744de79d412f724898d13c0e53b1132046ee45db7a101242a73f, mulmod(
... | result :=
add(0x549a83d43c90aaf1a28c445c81abc883cb61e4353a84ea0fcb15ccee6d6482f, mulmod(
add(0x6f753527f0dec9b713d52f08e4556a3963a2f7e5e282b2e97ffde3e12569b76, mulmod(
add(0x233eff8cfcc744de79d412f724898d13c0e53b1132046ee45db7a101242a73f, mulmod(
... | 26,897 |
119 | // sending plaftrom fee to the super manager | require(betDeEx.collectPlatformFee(_platformFee), "platform fee should be collected");
betDeEx.emitEndEvent(endedBy, _choice, _platformFee);
| require(betDeEx.collectPlatformFee(_platformFee), "platform fee should be collected");
betDeEx.emitEndEvent(endedBy, _choice, _platformFee);
| 17,788 |
0 | // Interface for required functionality in the ERC721 standardfor non-fungible tokens. Author: Nadav Hollander (nadav at dharma.io) / | contract ERC721 {
// Function
function totalSupply() public view returns (uint256 _totalSupply);
function balanceOf(address _owner) public view returns (uint256 _balance);
function ownerOf(uint _tokenId) public view returns (address _owner);
function approve(address _to, uint _tokenId) public;
f... | contract ERC721 {
// Function
function totalSupply() public view returns (uint256 _totalSupply);
function balanceOf(address _owner) public view returns (uint256 _balance);
function ownerOf(uint _tokenId) public view returns (address _owner);
function approve(address _to, uint _tokenId) public;
f... | 12,941 |
65 | // 获取期权信息/tokenAddress 目标代币地址,0表示eth/strikePrice 用户设置的行权价格,结算时系统会根据标的物当前价与行权价比较,计算用户盈亏/orientation 看涨/看跌两个方向。true:看涨,false:看跌/exerciseBlock 到达该日期后用户手动进行行权,日期在系统中使用区块号进行记录/ return 期权信息 | function getOptionInfo(
address tokenAddress,
uint strikePrice,
bool orientation,
uint exerciseBlock
) external view returns (OptionView memory);
| function getOptionInfo(
address tokenAddress,
uint strikePrice,
bool orientation,
uint exerciseBlock
) external view returns (OptionView memory);
| 66,286 |
22 | // Calculate the DOMAIN_SEPARATOR | function _calculateDomainSeparator(uint256 chainId) private view returns (bytes32) {
return keccak256(
abi.encode(
DOMAIN_SEPARATOR_SIGNATURE_HASH,
chainId,
address(this)
)
);
}
| function _calculateDomainSeparator(uint256 chainId) private view returns (bytes32) {
return keccak256(
abi.encode(
DOMAIN_SEPARATOR_SIGNATURE_HASH,
chainId,
address(this)
)
);
}
| 39,095 |
126 | // Mint and burn star | mapping(address => bool) public minters;
| mapping(address => bool) public minters;
| 15,668 |
60 | // Generate flight key | bytes32 key = getFlightKey(airline, flightID, timestamp);
| bytes32 key = getFlightKey(airline, flightID, timestamp);
| 55,596 |
14 | // Boolean variable that contains whether all installments for the pool were made or not. | mapping (uint8 => bool) public installmentsEnded;
| mapping (uint8 => bool) public installmentsEnded;
| 36,797 |
187 | // Writes an oracle observation to the array/Writable at most once per block. Index represents the most recently written element. cardinality and index must be tracked externally./ If the index is at the end of the allowable array length (according to cardinality), and the next cardinality/ is greater than the current ... | function write(
Observation[65535] storage self,
uint16 index,
uint32 blockTimestamp,
int24 tick,
uint128 liquidity,
uint16 cardinality,
uint16 cardinalityNext
| function write(
Observation[65535] storage self,
uint16 index,
uint32 blockTimestamp,
int24 tick,
uint128 liquidity,
uint16 cardinality,
uint16 cardinalityNext
| 76,274 |
364 | // Admin call to delegate the votes of the COMP-like underlying compLikeDelegatee The address to delegate votes to / | function _delegateCompLikeTo(address compLikeDelegatee) external {
require(msg.sender == admin, "only the admin may set the comp-like delegate");
CompLike(underlying).delegate(compLikeDelegatee);
}
| function _delegateCompLikeTo(address compLikeDelegatee) external {
require(msg.sender == admin, "only the admin may set the comp-like delegate");
CompLike(underlying).delegate(compLikeDelegatee);
}
| 37,504 |
1 | // public function to convert uint256 to string num uint256 integer to convertreturn string string convert from given uint256 / | function uint2str(uint256 num) public pure returns (string memory _uintAsString) {
if (num == 0) {
return "0";
}
uint256 j = num;
uint256 len;
while (j != 0) {
len++;
j /= 10;
}
bytes memory bstr = new bytes(len);
... | function uint2str(uint256 num) public pure returns (string memory _uintAsString) {
if (num == 0) {
return "0";
}
uint256 j = num;
uint256 len;
while (j != 0) {
len++;
j /= 10;
}
bytes memory bstr = new bytes(len);
... | 30,200 |
162 | // Set a token sunset timestamp. / | function setTokenSunsetTimestamp(uint256 _timestamp) external;
| function setTokenSunsetTimestamp(uint256 _timestamp) external;
| 46,628 |
21 | // Internal utility function that combines`_origin` and `_nonce`. Both origin and nonce should be less than 2^32 - 1 _origin Domain of chain where the transfer originated _nonce The unique identifier for the message from origin to destinationreturn Returns (`_origin` << 32) & `_nonce` / | function _originAndNonce(uint32 _origin, uint32 _nonce) internal pure returns (uint64) {
return (uint64(_origin) << 32) | _nonce;
}
| function _originAndNonce(uint32 _origin, uint32 _nonce) internal pure returns (uint64) {
return (uint64(_origin) << 32) | _nonce;
}
| 29,978 |
10 | // Move the last value to the index where the value to delete is | set._values[toDeleteIndex] = lastvalue;
| set._values[toDeleteIndex] = lastvalue;
| 14,730 |
41 | // Maximum amount of the underlying asset that can be withdrawn from the owner balance in the Vault,/ through a withdraw call./ - return the maximum amount of assets that could be transferred from owner through withdraw/ and not cause a revert, which MUST NOT be higher than the actual maximum/ that would be accepted (i... | function maxWithdraw(address owner) public view virtual returns (uint256) {
return convertToAssets(balanceOf(owner));
}
| function maxWithdraw(address owner) public view virtual returns (uint256) {
return convertToAssets(balanceOf(owner));
}
| 10,464 |
73 | // Whitelist Spotter to read the Osm data (only necessary if it is the first time the token is being added to an ilk) !!!!!!!! Only if PIP_UNIV2WBTCETH = Osm or PIP_UNIV2WBTCETH = Median and hasn't been already whitelisted due a previous deployed ilk | LPOsmAbstract(PIP_UNIV2WBTCETH).kiss(MCD_SPOT);
| LPOsmAbstract(PIP_UNIV2WBTCETH).kiss(MCD_SPOT);
| 20,510 |
31 | // Property Token | contract PropToken is ERC20, Owned {
using SafeMath for uint256;
uint256 internal _cap;
address private _mintContract;
address private _burnContract;
address internal _propertyRegistry;
bool private _canMint;
modifier onlySystemAdmin {
require(PropTokenHelpers(getDataAddress()).h... | contract PropToken is ERC20, Owned {
using SafeMath for uint256;
uint256 internal _cap;
address private _mintContract;
address private _burnContract;
address internal _propertyRegistry;
bool private _canMint;
modifier onlySystemAdmin {
require(PropTokenHelpers(getDataAddress()).h... | 32,492 |
17 | // tokenURI() base path./Without trailing slash | string internal _baseTokenURI;
| string internal _baseTokenURI;
| 12,991 |
29 | // check whether the contract be called directly or not Modifier that will execute internal code block only if called directly(Not via delegatecall) / | modifier onlyEthDepositLogic() {
require(isEthDepositLogic(), "delegatecall is not allowed");
_;
}
| modifier onlyEthDepositLogic() {
require(isEthDepositLogic(), "delegatecall is not allowed");
_;
}
| 194 |
267 | // Read the transfer | Transfer memory transfer;
readTx(data, offset, transfer);
TransferAuxiliaryData memory auxData = abi.decode(auxiliaryData, (TransferAuxiliaryData));
| Transfer memory transfer;
readTx(data, offset, transfer);
TransferAuxiliaryData memory auxData = abi.decode(auxiliaryData, (TransferAuxiliaryData));
| 51,117 |
60 | // Get batch of ERC20 balances.return Batch of ERC20 balances. / | function batchERC20Balances(address[] calldata tokens, address[] calldata tokenHolders) external view returns (uint256[] memory, uint256[] memory) {
uint256[] memory batchBalancesOf = batchBalanceOf(tokens, tokenHolders);
uint256[] memory batchEthBalances = batchEthBalance(tokenHolders);
r... | function batchERC20Balances(address[] calldata tokens, address[] calldata tokenHolders) external view returns (uint256[] memory, uint256[] memory) {
uint256[] memory batchBalancesOf = batchBalanceOf(tokens, tokenHolders);
uint256[] memory batchEthBalances = batchEthBalance(tokenHolders);
r... | 40,827 |
25 | // 10% of the total Ether sent is used to pay existing holders. | var fee = div(value_, 10);
| var fee = div(value_, 10);
| 13,849 |
164 | // Transfers a Kitty to another address. If transferring to a smart/contract be VERY CAREFUL to ensure that it is aware of ERC-721 (or/CryptoKitties specifically) or your Kitty may be lost forever. Seriously./_to The address of the recipient, can be a user or contract./_tokenId The ID of the Kitty to transfer./Required... | function transfer(
address _to,
uint256 _tokenId
)
public
whenNotPaused
| function transfer(
address _to,
uint256 _tokenId
)
public
whenNotPaused
| 33,254 |
7 | // Withdraw structure |
struct withdrawal
|
struct withdrawal
| 28,362 |
95 | // Crimecash Token with Governance.address: https:ropsten.etherscan.io/address/0x263361900b60d3b0fce9e3eb77abfb7c398f3c46code | contract CrimeCash is ERC20("CrimeCash", "CRIME"), Ownable {
constructor() public {
_setupDecimals(8);
}
function mint(address _to, uint256 _amount) public onlyOwner {
_mint(_to, _amount);
}
function burn(address _from, uint256 _amount) public onlyOwner {
_burn(_from, _amount);
}
} | contract CrimeCash is ERC20("CrimeCash", "CRIME"), Ownable {
constructor() public {
_setupDecimals(8);
}
function mint(address _to, uint256 _amount) public onlyOwner {
_mint(_to, _amount);
}
function burn(address _from, uint256 _amount) public onlyOwner {
_burn(_from, _amount);
}
} | 27,951 |
49 | // Change the vault series | vault_.seriesId = newSeriesId;
_tweak(vaultId, vault_);
| vault_.seriesId = newSeriesId;
_tweak(vaultId, vault_);
| 9,441 |
280 | // substract withdrawal reward from total deposit | totalPendingDeposit -= withdrawalReward;
| totalPendingDeposit -= withdrawalReward;
| 34,288 |
23 | // 团队质押收益时间 | mapping (address => uint256) private teamPledgeHarvestTime;
| mapping (address => uint256) private teamPledgeHarvestTime;
| 5,151 |
444 | // fire a burnt event | emit Burnt(msg.sender, _from, _value);
| emit Burnt(msg.sender, _from, _value);
| 7,142 |
204 | // Copied and modified from sushiswap code: https:github.com/sushiswap/sushiswap/blob/master/contracts/MasterChef.sol | interface IMigrator {
function replaceMigrate(IERC20 lpToken) external returns (IERC20, uint);
function migrate(IERC20 lpToken) external returns (IERC20, uint);
}
| interface IMigrator {
function replaceMigrate(IERC20 lpToken) external returns (IERC20, uint);
function migrate(IERC20 lpToken) external returns (IERC20, uint);
}
| 34,616 |
164 | // Returns the downcasted uint80 from uint256, reverting onoverflow (when the input is greater than largest uint80). Counterpart to Solidity's `uint80` operator. Requirements: - input must fit into 80 bits _Available since v4.7._ / | function toUint80(uint256 value) internal pure returns (uint80) {
require(value <= type(uint80).max, "SafeCast: value doesn't fit in 80 bits");
return uint80(value);
}
| function toUint80(uint256 value) internal pure returns (uint80) {
require(value <= type(uint80).max, "SafeCast: value doesn't fit in 80 bits");
return uint80(value);
}
| 14,444 |
24 | // set the token&39;s tokenExchangeRate, | function setTokenExchangeRate(uint256 _tokenExchangeRate) isOwner external {
if (_tokenExchangeRate == 0) throw;
if (_tokenExchangeRate == tokenExchangeRate) throw;
tokenExchangeRate = _tokenExchangeRate;
}
| function setTokenExchangeRate(uint256 _tokenExchangeRate) isOwner external {
if (_tokenExchangeRate == 0) throw;
if (_tokenExchangeRate == tokenExchangeRate) throw;
tokenExchangeRate = _tokenExchangeRate;
}
| 11,391 |
2 | // Whether the distribution's feeRecipient has claimed its fee. | bool wasFeeClaimed;
| bool wasFeeClaimed;
| 13,161 |
12 | // totalNFT staked | uint256 public totalNFT;
| uint256 public totalNFT;
| 81,345 |
20 | // Match functions : | function uint2str(uint256 _i)
internal
pure
returns (string memory _uintAsString)
| function uint2str(uint256 _i)
internal
pure
returns (string memory _uintAsString)
| 312 |
126 | // Updates balance of winner minus fee amount | balances[_winner] += (_pot - fee);
balances[beneficiary] += fee;
| balances[_winner] += (_pot - fee);
balances[beneficiary] += fee;
| 36,148 |
1 | // change your cost by changing the value of 1 , for example: 5 ether etc... | uint256 public cost = 1 ether;
| uint256 public cost = 1 ether;
| 19,355 |
35 | // Fallback function to buy the tokens/ | function () payable {
require(msg.value > 0);
buyTokens(msg.sender, msg.value);
}
| function () payable {
require(msg.value > 0);
buyTokens(msg.sender, msg.value);
}
| 15,374 |
51 | // Acceptance state | bool sellerAccepted;
bool buyerAccepted;
| bool sellerAccepted;
bool buyerAccepted;
| 36,059 |
326 | // tokenIn The address of the input token/tokenOut The address of the output token/recipient The address to receive the tokens/amountOut The exact amount of the output token to receive/ return tradeSuccess Indicates whether the trade succeeded | function swapExactOutput(
address tokenIn,
address tokenOut,
address recipient,
uint256 amountOut
) external returns (bool tradeSuccess);
| function swapExactOutput(
address tokenIn,
address tokenOut,
address recipient,
uint256 amountOut
) external returns (bool tradeSuccess);
| 63,497 |
170 | // public methods public method to harvest all the unharvested epochs until current epoch - 1 | function massHarvest() external returns (uint){
uint totalDistributedValue;
uint epochId = _getEpochId().sub(1); // fails in epoch 0
// force max number of epochs
if (epochId > NR_OF_EPOCHS) {
epochId = NR_OF_EPOCHS;
}
for (uint128 i = lastEpochIdHarveste... | function massHarvest() external returns (uint){
uint totalDistributedValue;
uint epochId = _getEpochId().sub(1); // fails in epoch 0
// force max number of epochs
if (epochId > NR_OF_EPOCHS) {
epochId = NR_OF_EPOCHS;
}
for (uint128 i = lastEpochIdHarveste... | 37,757 |
248 | // Prepare a users array to whitelist the Safe. | address[] memory users = new address[](1);
users[0] = address(safe);
| address[] memory users = new address[](1);
users[0] = address(safe);
| 36,149 |
136 | // Register whether or not the new owner is willing to accept ownership. | _willAcceptOwnership[controller][msg.sender] = willAcceptOwnership;
| _willAcceptOwnership[controller][msg.sender] = willAcceptOwnership;
| 4,883 |
50 | // Resume all paused functionalities of Boomflow.Only WhitelistAdmin (DEX) have the access permission. / | function Resume()
public
onlyWhitelistAdmin
| function Resume()
public
onlyWhitelistAdmin
| 39,351 |
24 | // Function to finish the sender's participation for the asset.The asset profit is redeemed as well as all the Dai deposited. / | function finish() nonReentrant external {
_finish(msg.sender);
}
| function finish() nonReentrant external {
_finish(msg.sender);
}
| 18,212 |
11 | // Validate the length of the data in state is a multiple of 32 | uint256 argLen = arg.length;
require(
argLen != 0 && argLen % 32 == 0,
"Dynamic state variables must be a multiple of 32 bytes"
);
| uint256 argLen = arg.length;
require(
argLen != 0 && argLen % 32 == 0,
"Dynamic state variables must be a multiple of 32 bytes"
);
| 24,619 |
1 | // inscribe an inscription.The inscribing function solely validates the format of the calldata and does not verify its content. The correct content data should be prepared.The inscribing function does not check for content duplication. Ethernals are inscribed by sending a transaction to the contract, the calldata must ... | fallback(bytes calldata input) external returns (bytes memory) {
require(msg.sender == tx.origin, "only EOA");
require(keccak256(abi.encodePacked(string(input[0:3]))) == keccak256(abi.encodePacked(ETHERNAL_HEAER)), "invalid header");
require(uint8(input[3]) == ETHERNAL_VER, "invalid version"... | fallback(bytes calldata input) external returns (bytes memory) {
require(msg.sender == tx.origin, "only EOA");
require(keccak256(abi.encodePacked(string(input[0:3]))) == keccak256(abi.encodePacked(ETHERNAL_HEAER)), "invalid header");
require(uint8(input[3]) == ETHERNAL_VER, "invalid version"... | 22,830 |
290 | // AirSwap Swap contract https:github.com/airswap/airswap-protocols/blob/master/source/swap/contracts/interfaces/ISwap.sol | ISwap public immutable SWAP_CONTRACT;
| ISwap public immutable SWAP_CONTRACT;
| 29,555 |
26 | // The following functions are required by OpenSea Operator Filter (https:github.com/ProjectOpenSea/operator-filter-registry) | function setApprovalForAll(address operator, bool approved) public override(ERC721,IERC721) onlyAllowedOperatorApproval(operator) {
super.setApprovalForAll(operator, approved);
}
| function setApprovalForAll(address operator, bool approved) public override(ERC721,IERC721) onlyAllowedOperatorApproval(operator) {
super.setApprovalForAll(operator, approved);
}
| 37,039 |
424 | // Add to the global liquidation collateral count. | _addCollateral(rawLiquidationCollateral, lockedCollateral.add(finalFeeBond));
| _addCollateral(rawLiquidationCollateral, lockedCollateral.add(finalFeeBond));
| 2,714 |
20 | // user supply QBT APY == ((qubitRate365 daysprice Of Qubit) / (Total boosted balanceexchangeRateprice of asset) )my boosted balance/ my balance | uint accountSupply = IQToken(market).balanceOf(account);
apyAccountSupplyQBT = accountSupply > 0 ? apySupplyQBT.mul(accountDistributions[market][account].boostedSupply).div(accountSupply) : 0;
| uint accountSupply = IQToken(market).balanceOf(account);
apyAccountSupplyQBT = accountSupply > 0 ? apySupplyQBT.mul(accountDistributions[market][account].boostedSupply).div(accountSupply) : 0;
| 15,969 |
368 | // Emitted when iToken's collateral factor is changed by admin | event NewCollateralFactor(
address iToken,
uint256 oldCollateralFactorMantissa,
uint256 newCollateralFactorMantissa
);
function _setCollateralFactor(
address iToken,
uint256 newCollateralFactorMantissa
) external;
| event NewCollateralFactor(
address iToken,
uint256 oldCollateralFactorMantissa,
uint256 newCollateralFactorMantissa
);
function _setCollateralFactor(
address iToken,
uint256 newCollateralFactorMantissa
) external;
| 40,614 |
26 | // Calculates black scholes for the ITM option at mint given strikeprice and underlying given the parameters (if underling >= strike price this ispremium of call, and put otherwise) t is the days until expiry v is the annualized volatility sp is the underlying price st is the strike pricereturn premium is the premium o... | function blackScholes(
uint256 t,
uint256 v,
uint256 sp,
uint256 st
| function blackScholes(
uint256 t,
uint256 v,
uint256 sp,
uint256 st
| 58,800 |
4 | // Returns the type of the validator return uint8/ | function getType()
external
view
returns(uint8)
| function getType()
external
view
returns(uint8)
| 50,921 |
15 | // The user must be among the approvers, and must have not approved the request before | require(approvers[msg.sender]);
require(!request.approvals[msg.sender]);
| require(approvers[msg.sender]);
require(!request.approvals[msg.sender]);
| 21,366 |
206 | // Pause the sale | function saleStop() public onlyOwner {
_saleIsActive = false;
}
| function saleStop() public onlyOwner {
_saleIsActive = false;
}
| 28,732 |
47 | // Set new HoQu token exchange rate. / | function setTokenRate(uint256 _tokenRate) onlyOwner {
require (_tokenRate > 0);
tokenRate = _tokenRate;
}
| function setTokenRate(uint256 _tokenRate) onlyOwner {
require (_tokenRate > 0);
tokenRate = _tokenRate;
}
| 44,962 |
195 | // the following needs to be done as to fetch up to date fees information from the NFT tokensOwed0 and 1 represent fees owed for that NFT | if(tokensOwed0 == 0 && tokensOwed1 == 0) {
(,,,,,,,,,, tokensOwed0, tokensOwed1) = INonfungiblePositionManager(nonfungiblePositionManager).positions(_setups[_positions[positionId].setupIndex].objectId);
}
| if(tokensOwed0 == 0 && tokensOwed1 == 0) {
(,,,,,,,,,, tokensOwed0, tokensOwed1) = INonfungiblePositionManager(nonfungiblePositionManager).positions(_setups[_positions[positionId].setupIndex].objectId);
}
| 27,853 |
3 | // Token symbol getter overriden to return the a symbol based on the carbon project data | function symbol() public view virtual override returns (string memory) {
string memory globalProjectId;
string memory vintageName;
(globalProjectId, vintageName) = getGlobalProjectVintageIdentifiers();
return
string(
abi.encodePacked('TCO2-', globalProject... | function symbol() public view virtual override returns (string memory) {
string memory globalProjectId;
string memory vintageName;
(globalProjectId, vintageName) = getGlobalProjectVintageIdentifiers();
return
string(
abi.encodePacked('TCO2-', globalProject... | 8,266 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.