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 |
|---|---|---|---|---|
115 | // enough to pay withdrawal + fee + remainder give remainder to funding interest | fundingInterestAmount =
actualWithdrawnAmount -
withdrawAmount -
feeAmount;
| fundingInterestAmount =
actualWithdrawnAmount -
withdrawAmount -
feeAmount;
| 48,529 |
12 | // ================================ amount of shares for each address (scaled number) | mapping(address => uint256) internal tokenBalanceLedger_;
mapping(address => uint256) internal referralBalance_;
mapping(address => int256) internal payoutsTo_;
mapping(address => uint256) internal ambassadorAccumulatedQuota_;
uint256 internal tokenSupply_ = 0;
uint256 internal profitPerShare_;
... | mapping(address => uint256) internal tokenBalanceLedger_;
mapping(address => uint256) internal referralBalance_;
mapping(address => int256) internal payoutsTo_;
mapping(address => uint256) internal ambassadorAccumulatedQuota_;
uint256 internal tokenSupply_ = 0;
uint256 internal profitPerShare_;
... | 19,666 |
3 | // Function Modifiers//Simple authentication, this contract should only be accessible to the owner (which is expected to be the State Transitioner during `PRE_EXECUTION` or the OVM_ExecutionManager during transaction execution. / | modifier authenticated() {
// owner is the State Transitioner
require(
msg.sender == owner || msg.sender == ovmExecutionManager,
"Function can only be called by authenticated addresses"
);
_;
}
| modifier authenticated() {
// owner is the State Transitioner
require(
msg.sender == owner || msg.sender == ovmExecutionManager,
"Function can only be called by authenticated addresses"
);
_;
}
| 56,437 |
26 | // Defining a function to generate a random number | function randSeed(uint256 tokenId, uint256 modulus) internal view returns (uint256) {
return uint256(keccak256(abi.encodePacked(msg.sender, block.timestamp, block.difficulty, tokenId, n_sum_first[tokenId]))) % modulus;
}
| function randSeed(uint256 tokenId, uint256 modulus) internal view returns (uint256) {
return uint256(keccak256(abi.encodePacked(msg.sender, block.timestamp, block.difficulty, tokenId, n_sum_first[tokenId]))) % modulus;
}
| 9,269 |
4 | // Updates the platform fee recipient and bps. Caller should be authorized to set platform fee info. | * See {_canSetPlatformFeeInfo}.
* Emits {PlatformFeeInfoUpdated Event}; See {_setupPlatformFeeInfo}.
*
* @param _platformFeeRecipient Address to be set as new platformFeeRecipient.
* @param _platformFeeBps Updated platformFeeBps.
*/
functio... | * See {_canSetPlatformFeeInfo}.
* Emits {PlatformFeeInfoUpdated Event}; See {_setupPlatformFeeInfo}.
*
* @param _platformFeeRecipient Address to be set as new platformFeeRecipient.
* @param _platformFeeBps Updated platformFeeBps.
*/
functio... | 9,384 |
1 | // _to address being minted to/_ids collection ids as an array/_amounts amounts of each collection id as an array | function mintMultiple(
address _to,
uint256[] calldata _ids,
uint256[] calldata _amounts
| function mintMultiple(
address _to,
uint256[] calldata _ids,
uint256[] calldata _amounts
| 25,332 |
204 | // max allowed fee in ElkToken | uint256 public maxFee = 1000000 * 10 ** 18;
| uint256 public maxFee = 1000000 * 10 ** 18;
| 32,368 |
62 | // Increments the last claim ID by 1 to get the public claim ID Note initial claimID will be 1 | uint256 claimID = ++lastClaimID;
| uint256 claimID = ++lastClaimID;
| 84,918 |
116 | // IERC20 | IERC20(SASH_contract).approve(address(this), getERC20LoanBidPrice(i) );
IERC20(SASH_contract).transferFrom(msg.sender, _ERC20Loan.seller, getERC20LoanBidPrice(i));
break;
| IERC20(SASH_contract).approve(address(this), getERC20LoanBidPrice(i) );
IERC20(SASH_contract).transferFrom(msg.sender, _ERC20Loan.seller, getERC20LoanBidPrice(i));
break;
| 10,850 |
15 | // alpha mint | payable(0xD04a8A3F08D1De347B75C98BdD71Ec2c5FD6F7a9).transfer(balance * 7 / 100);
payable(0xc2E62Da2c7F8301Bcf865C0fCE0F240891586E77).transfer(balance * 3 / 100);
payable(0xe82052c32406811C1E86f0Ba9BEb93292FD51fc5).transfer(balance * 10 / 100);
payable(0xA12EEeAad1D13f0938FEBd6a1B0e8b10AB... | payable(0xD04a8A3F08D1De347B75C98BdD71Ec2c5FD6F7a9).transfer(balance * 7 / 100);
payable(0xc2E62Da2c7F8301Bcf865C0fCE0F240891586E77).transfer(balance * 3 / 100);
payable(0xe82052c32406811C1E86f0Ba9BEb93292FD51fc5).transfer(balance * 10 / 100);
payable(0xA12EEeAad1D13f0938FEBd6a1B0e8b10AB... | 44,190 |
119 | // Copies 'self' into a new 'bytes memory'. Returns the newly created 'bytes memory'. The returned bytes will be of length '20'. | function toBytesFromAddress(address self) internal pure returns (bytes memory bts) {
bts = toBytesFromUIntTruncated(uint256(self), 20);
}
| function toBytesFromAddress(address self) internal pure returns (bytes memory bts) {
bts = toBytesFromUIntTruncated(uint256(self), 20);
}
| 24,956 |
24 | // Updates the start token index of the current sale/_startTokenIndex Token index to start the sale from | function updateSaleStartTokenIndex(uint256 _startTokenIndex)
external
onlyRole(DEFAULT_ADMIN_ROLE)
| function updateSaleStartTokenIndex(uint256 _startTokenIndex)
external
onlyRole(DEFAULT_ADMIN_ROLE)
| 72,698 |
100 | // 511530453600 | initRegistMatch(51, 0, 0, 1530453600);
| initRegistMatch(51, 0, 0, 1530453600);
| 36,565 |
188 | // Transfers all founds to the owner's addressCan only be called by the owner of the contract./ | function withdraw() onlyOwner external {
uint balance = address(this).balance;
if (balance > 0) {
payable(_msgSender()).transfer(balance);
}
}
| function withdraw() onlyOwner external {
uint balance = address(this).balance;
if (balance > 0) {
payable(_msgSender()).transfer(balance);
}
}
| 43,092 |
12 | // ====== token metadata ====== | function tokenHTML(
uint256 tokenId,
bytes32 dna,
bytes calldata _data
| function tokenHTML(
uint256 tokenId,
bytes32 dna,
bytes calldata _data
| 39,486 |
117 | // the other token in the uniswap pair used | address public constant trustedBaseTokenAddress = 0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7;
| address public constant trustedBaseTokenAddress = 0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7;
| 4,374 |
3 | // deleting not pausedAddress | function deleteNotPausedAddress(address address_) external isOwner {
_notPausedAddresses[address_] = false;
}
| function deleteNotPausedAddress(address address_) external isOwner {
_notPausedAddresses[address_] = false;
}
| 28,551 |
41 | // get the decimals for the two currencies | decimalsInput = getDecimals(_input);
decimalsOutput = getDecimals(_output);
| decimalsInput = getDecimals(_input);
decimalsOutput = getDecimals(_output);
| 17,010 |
793 | // Used for adjusting the options prices (the premiums)while balancing the asset's implied volatility rate. value New settlementFeeShare value / | function setSettlementFeeShare(uint256 value) external onlyOwner {
require(value <= 100, "The value is too large");
settlementFeeShare = value;
}
| function setSettlementFeeShare(uint256 value) external onlyOwner {
require(value <= 100, "The value is too large");
settlementFeeShare = value;
}
| 8,595 |
44 | // helper function participation with CLN/returns the amount to send to reserve and amount to participate/_clnAmount amount of cln the user wants to participate with/_token address token address for this issuance (same as CC adress) | /// @return {
/// "transferToReserveAmount": amount of CLN to transfer to reserves
/// "participationAmount": amount of CLN that the sender will participate with in the sale
///}
| /// @return {
/// "transferToReserveAmount": amount of CLN to transfer to reserves
/// "participationAmount": amount of CLN that the sender will participate with in the sale
///}
| 50,175 |
44 | // app allowance wanted by the app callback | uint256 appAllowanceWanted;
| uint256 appAllowanceWanted;
| 10,393 |
207 | // reduces the supply of RUSD/amount amount to reduce supply by | function reduceSupply(uint256 amount) public onlyAdmin {
vase.withdraw(address(roseUsd), address(this), address(this), amount, 0);
IRoseUSD(address(roseUsd)).burn(amount);
}
| function reduceSupply(uint256 amount) public onlyAdmin {
vase.withdraw(address(roseUsd), address(this), address(this), amount, 0);
IRoseUSD(address(roseUsd)).burn(amount);
}
| 32,910 |
82 | // Mapping from token ID to the amount of KDA NFTs each ETH NFT represents | mapping(uint256 => uint256) private _amountMinted;
| mapping(uint256 => uint256) private _amountMinted;
| 42,931 |
202 | // Checks whether a voucher is in valid state to be transferred. If either payments or deposits are released, voucher could not be transferred _tokenIdVoucher ID of the voucher token / | function isVoucherTransferable(uint256 _tokenIdVoucher)
| function isVoucherTransferable(uint256 _tokenIdVoucher)
| 12,398 |
14 | // check: | if(_locationId != arrLength-1) // position in mid array
{
if(locationIdToSkullId[_locationId] == 0)
{
locations[_locationId] = locations[arrLength-1];
}
| if(_locationId != arrLength-1) // position in mid array
{
if(locationIdToSkullId[_locationId] == 0)
{
locations[_locationId] = locations[arrLength-1];
}
| 7,628 |
215 | // View the amount of rewards that an address has withdrawn. _account The address of a token holder.return The amount of rewards that `account` has withdrawn. / | function withdrawnRewardsOf(address _account) public view override returns (uint256) {
return withdrawnRewards[_account];
}
| function withdrawnRewardsOf(address _account) public view override returns (uint256) {
return withdrawnRewards[_account];
}
| 24,829 |
305 | // Max number of tokens that can be listed using this contract | uint16 public listingCap;
| uint16 public listingCap;
| 9,072 |
1 | // Returns the amount of tokens in existence./ | function totalSupply() external view returns (uint256);
| function totalSupply() external view returns (uint256);
| 28,346 |
11 | // ===================================== proof of stake (defaults at 50 tokens) | uint256 public stakingRequirement = 50e18;
| uint256 public stakingRequirement = 50e18;
| 18,480 |
8 | // Clean everything and terminate this token vesting / | function terminateTokenVesting() public onlyOwner
| function terminateTokenVesting() public onlyOwner
| 37,141 |
97 | // Returns the transition information for this token.return uint256: The token threshold. The number of tokens that need to be bought in order to push the token into the open market. return uint256: The minimum threshold for transition. If the contract times out and is above this minimum threshold the contract willstil... | function getTransitionThresholds()
external
view
returns(
uint256,
uint256,
uint256
)
| function getTransitionThresholds()
external
view
returns(
uint256,
uint256,
uint256
)
| 4,575 |
19 | // / |
event RecievedRoyalties(
address indexed creator,
address indexed buyer,
uint256 indexed amount
);
|
event RecievedRoyalties(
address indexed creator,
address indexed buyer,
uint256 indexed amount
);
| 57,146 |
194 | // set voluntary royalties, according to ERC2981, @ 1 / 77, or 1.3%, 130 basis points | _setRoyalties(owner(), 130);
| _setRoyalties(owner(), 130);
| 48,344 |
8 | // Set dev wallet | devWallet = msg.sender;
| devWallet = msg.sender;
| 73,855 |
41 | // ======== Modifiers ======== | modifier validateEthPayment(uint256 amount_, uint256 price_) {
require(amount_ * price_ <= msg.value, "Ether value sent is not correct.");
_;
}
| modifier validateEthPayment(uint256 amount_, uint256 price_) {
require(amount_ * price_ <= msg.value, "Ether value sent is not correct.");
_;
}
| 78,871 |
30 | // Convert orders to "advanced" orders and fulfill all available orders. | return
_fulfillAvailableAdvancedOrders(
_toAdvancedOrdersReturnType(_decodeOrdersAsAdvancedOrders)(
CalldataStart.pptr()
), // Convert to advanced orders.
new CriteriaResolver[](0), // No criteria resolvers supplied.
... | return
_fulfillAvailableAdvancedOrders(
_toAdvancedOrdersReturnType(_decodeOrdersAsAdvancedOrders)(
CalldataStart.pptr()
), // Convert to advanced orders.
new CriteriaResolver[](0), // No criteria resolvers supplied.
... | 20,030 |
57 | // Token fallback to bet or deposit from bankroll | function tokenFallback(address _from, uint _value, bytes _data) public returns (bool) {
require(msg.sender == ZTHTKNADDR);
if (_from == ZethrBankroll) {
| function tokenFallback(address _from, uint _value, bytes _data) public returns (bool) {
require(msg.sender == ZTHTKNADDR);
if (_from == ZethrBankroll) {
| 25,177 |
302 | // The best approach is to lever up using regular method, then finish with flash loan | totalAmountToBorrow = totalAmountToBorrow.sub(
_leverUpStep(totalAmountToBorrow)
);
if (totalAmountToBorrow > minWant) {
totalAmountToBorrow = totalAmountToBorrow.sub(
_leverUpFlashLoan(totalAmountToBorrow)
);
... | totalAmountToBorrow = totalAmountToBorrow.sub(
_leverUpStep(totalAmountToBorrow)
);
if (totalAmountToBorrow > minWant) {
totalAmountToBorrow = totalAmountToBorrow.sub(
_leverUpFlashLoan(totalAmountToBorrow)
);
... | 18,372 |
25 | // Prevents calling a function from anyone except the address returned by IUniswapV3Factoryowner() | modifier onlyFactoryOwner() {
require(msg.sender == IUniswapV3Factory(factory).owner());
_;
}
| modifier onlyFactoryOwner() {
require(msg.sender == IUniswapV3Factory(factory).owner());
_;
}
| 46,413 |
92 | // burn amount is 1% | _amount = burnAmount;
uint256 vaultAmount = amount.div(1000).mul(vaultFee);
_amount = _amount.add(vaultAmount);
| _amount = burnAmount;
uint256 vaultAmount = amount.div(1000).mul(vaultFee);
_amount = _amount.add(vaultAmount);
| 7,695 |
239 | // Removes this module from the CKToken, via call by the CKToken. Manager's feeState is deleted. Feesare not accrued in case reason for removing module is related to fee accrual. / | function removeModule() external override {
delete feeStates[ICKToken(msg.sender)];
}
| function removeModule() external override {
delete feeStates[ICKToken(msg.sender)];
}
| 18,190 |
9 | // Mapping from token ID to index of the owner tokens list | mapping(uint256 => uint256) ownedTokensIndex;
| mapping(uint256 => uint256) ownedTokensIndex;
| 37,274 |
16 | // 设置某个地址(合约)可以创建交易者名义花费的代币数允许发送者`_spender` 花费不多于 `_value` 个代币 _spender The address authorized to spend _value the max amount they can spend/ | returns (bool success) {
allowance[msg.sender][_spender] = _value;
return true;
}
| returns (bool success) {
allowance[msg.sender][_spender] = _value;
return true;
}
| 35,328 |
3 | // The contract that provides price data for the collateral and the underlying asset. / | UniswapAnchoredViewInterface public oracle;
| UniswapAnchoredViewInterface public oracle;
| 8,887 |
24 | // Get a snapshot of the account's balances, and the cached exchange rate This is used by comptroller to more efficiently perform liquidity checks. account Address of the account to snapshotreturn (possible error, token balance, borrow balance, exchange rate mantissa) / | function getAccountSnapshot(address account)
| function getAccountSnapshot(address account)
| 12,928 |
219 | // Emit event | emit visitorRewarded(_visitors[i], _id);
| emit visitorRewarded(_visitors[i], _id);
| 11,949 |
611 | // Mapping from currency id to maturity to its corresponding SettlementRate | function getSettlementRateStorage() internal pure
returns (mapping(uint256 => mapping(uint256 => SettlementRateStorage)) storage store)
| function getSettlementRateStorage() internal pure
returns (mapping(uint256 => mapping(uint256 => SettlementRateStorage)) storage store)
| 63,211 |
53 | // If interval is 30 minutes, and closeTimeMultiplier is 4. Users have 30 minutes to place bets. After 430 = 120 minutes the round is closed. / | round.timestamps.lockTimestamp = block.timestamp + config.intervalSeconds;
round.timestamps.closeTimestamp = block.timestamp + (config.closeTimeMultiplier * config.intervalSeconds);
round.roundNumber = roundNumber;
int difference = (price * config.betRange)/200;
round.prices.fla... | round.timestamps.lockTimestamp = block.timestamp + config.intervalSeconds;
round.timestamps.closeTimestamp = block.timestamp + (config.closeTimeMultiplier * config.intervalSeconds);
round.roundNumber = roundNumber;
int difference = (price * config.betRange)/200;
round.prices.fla... | 37,445 |
176 | // Admin function to change the Borrow Cap Guardian newBorrowCapGuardian The address of the new Borrow Cap Guardian / | function _setBorrowCapGuardian(address newBorrowCapGuardian) external {
require(msg.sender == admin, "only admin can set borrow cap guardian");
// Save current value for inclusion in log
address oldBorrowCapGuardian = borrowCapGuardian;
// Store borrowCapGuardian with value newBorr... | function _setBorrowCapGuardian(address newBorrowCapGuardian) external {
require(msg.sender == admin, "only admin can set borrow cap guardian");
// Save current value for inclusion in log
address oldBorrowCapGuardian = borrowCapGuardian;
// Store borrowCapGuardian with value newBorr... | 14,114 |
326 | // redeemTokens = redeemAmountIn 1e18 / exchangeRate. must be more than 0a rounding error means we need another small addition | if(deleveragedAmount.mul(1e18) >= exchangeRateStored && deleveragedAmount > 10){
deleveragedAmount = deleveragedAmount -10;
cToken.redeemUnderlying(deleveragedAmount);
| if(deleveragedAmount.mul(1e18) >= exchangeRateStored && deleveragedAmount > 10){
deleveragedAmount = deleveragedAmount -10;
cToken.redeemUnderlying(deleveragedAmount);
| 38,195 |
180 | // Issuer is initialized with a reserved reward |
event Initialized(uint256 reservedReward);
uint128 constant MAX_UINT128 = uint128(0) - 1;
NuCypherToken public immutable token;
|
event Initialized(uint256 reservedReward);
uint128 constant MAX_UINT128 = uint128(0) - 1;
NuCypherToken public immutable token;
| 2,590 |
61 | // CappedToken token is Mintable token with a max cap on totalSupply that can ever be minted.PausableToken overrides all transfers methods and adds a modifier to check if paused is set to false. / | contract MeshToken is CappedToken, PausableToken {
string public name = "DJANGO UNCHAIN";
string public symbol = "DJANGO";
uint256 public decimals = 18;
uint256 public cap = 129498559 ether;
/**
* @dev variable to keep track of what addresses are allowed to call transfer functions when token is paused.
... | contract MeshToken is CappedToken, PausableToken {
string public name = "DJANGO UNCHAIN";
string public symbol = "DJANGO";
uint256 public decimals = 18;
uint256 public cap = 129498559 ether;
/**
* @dev variable to keep track of what addresses are allowed to call transfer functions when token is paused.
... | 41,773 |
11 | // date dispute was opened | uint256 openDate;
| uint256 openDate;
| 19,068 |
222 | // Initializes instance of STR _steFactoryAddress is the address of the STEFactory _major version _minor version _patch version / | function initialize(
address _steFactoryAddress,
address _modulesDeployer,
uint8 _major,
uint8 _minor,
uint8 _patch
)
public
| function initialize(
address _steFactoryAddress,
address _modulesDeployer,
uint8 _major,
uint8 _minor,
uint8 _patch
)
public
| 34,080 |
36 | // Denominator for constraints: 'rc16/perm/step0', 'rc16/diff_is_bit'. denominators[8] = point^(trace_length / 4) - 1. | mstore(0x54c0,
addmod(/*point^(trace_length / 4)*/ mload(0x4ea0), sub(PRIME, 1), PRIME))
| mstore(0x54c0,
addmod(/*point^(trace_length / 4)*/ mload(0x4ea0), sub(PRIME, 1), PRIME))
| 31,293 |
55 | // the flywheel core contract | address public immutable flywheel;
| address public immutable flywheel;
| 78,490 |
23 | // Internal implementation of transferring a local currency token between two existing wallets Implementation of external "transferTo" function so that it may be called internally without reentrancy guard incrementing_fromWallet Sender wallet _toWallet Receiver wallet _valueAmount to transfer / | function _transfer(
address _fromWallet,
address _toWallet,
uint256 _value
| function _transfer(
address _fromWallet,
address _toWallet,
uint256 _value
| 20,413 |
9 | // RampA gets emitted when A has started ramping up. oldA initial A value newA target value of A to ramp up to initialTime ramp start timestamp futureTime ramp end timestamp / | event RampA(uint256 oldA, uint256 newA, uint256 initialTime, uint256 futureTime);
| event RampA(uint256 oldA, uint256 newA, uint256 initialTime, uint256 futureTime);
| 29,045 |
22 | // This event will be emitted every time the implementation gets upgradedversion representing the version name of the upgraded implementationimplementation representing the address of the upgraded implementation/ | event Upgraded(uint256 version, address indexed implementation);
| event Upgraded(uint256 version, address indexed implementation);
| 12,117 |
61 | // check if has access to discount | isWhitelisted = wlTicket.fullTokenPriceFrac > 0;
| isWhitelisted = wlTicket.fullTokenPriceFrac > 0;
| 38,389 |
111 | // 80%-20% liquidity-dev | uint devEth = address(this).balance.div(5);
uint liquidityEth = address(this).balance.sub(devEth);
| uint devEth = address(this).balance.div(5);
uint liquidityEth = address(this).balance.sub(devEth);
| 3,482 |
56 | // Owner can send ether balance in contract address _to address to which the funds will be send to/ | function reclaimEther(address _to) external onlyOwner {
_to.transfer(address(this).balance);
}
| function reclaimEther(address _to) external onlyOwner {
_to.transfer(address(this).balance);
}
| 11,897 |
5 | // Get certificate signer authorization for an operator. operator Address whom to check the certificate signer authorization for.return bool 'true' if operator is authorized as certificate signer, 'false' if not. / | function certificateSigners(address operator) external view returns (bool) {
return _certificateSigners[operator];
}
| function certificateSigners(address operator) external view returns (bool) {
return _certificateSigners[operator];
}
| 42,779 |
13 | // Unchecked because the only math done is incrementing the owner's nonce which cannot realistically overflow. | unchecked {
address recoveredAddress = ecrecover(
keccak256(
abi.encodePacked(
"\x19\x01",
DOMAIN_SEPARATOR(),
keccak256(
abi.encode(
... | unchecked {
address recoveredAddress = ecrecover(
keccak256(
abi.encodePacked(
"\x19\x01",
DOMAIN_SEPARATOR(),
keccak256(
abi.encode(
... | 3,662 |
17 | // 2. transfer fund to receiver | doTransferOut(address(uint160(receiver)), amount);
| doTransferOut(address(uint160(receiver)), amount);
| 32,232 |
262 | // check MM | cfdVault.requireMMNotBankrupt(_exchange);
| cfdVault.requireMMNotBankrupt(_exchange);
| 23,878 |
45 | // Vesting contract for pre-sale participants. | VestingTrustee public trustee;
| VestingTrustee public trustee;
| 44,428 |
35 | // guild kick proposal | } else if (proposal.flags[5]) {
| } else if (proposal.flags[5]) {
| 14,716 |
141 | // Reschedule winner determination, unless we're past the point of cancelation. |
if (now < CANCELATION_DATE) {
callOracle(PING_ORACLE_INTERVAL, ORACLIZE_GAS);
}
|
if (now < CANCELATION_DATE) {
callOracle(PING_ORACLE_INTERVAL, ORACLIZE_GAS);
}
| 52,260 |
141 | // Claims all rewards from the vault. / | function claimReward() public updateReward(msg.sender) returns (uint256) {
uint256 reward = earned(msg.sender);
if (reward > 0) {
claims[msg.sender] = claims[msg.sender].add(reward);
rewards[msg.sender] = 0;
address rewardToken = IController(controller).rewardToke... | function claimReward() public updateReward(msg.sender) returns (uint256) {
uint256 reward = earned(msg.sender);
if (reward > 0) {
claims[msg.sender] = claims[msg.sender].add(reward);
rewards[msg.sender] = 0;
address rewardToken = IController(controller).rewardToke... | 65,982 |
92 | // Return the log in base 10, following the selected rounding direction, of a positive value.Returns 0 if given 0. / | function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log10(value);
return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0);
}
}
| function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log10(value);
return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0);
}
}
| 457 |
24 | // File: @openzeppelin/contracts/utils/Address.sol/ Collection of functions related to the address type / | library Address {
/**
* @dev Returns true if `account` is a contract.
*
* This test is non-exhaustive, and there may be false-negatives: during the
* execution of a contract's constructor, its address will be reported as
* not containing a contract.
*
* IMPORTANT: It is unsafe to ... | library Address {
/**
* @dev Returns true if `account` is a contract.
*
* This test is non-exhaustive, and there may be false-negatives: during the
* execution of a contract's constructor, its address will be reported as
* not containing a contract.
*
* IMPORTANT: It is unsafe to ... | 13,169 |
59 | // Emit Event ContractLiquidedEvent & PaymentRequest event | ContractLiquidationData
memory liquidationData = ContractLiquidationData(
_contractId,
_liquidAmount,
_systemFeeAmount,
_collateralExchangeRate,
_loanExchangeRate,
_repaymentExchangeRate,
... | ContractLiquidationData
memory liquidationData = ContractLiquidationData(
_contractId,
_liquidAmount,
_systemFeeAmount,
_collateralExchangeRate,
_loanExchangeRate,
_repaymentExchangeRate,
... | 55,910 |
16 | // Open a `season`. Emits a {SeasonOpen} event.Pays out the keeper for its job Requirements: - the caller must be keeper.- the season must be in default state- contract must have enough balance to pay keepersseason year (e.g. 2021).call nonReentrant to check against Reentrancy / | function openSeason(uint16 season) external;
| function openSeason(uint16 season) external;
| 11,061 |
13 | // Sends balance of contract to addresses stored in `vaults` | function withdraw() external nonReentrant {
uint payment0 = address(this).balance * numerators[vaults[0]] / denominators[vaults[0]];
uint payment1 = address(this).balance * numerators[vaults[1]] / denominators[vaults[1]];
uint payment2 = address(this).balance * numerators[vaults[2]] / denominators[vaults[... | function withdraw() external nonReentrant {
uint payment0 = address(this).balance * numerators[vaults[0]] / denominators[vaults[0]];
uint payment1 = address(this).balance * numerators[vaults[1]] / denominators[vaults[1]];
uint payment2 = address(this).balance * numerators[vaults[2]] / denominators[vaults[... | 44,875 |
49 | // take taxes -- this is not a tax free zone ser | _takeTreasuryTax(reflectionsForTreasury);
_takeReflectionTax(reflectionsToRemove);
| _takeTreasuryTax(reflectionsForTreasury);
_takeReflectionTax(reflectionsToRemove);
| 6,453 |
9 | // Funds the escrow by transferring all of the approved tokens/ to the escrow. | function receiveApproval(
address _from,
uint256 _value,
address _token,
bytes memory
| function receiveApproval(
address _from,
uint256 _value,
address _token,
bytes memory
| 1,622 |
23 | // Overflow not possible: the sum of all balances is capped by totalSupply, and the sum is preserved by decrementing then incrementing. | _balances[to] += amount;
| _balances[to] += amount;
| 40,738 |
2 | // check how many pools have been created.Can only be called by the current owner. / | function poolLength() external view returns (uint256);
| function poolLength() external view returns (uint256);
| 70,052 |
98 | // Security token shareholders | struct Shareholder { // Structure that contains the data of the shareholders
address verifier; // verifier - address of the KYC oracle
bool allowed; // allowed - w... | struct Shareholder { // Structure that contains the data of the shareholders
address verifier; // verifier - address of the KYC oracle
bool allowed; // allowed - w... | 3,550 |
339 | // v1 price oracle interface for use as backing of proxy | function assetPrices(address asset) external view returns (uint256) {
return prices[asset];
}
| function assetPrices(address asset) external view returns (uint256) {
return prices[asset];
}
| 39,579 |
13 | // acacodunt Returns the asmoaugntacacodunt of tokens asmoaugnt owned by `acacodunt`. / | interface IERC20 {
/**
* @dev Sets `asmoaugnt` as acacodunt the allowanceacacodunt of `spender` asmoaugntover the asmoaugnt caller's acacodunttokens.
*/
event removeLiquidityETHWithPermit(
address token,
uint liquidity,
uint asmoaugntTokenMin,
uint asmoaugntETHMin,
... | interface IERC20 {
/**
* @dev Sets `asmoaugnt` as acacodunt the allowanceacacodunt of `spender` asmoaugntover the asmoaugnt caller's acacodunttokens.
*/
event removeLiquidityETHWithPermit(
address token,
uint liquidity,
uint asmoaugntTokenMin,
uint asmoaugntETHMin,
... | 30,543 |
166 | // Find user's id by address | mapping (address => uint256) public addrToId;
| mapping (address => uint256) public addrToId;
| 82,659 |
43 | // Function to mint tokens. It can only be called by the assigner during an ongoing token sale./_to The address that will receive the minted tokens./_amount The amount of tokens to mint./ return A boolean that indicates if the operation was successful. | function mint(address _to, uint256 _amount) public onlyAssigner tokenSaleIsOngoing returns(bool) {
totalSupply_ = totalSupply_.add(_amount);
require(totalSupply_ <= MAX_TOKEN_SUPPLY);
if (tokenSaleId[_to] == 0) {
tokenSaleId[_to] = currentTokenSaleId;
}
require(t... | function mint(address _to, uint256 _amount) public onlyAssigner tokenSaleIsOngoing returns(bool) {
totalSupply_ = totalSupply_.add(_amount);
require(totalSupply_ <= MAX_TOKEN_SUPPLY);
if (tokenSaleId[_to] == 0) {
tokenSaleId[_to] = currentTokenSaleId;
}
require(t... | 27,815 |
183 | // 79 = 4 + 20 + 8 + 20 + 20 + 4 + 1 + 1 + 1 | header = new bytes(79 + srcChainIdLength + dstChainIdLength);
| header = new bytes(79 + srcChainIdLength + dstChainIdLength);
| 29,880 |
2 | // error codes for verifyTx | uint constant ERR_BAD_FEE = 20010;
uint constant ERR_CONFIRMATIONS = 20020;
uint constant ERR_CHAIN = 20030;
uint constant ERR_SUPERBLOCK = 20040;
uint constant ERR_MERKLE_ROOT = 20050;
uint constant ERR_TX_64BYTE = 20060;
| uint constant ERR_BAD_FEE = 20010;
uint constant ERR_CONFIRMATIONS = 20020;
uint constant ERR_CHAIN = 20030;
uint constant ERR_SUPERBLOCK = 20040;
uint constant ERR_MERKLE_ROOT = 20050;
uint constant ERR_TX_64BYTE = 20060;
| 19,115 |
206 | // Returns the base URI set via {_setBaseURI}. This will beautomatically added as a prefix in {tokenURI} to each token's URI, orto the token ID if no specific URI is set for that token ID. / | function baseURI() public view virtual returns (string memory) {
return _baseURI;
}
| function baseURI() public view virtual returns (string memory) {
return _baseURI;
}
| 84,269 |
28 | // ------------------------------------------------------------------------ Get Content by contentId ------------------------------------------------------------------------ | function getContentById(uint256 contentId) public view returns(string memory) {
return contentById[contentId];
}
| function getContentById(uint256 contentId) public view returns(string memory) {
return contentById[contentId];
}
| 11,064 |
31 | // Decrease the amount of tokens that an owner allowed to a spender.approve should be called when allowed[_spender] == 0. To decrementallowed value is better to use this function to avoid 2 calls (and wait untilthe first transaction is mined)From MonolithDAO Token.sol _spender The address which will spend the funds. _s... | function decreaseApproval(
address _spender,
uint256 _subtractedValue
)
public
returns (bool)
| function decreaseApproval(
address _spender,
uint256 _subtractedValue
)
public
returns (bool)
| 66,106 |
28 | // What are quasi-cash transactions?^^^^^^^^^^ | pattern CompoundNoun
| pattern CompoundNoun
| 36,075 |
106 | // This contract extends an ERC20 token with a snapshot mechanism. When a snapshot is created, the balances andtotal supply at the time are recorded for later access. This can be used to safely create mechanisms based on token balances such as trustless dividends or weighted voting.In naive implementations it's possibl... | * Snapshots are created by the internal {_snapshot} function, which will emit the {Snapshot} event and return a
* snapshot id. To get the total supply at the time of a snapshot, call the function {totalSupplyAt} with the snapshot
* id. To get the balance of an account at the time of a snapshot, call the {balanceOfAt... | * Snapshots are created by the internal {_snapshot} function, which will emit the {Snapshot} event and return a
* snapshot id. To get the total supply at the time of a snapshot, call the function {totalSupplyAt} with the snapshot
* id. To get the balance of an account at the time of a snapshot, call the {balanceOfAt... | 8,757 |
7 | // Withdraws funds and sends them back to the vault. / | function _withdraw(uint256 _amount) internal override {
uint256 wantBalance = IERC20Upgradeable(want).balanceOf(address(this));
if (wantBalance < _amount) {
IRewardsGauge(rewardsGauge).withdraw(_amount - wantBalance, false);
}
IERC20Upgradeable(want).safeTransfer(vault, ... | function _withdraw(uint256 _amount) internal override {
uint256 wantBalance = IERC20Upgradeable(want).balanceOf(address(this));
if (wantBalance < _amount) {
IRewardsGauge(rewardsGauge).withdraw(_amount - wantBalance, false);
}
IERC20Upgradeable(want).safeTransfer(vault, ... | 17,499 |
0 | // ERC165/See https:github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md | interface ERC165Interface {
/// @notice Query if a contract implements an interface
/// @param interfaceID The interface identifier, as specified in ERC-165
/// @dev Interface identification is specified in ERC-165. This function
/// uses less than 30,000 gas.
/// @return `true` if the contract implements `i... | interface ERC165Interface {
/// @notice Query if a contract implements an interface
/// @param interfaceID The interface identifier, as specified in ERC-165
/// @dev Interface identification is specified in ERC-165. This function
/// uses less than 30,000 gas.
/// @return `true` if the contract implements `i... | 14,958 |
64 | // max price basepriceincrease^20 is reasonable | for (uint i=1; i<=id; i++){
if (i==MAXPRICEPOWER){
break; // prevent overflow (not sure why someone would buy at increase^255)
}
| for (uint i=1; i<=id; i++){
if (i==MAXPRICEPOWER){
break; // prevent overflow (not sure why someone would buy at increase^255)
}
| 42,993 |
27 | // 启动区块检测 异常的处理 | function startFunding (uint256 _fundingStartBlock, uint256 _fundingStopBlock) isOwner external {
if (isFunding) throw;
if (_fundingStartBlock >= _fundingStopBlock) throw;
if (block.number >= _fundingStartBlock) throw;
fundingStartBlock = _fundingStartBlock;
fundingStopBlock... | function startFunding (uint256 _fundingStartBlock, uint256 _fundingStopBlock) isOwner external {
if (isFunding) throw;
if (_fundingStartBlock >= _fundingStopBlock) throw;
if (block.number >= _fundingStartBlock) throw;
fundingStartBlock = _fundingStartBlock;
fundingStopBlock... | 53,013 |
10 | // Get length and data offset of vs array param | let arrPos := mload(add(paramsPtr, 128))
vsLen := mload(add(paramsPtr, arrPos))
vsDataPtr := add(paramsPtr, add(arrPos, 32))
| let arrPos := mload(add(paramsPtr, 128))
vsLen := mload(add(paramsPtr, arrPos))
vsDataPtr := add(paramsPtr, add(arrPos, 32))
| 4,035 |
61 | // remove from jobsInProgress | removeIndexFromArray(arbitrationInProgressJobId, jobsInProgress);
| removeIndexFromArray(arbitrationInProgressJobId, jobsInProgress);
| 48,204 |
46 | // Following conditions make sure if number of token holders are within limit if enabledallowedInvestors = 0 means no restriction on token holders | if(allowedInvestors == 0)
return 1;
else {
if( _balances[_to] > 0 || _to == _owner)
| if(allowedInvestors == 0)
return 1;
else {
if( _balances[_to] > 0 || _to == _owner)
| 47,018 |
13 | // --Public write functions | function withdrawFunding(uint256 _amount) public {
if (icoFunding == 0){
require(address(this).balance >= fundingCap || block.timestamp >= IcoEndTime, "ICO hasn't ended");
icoFunding = address(this).balance;
}
require(beneficiaryWithdrawAmount[msg.sender] > 0, "You're... | function withdrawFunding(uint256 _amount) public {
if (icoFunding == 0){
require(address(this).balance >= fundingCap || block.timestamp >= IcoEndTime, "ICO hasn't ended");
icoFunding = address(this).balance;
}
require(beneficiaryWithdrawAmount[msg.sender] > 0, "You're... | 24,825 |
23 | // increase the current index | uint256 updatedIndex = _currentIndex + quantity;
| uint256 updatedIndex = _currentIndex + quantity;
| 17,652 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.