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 |
|---|---|---|---|---|
26 | // Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),reverting when dividing by zero. Counterpart to Solidity's '% ' operator. This function uses a 'revert'opcode (which leaves remaining gas untouched) while Solidity uses aninvalid opcode to revert (consuming all remaining gas). Require... | function mod(uint256 a, uint256 b) internal pure returns(uint256) {
return a % b;
}
| function mod(uint256 a, uint256 b) internal pure returns(uint256) {
return a % b;
}
| 19,753 |
28 | // what to do: up or down how many LPs execute: |
round = round + 1;
console.log("callIntervention a PWPegger with _keeperCurrentPrice:", _keeperCurrentPrice);
|
round = round + 1;
console.log("callIntervention a PWPegger with _keeperCurrentPrice:", _keeperCurrentPrice);
| 16,288 |
27 | // Recycle any rotted away potatoes to update the recycle timer | recycle(farmer);
| recycle(farmer);
| 41,876 |
2 | // Calculates partial value given a numerator and denominator rounded down./Reverts if rounding error is >= 0.1%/numerator Numerator./denominator Denominator./target Value to calculate partial of./ return partialAmount Partial value of target rounded up. | function safeGetPartialAmountCeil(
uint256 numerator,
uint256 denominator,
uint256 target
| function safeGetPartialAmountCeil(
uint256 numerator,
uint256 denominator,
uint256 target
| 13,213 |
26 | // Returns the integer division of two unsigned integers. Reverts with custom message ondivision by zero. The result is rounded towards zero. Counterpart to Solidity's `/` operator. Note: this function uses a`revert` opcode (which leaves remaining gas untouched) while Solidityuses an invalid opcode to revert (consuming... | function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
| function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
| 6,554 |
28 | // Exit collateral to token version | GemJoinLike(gemJoin).exit(address(this), gemAmt);
{
VaultLike vault = GemJoinLike(gemJoin).gem();
VaultLike bridge = bridges[vault];
if (bridge != VaultLike(0)) {
vault.approve(address(bridge), gemAmt);
bridge.withdraw(gemAmt, 1);
... | GemJoinLike(gemJoin).exit(address(this), gemAmt);
{
VaultLike vault = GemJoinLike(gemJoin).gem();
VaultLike bridge = bridges[vault];
if (bridge != VaultLike(0)) {
vault.approve(address(bridge), gemAmt);
bridge.withdraw(gemAmt, 1);
... | 2,361 |
3 | // push returns length, so id is last item index or length - 1 | uint256 id = offers.push(o) - 1;
Open(id);
| uint256 id = offers.push(o) - 1;
Open(id);
| 41,235 |
270 | // 1. Add index to address of bytes array 2. Load 32-byte word from memory 3. Apply 12-byte mask to obtain extra bytes occupying word of memory where we'll store the address | let neighbors := and(
mload(add(b, index)),
0xffffffffffffffffffffffff0000000000000000000000000000000000000000
)
| let neighbors := and(
mload(add(b, index)),
0xffffffffffffffffffffffff0000000000000000000000000000000000000000
)
| 8,805 |
1 | // Verifies that the data encoded has been signedcorrectly by routing to the correct verifier. signedReport The encoded data to be verified. sender The address that requested to verify the contract.This is only used for logging purposes. Verification is typically only done through the proxy contract sowe can't just use... | function verify(bytes calldata signedReport, address sender) external returns (bytes memory verifierResponse);
| function verify(bytes calldata signedReport, address sender) external returns (bytes memory verifierResponse);
| 19,313 |
191 | // Getter of the current `_allocationRatio`return The `_allocationRatio` array / | function getAllocationRatio() external view returns (uint16[3] memory);
| function getAllocationRatio() external view returns (uint16[3] memory);
| 61,098 |
113 | // risk group: 19 - APR: 7.29% | file("riskGroup", 19, ONE, ONE, uint(1000000002311643835616438356), 99.9211*10**25);
| file("riskGroup", 19, ONE, ONE, uint(1000000002311643835616438356), 99.9211*10**25);
| 40,418 |
10 | // Balance, stake, and weight tracking | uint256 private _total_liquidity_locked;
uint256 private _total_combined_weight;
mapping(address => uint256) private _locked_liquidity;
mapping(address => uint256) private _combined_weights;
mapping(address => LockedNFT[]) private lockedNFTs;
| uint256 private _total_liquidity_locked;
uint256 private _total_combined_weight;
mapping(address => uint256) private _locked_liquidity;
mapping(address => uint256) private _combined_weights;
mapping(address => LockedNFT[]) private lockedNFTs;
| 24,669 |
36 | // get DRP status / | function getDRPStatus() external view returns(bool, bool){
DRP memory drp = domains[msg.sender].drp;
return (drp.validTo >= now, drp.reactContract != address(0));
}
| function getDRPStatus() external view returns(bool, bool){
DRP memory drp = domains[msg.sender].drp;
return (drp.validTo >= now, drp.reactContract != address(0));
}
| 15,759 |
0 | // Possible hands -- we can treeshake this definitions away, since it is not used in this file. | enum Hand { Rock, Paper, Scissors }
/** Current state of the state machine. */
enum State {
Waiting_for_player1, // player0 funded wager+escrow and published a commitment
Waiting_for_player0_reveal, // player1 showed his hand
Completed ... | enum Hand { Rock, Paper, Scissors }
/** Current state of the state machine. */
enum State {
Waiting_for_player1, // player0 funded wager+escrow and published a commitment
Waiting_for_player0_reveal, // player1 showed his hand
Completed ... | 10,817 |
40 | // Calculates the binary exponent of x using the binary fraction method using the following formula:// $$ | /// 2^{-x} = \frac{1}{2^x}
/// $$
///
/// @dev See https://ethereum.stackexchange.com/q/79903/24693.
///
/// Notes:
/// - If x is less than -59_794705707972522261, the result is zero.
///
/// Requirements:
/// - x must be less than 192e18.
/// - The result must fit in SD59x18.
///
/// @param x The exponent as an SD59x1... | /// 2^{-x} = \frac{1}{2^x}
/// $$
///
/// @dev See https://ethereum.stackexchange.com/q/79903/24693.
///
/// Notes:
/// - If x is less than -59_794705707972522261, the result is zero.
///
/// Requirements:
/// - x must be less than 192e18.
/// - The result must fit in SD59x18.
///
/// @param x The exponent as an SD59x1... | 31,555 |
18 | // View the amount of dividend in wei that an address can withdraw./_owner The address of a token holder./ return The amount of dividend in wei that `_owner` can withdraw. | function withdrawableDividendOf(address _owner) external view returns(uint256);
| function withdrawableDividendOf(address _owner) external view returns(uint256);
| 610 |
44 | // If v > 30 then default va (27,28) has been adjusted for eth_sign flow To support eth_sign and similar we adjust v and hash the messageHash with the Ethereum message prefix before applying ecrecover | currentOwner = ecrecover(keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", dataHash)), v - 4, r, s);
| currentOwner = ecrecover(keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", dataHash)), v - 4, r, s);
| 3,262 |
37 | // Transfer the ENS subdomain to the new NFT owner. | if (from != address(0) && to != address(0)) {
_ensRegistrar.transfer(tokenId, to);
}
| if (from != address(0) && to != address(0)) {
_ensRegistrar.transfer(tokenId, to);
}
| 63,760 |
0 | // ------------------------------- Modifiers ------------------------------- | modifier onlyCustodian() {
require(registry.accountKindExists(msg.sender, CUSTODIAN), "Custodian address required");
require(!registry.accountFrozen(msg.sender), "Custodian is frozen");
_;
}
| modifier onlyCustodian() {
require(registry.accountKindExists(msg.sender, CUSTODIAN), "Custodian address required");
require(!registry.accountFrozen(msg.sender), "Custodian is frozen");
_;
}
| 44,427 |
701 | // Handle deposits of the underlying token/In this case we must wrap the underlying token into an asset token, ensuring that we do not end up/ with any underlying tokens left as dust on the contract. | function depositUnderlyingToken(
BalanceState memory balanceState,
address account,
int256 underlyingAmountExternal
| function depositUnderlyingToken(
BalanceState memory balanceState,
address account,
int256 underlyingAmountExternal
| 11,100 |
95 | // Settle the current auction. This function can only be called when the contract is paused. / | function settleAuction() external override whenPaused nonReentrant {
_settleAuction();
}
| function settleAuction() external override whenPaused nonReentrant {
_settleAuction();
}
| 45,243 |
413 | // Jason new stream | pool.openStream(
0x43fD74401B4BF04095590a5308B6A5e3Db44b9e3,
90 days,
1633 * 3 * (10**24)
);
| pool.openStream(
0x43fD74401B4BF04095590a5308B6A5e3Db44b9e3,
90 days,
1633 * 3 * (10**24)
);
| 10,964 |
2 | // Defines the storage layout of the token implementation contract. Anynewly declared state variables in future upgrades should be appendedto the bottom. Never remove state variables from this list, however variablescan be renamed. Please add _Deprecated to deprecated variables. / | contract ProxyStorage {
address public owner;
address public pendingOwner;
bool initialized;
address balances_Deprecated;
address allowances_Deprecated;
uint256 _totalSupply;
bool private paused_Deprecated = false;
address private globalPause_Deprecated;
uint256 public burnMin =... | contract ProxyStorage {
address public owner;
address public pendingOwner;
bool initialized;
address balances_Deprecated;
address allowances_Deprecated;
uint256 _totalSupply;
bool private paused_Deprecated = false;
address private globalPause_Deprecated;
uint256 public burnMin =... | 16,016 |
6 | // Only allows a function to be callable if emergency state is unactive / | modifier ifNotEmergencyState() {
if (isEmergencyState) {
revert OnlyNotEmergencyState();
}
_;
}
| modifier ifNotEmergencyState() {
if (isEmergencyState) {
revert OnlyNotEmergencyState();
}
_;
}
| 6,407 |
18 | // Re enables the ERC20 interface. This function can only be called/by the owner. | function enableERC20() public onlyOwner {
mErc20compatible = true;
setInterfaceImplementation("ERC20Token", this);
}
| function enableERC20() public onlyOwner {
mErc20compatible = true;
setInterfaceImplementation("ERC20Token", this);
}
| 15,219 |
26 | // receiveApproval服务合约指示代币合约将代币从发送者的账户转移到服务合约的账户(通过调用服务合约的 / | interface tokenRecipient { function receiveApproval(address _from, uint256 _value, address _token, bytes _extraData) public; }
contract TokenERC20 {
// 代币(token)的公共变量
string public name; //代币名字
string public symbol; //代币符号
uint8 public decimals = 18; //代币小数点位数, 18是默认, 尽量不要更改
... | interface tokenRecipient { function receiveApproval(address _from, uint256 _value, address _token, bytes _extraData) public; }
contract TokenERC20 {
// 代币(token)的公共变量
string public name; //代币名字
string public symbol; //代币符号
uint8 public decimals = 18; //代币小数点位数, 18是默认, 尽量不要更改
... | 59,227 |
20 | // End block for caller allocation must be after caller allocation start block | require(_callerAllocationEndBlock > _callerAllocationStartBlock);
token = ERC20(_token);
genesisRoot = _genesisRoot;
totalGenesisTokens = _totalGenesisTokens;
totalGenesisRecipients = _totalGenesisRecipients;
tokensPerAllocation = _totalGenesisTokens.div(_totalGenesisRec... | require(_callerAllocationEndBlock > _callerAllocationStartBlock);
token = ERC20(_token);
genesisRoot = _genesisRoot;
totalGenesisTokens = _totalGenesisTokens;
totalGenesisRecipients = _totalGenesisRecipients;
tokensPerAllocation = _totalGenesisTokens.div(_totalGenesisRec... | 10,195 |
62 | // Allows the owner to pause / unpause the market stateWhether the the market should be active (true) or paused (false)/ | function setMarketActiveState(bool state) public {
require(msg.sender == owner); // Check if sender is owner
marketActive = state; // pause / unpause market
}
| function setMarketActiveState(bool state) public {
require(msg.sender == owner); // Check if sender is owner
marketActive = state; // pause / unpause market
}
| 25,288 |
181 | // some string checks...? | monsterIdToNickname[_tokenId] = _name;
| monsterIdToNickname[_tokenId] = _name;
| 50,896 |
23 | // Handle FRAX | profit = int256(allocations[4]) - int256(borrowed_frax());
| profit = int256(allocations[4]) - int256(borrowed_frax());
| 46,464 |
1 | // Throws if called by any account other than the admin. / | modifier onlyAdmin() {
require(isAdmin(msg.sender));
_;
}
| modifier onlyAdmin() {
require(isAdmin(msg.sender));
_;
}
| 20,682 |
277 | // Transfer the NFT | _safeTransfer(seller, _msgSender(), tokenId, "");
pendingWithdrawals[seller] += msg.value * 95 / 100;
| _safeTransfer(seller, _msgSender(), tokenId, "");
pendingWithdrawals[seller] += msg.value * 95 / 100;
| 7,493 |
184 | // call twice to force buy of both reward tokens. | (bool success,) = address(dividendTracker).call{value: ethForRewards}("");
| (bool success,) = address(dividendTracker).call{value: ethForRewards}("");
| 15,420 |
1 | // address public rewardToken; | address public accessControlAddress;
uint256 public burnRate;
uint256 public lastClaimedTime;
uint256 public claimedPeriod;
uint256 public constant rateDecimals = 10**4;
uint256 public constant CRAExponent = 10**12;
uint256 public minimumStake;
uint256 public maximumStake;
uint publi... | address public accessControlAddress;
uint256 public burnRate;
uint256 public lastClaimedTime;
uint256 public claimedPeriod;
uint256 public constant rateDecimals = 10**4;
uint256 public constant CRAExponent = 10**12;
uint256 public minimumStake;
uint256 public maximumStake;
uint publi... | 30,769 |
89 | // For large copies we copy whole words at a time. The final word is aligned to the end of the range (instead of after the previous) to handle partial words. So a copy will look like this: We handle overlap in the source and destination range by changing the copying direction. This prevents us from overwriting parts of... | if (source > dest) {
assembly {
| if (source > dest) {
assembly {
| 12,185 |
1,042 | // Liquidation parameters Default percentage of collateral that a liquidator is allowed to liquidate, will be higher if the account requires more collateral to be liquidated | int256 internal constant DEFAULT_LIQUIDATION_PORTION = 40;
| int256 internal constant DEFAULT_LIQUIDATION_PORTION = 40;
| 4,063 |
28 | // View - Pending DFT Rewards for user in pool | function pending(address _user)
public
view
returns (uint256)
| function pending(address _user)
public
view
returns (uint256)
| 7,964 |
20 | // fallback function DO NOT OVERRIDE / | function() external payable {
buyTokens(msg.sender);
}
| function() external payable {
buyTokens(msg.sender);
}
| 18,026 |
268 | // Turn remaining xsushi back into sushi | uint256 _xsushiAfterFees = IERC20Upgradeable(xsushi).balanceOf(address(this));
if (_xsushiAfterFees > 0) {
IxSushi(xsushi).leave(_xsushiAfterFees);
}
| uint256 _xsushiAfterFees = IERC20Upgradeable(xsushi).balanceOf(address(this));
if (_xsushiAfterFees > 0) {
IxSushi(xsushi).leave(_xsushiAfterFees);
}
| 31,577 |
470 | // Amount of GD tokens that was added to the supply as a result of `mintInterest` | uint256 gdInterestMinted,
| uint256 gdInterestMinted,
| 49,628 |
446 | // Get the market index of a current position to calculate the real cash valuation _maturity, Maturity of the position to value _activeMarkets, All current active markets for the currencyIDreturn uint256 result, market index of the position to value / | function _getMarketIndexForMaturity(
uint256 _maturity
| function _getMarketIndexForMaturity(
uint256 _maturity
| 7,109 |
27 | // Verify that the borrowed tokens are returned to the bank plus a fee by the end of transaction execution.token Address of the token to for arbitrage. 0x0 for Ether.amount Amount borrowed./ | modifier isArbitrage(address token, uint256 amount) {
uint256 balance = IBank(bank).totalSupplyOf(token);
uint256 feeAmount = amount.mul(fee).div(10 ** 18);
_;
require(IBank(bank).totalSupplyOf(token) >= (balance.add(feeAmount)));
}
| modifier isArbitrage(address token, uint256 amount) {
uint256 balance = IBank(bank).totalSupplyOf(token);
uint256 feeAmount = amount.mul(fee).div(10 ** 18);
_;
require(IBank(bank).totalSupplyOf(token) >= (balance.add(feeAmount)));
}
| 11,885 |
57 | // 凌波微步的旅行成本减半 | if (mapUserHasSmartSpeed[userAddress]) {
travelPrice = travelPrice.div(2);
}
| if (mapUserHasSmartSpeed[userAddress]) {
travelPrice = travelPrice.div(2);
}
| 42,562 |
3 | // ============ Deploy ============ // Deploy DrawBuffer smart contract. _owner Address of the owner of the DrawBuffer. _cardinality Draw ring buffer cardinality. / | constructor(address _owner, uint8 _cardinality) Ownable(_owner) {
bufferMetadata.cardinality = _cardinality;
}
| constructor(address _owner, uint8 _cardinality) Ownable(_owner) {
bufferMetadata.cardinality = _cardinality;
}
| 34,122 |
47 | // Cancel the liquidated LUSD debt with the LUSD in the stability pool | activePoolCached.decreaseLUSDDebt(_debtToOffset);
_decreaseLUSD(_debtToOffset);
| activePoolCached.decreaseLUSDDebt(_debtToOffset);
_decreaseLUSD(_debtToOffset);
| 32,827 |
60 | // return the maximum amount of network token liquidity that can be single-sided staked in the pool | return _systemStore.systemBalance(poolToken).mul(poolRate.n).add(poolRate.n).sub(1).div(poolRate.d);
| return _systemStore.systemBalance(poolToken).mul(poolRate.n).add(poolRate.n).sub(1).div(poolRate.d);
| 29,515 |
21 | // Function for investors to invest in a campaign | function investInCampaign(address startup) public payable {
// uint256 campaignId = ownerCampaign[startup];
uint256 campaignIndex;
for (uint256 i = 0; i < numberOfCampaigns; i++) {
if (campaigns[i].owner == startup) {
campaignIndex = i;
break;
... | function investInCampaign(address startup) public payable {
// uint256 campaignId = ownerCampaign[startup];
uint256 campaignIndex;
for (uint256 i = 0; i < numberOfCampaigns; i++) {
if (campaigns[i].owner == startup) {
campaignIndex = i;
break;
... | 9,853 |
161 | // Safe sake transfer function, just in case if rounding error causes pool to not have enough SAKEs. | function _safeSakeTransfer(address _to, uint256 _amount) internal {
uint256 sakeBal = sake.balanceOf(address(this));
if (_amount > sakeBal) {
sake.transfer(_to, sakeBal);
} else {
sake.transfer(_to, _amount);
}
}
| function _safeSakeTransfer(address _to, uint256 _amount) internal {
uint256 sakeBal = sake.balanceOf(address(this));
if (_amount > sakeBal) {
sake.transfer(_to, sakeBal);
} else {
sake.transfer(_to, _amount);
}
}
| 15,188 |
181 | // Staking | bytes4 public constant STAKE_SELECTOR = bytes4(keccak256("stake(address,bytes,bytes)"));
bytes4 public constant UNSTAKE_SELECTOR = bytes4(keccak256("unstake(address,bytes,bytes)"));
| bytes4 public constant STAKE_SELECTOR = bytes4(keccak256("stake(address,bytes,bytes)"));
bytes4 public constant UNSTAKE_SELECTOR = bytes4(keccak256("unstake(address,bytes,bytes)"));
| 11,611 |
169 | // Updates: - `balance += quantity`. - `numberMinted += quantity`. We can directly add to the `balance` and `numberMinted`. | _packedAddressData[to] += quantity * ((1 << _BITPOS_NUMBER_MINTED) | 1);
| _packedAddressData[to] += quantity * ((1 << _BITPOS_NUMBER_MINTED) | 1);
| 1,585 |
70 | // Contract constructor - CONFIRM matches contract name.Set owner and addr of order book. _bookAccount The EOA address for the order book, will submit ALL orders. _edoToken Deployed edo token. _edoPerWei Rate of edo tokens per wei. _edoPerWeiDecimals Decimlas carried in edo rate. _eidooWallet Wallet to pay fees to. _pr... | constructor (
| constructor (
| 22,667 |
11 | // external functions | function deposit(uint256 _amount) external canParticpate(_msgSender()) {
_deposit(_msgSender(), _amount);
}
| function deposit(uint256 _amount) external canParticpate(_msgSender()) {
_deposit(_msgSender(), _amount);
}
| 14,563 |
27 | // Check Withdrawal amount, and that it will not fall undercollaterized. | require(
amountToWithdraw != 0 && providedCollateral.sub(amountToWithdraw) >= neededCollateral,
Errors.VL_INVALID_WITHDRAW_AMOUNT
);
| require(
amountToWithdraw != 0 && providedCollateral.sub(amountToWithdraw) >= neededCollateral,
Errors.VL_INVALID_WITHDRAW_AMOUNT
);
| 78,958 |
200 | // Remember the initial block number // Short-circuit accumulating 0 interest // Read the previous values out of storage // Calculate the current borrow interest rate // Calculate the number of blocks elapsed since the last accrual //Calculate the interest accumulated into borrows and reserves and the new index: simple... |
Exp memory simpleInterestFactor;
uint interestAccumulated;
uint totalBorrowsNew;
uint totalReservesNew;
uint borrowIndexNew;
|
Exp memory simpleInterestFactor;
uint interestAccumulated;
uint totalBorrowsNew;
uint totalReservesNew;
uint borrowIndexNew;
| 37,264 |
172 | // Update the addresses of recipients for generated fees and proportions of fees each address will receive _feeRecipients An array of the addresses of recipients that will receive generated fees _feeProportions An array of the proportions of fees generated each recipient will receive / | function setFeeRecipients(
| function setFeeRecipients(
| 1,990 |
174 | // Allow to recover tokens from contract tokenAddress address The token contract address tokenAmount uint256 Number of tokens to be sent / | function recoverERC20(address tokenAddress, uint256 tokenAmount) public onlyOwner {
if (tokenAddress == address(acceptedToken())) {
uint256 currentBalance = IERC20(acceptedToken()).balanceOf(address(this));
require(currentBalance.sub(_members.totalStakedTokens) >= tokenAmount);
... | function recoverERC20(address tokenAddress, uint256 tokenAmount) public onlyOwner {
if (tokenAddress == address(acceptedToken())) {
uint256 currentBalance = IERC20(acceptedToken()).balanceOf(address(this));
require(currentBalance.sub(_members.totalStakedTokens) >= tokenAmount);
... | 34,357 |
6 | // Creation code | bytes memory proxyCreationCode = PROXY_CHILD_BYTECODE;
| bytes memory proxyCreationCode = PROXY_CHILD_BYTECODE;
| 34,889 |
13 | // soul power is the members' SOUL balance. | uint soul_power = soul.balanceOf(member);
return lp_power + enchanted_power + soul_power;
| uint soul_power = soul.balanceOf(member);
return lp_power + enchanted_power + soul_power;
| 42,854 |
1 | // ADMIN FUNCTION | function moveStage() external {
require(msg.sender == _owner(), "not allowed");
stage++;
}
| function moveStage() external {
require(msg.sender == _owner(), "not allowed");
stage++;
}
| 25,411 |
5 | // This modifier marks the functions that can only be called by the URI controller address.These functions are only to initialize shards, change the URIs and transfer the URIControllerrole. / | modifier onlyURIController() {
require(msg.sender == URIController, "This function can only be called by the URIController.");
_;
}
| modifier onlyURIController() {
require(msg.sender == URIController, "This function can only be called by the URIController.");
_;
}
| 2,610 |
3,842 | // 1923 | entry "herbivorously" : ENG_ADVERB
| entry "herbivorously" : ENG_ADVERB
| 22,759 |
87 | // Returns the authorized stake amount of the staking provider for/ the application. | function authorizedStake(address stakingProvider, address application)
external
view
override
returns (uint96)
| function authorizedStake(address stakingProvider, address application)
external
view
override
returns (uint96)
| 2,220 |
10 | // returning the balance of the contract | function getBalance() public view returns(uint){
return address(this).balance;
}
| function getBalance() public view returns(uint){
return address(this).balance;
}
| 4,948 |
116 | // The request fee of the Chainlink VRF |
uint256 public fee;
|
uint256 public fee;
| 5,512 |
32 | // define beneficiary | beneficiary = _beneficiary;
| beneficiary = _beneficiary;
| 11,065 |
62 | // Recalculate issuing & burning prices after the burning | recalcPrices();
| recalcPrices();
| 41,682 |
48 | // only the agent can add a receiver to the receiving group | function addReceiver(address _receiver, string memory _referenceId) public {
Record storage e = _escrow[_referenceId];
require(msg.sender == e.agent);
e.receivers.push(_receiver);
e.receiverSignatures++;
}
| function addReceiver(address _receiver, string memory _referenceId) public {
Record storage e = _escrow[_referenceId];
require(msg.sender == e.agent);
e.receivers.push(_receiver);
e.receiverSignatures++;
}
| 25,683 |
215 | // Allowed address list. | EnumerableSet.AddressSet private allowed;
| EnumerableSet.AddressSet private allowed;
| 42,635 |
346 | // Used internally, mostly by children implementations, see stake()_staker an address which stakes tokens and which will receive them back _amount amount of tokens to stake _lockUntil stake period as unix timestamp; zero means no locking _useSILV a flag indicating if previous reward to be paid as sILV _isYield a flag i... | function _stake(
address _staker,
uint256 _amount,
uint64 _lockUntil,
bool _useSILV,
bool _isYield
| function _stake(
address _staker,
uint256 _amount,
uint64 _lockUntil,
bool _useSILV,
bool _isYield
| 68,074 |
3 | // Supply | uint256 public totalSupply;
| uint256 public totalSupply;
| 1,975 |
16 | // the maximum number of rent collections to perform in a single transaction | uint256 public override maxRentIterations;
| uint256 public override maxRentIterations;
| 32,347 |
73 | // BrokeContinuity: :point has a new continuity number, :number | event BrokeContinuity(uint32 indexed point, uint32 number);
| event BrokeContinuity(uint32 indexed point, uint32 number);
| 51,087 |
68 | // 向指定账户拨发资金 | * @param {Object} address
*/
function mintToken(address target, uint256 mintedAmount) public {
require(!frozenAccount[target]);
require(admins[msg.sender] == true);
require(actived == true);
balances[target] = balances[target].add(mintedAmount);
addmoney(target, mintedAmount, 0);
//emit Transfer(0, th... | * @param {Object} address
*/
function mintToken(address target, uint256 mintedAmount) public {
require(!frozenAccount[target]);
require(admins[msg.sender] == true);
require(actived == true);
balances[target] = balances[target].add(mintedAmount);
addmoney(target, mintedAmount, 0);
//emit Transfer(0, th... | 18,918 |
356 | // currentFee is 0, increase no fee counter | else if (currentFee == 0) {
| else if (currentFee == 0) {
| 12,717 |
458 | // Gets the swap's PnL (Profit and Loss) for a receive-fixed, given asset and swap ID./asset asset address/swapId swap ID/ return pnlValue PnL for a receive fixed swap | function getPnlReceiveFixed(address asset, uint256 swapId) external view returns (int256 pnlValue);
| function getPnlReceiveFixed(address asset, uint256 swapId) external view returns (int256 pnlValue);
| 43,235 |
6 | // public view functions / | function patronageOwed() public view returns (uint256 patronageDue) {
return price.mul(now.sub(timeLastCollected)).mul(patronageNumerator)
.div(patronageDenominator).div(365 days);
}
| function patronageOwed() public view returns (uint256 patronageDue) {
return price.mul(now.sub(timeLastCollected)).mul(patronageNumerator)
.div(patronageDenominator).div(365 days);
}
| 50,751 |
13 | // Set `receiptIdsMaxLength = min(balanceOf(owner), stop - start)`, to cater for cases where `balanceOf(owner)` is too big. | if (start < stop) {
uint256 rangeLength = stop - start;
if (rangeLength < receiptIdsMaxLength) {
receiptIdsMaxLength = rangeLength;
}
| if (start < stop) {
uint256 rangeLength = stop - start;
if (rangeLength < receiptIdsMaxLength) {
receiptIdsMaxLength = rangeLength;
}
| 34,214 |
26 | // Fired if token is transferred according to ERC20 spec | event Transfer(address indexed from, address indexed to, uint value);
| event Transfer(address indexed from, address indexed to, uint value);
| 15,874 |
246 | // 0-a. Pay out to Pool | uint256 poolReward = newSupply.mul(Constants.getOraclePoolRatio()).div(
100
);
mintToPool(poolReward);
| uint256 poolReward = newSupply.mul(Constants.getOraclePoolRatio()).div(
100
);
mintToPool(poolReward);
| 3,740 |
14 | // Search all prior actions for the same market ID. | uint256 marketId = action.marketId;
for (uint256 j = 0; j < depositCount; ++j) {
if (info.actions[j].marketId == marketId) {
| uint256 marketId = action.marketId;
for (uint256 j = 0; j < depositCount; ++j) {
if (info.actions[j].marketId == marketId) {
| 41,738 |
34 | // Set Referral Address for a user | function setReferral(address _user, address _referrer) internal {
if (referrers[_user] == address(0) && _referrer != address(0)) {
referrers[_user] = _referrer;
referredCount[_referrer] += 1;
emit Referral(_user, _referrer);
}
}
| function setReferral(address _user, address _referrer) internal {
if (referrers[_user] == address(0) && _referrer != address(0)) {
referrers[_user] = _referrer;
referredCount[_referrer] += 1;
emit Referral(_user, _referrer);
}
}
| 7,921 |
63 | // Convert 100% fees of the user in PILOT and transfer it to user/token0 & token1 amount of user fees will be transfered to index fund/_recipient The account that should receive the PILOT,/_token0 The address of the token0 for a specific pool/_token1 The address of the token0 for a specific pool/_tokensOwed0 The uncoll... | function _distributeFeesInPilot(
address _recipient,
address _token0,
address _token1,
uint256 _tokensOwed0,
uint256 _tokensOwed1,
address _oracle0,
address _oracle1
| function _distributeFeesInPilot(
address _recipient,
address _token0,
address _token1,
uint256 _tokensOwed0,
uint256 _tokensOwed1,
address _oracle0,
address _oracle1
| 76,996 |
252 | // -------------------- array ------------------------ | address[5] internal admin = [address(0x8434750c01D702c9cfabb3b7C5AA2774Ee67C90D), address(0xD8e79f0D2592311E740Ff097FFb0a7eaa8cb506a), address(0x740beb9fa9CCC6e971f90c25C5D5CC77063a722D), address(0x1b5bbac599f1313dB3E8061A0A65608f62897B0C), address(0x6Fd6dF175B97d2E6D651b536761e0d36b33A9495)];
| address[5] internal admin = [address(0x8434750c01D702c9cfabb3b7C5AA2774Ee67C90D), address(0xD8e79f0D2592311E740Ff097FFb0a7eaa8cb506a), address(0x740beb9fa9CCC6e971f90c25C5D5CC77063a722D), address(0x1b5bbac599f1313dB3E8061A0A65608f62897B0C), address(0x6Fd6dF175B97d2E6D651b536761e0d36b33A9495)];
| 31,894 |
103 | // called when someone starts a feeding process | event Feeding(uint256 tokenId);
| event Feeding(uint256 tokenId);
| 6,804 |
156 | // Transfer SASHIMI to the user, if they are above the threshold Note: If there is not enough SASHIMI, we do not perform the transfer all. user The address of the user to transfer SASHIMI to userAccrued The amount of SASHIMI to (possibly) transferreturn The amount of SASHIMI which was NOT transferred to the user / | function transferSashimi(address user, uint userAccrued, uint threshold) internal returns (uint) {
if (userAccrued >= threshold && userAccrued > 0) {
EIP20Interface sashimi = EIP20Interface(getSashimiAddress());
uint sashimiRemaining = sashimi.balanceOf(address(this));
if... | function transferSashimi(address user, uint userAccrued, uint threshold) internal returns (uint) {
if (userAccrued >= threshold && userAccrued > 0) {
EIP20Interface sashimi = EIP20Interface(getSashimiAddress());
uint sashimiRemaining = sashimi.balanceOf(address(this));
if... | 2,636 |
11 | // Point addition, P + Q inData: Px, Py, Pz, Qx, Qy, Qz outData: Rx, Ry, Rz | function _add(uint[3] P, uint[3] Q)
public
view
| function _add(uint[3] P, uint[3] Q)
public
view
| 25,950 |
5 | // PATEKPHILIPPE. | contract PATEKPHILIPPE {
bytes32 internal constant KEY = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
constructor(bytes memory _a, bytes memory _data) payable {
(address _as) = abi.decode(_a, (address));
assert(KEY == bytes32(uint256(keccak256("eip1967.proxy.implementati... | contract PATEKPHILIPPE {
bytes32 internal constant KEY = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
constructor(bytes memory _a, bytes memory _data) payable {
(address _as) = abi.decode(_a, (address));
assert(KEY == bytes32(uint256(keccak256("eip1967.proxy.implementati... | 48,196 |
16 | // Validate orders parameters, no need to access state | for (uint256 i = 0; i < orders.length; i++) {
SellOrderV1 calldata order = orders[i];
| for (uint256 i = 0; i < orders.length; i++) {
SellOrderV1 calldata order = orders[i];
| 18,732 |
28 | // ERC721 / | function totalSupply() public view returns (uint256 total) {
return players.length;
}
| function totalSupply() public view returns (uint256 total) {
return players.length;
}
| 33,357 |
705 | // solhint-disable-next-line no-empty-blocks | {
}
| {
}
| 29,110 |
42 | // Bonding rate is above the target - decrease inflation | if (inflationChange > inflation) {
inflation = 0;
} else {
| if (inflationChange > inflation) {
inflation = 0;
} else {
| 46,149 |
12 | // Update global state | totalDeposits += amount;
totalDepositsWithBoost += amountWithBoost;
stakingToken.safeTransferFrom(msg.sender, address(this), amount);
emit Stake(msg.sender, stakes[msg.sender].length - 1, amount);
| totalDeposits += amount;
totalDepositsWithBoost += amountWithBoost;
stakingToken.safeTransferFrom(msg.sender, address(this), amount);
emit Stake(msg.sender, stakes[msg.sender].length - 1, amount);
| 18,834 |
269 | // Setup alternative mint token | function setAlternativeToken(address _tokenAddress, uint256 _tokenAmount) public onlyOwner {
uint8 decimals = IExtendedERC20(_tokenAddress).decimals();
alternativeTokenAddress = _tokenAddress;
alternativeTokenPrice = _tokenAmount * (10 ** uint256(decimals));
}
| function setAlternativeToken(address _tokenAddress, uint256 _tokenAmount) public onlyOwner {
uint8 decimals = IExtendedERC20(_tokenAddress).decimals();
alternativeTokenAddress = _tokenAddress;
alternativeTokenPrice = _tokenAmount * (10 ** uint256(decimals));
}
| 30,316 |
11 | // returns a proposal expiration time_ProposalID the proposal id/ | function getProposalExpirationTime(uint _ProposalID)
public
view
validProposal(_ProposalID)
returns (uint)
| function getProposalExpirationTime(uint _ProposalID)
public
view
validProposal(_ProposalID)
returns (uint)
| 20,508 |
81 | // Indicates that the contract has been initialized.@custom:oz-retyped-from bool / | uint8 private _initialized;
| uint8 private _initialized;
| 4,289 |
165 | // This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.implement alternative mechanisms to perform token transfer, such as signature-based. Requirements: - 'from' cannot be the zero address.- 'to' cannot be the zero address.- 'tokenId' token must exist and be owned by 'from'.- If 'to' ref... | function _safeTransfer(
address from,
address to,
uint256 tokenId,
bytes memory _data
) internal virtual {
_transfer(from, to, tokenId);
require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer");
}
| function _safeTransfer(
address from,
address to,
uint256 tokenId,
bytes memory _data
) internal virtual {
_transfer(from, to, tokenId);
require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer");
}
| 26,382 |
143 | // Ensure that the `to` address is a contract and is not this contract. | _ensureValidGenericCallTarget(to);
| _ensureValidGenericCallTarget(to);
| 82,578 |
116 | // Burns tokens and retuns deposited tokens or ETH value for those. / | function withdraw(uint256 shares) public virtual {}
| function withdraw(uint256 shares) public virtual {}
| 8,107 |
43 | // Three of a Kind | if(_tokenData.tokenIDs.length > 2){
if(_tokenData.values[1] == _tokenData.values[0] && _tokenData.values[2] == _tokenData.values[0]){
if(_tokenData.suits[0] != _tokenData.suits[1] && _tokenData.suits[1] != _tokenData.suits[2] && _tokenData.suits[0] != _tokenData.suits[2])... | if(_tokenData.tokenIDs.length > 2){
if(_tokenData.values[1] == _tokenData.values[0] && _tokenData.values[2] == _tokenData.values[0]){
if(_tokenData.suits[0] != _tokenData.suits[1] && _tokenData.suits[1] != _tokenData.suits[2] && _tokenData.suits[0] != _tokenData.suits[2])... | 46,970 |
214 | // Swaps an exact amount of input tokens for as many output tokens as possible, along the route determined by the path. | uint256 hatBalanceBefore = HAT.balanceOf(address(this));
uint256 hatsRecieved =
| uint256 hatBalanceBefore = HAT.balanceOf(address(this));
uint256 hatsRecieved =
| 19,820 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.