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 |
|---|---|---|---|---|
97 | // Rebase ERC20 token This is part of an implementation of the Rebase Ideal Money protocol. Rebase is a normal ERC20 token, but its supply can be adjusted by splitting and combining tokens proportionally across all wallets.Rebase balances are internally represented with a hidden denomination, 'gons'. We support splitti... | contract Rebase is ERC20Detailed, Ownable {
// PLEASE READ BEFORE CHANGING ANY ACCOUNTING OR MATH
// Anytime there is division, there is a risk of numerical instability from rounding errors. In
// order to minimize this risk, we adhere to the following guidelines:
// 1) The conversion rate adopted is th... | contract Rebase is ERC20Detailed, Ownable {
// PLEASE READ BEFORE CHANGING ANY ACCOUNTING OR MATH
// Anytime there is division, there is a risk of numerical instability from rounding errors. In
// order to minimize this risk, we adhere to the following guidelines:
// 1) The conversion rate adopted is th... | 3,765 |
8 | // Calculate quantities | Registry memory reg = ctx.ar.getRegistry();
ctx.quantities = new uint192[](reg.erc20s.length);
for (uint256 i = 0; i < reg.erc20s.length; ++i) {
ctx.quantities[i] = ctx.bh.quantityUnsafe(reg.erc20s[i], reg.assets[i]);
}
| Registry memory reg = ctx.ar.getRegistry();
ctx.quantities = new uint192[](reg.erc20s.length);
for (uint256 i = 0; i < reg.erc20s.length; ++i) {
ctx.quantities[i] = ctx.bh.quantityUnsafe(reg.erc20s[i], reg.assets[i]);
}
| 40,216 |
440 | // approve the pool collection to transfer pool tokens, which we have received from the completion of the pending withdrawal, on behalf of the network | completedRequest.poolToken.approve(address(poolCollection), completedRequest.poolTokenAmount);
| completedRequest.poolToken.approve(address(poolCollection), completedRequest.poolTokenAmount);
| 56,408 |
71 | // Creates clone, more info here: https:blog.openzeppelin.com/deep-dive-into-the-minimal-proxy-contract/ | assembly {
let clone := mload(0x40)
mstore(clone, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000)
mstore(add(clone, 0x14), targetBytes)
mstore(add(clone, 0x28), 0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000... | assembly {
let clone := mload(0x40)
mstore(clone, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000)
mstore(add(clone, 0x14), targetBytes)
mstore(add(clone, 0x28), 0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000... | 15,802 |
174 | // Governance // DAO // Pool // Market // Regulator //Getters / | function getUsdcAddress() internal pure returns (address) {
return USDC;
}
| function getUsdcAddress() internal pure returns (address) {
return USDC;
}
| 1,371 |
28 | // Function to add a new owner `_owner` to the wallet, must be sent as a tx/_owner New owner to be added | function addOwner(address _owner)
external
notAnOwner(_owner)
notNull(_owner)
validInputs(owners.length + 1, threshold)
| function addOwner(address _owner)
external
notAnOwner(_owner)
notNull(_owner)
validInputs(owners.length + 1, threshold)
| 45,401 |
29 | // The minimal token1 receive after remove the liquidity, will be used when call removeLiquidity() of uniswap | uint256 minAmount1WhenRemoveLiquidity;
| uint256 minAmount1WhenRemoveLiquidity;
| 14,958 |
18 | // Encodes a 31 bit unsigned integer shifted by an offset. The return value can be logically ORed with other encoded values to form a 256 bit word. / | function encodeUint31(uint256 value, uint256 offset) internal pure returns (bytes32) {
return bytes32(value << offset);
}
| function encodeUint31(uint256 value, uint256 offset) internal pure returns (bytes32) {
return bytes32(value << offset);
}
| 40,423 |
5 | // Allowed tokens symbols list. | mapping(address => address[]) internal allowedTokens;
| mapping(address => address[]) internal allowedTokens;
| 25,992 |
134 | // Before adding to return index | strategyID = strategies.length;
strategies.push(
Strategy({
strategyName : strategyName,
token0Out : token0Out,
pairs : pairs,
feeOnTransfers : feeOnTransfers,
cBTCSupport : cBTCSupport,
feeOff :... | strategyID = strategies.length;
strategies.push(
Strategy({
strategyName : strategyName,
token0Out : token0Out,
pairs : pairs,
feeOnTransfers : feeOnTransfers,
cBTCSupport : cBTCSupport,
feeOff :... | 35,956 |
209 | // delete the bid | uint256 len = _tokenBids[_tokenId].length;
for (uint256 i = _index; i < len - 1; i++) {
_tokenBids[_tokenId][i] = _tokenBids[_tokenId][i + 1];
}
| uint256 len = _tokenBids[_tokenId].length;
for (uint256 i = _index; i < len - 1; i++) {
_tokenBids[_tokenId][i] = _tokenBids[_tokenId][i + 1];
}
| 16,981 |
59 | // 转移冻结账本 | balances[newFrozenAddress] = balances[frozenAddress];
balances[frozenAddress] = 0;
emit Transfer(frozenAddress, newFrozenAddress, balances[newFrozenAddress]);
frozenAddress = newFrozenAddress;
return true;
| balances[newFrozenAddress] = balances[frozenAddress];
balances[frozenAddress] = 0;
emit Transfer(frozenAddress, newFrozenAddress, balances[newFrozenAddress]);
frozenAddress = newFrozenAddress;
return true;
| 46,502 |
15 | // Ensure mutex is unlocked. | if (_locked) {
LibRichErrors.rrevert(
LibReentrancyGuardRichErrors.IllegalReentrancyError()
);
}
| if (_locked) {
LibRichErrors.rrevert(
LibReentrancyGuardRichErrors.IllegalReentrancyError()
);
}
| 32,311 |
8 | // modes[1] = 0; modes[2] = 0; modes[3] = 0; modes[4] = 0; modes[5] = 0; modes[6] = 0; |
address onBehalfOf = address(this);
bytes memory params = "";
uint16 referralCode = 0;
LENDING_POOL.flashLoan(
receiverAddress,
assets,
amounts,
modes,
|
address onBehalfOf = address(this);
bytes memory params = "";
uint16 referralCode = 0;
LENDING_POOL.flashLoan(
receiverAddress,
assets,
amounts,
modes,
| 9,356 |
178 | // Claim all comp accrued by the holders holders The addresses to claim COMP for cTokens The list of markets to claim COMP in borrowers Whether or not to claim COMP earned by borrowing suppliers Whether or not to claim COMP earned by supplying / | function claimComp(
address[] memory holders,
ICErc20[] memory cTokens,
bool borrowers,
bool suppliers
) external;
| function claimComp(
address[] memory holders,
ICErc20[] memory cTokens,
bool borrowers,
bool suppliers
) external;
| 52,358 |
52 | // Move to the next market account | _totalMarketAccounts++;
| _totalMarketAccounts++;
| 9,650 |
4 | // Transfers any ether held by timelock to beneficiary./ | function release() public {
require(block.timestamp >= releaseTime);
require(address(this).balance > 0);
beneficiary.transfer(address(this).balance);
}
| function release() public {
require(block.timestamp >= releaseTime);
require(address(this).balance > 0);
beneficiary.transfer(address(this).balance);
}
| 31,511 |
108 | // register the supported interface to conform to ERC721Enumerable via ERC165 | _registerInterface(_INTERFACE_ID_ERC721_ENUMERABLE);
| _registerInterface(_INTERFACE_ID_ERC721_ENUMERABLE);
| 8,336 |
179 | // Crowdsale mints to himself the initial supply | token.mint(address(this), crowdsale_supply);
| token.mint(address(this), crowdsale_supply);
| 44,381 |
36 | // only owner adjust contract balance variable (only used for max profit calc) / | {
contractBalance = newContractBalanceInWei;
}
| {
contractBalance = newContractBalanceInWei;
}
| 38,169 |
6 | // Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets. / | event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
| event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
| 16,722 |
10 | // Search for a needle in a haystack / | function startsWith(string memory haystack, string memory needle) internal pure returns (bool) {
return indexOf(needle, haystack) == 0;
}
| function startsWith(string memory haystack, string memory needle) internal pure returns (bool) {
return indexOf(needle, haystack) == 0;
}
| 31,643 |
34 | // Allows an owner to execute a confirmed transaction. transactionIdTransaction ID. / | function executeTransaction(
uint256 transactionId
)
public
ownerExists(msg.sender)
confirmed(transactionId, msg.sender)
notExecuted(transactionId)
| function executeTransaction(
uint256 transactionId
)
public
ownerExists(msg.sender)
confirmed(transactionId, msg.sender)
notExecuted(transactionId)
| 49,958 |
10 | // Version 1 adapter for metaverse integrations/Daniel K Ivanov/Adapter for metaverses that lack the necessary consumer role required to be integrated into LandWorks/ For reference see https:eips.ethereum.org/EIPS/eip-4400 | contract ConsumableAdapterV1 is IERC165, IERC721Consumable {
/// @notice LandWorks address
address public immutable landworks;
/// @notice NFT Token address
IERC721 public immutable token;
/// @notice mapping of authorised consumer addresses
mapping(uint256 => address) private consumers;
c... | contract ConsumableAdapterV1 is IERC165, IERC721Consumable {
/// @notice LandWorks address
address public immutable landworks;
/// @notice NFT Token address
IERC721 public immutable token;
/// @notice mapping of authorised consumer addresses
mapping(uint256 => address) private consumers;
c... | 4,963 |
42 | // Constructs a `Signed` from an unscaled int, e.g., `b=5` gets stored internally as `5(1018)`. a int to convert into a FixedPoint.Signed.return the converted FixedPoint.Signed. / | function fromUnscaledInt(int256 a) internal pure returns (Signed memory) {
return Signed(a.mul(SFP_SCALING_FACTOR));
}
| function fromUnscaledInt(int256 a) internal pure returns (Signed memory) {
return Signed(a.mul(SFP_SCALING_FACTOR));
}
| 19,186 |
280 | // Set the starting index for the collection / | function setStartingIndex() public {
require(startingIndex == 0, "Starting index is already set");
require(startingIndexBlock != 0, "Starting index block must be set");
startingIndex = uint(blockhash(startingIndexBlock)) % MAX_APES;
// Just a sanity case in the worst case if... | function setStartingIndex() public {
require(startingIndex == 0, "Starting index is already set");
require(startingIndexBlock != 0, "Starting index block must be set");
startingIndex = uint(blockhash(startingIndexBlock)) % MAX_APES;
// Just a sanity case in the worst case if... | 2,064 |
65 | // Contract registry/The contract registry holds Orbs PoS contracts and managers lists/The contract registry updates the managed contracts on changes in the contract list/Governance functions restricted to managers access the registry to retrieve the manager address /The contract registry represents the source of truth... | contract ContractRegistry is IContractRegistry, Initializable, WithClaimableRegistryManagement {
address previousContractRegistry;
mapping(string => address) contracts;
address[] managedContractAddresses;
mapping(string => address) managers;
/// Constructor
/// @param _previousContractRegistry is the prev... | contract ContractRegistry is IContractRegistry, Initializable, WithClaimableRegistryManagement {
address previousContractRegistry;
mapping(string => address) contracts;
address[] managedContractAddresses;
mapping(string => address) managers;
/// Constructor
/// @param _previousContractRegistry is the prev... | 69,032 |
23 | // Sets the publication fee that's charged to users to publish items publicationFee - Fee amount in wei this contract charges to publish an item / | function setPublicationFee(uint256 publicationFee) onlyOwner public {
publicationFeeInWei = publicationFee;
ChangedPublicationFee(publicationFeeInWei);
}
| function setPublicationFee(uint256 publicationFee) onlyOwner public {
publicationFeeInWei = publicationFee;
ChangedPublicationFee(publicationFeeInWei);
}
| 16,509 |
385 | // The default harvest delay for Vaults./See the documentation for the harvestDelay/ variable in the Vault contract for more details. | uint64 public defaultHarvestDelay;
| uint64 public defaultHarvestDelay;
| 21,543 |
73 | // solium-disable security/no-low-level-calls // ERC827, an extension of ERC20 token standardImplementation the ERC827, following the ERC20 standard with extramethods to transfer value and data and execute calls in transfers andapprovals. Uses OpenZeppelin StandardToken. / | contract ERC827Token is ERC827, StandardToken {
/**
* @dev Addition to ERC20 token methods. It allows to
* approve the transfer of value and execute a call with the sent data.
* Beware that changing an allowance with this method brings the risk that
* someone may use both the old and the new allowance by... | contract ERC827Token is ERC827, StandardToken {
/**
* @dev Addition to ERC20 token methods. It allows to
* approve the transfer of value and execute a call with the sent data.
* Beware that changing an allowance with this method brings the risk that
* someone may use both the old and the new allowance by... | 35,291 |
125 | // Get the balance of want held idle in the Strategy | function balanceOfWant() public view returns (uint256) {
return IERC20Upgradeable(want).balanceOf(address(this));
}
| function balanceOfWant() public view returns (uint256) {
return IERC20Upgradeable(want).balanceOf(address(this));
}
| 6,156 |
108 | // _token The token address _merkleRoot The merkleroot / | function addAirdrop(address _token, bytes32 _merkleRoot) external override onlyOwner {
require(_token != address(0), 'BnEX::Distributor::addAirdrop::INVALID_TOKEN');
airdropInfo.push(AirdropInfo({token: _token, merkleRoot: _merkleRoot}));
}
| function addAirdrop(address _token, bytes32 _merkleRoot) external override onlyOwner {
require(_token != address(0), 'BnEX::Distributor::addAirdrop::INVALID_TOKEN');
airdropInfo.push(AirdropInfo({token: _token, merkleRoot: _merkleRoot}));
}
| 29,657 |
4 | // Standard math utilities missing in the Solidity language. / | library Math {
/**
* @dev Returns the largest of two numbers.
*/
function max(uint256 a, uint256 b) internal pure returns (uint256) {
return a >= b ? a : b;
}
/**
* @dev Returns the smallest of two numbers.
*/
function min(uint256 a, uint256 b) internal pure returns (uin... | library Math {
/**
* @dev Returns the largest of two numbers.
*/
function max(uint256 a, uint256 b) internal pure returns (uint256) {
return a >= b ? a : b;
}
/**
* @dev Returns the smallest of two numbers.
*/
function min(uint256 a, uint256 b) internal pure returns (uin... | 883 |
11 | // Data structures / | mapping (address => uint256) balances;
mapping (address => mapping (address => uint256)) allowed;
| mapping (address => uint256) balances;
mapping (address => mapping (address => uint256)) allowed;
| 43,935 |
778 | // The integer part of the logarithm as an unsigned 60.18-decimal fixed-point number. The operation can't overflow because n is maximum 255 and SCALE is 1e18. | result = n * SCALE;
| result = n * SCALE;
| 26,334 |
61 | // [ADDRESS MAPPINGS]/ |
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private _isMultisig;
address[] private multisigPa... |
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private _isMultisig;
address[] private multisigPa... | 52,221 |
0 | // TestOne is deployed check bscscan for the contract addres then call/ | addressTestTwo = _addressTestTwo;
| addressTestTwo = _addressTestTwo;
| 31,588 |
5 | // tockenId : get 3th param | _tokenId := mload(add(_createAuctionlData,add(add(mul(2,32),4),0x20)))
| _tokenId := mload(add(_createAuctionlData,add(add(mul(2,32),4),0x20)))
| 36,600 |
122 | // Distributes dividends whenever ether is paid to this contract. | receive() external payable {
distributeDividends();
}
| receive() external payable {
distributeDividends();
}
| 6,080 |
15 | // return rights[customerADDR][right]; |
bytes32[] memory stringArr = new bytes32[](customer.rightsIndexCount);
bool[] memory boolArr = new bool[](customer.rightsIndexCount);
for (uint i = 0 ; i < customer.rightsIndexCount; i++){
bytes32 right = customer.rightsIndex[i];
stringArr[i] = right;
boolArr[i] = rights[customerADDR][ri... |
bytes32[] memory stringArr = new bytes32[](customer.rightsIndexCount);
bool[] memory boolArr = new bool[](customer.rightsIndexCount);
for (uint i = 0 ; i < customer.rightsIndexCount; i++){
bytes32 right = customer.rightsIndex[i];
stringArr[i] = right;
boolArr[i] = rights[customerADDR][ri... | 45,488 |
0 | // Hasher object | Hasher hasher;
| Hasher hasher;
| 38,816 |
2 | // make sure caller isn't a contract | modifier onlyEOA() {
require(tx.origin == msg.sender, "onlyEOA");
_;}
| modifier onlyEOA() {
require(tx.origin == msg.sender, "onlyEOA");
_;}
| 5,223 |
17 | // This function sets the symbol name as used, this function is called from records contract to reserve symbol for new version creation/governanceSymbol Symbol for governance token/communitySymbol Symbol for community token | function setSymbolsAsUsed(
string memory governanceSymbol,
string memory communitySymbol
) external;
| function setSymbolsAsUsed(
string memory governanceSymbol,
string memory communitySymbol
) external;
| 23,283 |
121 | // -- Configuration -- |
function setDefaultReserveRatio(uint32 _defaultReserveRatio) external;
function setMinimumCurationDeposit(uint256 _minimumCurationDeposit) external;
function setCurationTaxPercentage(uint32 _percentage) external;
|
function setDefaultReserveRatio(uint32 _defaultReserveRatio) external;
function setMinimumCurationDeposit(uint256 _minimumCurationDeposit) external;
function setCurationTaxPercentage(uint32 _percentage) external;
| 81,671 |
229 | // ERC20 token/ | contract ERC20Token {
using SafeMathLib for uint256;
string public name;
string public symbol;
uint8 public decimals;
uint256 public totalSupply;
mapping(address => uint256) internal balances;
mapping(address => mapping(address => uint256)) internal allowances;
// events
event Transfer(
addres... | contract ERC20Token {
using SafeMathLib for uint256;
string public name;
string public symbol;
uint8 public decimals;
uint256 public totalSupply;
mapping(address => uint256) internal balances;
mapping(address => mapping(address => uint256)) internal allowances;
// events
event Transfer(
addres... | 11,342 |
2 | // POOL | bytes32 public constant POOL_BASE_INTERESTS = bytes32('POOL_BASE_INTERESTS');
bytes32 public constant POOL_MARKET_FRENZY = bytes32('POOL_MARKET_FRENZY');
bytes32 public constant POOL_PLEDGE_RATE = bytes32('POOL_PLEDGE_RATE');
bytes32 public constant POOL_LIQUIDATION_RATE = bytes32('POOL_LIQUIDATION_RATE... | bytes32 public constant POOL_BASE_INTERESTS = bytes32('POOL_BASE_INTERESTS');
bytes32 public constant POOL_MARKET_FRENZY = bytes32('POOL_MARKET_FRENZY');
bytes32 public constant POOL_PLEDGE_RATE = bytes32('POOL_PLEDGE_RATE');
bytes32 public constant POOL_LIQUIDATION_RATE = bytes32('POOL_LIQUIDATION_RATE... | 24,357 |
285 | // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since | // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that
// the target address contains contract code and also asserts for success in the low-level call.
bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call fai... | // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that
// the target address contains contract code and also asserts for success in the low-level call.
bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call fai... | 27,805 |
5 | // This operation is equivalent to `x / 2 +y / 2`, and it can never overflow. | int256 sum = (xInt >> 1) + (yInt >> 1);
if (sum < 0) {
| int256 sum = (xInt >> 1) + (yInt >> 1);
if (sum < 0) {
| 31,536 |
96 | // Transfer tokens to delegate to this contract | require(graphToken().transferFrom(delegator, address(this), _tokens), "!transfer");
| require(graphToken().transferFrom(delegator, address(this), _tokens), "!transfer");
| 20,624 |
163 | // get LP at MasterChef | uint256 lpSupply = pool.lpToken.balanceOf(address(this));
if (lpSupply == 0) {
pool.lastRewardBlock = block.number;
return;
}
| uint256 lpSupply = pool.lpToken.balanceOf(address(this));
if (lpSupply == 0) {
pool.lastRewardBlock = block.number;
return;
}
| 23,414 |
35 | // Returns the data from the front of the queue, without removing it. O(1) queue Uint256Queue struct from contract. / | function peek(Uint256Queue storage queue) internal view returns (uint256 data) {
return uint256(_peek(queue._inner));
}
| function peek(Uint256Queue storage queue) internal view returns (uint256 data) {
return uint256(_peek(queue._inner));
}
| 16,810 |
5 | // accepts payeeship for offchain aggregators _contractIdxs indexes corresponding to the offchain aggregators / | function _acceptAdmin(uint[] calldata _contractIdxs) internal override {
for (uint i = 0; i < _contractIdxs.length; i++) {
require(_contractIdxs[i] < contracts.length, "contractIdx must be < contracts length");
IOffchainAggregator(contracts[_contractIdxs[i]]).acceptPayeeship(transmit... | function _acceptAdmin(uint[] calldata _contractIdxs) internal override {
for (uint i = 0; i < _contractIdxs.length; i++) {
require(_contractIdxs[i] < contracts.length, "contractIdx must be < contracts length");
IOffchainAggregator(contracts[_contractIdxs[i]]).acceptPayeeship(transmit... | 6,197 |
24 | // mapping(address => uint) public teamallget;mapping(address => mapping(uint => uint)) public teamdayget;mapping(address => uint) public teamgettime; | struct sunsdata{
uint n1;
uint n2;
uint getmoney;
}
| struct sunsdata{
uint n1;
uint n2;
uint getmoney;
}
| 18,450 |
234 | // migrate our want token to a new strategy if needed, make sure to check claimRewards first also send over any CRV or CVX that is claimed; for migrations we definitely want to claim | function prepareMigration(address _newStrategy) internal override {
uint256 _stakedBal = stakedBalance();
if (_stakedBal > 0) {
rewardsContract.withdrawAndUnwrap(_stakedBal, claimRewards);
}
crv.safeTransfer(_newStrategy, crv.balanceOf(address(this)));
convexToken... | function prepareMigration(address _newStrategy) internal override {
uint256 _stakedBal = stakedBalance();
if (_stakedBal > 0) {
rewardsContract.withdrawAndUnwrap(_stakedBal, claimRewards);
}
crv.safeTransfer(_newStrategy, crv.balanceOf(address(this)));
convexToken... | 18,870 |
2 | // b_two = '0xaaaa';Alternativa | return b_two.length;
| return b_two.length;
| 15,451 |
313 | // give platform its secondary sale percentage | uint256 platformAmount = saleAmount.mul(platformSecondSalePercentages[tokenId]).div(100);
safeFundsTransfer(platformAddress, platformAmount);
| uint256 platformAmount = saleAmount.mul(platformSecondSalePercentages[tokenId]).div(100);
safeFundsTransfer(platformAddress, platformAmount);
| 28,490 |
18 | // get NFT URI, the method will return different NFT URI according to the the `tokenId` owner's amount of SCR, so as to realize Dynamic NFT/ e.g:/ ipfs:QmSDdbLq2QDEgNUQGwRH7iVrcZiTy6PvCnKrdawGbTa7QD/1_1.json/ ipfs:QmSDdbLq2QDEgNUQGwRH7iVrcZiTy6PvCnKrdawGbTa7QD/1_2.json/ ipfs:QmSDdbLq2QDEgNUQGwRH7iVrcZiTy6PvCnKrdawGbTa7... | function tokenURI(
uint256 tokenId
| function tokenURI(
uint256 tokenId
| 36,293 |
50 | // Gas optimized reentrancy protection for smart contracts./Solmate (https:github.com/Rari-Capital/solmate/blob/main/src/utils/ReentrancyGuard.sol)/Modified from OpenZeppelin (https:github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/security/ReentrancyGuard.sol) | abstract contract ReentrancyGuard {
uint256 private locked = 1;
modifier nonReentrant() {
require(locked == 1, "REENTRANCY");
locked = 2;
_;
locked = 1;
}
}
| abstract contract ReentrancyGuard {
uint256 private locked = 1;
modifier nonReentrant() {
require(locked == 1, "REENTRANCY");
locked = 2;
_;
locked = 1;
}
}
| 47,241 |
8 | // Hypernet Protocol Buy Module for NFRs Todd Chapman Implementation of a simple purchasing extension for NFRs See the documentation for more details: See the unit tests for example usage: / | contract BuyModule is Context {
using SafeERC20 for IERC20;
/// @dev the name to be listed in the Hypernet Protocol Registry Modules NFR
/// @dev see https://docs.hypernet.foundation/hypernet-protocol/identity#registry-modules
string public name;
constructor(string memory _name)
{
na... | contract BuyModule is Context {
using SafeERC20 for IERC20;
/// @dev the name to be listed in the Hypernet Protocol Registry Modules NFR
/// @dev see https://docs.hypernet.foundation/hypernet-protocol/identity#registry-modules
string public name;
constructor(string memory _name)
{
na... | 16,567 |
80 | // returns a UQ112x112 which represents the ratio of the numerator to the denominator can be lossy | function fraction(uint256 numerator, uint256 denominator) internal pure returns (uq112x112 memory) {
require(denominator > 0, 'FixedPoint::fraction: division by zero');
if (numerator == 0) return FixedPoint.uq112x112(0);
if (numerator <= uint144(-1)) {
uint256 result = (numerato... | function fraction(uint256 numerator, uint256 denominator) internal pure returns (uq112x112 memory) {
require(denominator > 0, 'FixedPoint::fraction: division by zero');
if (numerator == 0) return FixedPoint.uq112x112(0);
if (numerator <= uint144(-1)) {
uint256 result = (numerato... | 54,789 |
35 | // Set the contract that can call release and make the token transferable./_crowdsaleAgent crowdsale contract address | function setCrowdsaleAgent(address _crowdsaleAgent) onlyOwner public {
crowdsaleAgent = _crowdsaleAgent;
}
| function setCrowdsaleAgent(address _crowdsaleAgent) onlyOwner public {
crowdsaleAgent = _crowdsaleAgent;
}
| 36,743 |
5 | // OLA_ADDITIONS : Contract hash name | bytes32 public contractNameHash;
| bytes32 public contractNameHash;
| 32,268 |
77 | // Quant Network Allows a mapp or gateway OVL Network staked deposit to be held in escrow to either be returned or slashed according to the verification rules / | contract EscrowedDeposit {
// @return - the connected payment channel
PaymentChannel pc;
// The QNT address of the MAPP or Gateway who added the deposit
address public MAPPorGatewayQNTAddress;
// The operator address that can trigger functions of this channel on behalf of the MAPP or Gateway
ad... | contract EscrowedDeposit {
// @return - the connected payment channel
PaymentChannel pc;
// The QNT address of the MAPP or Gateway who added the deposit
address public MAPPorGatewayQNTAddress;
// The operator address that can trigger functions of this channel on behalf of the MAPP or Gateway
ad... | 18,045 |
128 | // can not use swapExactTokensForETH if token is WETH | if (token == IUniswapV2Router02(uniswapRouterAddress).WETH()) {
| if (token == IUniswapV2Router02(uniswapRouterAddress).WETH()) {
| 12,514 |
154 | // ONLY OPERATOR: Updates fee recipient on both streaming fee and debt issuance modules. / | function updateFeeRecipient(address _newFeeRecipient) external onlyOperator {
bytes memory callData = abi.encodeWithSignature("updateFeeRecipient(address,address)", manager.setToken(), _newFeeRecipient);
invokeManager(address(streamingFeeModule), callData);
invokeManager(address(debtIssuance... | function updateFeeRecipient(address _newFeeRecipient) external onlyOperator {
bytes memory callData = abi.encodeWithSignature("updateFeeRecipient(address,address)", manager.setToken(), _newFeeRecipient);
invokeManager(address(streamingFeeModule), callData);
invokeManager(address(debtIssuance... | 11,034 |
296 | // 基金本币兑换成token1 | if(params.token1 == params.token){
amount1Max = params.amount1.add(params.amount.sub(fundToT0));
} else {
| if(params.token1 == params.token){
amount1Max = params.amount1.add(params.amount.sub(fundToT0));
} else {
| 7,069 |
346 | // Ends network exchange if necessary | if (shouldEndNetworkExchange) {
networkExchangeEnded = true;
}
| if (shouldEndNetworkExchange) {
networkExchangeEnded = true;
}
| 32,546 |
8 | // Called after the contract has | // function setTradeableCashflow(address tcfAddress) public {
// require(msg.sender == _ap.owner, "Only owner");
// // TODO: Require _tcf not set
// _tcf = ITradeableCashflow(tdfAddress);
// }
| // function setTradeableCashflow(address tcfAddress) public {
// require(msg.sender == _ap.owner, "Only owner");
// // TODO: Require _tcf not set
// _tcf = ITradeableCashflow(tdfAddress);
// }
| 43,224 |
12 | // if inFlowRate is zero, delete outflow. | (newCtx, ) = _host.callAgreementWithContext(
_cfa,
abi.encodeWithSelector(
_cfa.deleteFlow.selector,
_acceptedToken,
address(this),
_receiver,
new bytes(0) // placeholder
),
... | (newCtx, ) = _host.callAgreementWithContext(
_cfa,
abi.encodeWithSelector(
_cfa.deleteFlow.selector,
_acceptedToken,
address(this),
_receiver,
new bytes(0) // placeholder
),
... | 31,052 |
10 | // Function for loomiVault deposit/ | function deposit(uint256[] memory tokenIds) public nonReentrant whenNotPaused {
require(tokenIds.length > 0, "Empty array");
Staker storage user = _stakers[_msgSender()];
if (user.stakedVault.length == 0) {
uint256 currentLoomiPot = _getLoomiPot();
user.loomiPotSnapshot = currentL... | function deposit(uint256[] memory tokenIds) public nonReentrant whenNotPaused {
require(tokenIds.length > 0, "Empty array");
Staker storage user = _stakers[_msgSender()];
if (user.stakedVault.length == 0) {
uint256 currentLoomiPot = _getLoomiPot();
user.loomiPotSnapshot = currentL... | 51,612 |
42 | // Make sure they are sending min flush price | require(msg.value >= minFlushPrice);
| require(msg.value >= minFlushPrice);
| 38,305 |
35 | // solhint-disable-next-line not-rely-on-time | block.timestamp
);
| block.timestamp
);
| 16,929 |
17 | // Returns the address of the current owner./ | function owner() public view returns (address payable) {
return _owner;
}
| function owner() public view returns (address payable) {
return _owner;
}
| 23,572 |
44 | // Returns a random number using a specified block number Always use a FUTURE block number. | function maxRandom(uint blockn, address entropy) public view returns (uint256 randomNumber) {
return uint256(keccak256(
abi.encodePacked(
blockhash(blockn),
entropy)
));
}
| function maxRandom(uint blockn, address entropy) public view returns (uint256 randomNumber) {
return uint256(keccak256(
abi.encodePacked(
blockhash(blockn),
entropy)
));
}
| 38,848 |
86 | // uint256 vip1 = 0; uint256 vip2 = 0;uint256 vip3 = 0;for(uint i = 1;i < vipLevalLength;i++){address regAddr = regisUser[i];uint256 vip = getVipLeval(regAddr);if(vip == 1){vip1 ++;}else if(vip == 2){vip2 ++;}else if(vip == 3){vip3 ++;}}vipPoolInfo[1].vipNumber = vip1;vipPoolInfo[2].vipNumber = vip2;vipPoolInfo[3].vipN... | }
| }
| 29,717 |
85 | // given keeper fee, calculate how much to distribute to split recipients underflow should be impossible with validated distributorFee | amountToSplit -= distributorFeeAmount;
| amountToSplit -= distributorFeeAmount;
| 25,553 |
50 | // There must be sufficient allowance available. | uint256 _allowanceOf = directory.controllerOf(_projectId).overflowAllowanceOf(
_projectId,
fundingCycle.configuration,
terminal
);
if (_newUsedOverflowAllowanceOf > _allowanceOf || _allowanceOf == 0) {
revert INADEQUATE_CONTROLLER_ALLOWANCE();
}
| uint256 _allowanceOf = directory.controllerOf(_projectId).overflowAllowanceOf(
_projectId,
fundingCycle.configuration,
terminal
);
if (_newUsedOverflowAllowanceOf > _allowanceOf || _allowanceOf == 0) {
revert INADEQUATE_CONTROLLER_ALLOWANCE();
}
| 9,498 |
49 | // Allows owner to change exchangeLimit. newLimit The new limit to change to. / | function setExchangeLimit(uint newLimit) external onlyCFO {
exchangeLimit = newLimit;
}
| function setExchangeLimit(uint newLimit) external onlyCFO {
exchangeLimit = newLimit;
}
| 56,201 |
2 | // wd The withdraw data consisting of/ semantic withdraw information, i.e. assetId, recipient, and amount;/ information to make an optional call in addition to the actual transfer,/ i.e. target address for the call and call payload;/ additional information, i.e. channel address and nonce./aliceSignature Signature of ow... | function withdraw(
WithdrawData calldata wd,
bytes calldata aliceSignature,
bytes calldata bobSignature
| function withdraw(
WithdrawData calldata wd,
bytes calldata aliceSignature,
bytes calldata bobSignature
| 6,733 |
12 | // Gets the address of Vault. | function vaultAddress() public view returns (address) {
return _nameRegistry.get(keccak256(abi.encodePacked("Vault")));
}
| function vaultAddress() public view returns (address) {
return _nameRegistry.get(keccak256(abi.encodePacked("Vault")));
}
| 24,678 |
61 | // Set the burn address. / | function setBurnAddress(address addr) public onlyOwner {
burnAddress = addr;
}
| function setBurnAddress(address addr) public onlyOwner {
burnAddress = addr;
}
| 32,506 |
73 | // batch mint existing token from extension. Can only be called by a registered extension.to- Can be a single element array (all tokens go to same address) or multi-element array (single token to many recipients) tokenIds- Can be a single element array (all recipients get the same token) or a multi-element array amount... | function mintExtensionExisting(address[] calldata to, uint256[] calldata tokenIds, uint256[] calldata amounts) external;
| function mintExtensionExisting(address[] calldata to, uint256[] calldata tokenIds, uint256[] calldata amounts) external;
| 7,918 |
49 | // Handle new tickets | TicketPurchases storage purchases = ticketsBoughtByPlayer[msg.sender];
| TicketPurchases storage purchases = ticketsBoughtByPlayer[msg.sender];
| 6,765 |
24 | // 更新最新的最高出价者, 拍卖品数量, 本次出价的过期时间. | states[id].win = msg.sender;
states[id].oam = oam;
states[id].ttl = uint32(now) + ttl;
| states[id].win = msg.sender;
states[id].oam = oam;
states[id].ttl = uint32(now) + ttl;
| 22,783 |
253 | // owedWei is already negative and heldWei is already positive | if (negOwed && posHeld) {
return;
}
| if (negOwed && posHeld) {
return;
}
| 33,226 |
129 | // Sets the author. / | author = _own;
| author = _own;
| 16,638 |
11 | // Returns boolean flag indicating whether token is whitelisted token Addresses of the given token to checkreturn Boolean flag indicating whether the token is whitelisted / | function isWhitelistedERC20(address token) external view returns (bool);
| function isWhitelistedERC20(address token) external view returns (bool);
| 38,296 |
189 | // 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;
| 17,346 |
7 | // Deprecated: now resides in Harvester's rewardTokenConfigs slither-disable-next-line constable-states | uint256 private _deprecated_rewardLiquidationThreshold;
| uint256 private _deprecated_rewardLiquidationThreshold;
| 10,567 |
313 | // oods_coefficients[249]/ mload(add(context, 0x8a00)), Advance compositionQueryResponses by amount read (0x20constraintDegree). | compositionQueryResponses := add(compositionQueryResponses, 0x40)
| compositionQueryResponses := add(compositionQueryResponses, 0x40)
| 77,556 |
645 | // the token source. Specifies the source of the token - either a static source or a collection. | struct TokenSource {
// the token source type
TokenSourceType _type;
// the source id if a static collection
uint256 staticSourceId;
// the collection source address if collection
address collectionSourceAddress;
}
| struct TokenSource {
// the token source type
TokenSourceType _type;
// the source id if a static collection
uint256 staticSourceId;
// the collection source address if collection
address collectionSourceAddress;
}
| 76,117 |
18 | // total RFV deployed into lending pool | uint256 public totalValueDeployed;
| uint256 public totalValueDeployed;
| 82,150 |
9 | // burn tokens held by sender amount quantity of tokens to burn / | function burn (uint amount) override external {
_burn(msg.sender, amount);
}
| function burn (uint amount) override external {
_burn(msg.sender, amount);
}
| 29,895 |
269 | // https:docs.synthetix.io/contracts/Owned | contract Owned {
address public owner;
address public nominatedOwner;
constructor (address _owner) public {
require(_owner != address(0), "Owner address cannot be 0");
owner = _owner;
emit OwnerChanged(address(0), _owner);
}
function nominateNewOwner(address _owner) externa... | contract Owned {
address public owner;
address public nominatedOwner;
constructor (address _owner) public {
require(_owner != address(0), "Owner address cannot be 0");
owner = _owner;
emit OwnerChanged(address(0), _owner);
}
function nominateNewOwner(address _owner) externa... | 4,038 |
26 | // Withdraw JOE and harvest the rewards _amount The amount of JOE to withdraw / | function withdraw(uint256 _amount) external {
UserInfo storage user = userInfo[_msgSender()];
uint256 _previousAmount = user.amount;
require(_amount <= _previousAmount, "StableJoeStaking: withdraw amount exceeds balance");
uint256 _newAmount = user.amount.sub(_amount);
user.a... | function withdraw(uint256 _amount) external {
UserInfo storage user = userInfo[_msgSender()];
uint256 _previousAmount = user.amount;
require(_amount <= _previousAmount, "StableJoeStaking: withdraw amount exceeds balance");
uint256 _newAmount = user.amount.sub(_amount);
user.a... | 19,965 |
65 | // Additional assignment happens in the loop below | uint256 minimumUnit = uint256(-1);
for (uint256 i = 0; i < components.length; i++) {
address component = components[i];
| uint256 minimumUnit = uint256(-1);
for (uint256 i = 0; i < components.length; i++) {
address component = components[i];
| 35,018 |
1 | // Mapping from the uint256 challenge ID to the encoded challenge string | mapping(uint256 => string) private challenges;
| mapping(uint256 => string) private challenges;
| 5,779 |
184 | // Debt auction | function flop() external returns (uint id) {
require(sump <= sub(sub(vat.sin(address(this)), Sin), Ash), "Vow/insufficient-debt");
require(vat.USB(address(this)) == 0, "Vow/surplus-not-zero");
Ash = add(Ash, sump);
id = flopper.kick(address(this), dump, sump);
}
| function flop() external returns (uint id) {
require(sump <= sub(sub(vat.sin(address(this)), Sin), Ash), "Vow/insufficient-debt");
require(vat.USB(address(this)) == 0, "Vow/surplus-not-zero");
Ash = add(Ash, sump);
id = flopper.kick(address(this), dump, sump);
}
| 11,986 |
142 | // Creates a new Asset with the given fields. ONly available for C Levels/_creatorTokenID The asset who is father of this asset/_price asset price/_assetID asset ID/_category see Asset Struct description/_attributes see Asset Struct description/_stats see Asset Struct description | function createNewAsset(
uint256 _creatorTokenID,
address _owner,
uint256 _price,
uint16 _assetID,
uint8 _category,
uint8 _attributes,
uint8[STATS_SIZE] _stats
)
external onlyCLevel
| function createNewAsset(
uint256 _creatorTokenID,
address _owner,
uint256 _price,
uint16 _assetID,
uint8 _category,
uint8 _attributes,
uint8[STATS_SIZE] _stats
)
external onlyCLevel
| 33,666 |
65 | // UnitsAttack | function getUnitsAttack(address player, uint256 unitId, uint256 amount) internal constant returns (uint256) {
return (amount * (schema.unitAttack(unitId) + unitAttackIncreases[player][unitId]) * (10 + unitAttackMultiplier[player][unitId])) / 10;
}
| function getUnitsAttack(address player, uint256 unitId, uint256 amount) internal constant returns (uint256) {
return (amount * (schema.unitAttack(unitId) + unitAttackIncreases[player][unitId]) * (10 + unitAttackMultiplier[player][unitId])) / 10;
}
| 26,608 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.