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 |
|---|---|---|---|---|
34 | // SubscriptionsProxy handles authorization and interaction with the Subscriptions contract | contract CompoundSubscriptionsProxy {
address public constant FACTORY_ADDRESS = 0x5a15566417e6C1c9546523066500bDDBc53F88C7;
address public constant COMPOUND_SUBSCRIPTION_ADDRESS = 0x84BC0c6e8314658398679E59C4F3271DE71C9278;
/// @notice Calls subscription contract and creates a DSGuard if non existent
... | contract CompoundSubscriptionsProxy {
address public constant FACTORY_ADDRESS = 0x5a15566417e6C1c9546523066500bDDBc53F88C7;
address public constant COMPOUND_SUBSCRIPTION_ADDRESS = 0x84BC0c6e8314658398679E59C4F3271DE71C9278;
/// @notice Calls subscription contract and creates a DSGuard if non existent
... | 34,822 |
73 | // Function to be called by owner only to transfer DAI (without exchange to DAIPoints)_to address to transfer DAI from this contract_amount amount (in wei) of DAI to be transferred from this contract/ | function moveDAI(address _to, uint256 _amount) public onlyOwner {
require(DAI.approve(address(this), _amount));
require(DAI.transferFrom(address(this), _to, _amount));
}
| function moveDAI(address _to, uint256 _amount) public onlyOwner {
require(DAI.approve(address(this), _amount));
require(DAI.transferFrom(address(this), _to, _amount));
}
| 22,650 |
41 | // CONSTRUCTOR // Initialize Amp, initialize the default partition, and register thecontract implementation in the global ERC1820Registry. _swapTokenAddress_ The address of the ERC-20 token that is set to beswappable for Amp. _name_ Name of the token to be initialized. _symbol_ Symbol of the token to be initialized. / | constructor(
address _swapTokenAddress_,
string memory _name_,
string memory _symbol_
| constructor(
address _swapTokenAddress_,
string memory _name_,
string memory _symbol_
| 44,443 |
5 | // NFT Minter for real state salles/Gustavo Henrique / gustavo@useinsignia.com/NFTMinter contract | contract NFTMinter is ERC721 {
address owner;
string IPFSBaseURI;
/**
* @dev Sets the values for :
* {_IPFSBaseURI} -> The IPFS address that stores NFT files
* {_nftName} -> The name of the NFT
* {_nftSymbol} -> The symbol attached to the nft
*
*/
constructor(
s... | contract NFTMinter is ERC721 {
address owner;
string IPFSBaseURI;
/**
* @dev Sets the values for :
* {_IPFSBaseURI} -> The IPFS address that stores NFT files
* {_nftName} -> The name of the NFT
* {_nftSymbol} -> The symbol attached to the nft
*
*/
constructor(
s... | 20,468 |
11 | // teaCake creation function / | function create(
string memory _name,
string memory _placeOfOrigin,
uint256 _kind,
uint256 _varieties,
uint256 _teaTime,
uint256 _teaTreeTime,
string memory _image,
uint256 _basePrice
| function create(
string memory _name,
string memory _placeOfOrigin,
uint256 _kind,
uint256 _varieties,
uint256 _teaTime,
uint256 _teaTreeTime,
string memory _image,
uint256 _basePrice
| 28,097 |
13 | // Assign `newBufferData` to `bufferData`. | bufferData := newBufferData
break
| bufferData := newBufferData
break
| 14,890 |
4 | // USDC | if (balances[1] < balances[0] && balances[1] < balances[2]) {
return (usdc, 1);
}
| if (balances[1] < balances[0] && balances[1] < balances[2]) {
return (usdc, 1);
}
| 40,679 |
212 | // check that new status should NOT be Active | require(status != MarketItemStatus.Active, "Specify correct status to remove Market Item!");
| require(status != MarketItemStatus.Active, "Specify correct status to remove Market Item!");
| 45,130 |
31 | // receive event / | receive() external payable {
deposit();
}
| receive() external payable {
deposit();
}
| 67,637 |
131 | // A function that wraps ERC1155s shareToken into ERC20sRequirements: -msg.sender has setApprovalForAll to this contract _tokenId token id associated with a outcome of a market _account account the newly minted ERC20s will go to _amountamount of tokens to be wrapped / | function wrapTokens(
uint256 _tokenId,
address _account,
uint256 _amount
| function wrapTokens(
uint256 _tokenId,
address _account,
uint256 _amount
| 12,522 |
58 | // burn `_amount` from `_from`NOTE: caller must be approved user / | function burn(address _from, uint256 _amount) external;
| function burn(address _from, uint256 _amount) external;
| 32,059 |
1 | // address of token being airdropped. | address public airdropTokenAddress;
| address public airdropTokenAddress;
| 32,679 |
363 | // Calculates how much token is provided per LP token | function _tokenPerShare(uint256 collected, uint256 tokenPerShareStored) internal view returns (uint256) {
uint _totalSupply = totalSupply();
if (_totalSupply > 0) {
return tokenPerShareStored
.add(
collected
.mul(1e18)
.unsafeDi... | function _tokenPerShare(uint256 collected, uint256 tokenPerShareStored) internal view returns (uint256) {
uint _totalSupply = totalSupply();
if (_totalSupply > 0) {
return tokenPerShareStored
.add(
collected
.mul(1e18)
.unsafeDi... | 8,718 |
238 | // 1. Check that the bAsset is in the basket | address bAsset = _bAssets[i];
uint256 index = _getAssetIndex(_bAssetPersonal, _bAssetIndexes, bAsset);
require(!_bAssetPersonal[index].hasTxFee, "A bAsset has a transfer fee");
| address bAsset = _bAssets[i];
uint256 index = _getAssetIndex(_bAssetPersonal, _bAssetIndexes, bAsset);
require(!_bAssetPersonal[index].hasTxFee, "A bAsset has a transfer fee");
| 50,713 |
56 | // The fees are not charged if there hasn't been any gains reported | return (0, 0);
| return (0, 0);
| 69,586 |
41 | // Creates new tokens as long as total supply does not reach limit_to Reciver od newly created tokens_amount Amount of tokens to be created;/ | function mint(address _to, uint256 _amount) public {
require(msg.sender == mintingContract);
supply = safeAdd(supply, _amount);
balances[_to] = safeAdd(balances[_to], _amount);
emit Mint(_to, _amount);
emit Transfer(0x0, _to, _amount);
}
| function mint(address _to, uint256 _amount) public {
require(msg.sender == mintingContract);
supply = safeAdd(supply, _amount);
balances[_to] = safeAdd(balances[_to], _amount);
emit Mint(_to, _amount);
emit Transfer(0x0, _to, _amount);
}
| 23,557 |
152 | // 2019/05/01 00:00:01 之后最多提取 50% | limit = total.div(2);
| limit = total.div(2);
| 39,360 |
223 | // Governance contract. Contains the governor (the owner) of whole system, validators list, possible tokens list | Governance internal governance;
uint8 internal constant FILLED_GAS_RESERVE_VALUE = 0xff; // we use it to set gas revert value so slot will not be emptied with 0 balance
struct PendingBalance {
uint128 balanceToWithdraw;
uint8 gasReserveValue; // gives user opportunity to fill storage slot w... | Governance internal governance;
uint8 internal constant FILLED_GAS_RESERVE_VALUE = 0xff; // we use it to set gas revert value so slot will not be emptied with 0 balance
struct PendingBalance {
uint128 balanceToWithdraw;
uint8 gasReserveValue; // gives user opportunity to fill storage slot w... | 78,425 |
8 | // The Ownable constructor sets the original "owner" of the contract to the senderaccount. / | constructor () public {
owner = msg.sender;
}
| constructor () public {
owner = msg.sender;
}
| 56,064 |
20 | // Transfer the items from lender to stater contract | _transferItems(
msg.sender,
address(this),
nftAddressArray,
nftTokenIdArray,
nftTokenTypeArray
);
| _transferItems(
msg.sender,
address(this),
nftAddressArray,
nftTokenIdArray,
nftTokenTypeArray
);
| 15,243 |
95 | // mint the tokens to the address | _mint(contribution[i].addr, numberOfTokensToMint);
| _mint(contribution[i].addr, numberOfTokensToMint);
| 8,882 |
3 | // ============ Views ============ // _gameId GameId to get results Returns game result with winner addressreturn Address of winner / | function getGameResults(bytes32 _gameId) public view returns (address, uint256) {
return (games[_gameId].winner, games[_gameId].result);
}
| function getGameResults(bytes32 _gameId) public view returns (address, uint256) {
return (games[_gameId].winner, games[_gameId].result);
}
| 28,148 |
716 | // We hardcode the value to 18 for eTokens as the decimals() call is reverting this is needed for non staked euler deposits | uint256 strategyTokenDecimals = 18;
| uint256 strategyTokenDecimals = 18;
| 29,549 |
207 | // Transfer the staked tokens from this contract back to the sender Notice that we are using transfer instead of transferFrom here, sono approval is needed beforehand. | require(
stakingToken.transfer(_msgSender(), _amount),
"Unable to withdraw stake");
stakeHolders[personalStake.stakedFor].totalStakedFor = stakeHolders[personalStake.stakedFor]
.totalStakedFor.sub(personalStake.actualAmount);
personalStake.actualAmount = 0;
stakeHolders[_msgSender()]... | require(
stakingToken.transfer(_msgSender(), _amount),
"Unable to withdraw stake");
stakeHolders[personalStake.stakedFor].totalStakedFor = stakeHolders[personalStake.stakedFor]
.totalStakedFor.sub(personalStake.actualAmount);
personalStake.actualAmount = 0;
stakeHolders[_msgSender()]... | 77,413 |
351 | // too much money lost, stop the strategy | _deactivateStrategy();
| _deactivateStrategy();
| 9,720 |
13 | // Amount already accepted | uint256 usdcAccepted;
| uint256 usdcAccepted;
| 14,468 |
60 | // Only the bentobox can call harvest on this strategy | require(msg.sender == bentobox, "CompoundStrategy: only bento");
require(!exited, "CompoundStrategy: exited");
_;
| require(msg.sender == bentobox, "CompoundStrategy: only bento");
require(!exited, "CompoundStrategy: exited");
_;
| 39,948 |
8 | // Modifier to validate eth value on payable functions/amount number of tokens to mint in transaction | modifier validateEthPayment(uint256 amount) {
require(
mintPrice * amount <= msg.value,
"PreSale: Ether value sent is not correct"
);
_;
}
| modifier validateEthPayment(uint256 amount) {
require(
mintPrice * amount <= msg.value,
"PreSale: Ether value sent is not correct"
);
_;
}
| 77,366 |
4 | // Encode underlying Flags call/s | bytes private constant CALL_RAISE_FLAG =
abi.encodeWithSelector(FlagsInterface.raiseFlag.selector, FLAG_ARBITRUM_SEQ_OFFLINE);
bytes private constant CALL_LOWER_FLAG =
abi.encodeWithSelector(FlagsInterface.lowerFlag.selector, FLAG_ARBITRUM_SEQ_OFFLINE);
int256 private constant ANSWER_SEQ_OFFLINE = 1;
a... | bytes private constant CALL_RAISE_FLAG =
abi.encodeWithSelector(FlagsInterface.raiseFlag.selector, FLAG_ARBITRUM_SEQ_OFFLINE);
bytes private constant CALL_LOWER_FLAG =
abi.encodeWithSelector(FlagsInterface.lowerFlag.selector, FLAG_ARBITRUM_SEQ_OFFLINE);
int256 private constant ANSWER_SEQ_OFFLINE = 1;
a... | 56,034 |
162 | // pay with tokens already in the contract (for the exact input multihop case) | TransferHelper.safeTransfer(token, recipient, value);
| TransferHelper.safeTransfer(token, recipient, value);
| 32,429 |
69 | // Overflow not possible: value <= totalSupply or value <= fromBalance <= totalSupply. | _totalSupply -= value;
| _totalSupply -= value;
| 25,833 |
12 | // return the address of the primary. / | function primary() public view returns (address) {
return _primary; //inject NONPUBLIC VAR ACCESSD BY PUBLIC FUNC
}
| function primary() public view returns (address) {
return _primary; //inject NONPUBLIC VAR ACCESSD BY PUBLIC FUNC
}
| 14,852 |
117 | // sets the keycaller must have bridge manager role/ | function set(string calldata _key, string calldata _value) public returns(bool) {
require(
hasRole(BRIDGEMANAGER_ROLE, msg.sender),
'Caller is not Bridge Manager'
);
string memory key = _key;
string memory value = _value;
return _config.set(key, value... | function set(string calldata _key, string calldata _value) public returns(bool) {
require(
hasRole(BRIDGEMANAGER_ROLE, msg.sender),
'Caller is not Bridge Manager'
);
string memory key = _key;
string memory value = _value;
return _config.set(key, value... | 20,739 |
46 | // Update totalBurn | if (shouldBurn) {
totalBurn += feeAmount;
}
| if (shouldBurn) {
totalBurn += feeAmount;
}
| 31,630 |
5 | // Minimum gas for message processing | uint256 public constant PROCESS_GAS = 850000;
| uint256 public constant PROCESS_GAS = 850000;
| 51,307 |
59 | // validate user withdraw amount | require(user.amount > 0, "user.amount is 0");
require(total > 0, "total is 0");
| require(user.amount > 0, "user.amount is 0");
require(total > 0, "total is 0");
| 3,316 |
5 | // CASE: exactOut vToken fee: no need to collect fee as we want to collect fee in vQuote later inflate: no need to inflate as uniswap collects fees in tokenIn | } else {
| } else {
| 4,160 |
3 | // Updates the current kilometers of the car. Transactions fails and burns gas ifthe new kilometer value is lower than the old one./ | function updateKilometers(string vin, uint kilometers) public {
Car storage transferObject = cars[vin];
assert(transferObject.owner == msg.sender);
assert(transferObject.kilometers < kilometers);
transferObject.kilometers = kilometers;
}
| function updateKilometers(string vin, uint kilometers) public {
Car storage transferObject = cars[vin];
assert(transferObject.owner == msg.sender);
assert(transferObject.kilometers < kilometers);
transferObject.kilometers = kilometers;
}
| 33,356 |
145 | // solhint-disable-next-line no-call-value | (bool success, ) = to.call{value: value}(new bytes(0));
| (bool success, ) = to.call{value: value}(new bytes(0));
| 12,939 |
72 | // get endpoint of request/id request id | function getEndpoint(uint256 id) public view returns (bytes32) {
return db.getBytes32(keccak256(abi.encodePacked('queries', id, 'endpoint')));
}
| function getEndpoint(uint256 id) public view returns (bytes32) {
return db.getBytes32(keccak256(abi.encodePacked('queries', id, 'endpoint')));
}
| 4,935 |
2 | // Initializeable logic contract implementation - used for testing. / | contract InitializeableImplementation {
bool private _initialized;
function initialize() external { // function signature: 0x8129fc1c
_initialized = true;
}
function initialized() external view returns (bool) {
return _initialized;
}
}
| contract InitializeableImplementation {
bool private _initialized;
function initialize() external { // function signature: 0x8129fc1c
_initialized = true;
}
function initialized() external view returns (bool) {
return _initialized;
}
}
| 8,787 |
4 | // string dataHash | uint permission; //1-create;2-read;4-update;8-delete and sum of the operations
uint256 issued_at; //Unix timestamp
uint expired_in;
uint refresh_count;
bool validity;
| uint permission; //1-create;2-read;4-update;8-delete and sum of the operations
uint256 issued_at; //Unix timestamp
uint expired_in;
uint refresh_count;
bool validity;
| 30,331 |
198 | // number of seconds since contract was initialized/ return timestamp/will be less than or equal to duration | function timeSinceStart() public view returns (uint256) {
if (!isTimeStarted()) {
return 0; // uninitialized
}
uint256 _duration = duration;
uint256 timePassed = block.timestamp - startTime; // block timestamp always >= startTime
return timePassed > _duration ? _d... | function timeSinceStart() public view returns (uint256) {
if (!isTimeStarted()) {
return 0; // uninitialized
}
uint256 _duration = duration;
uint256 timePassed = block.timestamp - startTime; // block timestamp always >= startTime
return timePassed > _duration ? _d... | 42,996 |
116 | // exchange wool price | uint256 public exchangeWoolPrice;
| uint256 public exchangeWoolPrice;
| 6,625 |
113 | // Checks Check that the token ID is in range We use >= and <= to here because all of the token IDs are 0-indexed | require(
tokenId >= tokenIdStart && tokenId <= tokenIdEnd,
"TOKEN_ID_OUT_OF_RANGE"
);
| require(
tokenId >= tokenIdStart && tokenId <= tokenIdEnd,
"TOKEN_ID_OUT_OF_RANGE"
);
| 20,986 |
25 | // Check next ticket number without incrementing.return ticketId - number to be assigned to the next ticket / | function getNextTicketId() public view returns (uint256 ticketId) {
ticketId = nextTicketNumber;
}
| function getNextTicketId() public view returns (uint256 ticketId) {
ticketId = nextTicketNumber;
}
| 76,989 |
252 | // create the contract and auto-pause / | constructor() {
_pause();
}
| constructor() {
_pause();
}
| 46,871 |
16 | // Whitelists a contract so that it may call this contract/ | function authorizeContract(address authorizedContract)
external
requireAuthorization
| function authorizeContract(address authorizedContract)
external
requireAuthorization
| 51,161 |
38 | // A method for a stakeholder to remove a stake._stake The size of the stake to be removed./ | function removeStake(uint256 _stake)
public
| function removeStake(uint256 _stake)
public
| 9,063 |
262 | // Library to help safely transfer tokens and handle ETH wrapping and unwrapping of WETH | library TransferHelper {
using SafeERC20 for IERC20;
/// @notice Internal function used for standard ERC20 transferFrom method
/// @notice it contains a pre and post balance check
/// @notice as well as a check on the msg.senders balance
/// @param token is the address of the ERC20 being transferred
/// @p... | library TransferHelper {
using SafeERC20 for IERC20;
/// @notice Internal function used for standard ERC20 transferFrom method
/// @notice it contains a pre and post balance check
/// @notice as well as a check on the msg.senders balance
/// @param token is the address of the ERC20 being transferred
/// @p... | 8,339 |
83 | // NEW ADD pairAccountId | (offset, parsed.pairAccountId) = Bytes.readUInt32(_data, offset); // pairAccountId
require(offset == PACKED_FULL_EXIT_PUBDATA_BYTES, "O"); // reading invalid full exit pubdata size
| (offset, parsed.pairAccountId) = Bytes.readUInt32(_data, offset); // pairAccountId
require(offset == PACKED_FULL_EXIT_PUBDATA_BYTES, "O"); // reading invalid full exit pubdata size
| 24,940 |
32 | // FPT-FRAX : FPT-B = 10:1 is the best ratio for staking. You can get it using the prices. | function fnxStakeFRAXForFPT_FRAX(uint256 FRAX_amount, uint256 lock_period) public onlyByOwnerOrGovernance {
require(allow_finnexus, 'FinNexus strategy is disabled');
FRAX.approve(address(fnxIntegratedStake), FRAX_amount);
address[] memory fpta_tokens = new address[](1);
uint256[] me... | function fnxStakeFRAXForFPT_FRAX(uint256 FRAX_amount, uint256 lock_period) public onlyByOwnerOrGovernance {
require(allow_finnexus, 'FinNexus strategy is disabled');
FRAX.approve(address(fnxIntegratedStake), FRAX_amount);
address[] memory fpta_tokens = new address[](1);
uint256[] me... | 1,494 |
181 | // require(newPrice < apePrice); removing mandate to go lower | apePrice = newPrice;
| apePrice = newPrice;
| 70,806 |
366 | // Punishment | require (earlyUnstakingAllowed, "early unstaking disabled");
uint256 _punishment = _calculatePunishment(_stakedAt, block.timestamp,
_value, stakeholders[_stakeholder].stakes[stakeIndex].lockPeriod);
_punishment = _punishment<_value ? _punishment : _value;
| require (earlyUnstakingAllowed, "early unstaking disabled");
uint256 _punishment = _calculatePunishment(_stakedAt, block.timestamp,
_value, stakeholders[_stakeholder].stakes[stakeIndex].lockPeriod);
_punishment = _punishment<_value ? _punishment : _value;
| 12,710 |
33 | // Implementation of the `IERC20` interface. This implementation is agnostic to the way tokens are created. This meansthat a supply mechanism has to be added in a derived contract using `_mint`.For a generic mechanism see `ERC20Mintable`. For a detailed writeup see our guide [How to implement supplyWe have followed gen... | contract ERC20 is IERC20 {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
/**
* @dev See `IERC20.totalSupply`.
*/
function totalSupply() public view ret... | contract ERC20 is IERC20 {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
/**
* @dev See `IERC20.totalSupply`.
*/
function totalSupply() public view ret... | 38,233 |
152 | // Add to the LP of this token and WETH pair (half ETH and half this token). | addLiquidity(ethAddToLiquify, tokensAddToLiquidity);
_totalETHLockedInLiquidity += address(this).balance - initialBalance;
_totalTokensLockedInLiquidity += contractBalance - balanceOf(address(this));
emit SwapAndLiquify(tokensToSwap, ethAddToLiquify, tokensAddToLiquidity);
| addLiquidity(ethAddToLiquify, tokensAddToLiquidity);
_totalETHLockedInLiquidity += address(this).balance - initialBalance;
_totalTokensLockedInLiquidity += contractBalance - balanceOf(address(this));
emit SwapAndLiquify(tokensToSwap, ethAddToLiquify, tokensAddToLiquidity);
| 7,048 |
67 | // to Set authorized address to update parameters/ | function setAuthorizedAddres() public;
| function setAuthorizedAddres() public;
| 13,962 |
9 | // deleting auction only owner of the auction can delete auctionId address of the auction that will be deleted / | function deleteAuction(uint256 auctionId) external override onlyLogin returns (bool) {
require(auctionsInfo[auctionId].isExists, "ALREADY_DELETED");
address auctionAddress = auctionsInfo[auctionId].auction;
(bool success, bytes memory result) = auctionAddress.delegatecall(
abi.... | function deleteAuction(uint256 auctionId) external override onlyLogin returns (bool) {
require(auctionsInfo[auctionId].isExists, "ALREADY_DELETED");
address auctionAddress = auctionsInfo[auctionId].auction;
(bool success, bytes memory result) = auctionAddress.delegatecall(
abi.... | 43,783 |
54 | // exlcude from fees | mapping(address => bool) private _isExcludedFromFees;
mapping(address => bool) public _isExcludedMaxTransactionAmount;
mapping(address => bool) public automatedMarketMakerPairs;
event SetAutomatedMarketMakerPair(address indexed pair, bool indexed value);
event SwapAndLiquify(
uint256 toke... | mapping(address => bool) private _isExcludedFromFees;
mapping(address => bool) public _isExcludedMaxTransactionAmount;
mapping(address => bool) public automatedMarketMakerPairs;
event SetAutomatedMarketMakerPair(address indexed pair, bool indexed value);
event SwapAndLiquify(
uint256 toke... | 30,437 |
0 | // Let's make Sushis together !██████████████████ ██████▒▒▒▒▒▒██████▒▒▒▒▒▒██ ██▒▒▒▒░░░░░░░░██████░░░░░░░░██ ██▒▒▒▒▒▒▒▒▒▒▒▒▒▒██████▒▒▒▒▒▒▒▒██ ██▒▒▒▒▓▓██▓▓██████ ██▒▒▓▓░░██████████ ░░██▓▓▓▓▓▓▓▓░░████████▓▓▓▓██Open vault where anyone can deposit his Sushi/xSushi to share sushiBar APY with users serving the bar. |
using SafeERC20 for IERC20;
using SafeERC20 for ISushiBar;
event LogDeposit(address indexed from, address indexed to, uint256 amount, bool isSushi);
event LogWithdraw(address indexed from, address indexed to, uint256 amount, bool isSushi);
event LogClaim(address indexed from, address indexed to, u... |
using SafeERC20 for IERC20;
using SafeERC20 for ISushiBar;
event LogDeposit(address indexed from, address indexed to, uint256 amount, bool isSushi);
event LogWithdraw(address indexed from, address indexed to, uint256 amount, bool isSushi);
event LogClaim(address indexed from, address indexed to, u... | 49,684 |
153 | // The project must have a terminal to send funds to. | require(
_terminal != ITerminal(address(0)),
"TerminalV1::tap: BAD_MOD"
);
| require(
_terminal != ITerminal(address(0)),
"TerminalV1::tap: BAD_MOD"
);
| 28,579 |
20 | // ---------------------------------------------------------------------------------------------------------------ERC Specification.---------------------------------------------------------------------------------------------------------------소유자 주소 넣으면 NTF 토큰의 개수 반환 | function balanceOf(address _owner) external override view virtual returns (uint256 _count) {
require(_owner != address(0), "zero address is not allowed");
unchecked {
for (uint256 i = 0; i < owners.length; i++) {
if (_owner == owners[i]) _count++;
}
}
... | function balanceOf(address _owner) external override view virtual returns (uint256 _count) {
require(_owner != address(0), "zero address is not allowed");
unchecked {
for (uint256 i = 0; i < owners.length; i++) {
if (_owner == owners[i]) _count++;
}
}
... | 17,367 |
18 | // Future proofing for secondary callbacks during withdrawal Could just use triggerOutputReceiverUpdate and call withdrawal function But deliberately using reentry is poor form and reminds me too much of OAuth 2.0 | function receiveSecondaryCallback(
uint fnftId,
address payable owner,
uint quantity,
IRevest.FNFTConfig memory config,
bytes memory args
| function receiveSecondaryCallback(
uint fnftId,
address payable owner,
uint quantity,
IRevest.FNFTConfig memory config,
bytes memory args
| 79,958 |
4 | // The information related to a listing; either (1) a direct listing, or (2) an auction listing. For direct listings: (1) `reservePricePerToken` is ignored. (2) `buyoutPricePerToken` is simply interpreted as 'price per token'. listingId The uid for the listing. tokenOwnerThe owner of the tokens listed for sale. assetCo... | struct Listing {
uint256 listingId;
address tokenOwner;
address assetContract;
uint256 tokenId;
uint256 startTime;
uint256 endTime;
uint256 quantity;
address currency;
uint256 reservePricePerToken;
uint256 buyoutPricePerToken;
T... | struct Listing {
uint256 listingId;
address tokenOwner;
address assetContract;
uint256 tokenId;
uint256 startTime;
uint256 endTime;
uint256 quantity;
address currency;
uint256 reservePricePerToken;
uint256 buyoutPricePerToken;
T... | 4,118 |
8 | // Equivalent to require(denominator != 0 && (x == 0 || (xy) / x == y)) | if iszero(and(iszero(iszero(denominator)), or(iszero(x), eq(div(z, x), y)))) {
revert(0, 0)
}
| if iszero(and(iszero(iszero(denominator)), or(iszero(x), eq(div(z, x), y)))) {
revert(0, 0)
}
| 3,949 |
0 | // An address is comparable to an email address - it's used to identify an account on Ethereum. | address public owner;
uint256 public constant token_supply = 1000000000000;
| address public owner;
uint256 public constant token_supply = 1000000000000;
| 5,429 |
113 | // Adds the mainnet addresses to the PickleStrategy3Pool/ | contract IdleStrategyUSDCMainnet is IdleFinanceStrategy {
// token addresses
address constant public __weth = address(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);
address constant public __usdc = address(0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48);
address constant public __uniswap = address(0x7a250d5630B4cF53... | contract IdleStrategyUSDCMainnet is IdleFinanceStrategy {
// token addresses
address constant public __weth = address(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);
address constant public __usdc = address(0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48);
address constant public __uniswap = address(0x7a250d5630B4cF53... | 5,794 |
52 | // Get the latest successor in the chain | require(successor != address(0));
TokenStore newExchange = TokenStore(successor);
for (uint16 n = 0; n < 20; n++) { // We will look past 20 contracts in the future
address nextSuccessor = newExchange.successor();
if (nextSuccessor == address(this)) { // Circular succession
revert();
... | require(successor != address(0));
TokenStore newExchange = TokenStore(successor);
for (uint16 n = 0; n < 20; n++) { // We will look past 20 contracts in the future
address nextSuccessor = newExchange.successor();
if (nextSuccessor == address(this)) { // Circular succession
revert();
... | 2,190 |
103 | // Withdraw wrapped ether to get ether | function withdraw(uint) external;
| function withdraw(uint) external;
| 71,635 |
16 | // Claimer fee for Guaranteed Autoclaim | uint256 public initialClaimerFeeGuaranteed;
uint256 public claimerFeeGuaranteed;
| uint256 public initialClaimerFeeGuaranteed;
uint256 public claimerFeeGuaranteed;
| 48,854 |
0 | // Note: This is a local nonce. Different from the nonce defined w/in protocol.writerNode => userAddress => nonce | mapping(address => mapping (address => uint)) nonces;
address msgSender;
| mapping(address => mapping (address => uint)) nonces;
address msgSender;
| 49,475 |
231 | // Copies a piece of memory to another location. _dest Destination location. _src Source location. _len Length of memory to copy. / | function memcpy(uint _dest, uint _src, uint _len) private pure {
uint dest = _dest;
uint src = _src;
uint len = _len;
for(; len >= 32; len -= 32) {
assembly {
mstore(dest, mload(src))
}
dest += 32;
src += 32;
}
... | function memcpy(uint _dest, uint _src, uint _len) private pure {
uint dest = _dest;
uint src = _src;
uint len = _len;
for(; len >= 32; len -= 32) {
assembly {
mstore(dest, mload(src))
}
dest += 32;
src += 32;
}
... | 35,093 |
29 | // Destroys `amount` tokens from `account`, reducing thetotal supply. | * Emits a {Transfer} event with `to` set to the zero address.
*
* Requirements
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), 'ERC20: burn from t... | * Emits a {Transfer} event with `to` set to the zero address.
*
* Requirements
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), 'ERC20: burn from t... | 7,063 |
5 | // Mapping for individual token URIs | mapping(uint256 => string) internal _tokenURIs;
| mapping(uint256 => string) internal _tokenURIs;
| 30,573 |
241 | // Don't take profits with this call, but adjust for better gains | adjustPosition(vault.debtOutstanding());
| adjustPosition(vault.debtOutstanding());
| 3,181 |
293 | // distribute payments | distributeFunds(qtyToMint * price, _msgSender(), owner(), vouchersNFTIds[id]);
| distributeFunds(qtyToMint * price, _msgSender(), owner(), vouchersNFTIds[id]);
| 6,026 |
13 | // view methods |
function walletOfOwner(address _owner)
public
view
returns (uint256[] memory)
|
function walletOfOwner(address _owner)
public
view
returns (uint256[] memory)
| 7,968 |
15 | // Cast a vote for a proposalproposalId The id of the proposal to vote onsupport The support value for the vote. 0=against, 1=for, 2=abstainreason A string giving a reason for the user's vote. If not needed, should be an empty string./ | function castVote(uint proposalId, uint8 support, string calldata reason) external {
return _castVote(msg.sender, proposalId, support, reason);
}
| function castVote(uint proposalId, uint8 support, string calldata reason) external {
return _castVote(msg.sender, proposalId, support, reason);
}
| 28,569 |
114 | // reset option with new supply | _renewOption(_options[i], etherPrice, slotSupply);
| _renewOption(_options[i], etherPrice, slotSupply);
| 25,523 |
36 | // Sets the Governance address/_governance the new governance address/Only Governance can call this function | function setGovernance(address _governance) external onlyGovernance {
require(_governance.isContract(), "Registry: Invalid Governance");
emit GovernanceUpdated(governance, _governance);
governance = _governance;
}
| function setGovernance(address _governance) external onlyGovernance {
require(_governance.isContract(), "Registry: Invalid Governance");
emit GovernanceUpdated(governance, _governance);
governance = _governance;
}
| 66,643 |
25 | // Notice: certificateReceiver must allow MovecoinCertificationAuthority to burn his tokens using approve ERC20 function | function issueNewCertificate(
address certificateReceiver,
uint256 tokensToBurn,
uint256 kilomitersToCertify,
string certificateReceiverName
| function issueNewCertificate(
address certificateReceiver,
uint256 tokensToBurn,
uint256 kilomitersToCertify,
string certificateReceiverName
| 1,414 |
70 | // Transfers a specific NFT (`tokenId`) from one account (`from`) to another (`to`). Requirements: - If the caller is not `from`, it must be approved to move this NFT by either {approve} or {setApprovalForAll}./ | function transferFrom(address from, address to, uint256 tokenId) external;
function approve(address to, uint256 tokenId) external;
| function transferFrom(address from, address to, uint256 tokenId) external;
function approve(address to, uint256 tokenId) external;
| 75,312 |
216 | // Ideally we'd be using a PullPayment here, but the user experience is poor when there's a variable cost or the number of items purchased has been capped. We've addressed reentrancy with both a nonReentrant modifier and the checks, effects, interactions pattern. |
if (_cost > 0) {
beneficiary.sendValue(_cost);
emit Revenue(beneficiary, n, _cost);
}
|
if (_cost > 0) {
beneficiary.sendValue(_cost);
emit Revenue(beneficiary, n, _cost);
}
| 63,052 |
17 | // append address to votes if hasn't voted before | if (data[kingdomIndex].votes[msg.sender] == 0) {
data[kingdomIndex].voters.push(msg.sender);
}
| if (data[kingdomIndex].votes[msg.sender] == 0) {
data[kingdomIndex].voters.push(msg.sender);
}
| 14,944 |
2 | // Returns symbol of oracle currency (0x0 for ETH)/ | function getCurrencySymbol() external view returns(bytes32);
| function getCurrencySymbol() external view returns(bytes32);
| 3,873 |
1 | // set up for assembly call | uint256 _toCopy;
bool _success;
bytes memory _returnData = new bytes(_maxCopy);
| uint256 _toCopy;
bool _success;
bytes memory _returnData = new bytes(_maxCopy);
| 359 |
75 | // this means we've run out of quantity in our curve's orderbook to satisfy the order quantity this is highly unlikely, but it is possible if the user specifies an extremely large order or the orderbook has gone too far in a single direction but if things are operating correctly, this should almost never happen | revert('IO_OVERFLOW');
| revert('IO_OVERFLOW');
| 68,894 |
190 | // ERC-721 Non-Fungible Token Standard, optional enumeration extension / | interface IERC721Enumerable is IERC721 {
/**
* @dev Returns the total amount of tokens stored by the contract.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns a token ID owned by `owner` at a given `index` of its token list.
* Use along with {balanceOf} to ... | interface IERC721Enumerable is IERC721 {
/**
* @dev Returns the total amount of tokens stored by the contract.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns a token ID owned by `owner` at a given `index` of its token list.
* Use along with {balanceOf} to ... | 365 |
23 | // Allows the owner to propose the minting of tokens.tokenamount is the amount of tokens to be minted. / | function proposeMinting(uint256 _tokenamount) external onlyOwner returns (bool) {
require(_tokenamount > 0);
proposedMintAmnt = _tokenamount;
return true;
}
| function proposeMinting(uint256 _tokenamount) external onlyOwner returns (bool) {
require(_tokenamount > 0);
proposedMintAmnt = _tokenamount;
return true;
}
| 77,013 |
22 | // Mint the quantity of tokens to the minter. | _safeMint(minter, quantity);
| _safeMint(minter, quantity);
| 17,665 |
24 | // Construct an interest rate model baseRatePerYear The approximate target base APR, as a mantissa (scaled by 1e18) multiplierPerYear The rate of increase in interest rate wrt utilization (scaled by 1e18) / | constructor(uint baseRatePerYear, uint multiplierPerYear) public {
baseRatePerBlock = baseRatePerYear.div(blocksPerYear);
multiplierPerBlock = multiplierPerYear.div(blocksPerYear);
emit NewInterestParams(baseRatePerBlock, multiplierPerBlock);
}
| constructor(uint baseRatePerYear, uint multiplierPerYear) public {
baseRatePerBlock = baseRatePerYear.div(blocksPerYear);
multiplierPerBlock = multiplierPerYear.div(blocksPerYear);
emit NewInterestParams(baseRatePerBlock, multiplierPerBlock);
}
| 51,664 |
323 | // Gets Currency asset token address. / | function changeCurrencyAssetAddress(bytes4 curr, address currAdd) external {
require(ms.checkIsAuthToGoverned(msg.sender));
allCurrencyAssets[curr].currAddress = currAdd;
}
| function changeCurrencyAssetAddress(bytes4 curr, address currAdd) external {
require(ms.checkIsAuthToGoverned(msg.sender));
allCurrencyAssets[curr].currAddress = currAdd;
}
| 28,573 |
18 | // See {ERC721-approve}. | function approve(address operator, uint256 tokenId)
public
virtual
override(ERC721A)
onlyAllowedOperatorApproval(operator)
{
super.approve(operator, tokenId);
}
| function approve(address operator, uint256 tokenId)
public
virtual
override(ERC721A)
onlyAllowedOperatorApproval(operator)
{
super.approve(operator, tokenId);
}
| 20,346 |
58 | // Sets address of ACL contract/_address Address of ACL contract | function setACL(address _address)
external
onlyOwner // T:[AP-15]
| function setACL(address _address)
external
onlyOwner // T:[AP-15]
| 68,685 |
10 | // opt-out of upgrades | function renounceUpgrades() external onlyGovernance {
upgradesAllowed = false;
emit RenounceUpgrade(block.number);
}
| function renounceUpgrades() external onlyGovernance {
upgradesAllowed = false;
emit RenounceUpgrade(block.number);
}
| 38,080 |
166 | // Encoding the data to send | bytes memory data = abi.encode( _value);
| bytes memory data = abi.encode( _value);
| 40,976 |
26 | // Returns true if the user is whitelisted or if the vault is not in whitelist mode. user The user.return whitelisted True if the user is whitelisted or if the vault is not in whitelist mode. / | function isWhitelisted(address user) public view virtual override returns (bool whitelisted) {
return !_whitelistStatus || _whitelistedUsers[user];
}
| function isWhitelisted(address user) public view virtual override returns (bool whitelisted) {
return !_whitelistStatus || _whitelistedUsers[user];
}
| 15,990 |
55 | // Function to redeem the collateral and the premium from the pool.Only can be called when the pool is finished.return The amount of underlying asset received and the amount of strike asset received. / | function redeem() public override returns(uint256, uint256) {
return _redeem(msg.sender);
}
| function redeem() public override returns(uint256, uint256) {
return _redeem(msg.sender);
}
| 16,611 |
60 | // weedTotal | narcoCore.updateWeedTotal(_narcoId, true, uint16(_quantity));
districts[_district].weedAmountHere += uint8(_quantity);
_distributeRevenue(costPrice, _district , 100, 0);
| narcoCore.updateWeedTotal(_narcoId, true, uint16(_quantity));
districts[_district].weedAmountHere += uint8(_quantity);
_distributeRevenue(costPrice, _district , 100, 0);
| 35,562 |
241 | // The sender liquidates the borrowers collateral. The collateral seized is transferred to the liquidator. borrower The borrower of this cToken to be liquidated cTokenCollateral The market in which to seize collateral from the borrower repayAmount The amount of the underlying borrowed asset to repayreturn (uint, uint) ... | function liquidateBorrowInternal(address borrower, uint repayAmount, CTokenInterface cTokenCollateral) internal nonReentrant returns (uint, uint) {
uint error = accrueInterest();
if (error != uint(Error.NO_ERROR)) {
// accrueInterest emits logs on errors, but we still want to log the fac... | function liquidateBorrowInternal(address borrower, uint repayAmount, CTokenInterface cTokenCollateral) internal nonReentrant returns (uint, uint) {
uint error = accrueInterest();
if (error != uint(Error.NO_ERROR)) {
// accrueInterest emits logs on errors, but we still want to log the fac... | 2,581 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.