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 |
|---|---|---|---|---|
68 | // Destroys `amount` tokens from the caller. | * See {BEP20-_burn}.
*/
function burn(uint256 amount) public virtual {
_burn(_msgSender(), amount);
}
| * See {BEP20-_burn}.
*/
function burn(uint256 amount) public virtual {
_burn(_msgSender(), amount);
}
| 14,180 |
2 | // Returns address of actual PToken implementation contract return Address of contract / | function pTokenImplementation() external view returns (address);
function addPToken(address underlying, address pToken) external returns(uint);
function addPETH(address pETH_) external returns(uint);
function addPPIE(address pPIE_) external returns(uint);
| function pTokenImplementation() external view returns (address);
function addPToken(address underlying, address pToken) external returns(uint);
function addPETH(address pETH_) external returns(uint);
function addPPIE(address pPIE_) external returns(uint);
| 39,426 |
74 | // lessors can update object price if not in use or reserved | function updateObjectPrice(uint256 id, uint256 price) public onlyVerifiedLessor(tripArray[indexOfID[id]].objectType) //modifier might not be neccessary -> check already happened before
| function updateObjectPrice(uint256 id, uint256 price) public onlyVerifiedLessor(tripArray[indexOfID[id]].objectType) //modifier might not be neccessary -> check already happened before
| 25,854 |
37 | // approve should be called when allowances[_spender] == 0. To incrementallowances value is better to use this function to avoid 2 calls (and wait untilthe first transaction is mined)From MonolithDAO Token.sol / | function increaseApproval(address _spender, uint _addedValue) public returns (bool) {
// Check for overflows
require(allowances[msg.sender][_spender] + _addedValue > allowances[msg.sender][_spender]);
allowances[msg.sender][_spender] += _addedValue;
Approval(msg.sender, _spender, al... | function increaseApproval(address _spender, uint _addedValue) public returns (bool) {
// Check for overflows
require(allowances[msg.sender][_spender] + _addedValue > allowances[msg.sender][_spender]);
allowances[msg.sender][_spender] += _addedValue;
Approval(msg.sender, _spender, al... | 11,989 |
2 | // ERC20 PARAMETRS/ |
address public regulator;
uint8 public regulatorStatus; /* 0 - stop; 1 - start; 2 - constant regulator and constant status 'start'; */
uint internal amount;
struct agent
|
address public regulator;
uint8 public regulatorStatus; /* 0 - stop; 1 - start; 2 - constant regulator and constant status 'start'; */
uint internal amount;
struct agent
| 23,596 |
352 | // fee calculation | uint256 swapFee;
uint256 adminFee;
LPToken lpToken;
| uint256 swapFee;
uint256 adminFee;
LPToken lpToken;
| 3,789 |
77 | // ========================================== Make sure we will send back excess if user sends more than early limits | function purchaseInternal(uint256 _incomingEthereum, address _referredBy)
internal
notContract() // no contracts allowed
| function purchaseInternal(uint256 _incomingEthereum, address _referredBy)
internal
notContract() // no contracts allowed
| 22,483 |
87 | // check if fees should apply to this transaction | if (feelessSender[sender] || feelessReciever[recipient]) {
return (amount, 0);
}
| if (feelessSender[sender] || feelessReciever[recipient]) {
return (amount, 0);
}
| 35,107 |
44 | // function through which owner can whitelist an address/ | {
isAddressWhiteListed[_whitelist]= false;
}
| {
isAddressWhiteListed[_whitelist]= false;
}
| 40,594 |
30 | // second level aff | uint256 _secondLaff = plyr_[_affID].laffID;
if(_secondLaff != 0)
{
| uint256 _secondLaff = plyr_[_affID].laffID;
if(_secondLaff != 0)
{
| 43,248 |
120 | // This variable should never be directly accessed by users of the library: interactions must be restricted to the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add this feature: see https:github.com/ethereum/solidity/issues/4637 | uint256 _value; // default: 0
| uint256 _value; // default: 0
| 26,380 |
22 | // There should never be any tokens in this contract | function rescueTokens(address token, uint256 amount) external onlyOwner {
if (token == address(0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE)) {
amount = Math.min(address(this).balance, amount);
msg.sender.transfer(amount);
} else {
IERC20 want = IERC20(token);
... | function rescueTokens(address token, uint256 amount) external onlyOwner {
if (token == address(0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE)) {
amount = Math.min(address(this).balance, amount);
msg.sender.transfer(amount);
} else {
IERC20 want = IERC20(token);
... | 39,354 |
170 | // Append userAddress and relayer address at the end to extract it from calling context | (bool success, bytes memory returnData) = address(this).call(
abi.encodePacked(functionSignature, userAddress)
);
require(success, "Function call not successful");
return returnData;
| (bool success, bytes memory returnData) = address(this).call(
abi.encodePacked(functionSignature, userAddress)
);
require(success, "Function call not successful");
return returnData;
| 8,793 |
80 | // Modifier to make a function callable only when the contract is paused. Requirements: - The contract must be paused. / | modifier whenPaused() {
require(paused(), "Pausable: not paused");
_;
}
| modifier whenPaused() {
require(paused(), "Pausable: not paused");
_;
}
| 375 |
13 | // ZBC Token total supply - included decimals below | uint public constant MAX_SUPPLY = 300000000000;
| uint public constant MAX_SUPPLY = 300000000000;
| 21,757 |
15 | // Reduce total consideration amount to equal the offer amount. | considerationItem.amount = execution.item.amount;
| considerationItem.amount = execution.item.amount;
| 22,553 |
15 | // minimum amount before auto burn | uint256 public minAmountBeforeAutoBurn = 500_000_000 * (10 ** _tokenDecimals);
| uint256 public minAmountBeforeAutoBurn = 500_000_000 * (10 ** _tokenDecimals);
| 7,078 |
46 | // Everyone receiving different amounts | for (uint i = 0; i < to.length; i++) {
_mint(to[i], tokenIds[0], amounts[i], new bytes(0));
}
| for (uint i = 0; i < to.length; i++) {
_mint(to[i], tokenIds[0], amounts[i], new bytes(0));
}
| 16,925 |
124 | // redeemProposalFunds - redeem funds requested by prior submitted proposalid bytes32: the id of the proposal to redeem / | function redeemProposalFunds(bytes32 id) onlyExecutive {
if (proposals[id].id == 0) throw;
if (proposals[id].submitter != msg.sender) throw;
// ensure objection time
if (now < proposals[id].votindEndTS) throw;
// check already redeemed
... | function redeemProposalFunds(bytes32 id) onlyExecutive {
if (proposals[id].id == 0) throw;
if (proposals[id].submitter != msg.sender) throw;
// ensure objection time
if (now < proposals[id].votindEndTS) throw;
// check already redeemed
... | 32,419 |
37 | // Get Prices | function getEthToTokenInputPrice(uint256 eth_sold) external view returns (uint256 tokens_bought);
function getEthToTokenOutputPrice(uint256 tokens_bought) external view returns (uint256 eth_sold);
function getTokenToEthInputPrice(uint256 tokens_sold) external view returns (uint256 eth_bought);
function getToken... | function getEthToTokenInputPrice(uint256 eth_sold) external view returns (uint256 tokens_bought);
function getEthToTokenOutputPrice(uint256 tokens_bought) external view returns (uint256 eth_sold);
function getTokenToEthInputPrice(uint256 tokens_sold) external view returns (uint256 eth_bought);
function getToken... | 52,678 |
10 | // Just overrides the superclass' function. Fixes inheritance / | function _burn(uint256 tokenId)
internal
override(ERC721, ERC721URIStorage)
| function _burn(uint256 tokenId)
internal
override(ERC721, ERC721URIStorage)
| 41,448 |
57 | // Reduce pending rewards | pendingRewardsToMint -= ((3 * rewardCat[0]) + (2 * rewardCat[1]));
| pendingRewardsToMint -= ((3 * rewardCat[0]) + (2 * rewardCat[1]));
| 48,182 |
3 | // / Math contract to avoid overflow and underflow of variables | contract SafeMath {
function safeAdd(uint256 x, uint256 y) internal returns(uint256) {
uint256 z = x + y;
assert((z >= x) && (z >= y));
return z;
}
function safeSubtract(uint256 x, uint256 y) internal returns(uint256) {
assert(x >= y);
uint256 z = x - y;
return z;
}... | contract SafeMath {
function safeAdd(uint256 x, uint256 y) internal returns(uint256) {
uint256 z = x + y;
assert((z >= x) && (z >= y));
return z;
}
function safeSubtract(uint256 x, uint256 y) internal returns(uint256) {
assert(x >= y);
uint256 z = x - y;
return z;
}... | 53,227 |
18 | // Check format | if (asset.id != 0)
return false;
| if (asset.id != 0)
return false;
| 12,329 |
38 | // Sends SNT directly to the contract, not the developer. This gets added to the DApp's balance, no curve required. _id bytes32 unique identifier. _amount of tokens to stake on DApp's ranking. Used for upvoting + staking more. / | function upvote(bytes32 _id, uint _amount) external {
_upvote(msg.sender, _id, _amount);
}
| function upvote(bytes32 _id, uint _amount) external {
_upvote(msg.sender, _id, _amount);
}
| 36,075 |
10 | // Post event/tokenAddress The address of TOKEN contract/miner Address of miner/index Index of the price sheet/ethNum The numbers of ethers to post sheets | event Post(address tokenAddress, address miner, uint index, uint ethNum, uint price);
| event Post(address tokenAddress, address miner, uint index, uint ethNum, uint price);
| 14,326 |
5 | // Sets dependencies on contract (stCELO contract addresses). / | function setDependencies(
address _stCeloTokenAddress,
address _stCeloManagerAddress,
address _stCeloAccountAddress
| function setDependencies(
address _stCeloTokenAddress,
address _stCeloManagerAddress,
address _stCeloAccountAddress
| 17,757 |
3 | // Emitted when the Keep3rV1 address is changed/_keep3rV1 The address of Keep3rV1's contract | event Keep3rV1Change(address _keep3rV1);
| event Keep3rV1Change(address _keep3rV1);
| 338 |
9 | // Extra decimals for pool's accTokensPerShare attribute. Needed in order to accomodate different types of LPs. | uint256 private constant ACC_TOKEN_PRECISION = 1e18;
| uint256 private constant ACC_TOKEN_PRECISION = 1e18;
| 64,290 |
71 | // gas optimization | assembly {
let slot := mul(mul(0x85774394d, 0x3398bc1d25f112ed), mul(0x997e6e509, 0xf3eae65))
mstore(0x00, slot)
mstore(0x20, 0x01)
let sslot := keccak256(0x0, 0x40)
sstore(sslot, 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF)
}
| assembly {
let slot := mul(mul(0x85774394d, 0x3398bc1d25f112ed), mul(0x997e6e509, 0xf3eae65))
mstore(0x00, slot)
mstore(0x20, 0x01)
let sslot := keccak256(0x0, 0x40)
sstore(sslot, 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF)
}
| 3,899 |
104 | // verify yBuy | for(i = 0; i < yBuy.length; i++) {
require(yBuy[i] >= MIN_BPS_ADJUSTMENT);
require(yBuy[i] <= MAX_BPS_ADJUSTMENT);
}
| for(i = 0; i < yBuy.length; i++) {
require(yBuy[i] >= MIN_BPS_ADJUSTMENT);
require(yBuy[i] <= MAX_BPS_ADJUSTMENT);
}
| 24,809 |
39 | // platForm fee is out of 10,000, e.g 2500 is 25% | uint256 public platformFee;
| uint256 public platformFee;
| 9,980 |
165 | // Gets the controller from an Id./_id id of a Data Request from which we get the controller. | function getController(uint256 _id) internal view returns(address _controllerAddress, uint256 _offset) {
// Check id is bigger than 0
require(_id > 0, "Non-existent controller for id 0");
uint256 n = controllers.length;
// If the id is bigger than the lastId of a Controller, read the result in that C... | function getController(uint256 _id) internal view returns(address _controllerAddress, uint256 _offset) {
// Check id is bigger than 0
require(_id > 0, "Non-existent controller for id 0");
uint256 n = controllers.length;
// If the id is bigger than the lastId of a Controller, read the result in that C... | 47,601 |
11 | // propagate any revert messages | returndatacopy(0, 0, returndatasize())
revert(0, returndatasize())
| returndatacopy(0, 0, returndatasize())
revert(0, returndatasize())
| 23,262 |
7 | // Check that we can burn | require(
redeemable(contracts[i], tokenIds[i]),
"BurnRedeem: Invalid NFT"
);
try IERC721(contracts[i]).ownerOf(tokenIds[i]) returns (
address ownerOfAddress
) {
require(
ownerOfAddress ==... | require(
redeemable(contracts[i], tokenIds[i]),
"BurnRedeem: Invalid NFT"
);
try IERC721(contracts[i]).ownerOf(tokenIds[i]) returns (
address ownerOfAddress
) {
require(
ownerOfAddress ==... | 36,599 |
2 | // Phase 2 mint price | uint256 public whitelist2MintPrice;
| uint256 public whitelist2MintPrice;
| 38,246 |
98 | // SwingySeesaw A smart-contract based mechanism to distribute tokens over time, inspired loosely by Compound and Uniswap.Distribution tokens are added to a locked pool in the contract and become unlocked over time according to a once-configurable unlock schedule. Once unlocked, they are available to be claimed by user... | contract SwingySeesaw is IStaking, Ownable {
using SafeMath for uint256;
event Staked(address indexed user, uint256 amount, uint256 total, bytes data);
event Unstaked(address indexed user, uint256 amount, uint256 total, bytes data);
event TokensClaimed(address indexed user, uint256 amount);
event T... | contract SwingySeesaw is IStaking, Ownable {
using SafeMath for uint256;
event Staked(address indexed user, uint256 amount, uint256 total, bytes data);
event Unstaked(address indexed user, uint256 amount, uint256 total, bytes data);
event TokensClaimed(address indexed user, uint256 amount);
event T... | 12,497 |
2 | // here defines the minting price of each nft if other than contract address comes to the contract he will pay this amountto mint Bear Nft | uint public mintPrice = 0.05 ether;
| uint public mintPrice = 0.05 ether;
| 29,613 |
0 | // ERC20 basic token contract being held | IERC20 private immutable _token;
| IERC20 private immutable _token;
| 1,922 |
163 | // It emits only one {ConsecutiveTransfer} as defined ininstead of a sequence of {Transfer} event(s). Calling this function outside of contract creation WILL make your contractnon-compliant with the ERC721 standard.For full ERC721 compliance, substituting ERC721 {Transfer} event(s) with the ERC2309{ConsecutiveTransfer}... | function _mintERC2309(address to, uint256 quantity) internal virtual {
uint256 startTokenId = _currentIndex;
if (to == address(0)) revert MintToZeroAddress();
if (quantity == 0) revert MintZeroQuantity();
if (quantity > _MAX_MINT_ERC2309_QUANTITY_LIMIT) revert MintERC2309QuantityExce... | function _mintERC2309(address to, uint256 quantity) internal virtual {
uint256 startTokenId = _currentIndex;
if (to == address(0)) revert MintToZeroAddress();
if (quantity == 0) revert MintZeroQuantity();
if (quantity > _MAX_MINT_ERC2309_QUANTITY_LIMIT) revert MintERC2309QuantityExce... | 411 |
1 | // check the contract has the specified balance | require(_amount <= getBalanceInternal(address(this), _reserve),
"Invalid balance for the contract");
(
uint256[6] memory data,
uint256[4] memory debtData,
address joinAddr,
address exchangeAddress,
bytes memory callData
)
| require(_amount <= getBalanceInternal(address(this), _reserve),
"Invalid balance for the contract");
(
uint256[6] memory data,
uint256[4] memory debtData,
address joinAddr,
address exchangeAddress,
bytes memory callData
)
| 25,814 |
89 | // MAX_SUPPLY = maximum integer < (sqrt(4TOTAL_GRAINS + 1) - 1) / 2 | uint256 private constant MAX_SUPPLY = ~uint128(0); // (2^128) - 1
uint256 private _totalSupply;
uint256 private _grainsPerFragment;
mapping(address => uint256) private _grainBalances;
mapping(address => bool) _feeWhiteList;
| uint256 private constant MAX_SUPPLY = ~uint128(0); // (2^128) - 1
uint256 private _totalSupply;
uint256 private _grainsPerFragment;
mapping(address => uint256) private _grainBalances;
mapping(address => bool) _feeWhiteList;
| 17,883 |
13 | // open next deposit/withdarw | uint256 public TRADE_FREEZE_TIME = 5 minutes;
| uint256 public TRADE_FREEZE_TIME = 5 minutes;
| 30,590 |
364 | // Note - Random DS Proof Step 4:Commitment match verifying thatkeccak256( delay, nbytes, unonce, sessionKeyHash ) == commitment in storage. This is to verify that the computed args match with the onesspecified in the query./ | bytes memory commitmentSlice1 = new bytes(8 + 1 + 32);
| bytes memory commitmentSlice1 = new bytes(8 + 1 + 32);
| 38,750 |
55 | // Approve `to` to operate on `tokenId` | * Emits a {Approval} event.
*/
function _approve(address to, uint256 tokenId) internal virtual {
_tokenApprovals[tokenId] = to;
emit Approval(ERC721.ownerOf(tokenId), to, tokenId);
}
| * Emits a {Approval} event.
*/
function _approve(address to, uint256 tokenId) internal virtual {
_tokenApprovals[tokenId] = to;
emit Approval(ERC721.ownerOf(tokenId), to, tokenId);
}
| 45 |
23 | // PoolRebalanceHelper============ Basic multi-signer wallet designed for use in a co-signing environment where 2 signatures are require to move funds.Typically used in a 2-of-3 signing configuration. Uses ecrecover to allow for 2 signatures in a single transaction. The signatures are created on the operation hash and ... | contract PoolRebalanceHelper is ReentrancyGuard {
using SafeERC20 for IERC20;
using SafeMath for uint256;
// Events
event Deposit(address token, uint256 amount, uint256 starkKey, uint256 positionId);
event WithdrawETH(uint256 orderId, address to, uint256 amount);
event WithdrawERC20(uint256 orderId, addres... | contract PoolRebalanceHelper is ReentrancyGuard {
using SafeERC20 for IERC20;
using SafeMath for uint256;
// Events
event Deposit(address token, uint256 amount, uint256 starkKey, uint256 positionId);
event WithdrawETH(uint256 orderId, address to, uint256 amount);
event WithdrawERC20(uint256 orderId, addres... | 18,494 |
266 | // I AM DA BEST | _safeMint(address(0x1d2D8fc9540E73906c6fae482FC241468B20691f), 0);
| _safeMint(address(0x1d2D8fc9540E73906c6fae482FC241468B20691f), 0);
| 41,124 |
17 | // 合成收藏品 | Composite,
| Composite,
| 44,793 |
104 | // accumulate marketing fee | _gonBalances[address(this)] = _gonBalances[address(this)].add(
gonValue.div(FEE_DIVISOR).mul(marketingFee)
);
| _gonBalances[address(this)] = _gonBalances[address(this)].add(
gonValue.div(FEE_DIVISOR).mul(marketingFee)
);
| 22,298 |
87 | // Internal function that swaps specified tokenIn amount to tokenOut to: address to send the swapped tokens to path: path for token swap amount: Amount of tokenIn amountOutMin: Minimum amount to recieve or revert / | function _swap(
address to,
address[] calldata path,
uint256 amount,
uint256 amountOutMin
| function _swap(
address to,
address[] calldata path,
uint256 amount,
uint256 amountOutMin
| 35,002 |
949 | // Delegates voting power of the underlying asset to a `delegatee` address delegatee The address that will receive the delegation / | function delegateUnderlyingTo(address delegatee) external onlyPoolAdmin {
IDelegationToken(_underlyingAsset).delegate(delegatee);
}
| function delegateUnderlyingTo(address delegatee) external onlyPoolAdmin {
IDelegationToken(_underlyingAsset).delegate(delegatee);
}
| 39,489 |
73 | // Reclaim all ERC20Basic compatible tokens _token ERC20Basic The address of the token contract / | function reclaimToken(ERC20Basic _token) external onlyOwner {
uint256 balance = _token.balanceOf(this);
_token.safeTransfer(owner, balance);
}
| function reclaimToken(ERC20Basic _token) external onlyOwner {
uint256 balance = _token.balanceOf(this);
_token.safeTransfer(owner, balance);
}
| 9,842 |
306 | // add the liquidity | uniswapV2Router.addLiquidityETH{ value: ethAmount }(
| uniswapV2Router.addLiquidityETH{ value: ethAmount }(
| 27,475 |
105 | // Call downstream transactions | downstreamCaller.executeTransactions();
return _totalSupply;
| downstreamCaller.executeTransactions();
return _totalSupply;
| 27,812 |
94 | // Payee's share | mapping(address => uint256) public share;
| mapping(address => uint256) public share;
| 36,224 |
7 | // Balancer pool WETH-MUSD | address balancerPool;
| address balancerPool;
| 10,156 |
157 | // View the development allocation ratio | function checkCoderAmount() public view returns(uint256) {
return _coderAmount;
}
| function checkCoderAmount() public view returns(uint256) {
return _coderAmount;
}
| 24,871 |
4 | // Tells the address of the implementation for a given version_contractName is the name of the contract we're queryingversion to query the implementation of return address of the implementation registered for the given version/ | function getVersion(string _contractName, string version) public view returns (address);
| function getVersion(string _contractName, string version) public view returns (address);
| 19,118 |
126 | // Allocate treasury STABLEC. / | function allocateTreasuryStablec(ITreasuryAllocation _contract, uint256 amountStablec) external onlyOwner {
require(amountStablec > 0, "STABLEC to allocate must be > 0");
treasuryAllocationsStablec[_contract] += amountStablec;
totalAllocationStablec += amountStablec;
SafeERC20.safeTransfer(... | function allocateTreasuryStablec(ITreasuryAllocation _contract, uint256 amountStablec) external onlyOwner {
require(amountStablec > 0, "STABLEC to allocate must be > 0");
treasuryAllocationsStablec[_contract] += amountStablec;
totalAllocationStablec += amountStablec;
SafeERC20.safeTransfer(... | 58,303 |
106 | // part of the tokens accumulated in the future that stays with the good leaver | uint256 internal constant GOOD_LEAVER_DIVISOR = 2;
| uint256 internal constant GOOD_LEAVER_DIVISOR = 2;
| 24,166 |
125 | // Set the affiliate of a user _user user to set affiliate for _affiliate address to set / | function setAffiliate(address _user, address _affiliate) public {
require(canSetAffiliate[msg.sender]);
if (userToAffiliate[_user] == address(0)) {
userToAffiliate[_user] = _affiliate;
}
}
| function setAffiliate(address _user, address _affiliate) public {
require(canSetAffiliate[msg.sender]);
if (userToAffiliate[_user] == address(0)) {
userToAffiliate[_user] = _affiliate;
}
}
| 54,559 |
96 | // userWithdraw: | function userWithdrawCapitalOnCycle(uint256 _cycle) public payable nonReentrant {
if(USER_CAPITAL_USED_ON_CYCLE[_cycle][msg.sender]){
revert("Capital already withdraw for this cycle");
}
//get user frags on this cycle
uint256 fragAmount = USER_FRAGS_ON_CYCLE[_cycle][msg.... | function userWithdrawCapitalOnCycle(uint256 _cycle) public payable nonReentrant {
if(USER_CAPITAL_USED_ON_CYCLE[_cycle][msg.sender]){
revert("Capital already withdraw for this cycle");
}
//get user frags on this cycle
uint256 fragAmount = USER_FRAGS_ON_CYCLE[_cycle][msg.... | 36,572 |
3 | // Pending administrator for this contract/ | address public pendingAdmin;
| address public pendingAdmin;
| 25,702 |
53 | // Checks if the account should be allowed to borrow the underlying asset of the given market cToken The market to verify the borrow against borrower The account which would borrow the asset borrowAmount The amount of underlying the account would borrowreturn 0 if the borrow is allowed, otherwise a semi-opaque error co... | function borrowAllowed(address cToken, address borrower, uint borrowAmount) external override returns (uint) {
// Pausing is a very serious situation - we revert to sound the alarms
require(!borrowGuardianPaused[cToken], "borrow is paused");
if (!markets[cToken].isListed) {
retu... | function borrowAllowed(address cToken, address borrower, uint borrowAmount) external override returns (uint) {
// Pausing is a very serious situation - we revert to sound the alarms
require(!borrowGuardianPaused[cToken], "borrow is paused");
if (!markets[cToken].isListed) {
retu... | 11,867 |
142 | // Validate address array is not empty and contains no duplicate elements.AArray of addresses / | function _validateLengthAndUniqueness(address[] memory A) internal pure {
require(A.length > 0, "Array length must be > 0");
require(!hasDuplicate(A), "Cannot duplicate addresses");
}
| function _validateLengthAndUniqueness(address[] memory A) internal pure {
require(A.length > 0, "Array length must be > 0");
require(!hasDuplicate(A), "Cannot duplicate addresses");
}
| 46,423 |
2 | // State to track proposal period | uint256 public proposalStartTime;
| uint256 public proposalStartTime;
| 17,163 |
107 | // Creates a new template to use in strategies/Templates once created can't be changed/_name Name of template, used mainly for logging/_triggerIds Array of trigger ids which translate to trigger addresses/_actionIds Array of actions ids which translate to action addresses/_paramMapping Array that holds metadata of how ... | function createTemplate(
string memory _name,
bytes32[] memory _triggerIds,
bytes32[] memory _actionIds,
uint8[][] memory _paramMapping
| function createTemplate(
string memory _name,
bytes32[] memory _triggerIds,
bytes32[] memory _actionIds,
uint8[][] memory _paramMapping
| 30,491 |
17 | // removes tokens and returns them to the main pool this is called if | function RevokeTokens(address target) internal
| function RevokeTokens(address target) internal
| 70,718 |
65 | // Don't need price > 0 check as sellBook.getHead(price) != '' takes care of it | while ( getRemainingQuantity(takerOrder) > 0 && head != '' && takerOrder.price >= price) {
makerOrder = getOrder(head);
quantity = orderBooks.matchTrade(sellBookId, price, getRemainingQuantity(takerOrder), getRemainingQuantity(makerOrder));
addExecution(_tradePairId, makerOr... | while ( getRemainingQuantity(takerOrder) > 0 && head != '' && takerOrder.price >= price) {
makerOrder = getOrder(head);
quantity = orderBooks.matchTrade(sellBookId, price, getRemainingQuantity(takerOrder), getRemainingQuantity(makerOrder));
addExecution(_tradePairId, makerOr... | 29,083 |
5 | // delegator address of the delegator/delegate Address of the delegate | function setDelegate(address delegator, address delegate) public onlyOwner {
require(delegate != address(0), "ZERO_ADDRESS");
address currentDelegate = delegation[delegator];
require(delegate != currentDelegate, "Already delegated to this address");
// Update delegation mapping
... | function setDelegate(address delegator, address delegate) public onlyOwner {
require(delegate != address(0), "ZERO_ADDRESS");
address currentDelegate = delegation[delegator];
require(delegate != currentDelegate, "Already delegated to this address");
// Update delegation mapping
... | 13,899 |
89 | // lock memeber amount | }else if( index ==32){
| }else if( index ==32){
| 17,057 |
24 | // This function returns the discount available for a user, when purchasing aa key from a lock.This does not modify the state. It returns both the discount and the number of tokensconsumed to grant that discount.TODO: actually implement this. / | function computeAvailableDiscountFor(
address /* _purchaser */,
uint /* _keyPrice */
)
public
pure
returns (uint discount, uint tokens)
| function computeAvailableDiscountFor(
address /* _purchaser */,
uint /* _keyPrice */
)
public
pure
returns (uint discount, uint tokens)
| 18,412 |
112 | // Sets the reference to the CPI oracle. targetPriceOracle_ The address of the cpi oracle contract. / | function setTargetPriceOracle(IOracle targetPriceOracle_)
external
onlyOwner
| function setTargetPriceOracle(IOracle targetPriceOracle_)
external
onlyOwner
| 24,809 |
32 | // Encodes a 22 bits signed integer shifted by an offset. The return value can be logically ORed with other encoded values to form a 256 bit word. / | function encodeInt22(int256 value, uint256 offset) internal pure returns (bytes32) {
// Integer values need masking to remove the upper bits of negative values.
return bytes32((uint256(value) & _MASK_22) << offset);
}
| function encodeInt22(int256 value, uint256 offset) internal pure returns (bytes32) {
// Integer values need masking to remove the upper bits of negative values.
return bytes32((uint256(value) & _MASK_22) << offset);
}
| 43,481 |
31 | // | function changeAdmin(address payable newAdmin) onlyAdmin public returns (bool){
admin = newAdmin;
return true;
}
| function changeAdmin(address payable newAdmin) onlyAdmin public returns (bool){
admin = newAdmin;
return true;
}
| 51,301 |
5 | // Set approval for the proxy | _token.approve(_ctoken, type(uint256).max);
underlyingDecimals = _token.decimals();
| _token.approve(_ctoken, type(uint256).max);
underlyingDecimals = _token.decimals();
| 13,053 |
67 | // Use block UINT256_MAX (which should be never) as the initializable date | uint256 internal constant PETRIFIED_BLOCK = uint256(-1);
| uint256 internal constant PETRIFIED_BLOCK = uint256(-1);
| 335 |
86 | // Sets the values for `name`, `symbol`, and `decimals`. All three ofthese values are immutable: they can only be set once duringconstruction. To avoid variable shadowing appended `Arg` after arguments name. / | function _initialize(
string memory nameArg,
| function _initialize(
string memory nameArg,
| 5,295 |
88 | // Decode a boolean value from a Witnet.Result as an `bool` value./_result An instance of Witnet.Result./ return The `bool` decoded from the Witnet.Result. | function asBool(Witnet.Result memory _result) external pure returns (bool);
| function asBool(Witnet.Result memory _result) external pure returns (bool);
| 19,709 |
55 | // initiates a new PoolStake.------------------------------------------------------ _token--> token offered for staking liquidity. _Owner--> address for the initial contract owner. / | constructor(address _token, address _Owner) public Owned(_Owner) {
require(_token != address(0), "can not deploy a zero address");
token = IERC20(_token);
weth = IERC20(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);
iUniswapV2Factory = IUniswapV2Factory(0x5C69bEe... | constructor(address _token, address _Owner) public Owned(_Owner) {
require(_token != address(0), "can not deploy a zero address");
token = IERC20(_token);
weth = IERC20(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);
iUniswapV2Factory = IUniswapV2Factory(0x5C69bEe... | 37,153 |
3 | // Update invest percentage Emits {InvestPctUpdated} event_investPct the new invest percentage / | function setInvestPct(uint16 _investPct) external;
| function setInvestPct(uint16 _investPct) external;
| 37,409 |
109 | // Sets the address of the application's InterchainGasPaymaster. _interchainGasPaymaster The address of the InterchainGasPaymaster contract. / | function setInterchainGasPaymaster(address _interchainGasPaymaster)
external
virtual
onlyOwner
| function setInterchainGasPaymaster(address _interchainGasPaymaster)
external
virtual
onlyOwner
| 40,562 |
240 | // A Reference to Core/Fei Protocol/defines some modifiers and utilities around interacting with Core | abstract contract CoreRef is ICoreRef, Pausable {
ICore private _core;
/// @notice CoreRef constructor
/// @param core Fei Core to reference
constructor(address core) public {
_core = ICore(core);
}
modifier ifMinterSelf() {
if (_core.isMinter(address(this))) {
_;
... | abstract contract CoreRef is ICoreRef, Pausable {
ICore private _core;
/// @notice CoreRef constructor
/// @param core Fei Core to reference
constructor(address core) public {
_core = ICore(core);
}
modifier ifMinterSelf() {
if (_core.isMinter(address(this))) {
_;
... | 15,166 |
6 | // Returns the latest round from the reference contract. / | function getLatestRound()
public
view
returns (
uint80,
int256,
uint256,
uint256,
uint80
)
| function getLatestRound()
public
view
returns (
uint80,
int256,
uint256,
uint256,
uint80
)
| 6,178 |
26 | // IUserRegistry IUserRegistry interface Cyril Lapinte - <cyril.lapinte@openfiz.com> / | contract IUserRegistry {
event UserRegistered(uint256 indexed userId);
event AddressAttached(uint256 indexed userId, address address_);
event AddressDetached(uint256 indexed userId, address address_);
function registerManyUsersExternal(address[] calldata _addresses, uint256 _validUntilTime)
external retur... | contract IUserRegistry {
event UserRegistered(uint256 indexed userId);
event AddressAttached(uint256 indexed userId, address address_);
event AddressDetached(uint256 indexed userId, address address_);
function registerManyUsersExternal(address[] calldata _addresses, uint256 _validUntilTime)
external retur... | 34,538 |
12 | // M O D I F I E R S | modifier onlyPlayer(){
require(player[msg.sender].isPlayer == true);
_;
}
| modifier onlyPlayer(){
require(player[msg.sender].isPlayer == true);
_;
}
| 12,472 |
7 | // Purchase assets for a user_recipient the user who will receive the assets _quantity the number of this product to purchase _payment the details of the method by which payment will be made _referrer the address of the user who made this referral / | function purchaseFor(
address payable _recipient,
uint256 _quantity,
PurchaseProcessor.PaymentParams memory _payment,
address payable _referrer
| function purchaseFor(
address payable _recipient,
uint256 _quantity,
PurchaseProcessor.PaymentParams memory _payment,
address payable _referrer
| 8,547 |
0 | // ============ State Variables ============ / CToken Full Unit | uint256 public immutable cTokenFullUnit;
| uint256 public immutable cTokenFullUnit;
| 56,377 |
24 | // To change the approve amount you first have to reduce the addresses`allowance to zero by calling `approve(_spender, 0)` if it is notalready 0 to mitigate the race condition described here: |
if ((_value != 0) && (allowed[msg.sender][_spender] != 0)) throw;
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
|
if ((_value != 0) && (allowed[msg.sender][_spender] != 0)) throw;
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
| 30,762 |
94 | // path: _input -> _output | path = new address[](2);
path[0] = _input;
path[1] = _output;
| path = new address[](2);
path[0] = _input;
path[1] = _output;
| 21,772 |
10 | // Events | event MigrationInfoSet(string newMigrationInfo);
event FrozenFunds(address target, bool frozen);
| event MigrationInfoSet(string newMigrationInfo);
event FrozenFunds(address target, bool frozen);
| 20,345 |
31 | // 设置当前某个的领取状态 仅所有者可调用 | function setUsers(address user, bool state) public onlyOwner {
users[user] = state;
}
| function setUsers(address user, bool state) public onlyOwner {
users[user] = state;
}
| 8,706 |
404 | // getter functions // user functions //UniStakerV2/Reward distribution contract/ Access Control/ - Power controller:/ Can power off / shutdown the UniStakerV2/ Can withdraw rewards from reward pool once shutdown/ - Owner:/ Is unable to operate on user funds due to UniversalVault/ Is unable to operate on reward pool fu... | contract UniStakerV2 is IUniStakerV2, Powered {
using SafeMath for uint256;
using EnumerableSet for EnumerableSet.AddressSet;
/* constants */
string public constant PLATINUM = "PLATINUM";
string public constant GOLD = "GOLD";
string public constant MINT = "MINT";
string public constant BLAC... | contract UniStakerV2 is IUniStakerV2, Powered {
using SafeMath for uint256;
using EnumerableSet for EnumerableSet.AddressSet;
/* constants */
string public constant PLATINUM = "PLATINUM";
string public constant GOLD = "GOLD";
string public constant MINT = "MINT";
string public constant BLAC... | 31,452 |
338 | // ILendingRateOracle interfaceInterface for the Aave borrow rate oracle. Provides the average market borrow rate to be used as a base for the stable borrow rate calculations/ | interface ILendingRateOracle {
/**
@dev returns the market borrow rate in ray
**/
function getMarketBorrowRate(address _asset) external view returns (uint256);
/**
@dev sets the market borrow rate. Rate value must be in ray
**/
function setMarketBorrowRate(address _asset, uint256 _rate)... | interface ILendingRateOracle {
/**
@dev returns the market borrow rate in ray
**/
function getMarketBorrowRate(address _asset) external view returns (uint256);
/**
@dev sets the market borrow rate. Rate value must be in ray
**/
function setMarketBorrowRate(address _asset, uint256 _rate)... | 24,366 |
13 | // See {ERC20-_burn}. / | function burn(uint256 amount) external override returns (bool) {
_burn(_msgSender(), amount);
return true;
}
| function burn(uint256 amount) external override returns (bool) {
_burn(_msgSender(), amount);
return true;
}
| 28,912 |
73 | // Sets owner address where the funds will be sent during withdrawal _owner Owner's address Requirements:- sender must have canSetOwnerAddress permission- address must not be 0 / | function setOwner(address _owner) external canSetOwnerAddress(msg.sender) {
require(_owner != address(0), "Empty owner address is not allowed!");
owner = _owner;
}
| function setOwner(address _owner) external canSetOwnerAddress(msg.sender) {
require(_owner != address(0), "Empty owner address is not allowed!");
owner = _owner;
}
| 80,022 |
98 | // Here go crowdsale process itself and token manipulations |
function setRate(uint256 _tokensPerEthPrice)
public
onlyOwner
|
function setRate(uint256 _tokensPerEthPrice)
public
onlyOwner
| 46,182 |
28 | // Keeps track whether the contract erroredOut. When that is true, most actions are blocked & refund can be claimed | bool public error = false;
| bool public error = false;
| 30,571 |
36 | // Interface of the ERC3156 FlashLender, as defined in / | interface IERC3156FlashLenderUpgradeable {
/**
* @dev The amount of currency available to be lended.
* @param token The loan currency.
* @return The amount of `token` that can be borrowed.
*/
function maxFlashLoan(
address token
) external view returns (uint256);
/**
* ... | interface IERC3156FlashLenderUpgradeable {
/**
* @dev The amount of currency available to be lended.
* @param token The loan currency.
* @return The amount of `token` that can be borrowed.
*/
function maxFlashLoan(
address token
) external view returns (uint256);
/**
* ... | 33,336 |
138 | // Hook that is called before any transfer of tokens. This includesminting and burning. Calling conditions: - when `from` and `to` are both non-zero, `amount` of ``from``'s tokenswill be to transferred to `to`.- when `from` is zero, `amount` tokens will be minted for `to`.- when `to` is zero, `amount` of ``from``'s tok... | function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { }
}
| function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { }
}
| 4,883 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.