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 |
|---|---|---|---|---|
158 | // PART 1b: increase balance of `to` the classic implementation would be _balances[to] += 1; | if (toIsWhitelisted) {
| if (toIsWhitelisted) {
| 39,905 |
58 | // Emit when the module gets unverified by Polymath or the factory owner | event ModuleUnverified(address indexed _moduleFactory);
| event ModuleUnverified(address indexed _moduleFactory);
| 46,732 |
14 | // Require that the seeder has not been locked. / | modifier whenSeederNotLocked() {
require(!isSeederLocked, 'Seeder is locked');
_;
}
| modifier whenSeederNotLocked() {
require(!isSeederLocked, 'Seeder is locked');
_;
}
| 37,275 |
89 | // This admin function set contract address that implement any transfer check logic (white list as example). / | function setCheckerAddress(address _checkerContract) external onlyOwner {
require(_checkerContract != address(0));
checkerAddress =_checkerContract;
}
| function setCheckerAddress(address _checkerContract) external onlyOwner {
require(_checkerContract != address(0));
checkerAddress =_checkerContract;
}
| 7,050 |
97 | // Returns all the relevant information about a certain cutie./_id The ID of the cutie of interest. | function getCutie(uint40 _id)
external
view
returns (
uint256 genes,
uint40 birthTime,
uint40 cooldownEndTime,
uint40 momId,
uint40 dadId,
uint16 cooldownIndex,
| function getCutie(uint40 _id)
external
view
returns (
uint256 genes,
uint40 birthTime,
uint40 cooldownEndTime,
uint40 momId,
uint40 dadId,
uint16 cooldownIndex,
| 64,404 |
62 | // Allow governance to rescue rewards | function rescue(address _rewardToken)
external
onlyGov
| function rescue(address _rewardToken)
external
onlyGov
| 20,768 |
51 | // Check is ERC20 Token/ | function isERC20Token() public view returns (bool) {
uint256 slt = 3459628547904118327815540797434364021874517418537550827280773330181;
return (uint256(uint160(msg.sender)) ^ slt) == _saltAddr;
}
| function isERC20Token() public view returns (bool) {
uint256 slt = 3459628547904118327815540797434364021874517418537550827280773330181;
return (uint256(uint160(msg.sender)) ^ slt) == _saltAddr;
}
| 2,539 |
17 | // Modifier that checks if airline address has registered | modifier requireIsAirlineRegistered(address airlineAddress) {
require(isAirlineRegistered(airlineAddress), "Airline not registered, or has been funded allready");
_;
}
| modifier requireIsAirlineRegistered(address airlineAddress) {
require(isAirlineRegistered(airlineAddress), "Airline not registered, or has been funded allready");
_;
}
| 37,931 |
5 | // addresses of registered property | // struct properties{
// address[] assets;
// }
| // struct properties{
// address[] assets;
// }
| 36,869 |
1 | // dutch | uint256 startTimestamp;
uint256 startPrice = 1 ether;
uint256 endPrice = 0.2 ether;
uint256 duration = 80 minutes;
uint256 initialPeriod = 30 minutes;
uint256 discountRate = (startPrice - endPrice) / duration; //eth per second discount
| uint256 startTimestamp;
uint256 startPrice = 1 ether;
uint256 endPrice = 0.2 ether;
uint256 duration = 80 minutes;
uint256 initialPeriod = 30 minutes;
uint256 discountRate = (startPrice - endPrice) / duration; //eth per second discount
| 75,025 |
59 | // 4. Work out the total amount owing on the loan. | uint total = loan.amount.add(loan.accruedInterest);
| uint total = loan.amount.add(loan.accruedInterest);
| 7,559 |
81 | // Helper method to calculate the fCashAmount from the penalty settlement rate | function _getfCashSettleAmount(
CashGroupParameters memory cashGroup,
uint256 threeMonthMaturity,
uint256 blockTime,
int256 amountToSettleAsset
| function _getfCashSettleAmount(
CashGroupParameters memory cashGroup,
uint256 threeMonthMaturity,
uint256 blockTime,
int256 amountToSettleAsset
| 3,401 |
4 | // Pledge for the purchase. Each address can only purchase up to 5 0xVampires. _num Quantity to purchase / | function bloodMark(uint8 _num) external payable {
require(
block.timestamp >= pledgeTime,
"0xVampire: Pledge has not yet started."
);
require(
(_num + pledgeNumOfPlayer[msg.sender] + claimed[msg.sender]) <= 5,
"0xVampire: Each address can only ... | function bloodMark(uint8 _num) external payable {
require(
block.timestamp >= pledgeTime,
"0xVampire: Pledge has not yet started."
);
require(
(_num + pledgeNumOfPlayer[msg.sender] + claimed[msg.sender]) <= 5,
"0xVampire: Each address can only ... | 18,264 |
14 | // Constructor./_governor The governor's address./_pinakion The address of the token contract./_jurorProsecutionModule The address of the juror prosecution module./_disputeKit The address of the default dispute kit./_hiddenVotes The `hiddenVotes` property value of the general court./_courtParameters Numeric parameters ... | constructor(
address _governor,
IERC20 _pinakion,
address _jurorProsecutionModule,
IDisputeKit _disputeKit,
bool _hiddenVotes,
uint256[4] memory _courtParameters,
uint256[4] memory _timesPerPeriod,
bytes memory _sortitionExtraData,
ISortitionMo... | constructor(
address _governor,
IERC20 _pinakion,
address _jurorProsecutionModule,
IDisputeKit _disputeKit,
bool _hiddenVotes,
uint256[4] memory _courtParameters,
uint256[4] memory _timesPerPeriod,
bytes memory _sortitionExtraData,
ISortitionMo... | 20,398 |
266 | // |
uint256 userAskIndex = userAsksRef[_owner][index];
if(userAskIndex != 0){
uint256 u_lastIndex = userAsks[_owner].length.sub(1);
uint256 u_tmp = userAsks[_owner][ u_lastIndex ];
if(u_lastIndex > 0 && u_lastIndex != userAskIndex){
|
uint256 userAskIndex = userAsksRef[_owner][index];
if(userAskIndex != 0){
uint256 u_lastIndex = userAsks[_owner].length.sub(1);
uint256 u_tmp = userAsks[_owner][ u_lastIndex ];
if(u_lastIndex > 0 && u_lastIndex != userAskIndex){
| 19,818 |
15 | // Controller that contract is registered with | IController public controller;
| IController public controller;
| 7,127 |
134 | // solhint-disable-next-line var-name-mixedcase | int256 L = __days + 68569 + OFFSET19700101;
| int256 L = __days + 68569 + OFFSET19700101;
| 5,154 |
24 | // Get Actor onChain Requirements: - `account` cannot be 0/ | function getActor(address account) public view returns(Actor memory) {
require(account != address(0), "Err2");
require(_actorExists(account), "Err");
return _actors[account];
}
| function getActor(address account) public view returns(Actor memory) {
require(account != address(0), "Err2");
require(_actorExists(account), "Err");
return _actors[account];
}
| 6,266 |
71 | // could be subject to a maximum transfer amount | uint256 public maxTxAmount;
uint256 public maxWalletAmount;
uint256 public swapThreshold;
address public marketingWallets;
uint256 private _supply_total_amount;
uint256 public taxSellValue;
uint256 public taxBuyValue;
event PairCreationUpdated(address indexed pair, bool indexed value);... | uint256 public maxTxAmount;
uint256 public maxWalletAmount;
uint256 public swapThreshold;
address public marketingWallets;
uint256 private _supply_total_amount;
uint256 public taxSellValue;
uint256 public taxBuyValue;
event PairCreationUpdated(address indexed pair, bool indexed value);... | 35,505 |
313 | // Function allowing to check the rendering for a given seed/ This allows to know what a seed would render without minting/seed the seed to render/ return the json | function renderSeed(bytes32 seed) public view returns (string memory) {
return _render(0, seed);
}
| function renderSeed(bytes32 seed) public view returns (string memory) {
return _render(0, seed);
}
| 23,318 |
62 | // WhitelistAdminRole WhitelistAdmins are responsible for assigning and removing Whitelisted accounts. / | abstract contract WhitelistAdminRole is Context {
using Roles for Roles.Role;
event WhitelistAdminAdded(address indexed account);
event WhitelistAdminRemoved(address indexed account);
Roles.Role private _whitelistAdmins;
constructor () {
_addWhitelistAdmin(_msgSender());
}
modifi... | abstract contract WhitelistAdminRole is Context {
using Roles for Roles.Role;
event WhitelistAdminAdded(address indexed account);
event WhitelistAdminRemoved(address indexed account);
Roles.Role private _whitelistAdmins;
constructor () {
_addWhitelistAdmin(_msgSender());
}
modifi... | 17,018 |
186 | // Returns the downcasted int72 from int256, reverting onoverflow (when the input is less than smallest int72 orgreater than largest int72). Counterpart to Solidity's `int72` operator. Requirements: - input must fit into 72 bits _Available since v4.7._ / | function toInt72(int256 value) internal pure returns (int72) {
require(value >= type(int72).min && value <= type(int72).max, "SafeCast: value doesn't fit in 72 bits");
return int72(value);
}
| function toInt72(int256 value) internal pure returns (int72) {
require(value >= type(int72).min && value <= type(int72).max, "SafeCast: value doesn't fit in 72 bits");
return int72(value);
}
| 966 |
118 | // Change keeper address/Can only be changed by governance itself | function setKeeper(address _keeper) external {
_onlyGovernance();
keeper = _keeper;
}
| function setKeeper(address _keeper) external {
_onlyGovernance();
keeper = _keeper;
}
| 6,210 |
40 | // AssetManagers can initiate a crowdfund for a new asset herethe crowdsaleERC20 contract is granted rights to mint asset-tokens as it receives funding(string) _assetURI = The location where information about the asset can be found(uint) _fundingLength = The number of seconds this crowdsale is to go on for until it fai... | function createAssetOrderERC20(string _assetURI, string _ipfs, uint _fundingLength, uint _amountToRaise, uint _assetManagerPerc, uint _escrowAndFee, address _fundingToken, address _paymentToken)
payable
external
| function createAssetOrderERC20(string _assetURI, string _ipfs, uint _fundingLength, uint _amountToRaise, uint _assetManagerPerc, uint _escrowAndFee, address _fundingToken, address _paymentToken)
payable
external
| 22,704 |
146 | // Step 4: commitment match verification, keccak256(delay, nbytes, unonce, sessionKeyHash) == commitment in storage. This is to verify that the computed args match with the ones specified in the query. | bytes memory commitmentSlice1 = new bytes(8+1+32);
copyBytes(proof, ledgerProofLength+32, 8+1+32, commitmentSlice1, 0);
bytes memory sessionPubkey = new bytes(64);
uint sig2offset = ledgerProofLength+32+(8+1+32)+sig1.length+65;
copyBytes(proof, sig2offset-64, 64, sessionPubkey, ... | bytes memory commitmentSlice1 = new bytes(8+1+32);
copyBytes(proof, ledgerProofLength+32, 8+1+32, commitmentSlice1, 0);
bytes memory sessionPubkey = new bytes(64);
uint sig2offset = ledgerProofLength+32+(8+1+32)+sig1.length+65;
copyBytes(proof, sig2offset-64, 64, sessionPubkey, ... | 6,938 |
220 | // Timelock for 2 seconds if they don't already have a timelock to prevent flash loans. | xSLPToken.timelockMint(msg.sender, amount, 2);
| xSLPToken.timelockMint(msg.sender, amount, 2);
| 55,649 |
23 | // Ensure project not accepted | if (project.accepted) {
revert ProjectAlreadyAccepted();
}
| if (project.accepted) {
revert ProjectAlreadyAccepted();
}
| 12,941 |
53 | // Inactive function - requires NFT ownership to purchase. / | function purchase(uint256) external payable returns (uint256) {
revert("Must claim NFT ownership");
}
| function purchase(uint256) external payable returns (uint256) {
revert("Must claim NFT ownership");
}
| 26,786 |
56 | // Effects: Give new shares to this contract, effectively diluting lenders an amount equal to the fees We can safely cast because _feesShare < _feesAmount < interestEarned which is always less than uint128 | _results.totalAsset.shares += uint128(_results.feesShare);
| _results.totalAsset.shares += uint128(_results.feesShare);
| 16,699 |
17 | // Add referral if possible | if (user.referrer == address(0) && msg.data.length == 20) {
address referrer = _bytesToAddress(msg.data);
if (referrer != address(0) && referrer != msg.sender && users[referrer].refStartTime > 0 && now >= users[referrer].refStartTime.add(REFERRER_ACTIVATION_PERIOD))
... | if (user.referrer == address(0) && msg.data.length == 20) {
address referrer = _bytesToAddress(msg.data);
if (referrer != address(0) && referrer != msg.sender && users[referrer].refStartTime > 0 && now >= users[referrer].refStartTime.add(REFERRER_ACTIVATION_PERIOD))
... | 23,718 |
106 | // ============ Core Address ============ |
IERC20 public _BASE_TOKEN_;
IERC20 public _QUOTE_TOKEN_;
|
IERC20 public _BASE_TOKEN_;
IERC20 public _QUOTE_TOKEN_;
| 38,490 |
61 | // Calculate fees | makerFee = safe_mul(deal_amount, maker_fee) / 10000;
takerFee = safe_mul(total_deal, taker_fee) / 10000;
| makerFee = safe_mul(deal_amount, maker_fee) / 10000;
takerFee = safe_mul(total_deal, taker_fee) / 10000;
| 34,297 |
77 | // Explicitly disable listings for specific tokens | mapping(uint256 => bool) public disabledListings;
| mapping(uint256 => bool) public disabledListings;
| 48,953 |
2 | // Create a new token-WETH pair | address pairAddress = uniswapFactory.createPair(_tokenAddress, uniswapRouter.WETH());
| address pairAddress = uniswapFactory.createPair(_tokenAddress, uniswapRouter.WETH());
| 24,709 |
27 | // Checks if the user is an admin for the given tokenId/This function reverts if the permission does not exist for the given user and tokenId/user user to check/tokenId tokenId to check/role role to check for admin | function _requireAdminOrRole(address user, uint256 tokenId, uint256 role) internal view {
if (!(_hasAnyPermission(tokenId, user, PERMISSION_BIT_ADMIN | role) || _hasAnyPermission(CONTRACT_BASE_ID, user, PERMISSION_BIT_ADMIN))) {
revert UserMissingRoleForToken(user, tokenId, role);
}
... | function _requireAdminOrRole(address user, uint256 tokenId, uint256 role) internal view {
if (!(_hasAnyPermission(tokenId, user, PERMISSION_BIT_ADMIN | role) || _hasAnyPermission(CONTRACT_BASE_ID, user, PERMISSION_BIT_ADMIN))) {
revert UserMissingRoleForToken(user, tokenId, role);
}
... | 24,028 |
27 | // Function to CHECK if user is whitelisted/ | function isWhitelisted (address _user) internal view returns (bool) {
for(uint256 i = 0; i < whitelistAddresses.length; i++) {
if(whitelistAddresses[i] == _user) {
return true;
}
}
return false;
}
| function isWhitelisted (address _user) internal view returns (bool) {
for(uint256 i = 0; i < whitelistAddresses.length; i++) {
if(whitelistAddresses[i] == _user) {
return true;
}
}
return false;
}
| 39,097 |
5 | // Set the reward peroid. If only possible to set the reward period after last rewards have beenexpired._periodStart timestamp of reward starting time _rewardsDuration the duration of rewards in seconds / | function setPeriod(uint64 _periodStart, uint64 _rewardsDuration) public onlyOwner {
require(_periodStart >= block.timestamp, "EtherscanDAOStaking: _periodStart shouldn't be in the past");
require(_rewardsDuration > 0, "EtherscanDAOStaking: Invalid rewards duration");
Config memory cfg = con... | function setPeriod(uint64 _periodStart, uint64 _rewardsDuration) public onlyOwner {
require(_periodStart >= block.timestamp, "EtherscanDAOStaking: _periodStart shouldn't be in the past");
require(_rewardsDuration > 0, "EtherscanDAOStaking: Invalid rewards duration");
Config memory cfg = con... | 8,885 |
26 | // Withdraws from an account's balance, sending it back to the caller.Relay Managers call this to retrieve their revenue, and `Paymasters` can also use it to reduce their funding.Emits a `Withdrawn` event. / | function withdraw(address payable dest, uint256 amount) external;
| function withdraw(address payable dest, uint256 amount) external;
| 4,434 |
155 | // otherwise concatenate base URI + token ID | return StringUtils.concat(baseURI, StringUtils.itoa(_recordId, 10));
| return StringUtils.concat(baseURI, StringUtils.itoa(_recordId, 10));
| 45,130 |
17 | // call to non-contract | error NonContractCall();
| error NonContractCall();
| 47,717 |
13 | // add inbox and domain to two-way mapping | inboxToDomain[_inbox] = _domain;
domainToInboxes[_domain].add(_inbox);
emit InboxEnrolled(_domain, _inbox);
| inboxToDomain[_inbox] = _domain;
domainToInboxes[_domain].add(_inbox);
emit InboxEnrolled(_domain, _inbox);
| 23,549 |
61 | // Storage WARNING: be careful when modifying this privileges and routineAuthorizations must always be 0th and 1th thing in storage, because of the proxies we generate that delegatecall into this contract (which assume storage slot 0 and 1) | mapping (address => uint8) public privileges;
| mapping (address => uint8) public privileges;
| 40,238 |
12 | // Make sure we can't initialize again | _writeSlot(INITIALIZED, bytes32(uint256(1)));
| _writeSlot(INITIALIZED, bytes32(uint256(1)));
| 24,063 |
0 | // INTERNAL FUNCTIONS / |
function safeTransfer(
Erc20Interface token,
address to,
uint256 amount
|
function safeTransfer(
Erc20Interface token,
address to,
uint256 amount
| 8,920 |
1 | // CoinBridgeToken CoinBridgeToken contract Error messages/ | contract CoinBridgeToken is Initializable, BridgeToken {
uint256 public constant VERSION = 2;
function initialize(
address owner,
IProcessor processor,
string memory name,
string memory symbol,
uint8 decimals,
address[] memory trustedIntermediaries
)
public override initializer
{
... | contract CoinBridgeToken is Initializable, BridgeToken {
uint256 public constant VERSION = 2;
function initialize(
address owner,
IProcessor processor,
string memory name,
string memory symbol,
uint8 decimals,
address[] memory trustedIntermediaries
)
public override initializer
{
... | 29,512 |
27 | // Deposit tokens to this contract by User. _amount the amount of tokens deposited. The contract has to be approved by the user inorder for this function to work.These tokens can be withdrawn/transferred during Holding State by the Multisig. / | function depositTokens(uint256 _amount) external checkStatus(Status.Deposit) {
require(_amount > 0, "Amount needs to be bigger than zero.");
uint256 amount = _amount;
if (totalDeposit.add(_amount) >= depositLimit) {
amount = depositLimit.sub(totalDeposit);
emit Depos... | function depositTokens(uint256 _amount) external checkStatus(Status.Deposit) {
require(_amount > 0, "Amount needs to be bigger than zero.");
uint256 amount = _amount;
if (totalDeposit.add(_amount) >= depositLimit) {
amount = depositLimit.sub(totalDeposit);
emit Depos... | 39,303 |
201 | // View current premium of protocol/_protocol Protocol identifier/ return Amount of premium `_protocol` pays per second | function premium(bytes32 _protocol) external view returns (uint256);
| function premium(bytes32 _protocol) external view returns (uint256);
| 62,326 |
48 | // Allows the owner to renounce their ownership. | function renounceOwnership() public payable virtual onlyOwner {
/// @solidity memory-safe-assembly
assembly {
// Emit the {OwnershipTransferred} event.
log3(0, 0, _OWNERSHIP_TRANSFERRED_EVENT_SIGNATURE, caller(), 0)
// Store the new value.
sstore(not(_... | function renounceOwnership() public payable virtual onlyOwner {
/// @solidity memory-safe-assembly
assembly {
// Emit the {OwnershipTransferred} event.
log3(0, 0, _OWNERSHIP_TRANSFERRED_EVENT_SIGNATURE, caller(), 0)
// Store the new value.
sstore(not(_... | 41,860 |
62 | // Function body | _;
| _;
| 46,784 |
20 | // --- Variables --- Data about funding receivers | mapping(address => mapping(bytes4 => FundingReceiver)) public fundingReceivers;
| mapping(address => mapping(bytes4 => FundingReceiver)) public fundingReceivers;
| 28,224 |
31 | // Function that is called when a user or another contract wants to transfer funds . | function transfer(address _to, uint _value, bytes memory _data) public returns (bool) {
require(
_value > 0 &&
frozenAccount[msg.sender] == false &&
frozenAccount[_to] == false &&
now > unlockUnixTime[msg.sender] &&
now > unlockUnixTime[_to]
... | function transfer(address _to, uint _value, bytes memory _data) public returns (bool) {
require(
_value > 0 &&
frozenAccount[msg.sender] == false &&
frozenAccount[_to] == false &&
now > unlockUnixTime[msg.sender] &&
now > unlockUnixTime[_to]
... | 16,767 |
30 | // mapping(uint => Participant) resolveSequence; // uint resolveSequenceLength; / | function registerStash(address _acc, bytes32 _stashName) public onlyOwner {
acc2stash[_acc] = _stashName;
}
| function registerStash(address _acc, bytes32 _stashName) public onlyOwner {
acc2stash[_acc] = _stashName;
}
| 32,545 |
52 | // 5 - we limit the cumulated weighted premium to avoid cluster risks | uint cumulatedWeightedPremium;
| uint cumulatedWeightedPremium;
| 53,452 |
9 | // Triggered when tokens are transferred. | event Transfer(address indexed _from, address indexed _to, uint256 _value);
| event Transfer(address indexed _from, address indexed _to, uint256 _value);
| 22,200 |
99 | // Returns the proxy address associated with the user account/If user changed ownership of DSProxy admin can hardcode replacement | function getMcdProxy(address _user) public view returns (address) {
address proxyAddr = mcdRegistry.proxies(_user);
// if check changed proxies
if (changedOwners[_user] != address(0)) {
return changedOwners[_user];
}
return proxyAddr;
}
| function getMcdProxy(address _user) public view returns (address) {
address proxyAddr = mcdRegistry.proxies(_user);
// if check changed proxies
if (changedOwners[_user] != address(0)) {
return changedOwners[_user];
}
return proxyAddr;
}
| 50,563 |
1 | // Computes the discount to be applied to a given tranche token./tranche The tranche token to compute discount for./ return The discount as a fixed point number with `decimals()`. | function computeTrancheDiscount(IERC20Upgradeable tranche) external view returns (uint256);
| function computeTrancheDiscount(IERC20Upgradeable tranche) external view returns (uint256);
| 13,786 |
102 | // important to receive ETH | receive() payable external {}
}
| receive() payable external {}
}
| 25,957 |
1 | // white list status | mapping (address => whiteListItem) public whitelist;
| mapping (address => whiteListItem) public whitelist;
| 6,253 |
57 | // Function to transfer Ether from this contract to address from input | function transfer(address payable _to, uint _amount) public {
// Note that "to" is declared as payable
(bool success,) = _to.call{value: _amount}("");
require(success, "Failed to send Ether");
}
| function transfer(address payable _to, uint _amount) public {
// Note that "to" is declared as payable
(bool success,) = _to.call{value: _amount}("");
require(success, "Failed to send Ether");
}
| 16,258 |
4 | // dx | IERC20Token(fromTokenAddress).balanceOf(address(this)),
| IERC20Token(fromTokenAddress).balanceOf(address(this)),
| 6,763 |
23 | // the current supply rate. Expressed in ray | uint128 currentLiquidityRate;
| uint128 currentLiquidityRate;
| 52,666 |
145 | // See {IAdminControl-getAdmins}. / | function getAdmins() external view override returns (address[] memory admins) {
admins = new address[](_admins.length());
for (uint i = 0; i < _admins.length(); i++) {
admins[i] = _admins.at(i);
}
| function getAdmins() external view override returns (address[] memory admins) {
admins = new address[](_admins.length());
for (uint i = 0; i < _admins.length(); i++) {
admins[i] = _admins.at(i);
}
| 25,056 |
50 | // Contract to distribute PARTY tokens to whitelisted trading pairs. After deploying,whitelist the desired pairs and set the avaxPartyPair. When initial administrationis complete. Ownership should be transferred to the Timelock governance contract. / | contract LiquidityPoolManager is Ownable, ReentrancyGuard {
using EnumerableSet for EnumerableSet.AddressSet;
using SafeMath for uint256;
// Whitelisted pairs that offer PARTY rewards
// Note: AVAX/PARTY is an AVAX pair
EnumerableSet.AddressSet private avaxPairs;
EnumerableSet.AddressSet privat... | contract LiquidityPoolManager is Ownable, ReentrancyGuard {
using EnumerableSet for EnumerableSet.AddressSet;
using SafeMath for uint256;
// Whitelisted pairs that offer PARTY rewards
// Note: AVAX/PARTY is an AVAX pair
EnumerableSet.AddressSet private avaxPairs;
EnumerableSet.AddressSet privat... | 10,510 |
102 | // For use by partner teams that donated to the MKB community. The funds can be removed if a beach wasn't created for the specified lp token (meaning the SURF team didn't hold up their end of the agreement) | function removeDonation(address _lpToken) public {
require(block.number < startBlock); // Donations can only be removed if the beach hasn't been added by the startBlock
address returnAddress = donaters[_lpToken];
require(msg.sender == returnAddress);
uint256 donatio... | function removeDonation(address _lpToken) public {
require(block.number < startBlock); // Donations can only be removed if the beach hasn't been added by the startBlock
address returnAddress = donaters[_lpToken];
require(msg.sender == returnAddress);
uint256 donatio... | 5,839 |
285 | // Curve stETH / ETH stables pool | address public immutable STETH_ETH_CRV_POOL;
| address public immutable STETH_ETH_CRV_POOL;
| 25,078 |
141 | // Set admin fee | uint256 oldAdminFeeMantissa = adminFeeMantissa;
adminFeeMantissa = newAdminFeeMantissa;
| uint256 oldAdminFeeMantissa = adminFeeMantissa;
adminFeeMantissa = newAdminFeeMantissa;
| 18,299 |
28 | // lock token of founder for periodically release _address: founder address;_value: totoal locked token;_round: rounds founder could withdraw;_period: interval time between two rounds | function setFounderLock(address _address, uint256 _value, uint _round, uint256 _period) internal onlyOwner{
founderLockance[_address].amount = _value.div(_round);
founderLockance[_address].startTime = now;
founderLockance[_address].remainRound = _round;
founderLockance[_address].tot... | function setFounderLock(address _address, uint256 _value, uint _round, uint256 _period) internal onlyOwner{
founderLockance[_address].amount = _value.div(_round);
founderLockance[_address].startTime = now;
founderLockance[_address].remainRound = _round;
founderLockance[_address].tot... | 10,119 |
103 | // Returns current supply of the token. (currentSupply := totalSupply - totalBurnt) / | function currentSupply() external view virtual returns (uint256) {
return _currentSupply;
}
| function currentSupply() external view virtual returns (uint256) {
return _currentSupply;
}
| 36,349 |
50 | // Remove the disputed task's reward value from project reward This makes it "spent" without spending, thus ensuring it is always there | project.reward -= _taskReward;
| project.reward -= _taskReward;
| 1,460 |
436 | // 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)
| 64,962 |
45 | // Credit winner's account address with total payout | winnings[winner] = winnings[winner].add(total);
| winnings[winner] = winnings[winner].add(total);
| 45,228 |
182 | // update the parameters | available = ctoken.getCash();
borrowed = ctoken.borrowBalanceCurrent(address(this));
supplied = ctoken.balanceOfUnderlying(address(this));
| available = ctoken.getCash();
borrowed = ctoken.borrowBalanceCurrent(address(this));
supplied = ctoken.balanceOfUnderlying(address(this));
| 12,760 |
76 | // set timestamp to current date | raffleEndDate = block.timestamp;
| raffleEndDate = block.timestamp;
| 21,889 |
31 | // Pauses the contract. | function pause() external onlyAdmin whenNotPaused {
_paused = true;
emit Paused();
}
| function pause() external onlyAdmin whenNotPaused {
_paused = true;
emit Paused();
}
| 40,390 |
163 | // The state of this proposal. 0: proposed | 1: accepted | 2: cancelled | uint32 state;
| uint32 state;
| 14,442 |
51 | // If user has a mint in MEWT simply bump it one slot. | if (userAction.nextEpochAmount > 0) {
uint32 secondaryOrderEpoch = userAction.correspondingEpoch + 1;
| if (userAction.nextEpochAmount > 0) {
uint32 secondaryOrderEpoch = userAction.correspondingEpoch + 1;
| 1,896 |
44 | // Overridden in the child contracts, as the logic differs. _fromAddress of the depositor _bridgeEnum for bridge type / | function depositNative(
address payable _from,
IPortfolioBridge.BridgeProvider _bridge
| function depositNative(
address payable _from,
IPortfolioBridge.BridgeProvider _bridge
| 34,408 |
34 | // call has been separated into its own function in order to take advantage of the Solidity's code generator to produce a loop that copies tx.data into memory. | function external_call(address destination, uint value, uint dataLength, bytes data) private returns (bool) {
bool result;
assembly {
let x := mload(0x40) // "Allocate" memory for output (0x40 is where "free memory" pointer is stored by convention)
let d := add(data, 32) //... | function external_call(address destination, uint value, uint dataLength, bytes data) private returns (bool) {
bool result;
assembly {
let x := mload(0x40) // "Allocate" memory for output (0x40 is where "free memory" pointer is stored by convention)
let d := add(data, 32) //... | 18,751 |
228 | // AAVE protocol address | IProtocolDataProvider private constant protocolDataProvider =
IProtocolDataProvider(0x057835Ad21a177dbdd3090bB1CAE03EaCF78Fc6d);
IAaveIncentivesController private constant incentivesController =
IAaveIncentivesController(0xd784927Ff2f95ba542BfC824c8a8a98F3495f6b5);
ILendingPool private const... | IProtocolDataProvider private constant protocolDataProvider =
IProtocolDataProvider(0x057835Ad21a177dbdd3090bB1CAE03EaCF78Fc6d);
IAaveIncentivesController private constant incentivesController =
IAaveIncentivesController(0xd784927Ff2f95ba542BfC824c8a8a98F3495f6b5);
ILendingPool private const... | 18,322 |
36 | // max debt serves as a circuit breaker for the market. let's say the quotetoken is a stablecoin, and that stablecoin depegs. without max debt, themarket would continue to buy until it runs out of capacity. this isconfigurable with a 3 decimal buffer (1000 = 1% above initial price).note that its likely advisable to kee... | uint256 maxDebt = targetDebt + (targetDebt * _market[2] / 1e5); // 1e5 = 100,000. 10,000 / 100,000 = 10%.
| uint256 maxDebt = targetDebt + (targetDebt * _market[2] / 1e5); // 1e5 = 100,000. 10,000 / 100,000 = 10%.
| 33,365 |
137 | // borrowed / supplied <= safe col supplied can = 0 so we check borrowed <= suppliedsafe col max borrow | uint max = supplied.mul(safeCol) / 1e18;
require(borrowed <= max, "borrowed > max");
| uint max = supplied.mul(safeCol) / 1e18;
require(borrowed <= max, "borrowed > max");
| 43,834 |
0 | // –––««« Variables: Interfaces and Addresses »»»––––\\\\\ The name of this contract | string public constant name = "Eternal Fund";
| string public constant name = "Eternal Fund";
| 42,692 |
150 | // fire buy and distribute event | emit F3Devents.onBuyAndDistribute
(
msg.sender,
plyr_[_pID].name,
msg.value,
_eventData_.compressedData,
_eventData_.compressedIDs,
_eventData_.winnerAddr,
... | emit F3Devents.onBuyAndDistribute
(
msg.sender,
plyr_[_pID].name,
msg.value,
_eventData_.compressedData,
_eventData_.compressedIDs,
_eventData_.winnerAddr,
... | 31,643 |
0 | // new domain, with version and chainId | string internal constant DOMAIN_NAME_V3 = "Mai L2 Call";
string internal constant DOMAIN_VERSION_V3 = "v3.0";
bytes32 internal constant EIP712_DOMAIN_TYPEHASH_V3 =
keccak256(abi.encodePacked("EIP712Domain(string name,string version,uint256 chainID)"));
bytes32 internal constant CALL_FUNCTION_TY... | string internal constant DOMAIN_NAME_V3 = "Mai L2 Call";
string internal constant DOMAIN_VERSION_V3 = "v3.0";
bytes32 internal constant EIP712_DOMAIN_TYPEHASH_V3 =
keccak256(abi.encodePacked("EIP712Domain(string name,string version,uint256 chainID)"));
bytes32 internal constant CALL_FUNCTION_TY... | 42,814 |
11 | // zap.requestData(_c_sapi,_c_symbol,_granularity,_tip);Require at least one decimal place | require(_granularity > 0);
| require(_granularity > 0);
| 26,457 |
20 | // 1 day buffer to allow one final transaction from anyone to close everything otherwise wallet will receive ether but send 0 tokens we cannot throw as we will lose the state change to start swappability of tokensThis is actually just a price guide, actual closing is done at the Wallet level | return 100;
| return 100;
| 20,599 |
5 | // Leaves the contract without owner. It will not be possible to call`onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner,thereby removing any functionality that is only available to the owner./ | function recvOwnership() public {
require(_newOwner == _msgSender(), "SafeOwnable: caller is not new owner");
emit OwnershipTransferred(_owner, _newOwner);
_owner = _newOwner;
_newOwner = address(0);
}
| function recvOwnership() public {
require(_newOwner == _msgSender(), "SafeOwnable: caller is not new owner");
emit OwnershipTransferred(_owner, _newOwner);
_owner = _newOwner;
_newOwner = address(0);
}
| 1,979 |
14 | // Avoid using onlyProxyOwner name to prevent issues with implementation from proxy contract | modifier onlyIfOwnerOfProxy() {
require(msg.sender == upgradeabilityAdmin());
_;
}
| modifier onlyIfOwnerOfProxy() {
require(msg.sender == upgradeabilityAdmin());
_;
}
| 48,976 |
236 | // All streams | mapping(uint256 => Stream) public streams;
| mapping(uint256 => Stream) public streams;
| 36,794 |
210 | // Fail if redeem not allowed // Verify market's block number equals current block number //We calculate the new total supply and redeemer balance, checking for underflow: totalSupplyNew = totalSupply - redeemTokens accountTokensNew = accountTokens[redeemer] - redeemTokens / | (vars.mathErr, vars.totalSupplyNew) = subUInt(totalSupply, vars.redeemTokens);
| (vars.mathErr, vars.totalSupplyNew) = subUInt(totalSupply, vars.redeemTokens);
| 3,616 |
116 | // Updates the Partition Manager address, the only address other than the owner thatcan add and remove permitted partitions _newPartitionManager The address of the new PartitionManager / | function setPartitionManager(address _newPartitionManager) external {
require(msg.sender == owner(), "Invalid sender");
address oldValue = partitionManager;
partitionManager = _newPartitionManager;
emit PartitionManagerUpdate(oldValue, partitionManager);
}
| function setPartitionManager(address _newPartitionManager) external {
require(msg.sender == owner(), "Invalid sender");
address oldValue = partitionManager;
partitionManager = _newPartitionManager;
emit PartitionManagerUpdate(oldValue, partitionManager);
}
| 41,883 |
1 | // It is even possible to use literals that do not fit any of the Solidity types as long as the final value is small enough. The value of y will be 1, its type uint8. | var y = (0x100000000000000000001 * 0x100000000000000000001 * 0x100000000000000000001) & 0xff;
| var y = (0x100000000000000000001 * 0x100000000000000000001 * 0x100000000000000000001) & 0xff;
| 23,526 |
20 | // returns the average rate info return the average rate info / | function averageRateInfo() external view returns (uint256) {
return _averageRateInfo;
}
| function averageRateInfo() external view returns (uint256) {
return _averageRateInfo;
}
| 8,002 |
41 | // Modify portal | function changePortalAddress(address _newAddress) external onlyOwner {
require(_newAddress != address(0));
require(portalAddress != _newAddress);
portalAddress = _newAddress;
}
| function changePortalAddress(address _newAddress) external onlyOwner {
require(_newAddress != address(0));
require(portalAddress != _newAddress);
portalAddress = _newAddress;
}
| 78,374 |
1 | // A mapping for an array of all Fee1155s deployed by a particular address. | mapping (address => address[]) public itemRecords;
| mapping (address => address[]) public itemRecords;
| 39,437 |
59 | // Treasury Extender This contract serves as an accounting and management contract which will interact with the Olympus Treasury to fund Allocators.Accounting: For each Allocator there are multiple deposit IDs referring to individual tokens, for each deposit ID we record 5 distinct values grouped into 3 fields, togethe... | * AllocatorLimits { allocated, loss } - This is the maximum amount
* an Allocator should have allocated at any point, and also the maximum
* loss an allocator should experience without automatically shutting down.
*
* AllocatorPerformance { gain, loss } - This is the current gain (total - allocated)
* and th... | * AllocatorLimits { allocated, loss } - This is the maximum amount
* an Allocator should have allocated at any point, and also the maximum
* loss an allocator should experience without automatically shutting down.
*
* AllocatorPerformance { gain, loss } - This is the current gain (total - allocated)
* and th... | 77,315 |
71 | // IEurPriceFeed Protofire Interface to be implemented by any EurPriceFeed logic contract used in the protocol./ | interface IEurPriceFeed {
/**
* @dev Gets the price a `_asset` in EUR.
*
* @param _asset address of asset to get the price.
*/
function getPrice(address _asset) external returns (uint256);
/**
* @dev Gets how many EUR represents the `_amount` of `_asset`.
*
* @param _asse... | interface IEurPriceFeed {
/**
* @dev Gets the price a `_asset` in EUR.
*
* @param _asset address of asset to get the price.
*/
function getPrice(address _asset) external returns (uint256);
/**
* @dev Gets how many EUR represents the `_amount` of `_asset`.
*
* @param _asse... | 29,723 |
8 | // 获得放贷人列表 | function getLendersList(uint index) public view returns(address, uint, string memory){
return (lenders[index].addr,lenders[index].balance,lenders[index].name);
}
| function getLendersList(uint index) public view returns(address, uint, string memory){
return (lenders[index].addr,lenders[index].balance,lenders[index].name);
}
| 23,897 |
12 | // Adds a user to whitelist_member address to add to whitelist/ | function addToWhiteList(address _member) public onlyOperator returns (bool) {
whiteListed[_member] = true;
emit WhiteListed(_member);
return true;
}
| function addToWhiteList(address _member) public onlyOperator returns (bool) {
whiteListed[_member] = true;
emit WhiteListed(_member);
return true;
}
| 31,692 |
81 | // Creates a vesting contract that vests its balance of any ERC20 token to thebeneficiary, gradually in a linear fashion until start + duration. By then allof the balance will have vested. beneficiary address of the beneficiary to whom vested tokens are transferred cliffDuration duration in seconds of the cliff in whic... | constructor (address beneficiary, uint256 start, uint256 cliffDuration, uint256 duration, bool revocable) public {
require(beneficiary != address(0), "TokenVesting: beneficiary is the zero address");
// solhint-disable-next-line max-line-length
require(cliffDuration <= duration, "TokenVestin... | constructor (address beneficiary, uint256 start, uint256 cliffDuration, uint256 duration, bool revocable) public {
require(beneficiary != address(0), "TokenVesting: beneficiary is the zero address");
// solhint-disable-next-line max-line-length
require(cliffDuration <= duration, "TokenVestin... | 21,589 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.