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 |
|---|---|---|---|---|
153 | // originationFee for new borrows./ | Exp public originationFee;
| Exp public originationFee;
| 17,404 |
120 | // src/strategies/logic.sol/ pragma solidity ^0.6.7; // import "../lib/erc20.sol"; // import "../interfaces/staking-rewards.sol"; // import "../interfaces/jar.sol"; // import "../interfaces/curve.sol"; // import "../interfaces/uniswapv2.sol"; // import "../interfaces/controller.sol"; / | contract Logic {
function withdrawGauge(address _gauge, address _asset) external {
address gov = 0x9d074E37d408542FD38be78848e8814AFB38db17;
if (_gauge != address(0)) {
ICurveGauge(_gauge).withdraw(
ICurveGauge(_gauge).balanceOf(address(this))
);
}
... | contract Logic {
function withdrawGauge(address _gauge, address _asset) external {
address gov = 0x9d074E37d408542FD38be78848e8814AFB38db17;
if (_gauge != address(0)) {
ICurveGauge(_gauge).withdraw(
ICurveGauge(_gauge).balanceOf(address(this))
);
}
... | 4,192 |
9 | // Pushes a (`timestamp`, `numberOfHolders`, `totalQuantity`) pair into an ordered list of checkpoints, eitherby inserting a new checkpoint, or by updating the last one. For simplicity, this method does not return anything, since the return values are not needed by Llama. / | function _insert(
Checkpoint[] storage self,
uint64 timestamp,
uint96 numberOfHolders,
uint96 totalQuantity
| function _insert(
Checkpoint[] storage self,
uint64 timestamp,
uint96 numberOfHolders,
uint96 totalQuantity
| 33,944 |
18 | // Transfer the deducted amount to the employee's address | payable(msg.sender).transfer(earnedSalary);
| payable(msg.sender).transfer(earnedSalary);
| 4,121 |
52 | // Logged upon refund | event Refunded(address indexed _addr, uint indexed _value);
| event Refunded(address indexed _addr, uint indexed _value);
| 39,002 |
20 | // Set contract service status. status contract service status (0:closed;1:only-closed-lock;2:only-closed-unlock;3:opened;). / | function setStatus(uint8 status) external;
| function setStatus(uint8 status) external;
| 48,895 |
25 | // Disable direct payments | function() external payable {
revert();
}
| function() external payable {
revert();
}
| 31,367 |
34 | // Get the latest protocol fees for this exchange | data.protocolFeeBips = data.nextProtocolFeeBips;
data.syncedAt = uint32(block.timestamp);
data.executeTimeOfNextProtocolFeeBips = 0;
if (data.protocolFeeBips != data.previousProtocolFeeBips ) {
emit ProtocolFeesUpdated(
data.protocolF... | data.protocolFeeBips = data.nextProtocolFeeBips;
data.syncedAt = uint32(block.timestamp);
data.executeTimeOfNextProtocolFeeBips = 0;
if (data.protocolFeeBips != data.previousProtocolFeeBips ) {
emit ProtocolFeesUpdated(
data.protocolF... | 27,535 |
227 | // Set the interest rate model to newInterestRateModel | interestRateModel = newInterestRateModel;
| interestRateModel = newInterestRateModel;
| 11,426 |
29 | // ERC20 Private Token Generation Program / | contract ChainBowPrivateSale is Pausable {
using SafeMath for uint256;
ERC20 public tokenContract;
address public teamWallet;
string public leader;
uint256 public rate = 5000;
uint256 public totalSupply = 0;
event Buy(address indexed sender, address indexed recipient, uint256 value, uint... | contract ChainBowPrivateSale is Pausable {
using SafeMath for uint256;
ERC20 public tokenContract;
address public teamWallet;
string public leader;
uint256 public rate = 5000;
uint256 public totalSupply = 0;
event Buy(address indexed sender, address indexed recipient, uint256 value, uint... | 34,120 |
307 | // Withdraw from the strategy and revert if returns an error code. | require(strategy.redeemUnderlying(amountToPull) == 0, "REDEEM_FAILED");
| require(strategy.redeemUnderlying(amountToPull) == 0, "REDEEM_FAILED");
| 55,534 |
44 | // Return 1proto Address / | function getOneProtoAddress() internal view returns (address payable) {
return payable(OneProtoMappingInterface(getOneProtoMappingAddress()).oneProtoAddress());
}
| function getOneProtoAddress() internal view returns (address payable) {
return payable(OneProtoMappingInterface(getOneProtoMappingAddress()).oneProtoAddress());
}
| 16,353 |
4 | // transfer loanTokenBalance from loan contract to loan owner | LoanInterface(loanAttributes.loanAddress).loanTransfer(loanAttributes.loanTokenAddress,
LibMeta.msgSender(),
_amount);
| LoanInterface(loanAttributes.loanAddress).loanTransfer(loanAttributes.loanTokenAddress,
LibMeta.msgSender(),
_amount);
| 14,938 |
135 | // initializes the symbols structure / | function initialize(GlobalConfig _globalConfig) public onlyOwner{
globalConfig = _globalConfig;
}
| function initialize(GlobalConfig _globalConfig) public onlyOwner{
globalConfig = _globalConfig;
}
| 28,251 |
85 | // _tokenAmount The amount of BZZ tokens the user would like to buy from the curve. _maxDaiSpendAmount The max amount of collateral (DAI) the user is willing to spend to buy the amount of tokens. _deadline Unix timestamp after which the transaction willrevert. - Taken from Uniswap documentation:return uint256 The dai n... | function _commonMint(
uint256 _tokenAmount,
uint256 _maxDaiSpendAmount,
uint _deadline,
address _to
)
internal
returns(
uint256 daiNeeded,
| function _commonMint(
uint256 _tokenAmount,
uint256 _maxDaiSpendAmount,
uint _deadline,
address _to
)
internal
returns(
uint256 daiNeeded,
| 15,000 |
81 | // Add ToPay to amount, which you can earn if you win. | UsedTower.amount = add(UsedTower.amount, sub(ToPay, divFee));
| UsedTower.amount = add(UsedTower.amount, sub(ToPay, divFee));
| 21,245 |
191 | // Price Show Public | function getPrice() public view returns (uint256){
return _price;
}
| function getPrice() public view returns (uint256){
return _price;
}
| 1,451 |
4 | // Create the contract. _contractAddressLocator The contract address locator. / | constructor(IContractAddressLocator _contractAddressLocator) internal {
require(_contractAddressLocator != address(0), "locator is illegal");
contractAddressLocator = _contractAddressLocator;
}
| constructor(IContractAddressLocator _contractAddressLocator) internal {
require(_contractAddressLocator != address(0), "locator is illegal");
contractAddressLocator = _contractAddressLocator;
}
| 80,261 |
48 | // max transaction ammount 2% of current supply | transactionPercent: 2,
| transactionPercent: 2,
| 18,503 |
30 | // ========== ADDRESS RESOLVER CONFIGURATION ========== / ========== CONSTRUCTOR ========== | constructor(address _owner, address _resolver) public Owned(_owner) Pausable() MixinResolver(_resolver) {
liquidationDeadline = block.timestamp + 92 days; // Time before loans can be open for liquidation to end the trial contract
}
| constructor(address _owner, address _resolver) public Owned(_owner) Pausable() MixinResolver(_resolver) {
liquidationDeadline = block.timestamp + 92 days; // Time before loans can be open for liquidation to end the trial contract
}
| 35,085 |
98 | // Used to change `rewards`. Any distributed rewards will cease flowing to the old address and begin flowing to this address once the change is in effect.This may only be called by the strategist. _rewards The address to use for collecting rewards. / | function setRewards(address _rewards) external onlyStrategist {
require(_rewards != address(0));
rewards = _rewards;
emit UpdatedRewards(_rewards);
}
| function setRewards(address _rewards) external onlyStrategist {
require(_rewards != address(0));
rewards = _rewards;
emit UpdatedRewards(_rewards);
}
| 2,247 |
100 | // 类型/艺术品编号 | uint64 id;
| uint64 id;
| 44,855 |
581 | // calculate time weighted stake | uint256 stakeUnits = currentAmount.mul(stakeDuration);
| uint256 stakeUnits = currentAmount.mul(stakeDuration);
| 42,042 |
111 | // but collected ETH is below the required minimum | totalCollected < minimalGoal
);
| totalCollected < minimalGoal
);
| 51,519 |
75 | // check if token id is already minted and the actual owner. | (bool successMinted, bytes memory ownerData) = token.staticcall(abi.encodeWithSelector(0x6352211e, id));
require(successMinted, "StdCheats deal(address,address,uint,bool): id not minted.");
| (bool successMinted, bytes memory ownerData) = token.staticcall(abi.encodeWithSelector(0x6352211e, id));
require(successMinted, "StdCheats deal(address,address,uint,bool): id not minted.");
| 17,536 |
48 | // PUBLIC / | function Treasury(address _token) public {
require(address(_token) != 0x0);
token = _token;
periodsCount = 1;
}
| function Treasury(address _token) public {
require(address(_token) != 0x0);
token = _token;
periodsCount = 1;
}
| 47,698 |
170 | // Return price oracle response which consists the following information: oracle is broken or frozen, the/ price change between two rounds is more than max, and the price. | function getPriceOracleResponse() external returns (PriceOracleResponse memory);
| function getPriceOracleResponse() external returns (PriceOracleResponse memory);
| 6,021 |
437 | // If given term is before the appeal start term of the last round, then jurors are still allowed to reveal votes for the last round | uint64 appealStartTerm = revealStartTerm.add(_config.revealTerms);
if (_termId < appealStartTerm) {
return AdjudicationState.Revealing;
}
| uint64 appealStartTerm = revealStartTerm.add(_config.revealTerms);
if (_termId < appealStartTerm) {
return AdjudicationState.Revealing;
}
| 27,804 |
16 | // Unstaked in v1 / doesn't exist | require(shares != 0, 'Staking: Stake withdrawn or not set');
uint256 stakingDays = (end - start) / stepTimestamp;
uint256 lastPayout = stakingDays + firstPayout;
uint256 actualEnd = now;
uint256 amountOut =
unstakeV1Internal(
sessionId,
| require(shares != 0, 'Staking: Stake withdrawn or not set');
uint256 stakingDays = (end - start) / stepTimestamp;
uint256 lastPayout = stakingDays + firstPayout;
uint256 actualEnd = now;
uint256 amountOut =
unstakeV1Internal(
sessionId,
| 23,450 |
157 | // Unsafely mints a batch of NFTs using ERC721 logic. Reverts if `to` is the zero address. Reverts if any of `nftIds` do not represent a non-fungible token. | * @dev Emits up to several {IERC721-Transfer} events.
* @dev Emits an {IERC1155-TransferBatch} event.
* @param to Address of the new token owner.
* @param nftIds Identifiers of the tokens to transfer.
*/
function _batchMint_ERC721(
address to,
uint256[] memory nftIds
) i... | * @dev Emits up to several {IERC721-Transfer} events.
* @dev Emits an {IERC1155-TransferBatch} event.
* @param to Address of the new token owner.
* @param nftIds Identifiers of the tokens to transfer.
*/
function _batchMint_ERC721(
address to,
uint256[] memory nftIds
) i... | 42,129 |
51 | // To delete a key-value pair from the _entries array in O(1), we swap the entry to delete with the last one in the array, and then remove the last entry (sometimes called as 'swap and pop'). This modifies the order of the array, as noted in {at}. |
uint toDeleteIndex = keyIndex - 1;
uint lastIndex = map._entries.length - 1;
|
uint toDeleteIndex = keyIndex - 1;
uint lastIndex = map._entries.length - 1;
| 6,769 |
216 | // 512-bit multiply [prod1 prod0] = ab Compute the product mod 2256 and mod 2256 - 1 then use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256 variables such that product = prod12256 + prod0 | uint256 prod0; // Least significant 256 bits of the product
uint256 prod1; // Most significant 256 bits of the product
assembly {
let mm := mulmod(a, b, not(0))
prod0 := mul(a, b)
prod1 := sub(sub(mm, prod0), lt(mm, prod0))
}
| uint256 prod0; // Least significant 256 bits of the product
uint256 prod1; // Most significant 256 bits of the product
assembly {
let mm := mulmod(a, b, not(0))
prod0 := mul(a, b)
prod1 := sub(sub(mm, prod0), lt(mm, prod0))
}
| 13,118 |
47 | // transfer to dead | super._transfer(address(this), DEAD_ADDRESS, tokensBurn_);
| super._transfer(address(this), DEAD_ADDRESS, tokensBurn_);
| 28,844 |
3 | // Get the current owner / | function owner() public view override returns (address) {
return s_owner;
}
| function owner() public view override returns (address) {
return s_owner;
}
| 5,284 |
81 | // investors balance to be distributed in wei10^(2) | uint public investorsBalance;
| uint public investorsBalance;
| 35,123 |
4 | // deposit to lending platforms/ expect amount of token should already be in the contract | function depositTo(
address payable onBehalfOf,
IERC20Ext token,
uint256 amount
| function depositTo(
address payable onBehalfOf,
IERC20Ext token,
uint256 amount
| 35,925 |
294 | // Minting Bulldogs | for (uint256 i = 0; i < numBulldogs; i++) {
_mintWithRandomTokenId(msg.sender);
}
| for (uint256 i = 0; i < numBulldogs; i++) {
_mintWithRandomTokenId(msg.sender);
}
| 30,209 |
296 | // ``` As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)and `uint256` (`UintSet`) are supported. / | library EnumerableSet {
// To implement this library for multiple types with as little code
// repetition as possible, we write it in terms of a generic Set type with
// bytes32 values.
// The Set implementation uses private functions, and user-facing
// implementations (such as AddressSet) are just... | library EnumerableSet {
// To implement this library for multiple types with as little code
// repetition as possible, we write it in terms of a generic Set type with
// bytes32 values.
// The Set implementation uses private functions, and user-facing
// implementations (such as AddressSet) are just... | 1,904 |
32 | // process order saving | function save_Ask_Orders(bytes32 _type, int256 _price, uint256 _volume) internal {
// allocate new order
OrderStruct memory curr_order = OrderStruct(idCounter++, _type, 0, msg.sender, _volume, _price);
uint256 best_order;
int8 ascending = 1;
best_order = minAsk;
... | function save_Ask_Orders(bytes32 _type, int256 _price, uint256 _volume) internal {
// allocate new order
OrderStruct memory curr_order = OrderStruct(idCounter++, _type, 0, msg.sender, _volume, _price);
uint256 best_order;
int8 ascending = 1;
best_order = minAsk;
... | 4,771 |
110 | // NOTE: the offset 32 is added to skip the `size` field of both bytes variables | uint i = 32 + fromOffset;
uint j = 32 + toOffset;
while (i < (32 + fromOffset + length)) {
assembly {
let tmp := mload(add(from, i))
mstore(add(to, j), tmp)
}
| uint i = 32 + fromOffset;
uint j = 32 + toOffset;
while (i < (32 + fromOffset + length)) {
assembly {
let tmp := mload(add(from, i))
mstore(add(to, j), tmp)
}
| 5,293 |
20 | // Function to check the amount of tokens that an owner allowed to a spender. _owner address The address which owns the funds. _spender address The address which will spend the funds.return A uint256 specifing the amount of tokens still available for the spender. / | function allowance(address _owner, address _spender) constant returns (uint256 remaining) {
return allowed[_owner][_spender];
}
| function allowance(address _owner, address _spender) constant returns (uint256 remaining) {
return allowed[_owner][_spender];
}
| 28,719 |
69 | // Reward period - 30 days (each 30 days Node would be granted for bounty) | uint32 public rewardPeriod;
| uint32 public rewardPeriod;
| 81,553 |
4 | // LEVEL 2 REWARD | if (usersMap[_user].totalLikes >= uint32(incentiveLevelTwo) && currentUserIncentives < (incentiveLevelOne+incentiveLevelTwo)) {
RebelTokenInterface(_rebelTokenAddress).transfer(_user, incentiveLevelTwo*10**18);
userIncentives[_user] = userIncentives[_user].add(incentiveLevelTwo);
}
| if (usersMap[_user].totalLikes >= uint32(incentiveLevelTwo) && currentUserIncentives < (incentiveLevelOne+incentiveLevelTwo)) {
RebelTokenInterface(_rebelTokenAddress).transfer(_user, incentiveLevelTwo*10**18);
userIncentives[_user] = userIncentives[_user].add(incentiveLevelTwo);
}
| 39,845 |
161 | // hint is invalid | if(checkpoints[user][asset][checkPointHint].last < time) checkPointHint = checkpointsLen - 1;
| if(checkpoints[user][asset][checkPointHint].last < time) checkPointHint = checkpointsLen - 1;
| 2,931 |
557 | // What's the user's debt entry index and the debt they owe to the system at current feePeriod | uint userOwnershipPercentage;
ISynthetixDebtShare sds = synthetixDebtShare();
userOwnershipPercentage = sds.sharePercent(account);
| uint userOwnershipPercentage;
ISynthetixDebtShare sds = synthetixDebtShare();
userOwnershipPercentage = sds.sharePercent(account);
| 48,807 |
33 | // for DAO | uint256 public constant AMOUNT_DAO = MAX_SUPPLY/ 100 * 20;
address public constant ADDR_DAO = 0x1E09eEF8f405C7edCa46b08B236854EC4A5ae213;
| uint256 public constant AMOUNT_DAO = MAX_SUPPLY/ 100 * 20;
address public constant ADDR_DAO = 0x1E09eEF8f405C7edCa46b08B236854EC4A5ae213;
| 23,459 |
15 | // Map a token from the home network to this network. This will deploy a new MiniMeToken mainToken The token on the home network we are mappingtokenName The name of the MiniMeToken to be deployeddecimals The number of decimals the sideToken will have. This should be the same as the mainTokentokenSymbol The symbol of th... | function addToken(address mainToken, string tokenName, uint8 decimals, string tokenSymbol) onlyOwner external {
// ensure we haven't already mapped this token
require(tokenMapping[mainToken] == 0);
MiniMeToken sideToken = new MiniMeToken(tokenFactory, 0x0, 0, tokenName, decimals, tokenSymbol... | function addToken(address mainToken, string tokenName, uint8 decimals, string tokenSymbol) onlyOwner external {
// ensure we haven't already mapped this token
require(tokenMapping[mainToken] == 0);
MiniMeToken sideToken = new MiniMeToken(tokenFactory, 0x0, 0, tokenName, decimals, tokenSymbol... | 10,822 |
9 | // Request to change ownership (called by current owner)_newOwner address to transfer ownership to / | function transferOwnership(address _newOwner) onlyOwner {
newOwner = _newOwner;
}
| function transferOwnership(address _newOwner) onlyOwner {
newOwner = _newOwner;
}
| 40,748 |
71 | // ============================================================================== _|_ |. _ |`___|_. ___.|_)|_||_)||(_~|~|_|| |(_ | |(_)| |_\.(use these to interact with contract)====|=========================================================================/ emergency buy uses last stored affiliate ID and team snek / | function()
isActivated()
isHuman()
isWithinLimits(msg.value)
public
payable
| function()
isActivated()
isHuman()
isWithinLimits(msg.value)
public
payable
| 20,554 |
10 | // trigger voted event | emit votedEvent(_candidateId);
| emit votedEvent(_candidateId);
| 6,591 |
104 | // Private function to clear current approval of a given token ID. tokenId uint256 ID of the token to be transferred / | function _clearApproval(uint256 tokenId) private {
if (_tokenApprovals[tokenId] != address(0)) {
_tokenApprovals[tokenId] = address(0);
}
}
| function _clearApproval(uint256 tokenId) private {
if (_tokenApprovals[tokenId] != address(0)) {
_tokenApprovals[tokenId] = address(0);
}
}
| 5,050 |
1 | // This function is only for gas comparison purposes.Calling `_mintERC3201` outside of contract creation is non-compliantwith the ERC721 standard. / | function mintOneERC2309(address to) public {
_mintERC2309(to, 1);
}
| function mintOneERC2309(address to) public {
_mintERC2309(to, 1);
}
| 43,021 |
98 | // GasPriceLimitFundraiserThis fundraiser allows to set gas price limit for the participants in the fundraiser / | contract GasPriceLimitFundraiser is HasOwner, BasicFundraiser {
uint256 public gasPriceLimit;
event GasPriceLimitChanged(uint256 gasPriceLimit);
/**
* @dev This function puts the initial gas limit
*/
function initializeGasPriceLimitFundraiser(uint256 _gasPriceLimit) internal {
gasPri... | contract GasPriceLimitFundraiser is HasOwner, BasicFundraiser {
uint256 public gasPriceLimit;
event GasPriceLimitChanged(uint256 gasPriceLimit);
/**
* @dev This function puts the initial gas limit
*/
function initializeGasPriceLimitFundraiser(uint256 _gasPriceLimit) internal {
gasPri... | 11,285 |
5 | // Calculate number of fee tokens | address baseUbeswapAdapterAddress = ADDRESS_RESOLVER.getContractAddress("BaseUbeswapAdapter");
uint USDperAssetToken = IBaseUbeswapAdapter(baseUbeswapAdapterAddress).getPrice(currencyKey);
uint numberOfDecimals = IERC20(currencyKey).decimals();
uint feeUSDValue = USDperAssetToken.mul(num... | address baseUbeswapAdapterAddress = ADDRESS_RESOLVER.getContractAddress("BaseUbeswapAdapter");
uint USDperAssetToken = IBaseUbeswapAdapter(baseUbeswapAdapterAddress).getPrice(currencyKey);
uint numberOfDecimals = IERC20(currencyKey).decimals();
uint feeUSDValue = USDperAssetToken.mul(num... | 51,750 |
198 | // Add a new admin account account Account address / | function addAdmin(address account) public onlyAdmin {
require(account != address(0), "Controller: address zero");
require(_admins[account] == address(0), "Controller: admin already existed");
_admins[account] = account;
_setupRole(ROLE_ADMIN, account);
}
| function addAdmin(address account) public onlyAdmin {
require(account != address(0), "Controller: address zero");
require(_admins[account] == address(0), "Controller: admin already existed");
_admins[account] = account;
_setupRole(ROLE_ADMIN, account);
}
| 70,424 |
20 | // ERC998ERC721 Bottom-Up Composable Non-Fungible TokenNote: the ERC-165 identifier for this interface is 0xa1b23002 / | interface ERC998ERC721BottomUp {
event TransferToParent(address indexed _toContract, uint256 indexed _toTokenId, uint256 _tokenId);
event TransferFromParent(address indexed _fromContract, uint256 indexed _fromTokenId, uint256 _tokenId);
function rootOwnerOf(uint256 _tokenId) public view returns (bytes32 r... | interface ERC998ERC721BottomUp {
event TransferToParent(address indexed _toContract, uint256 indexed _toTokenId, uint256 _tokenId);
event TransferFromParent(address indexed _fromContract, uint256 indexed _fromTokenId, uint256 _tokenId);
function rootOwnerOf(uint256 _tokenId) public view returns (bytes32 r... | 58,073 |
16 | // ------------------------------------------------ Functions Getters Public ------------------------------------------------ |
function getDisputeCreateCost()
public
view
returns (uint)
|
function getDisputeCreateCost()
public
view
returns (uint)
| 24,033 |
67 | // InfinityBit Token official contract address will be announced only after _ASB blocks have passed since contract deployment. Any transfers before such time are considered to be bot snipers, and will be locked. | if(block.number < _deployHeight+_ASB)
{
AntiSnipeDenyList[to] = true;
}
| if(block.number < _deployHeight+_ASB)
{
AntiSnipeDenyList[to] = true;
}
| 11,606 |
27 | // stake | totalSupply = totalSupply_ + amount;
balanceOf[msg.sender] = accountBalance + amount;
startedStaking[msg.sender] = block.timestamp;
| totalSupply = totalSupply_ + amount;
balanceOf[msg.sender] = accountBalance + amount;
startedStaking[msg.sender] = block.timestamp;
| 14,671 |
4 | // Create a new drop collection contract with a custom payment address. All params other than `paymentAddress` are the same as in `createNFTTimedEditionCollection`.The nonce must be unique for the msg.sender + implementation version, otherwise this call will revert. name The collection's `name`. symbol The collection's... | function createNFTTimedEditionCollectionWithPaymentAddress(
string calldata name,
string calldata symbol,
string calldata tokenURI,
uint256 mintEndTime,
address approvedMinter,
uint96 nonce,
address payable paymentAddress
| function createNFTTimedEditionCollectionWithPaymentAddress(
string calldata name,
string calldata symbol,
string calldata tokenURI,
uint256 mintEndTime,
address approvedMinter,
uint96 nonce,
address payable paymentAddress
| 20,112 |
9 | // Revert reason should match REENTRANCY | bytes memory reentryMessageData = abi.encodeWithSelector(
bytes4(keccak256("Error(string)")),
"REENTRANCY"
);
| bytes memory reentryMessageData = abi.encodeWithSelector(
bytes4(keccak256("Error(string)")),
"REENTRANCY"
);
| 30,202 |
297 | // mapping of Proposal struct by its ID ID is also the IPFS doc hash of the first ever version of this proposal | mapping (bytes32 => DaoStructs.Proposal) proposalsById;
| mapping (bytes32 => DaoStructs.Proposal) proposalsById;
| 53,349 |
209 | // Create new repo in registry with `_name` and first repo version_name Repo name_dev Address that will be given permission to create versions_initialSemanticVersion Semantic version for new repo version_contractAddress address for smart contract logic for version (if set to 0, it uses last versions&39; contractAddress... | function newRepoWithVersion(
string _name,
address _dev,
uint16[3] _initialSemanticVersion,
address _contractAddress,
bytes _contentURI
) auth(CREATE_REPO_ROLE) public returns (Repo)
| function newRepoWithVersion(
string _name,
address _dev,
uint16[3] _initialSemanticVersion,
address _contractAddress,
bytes _contentURI
) auth(CREATE_REPO_ROLE) public returns (Repo)
| 13,089 |
716 | // Returns net asset cash amounts to the account, the market and the reserve/ return/ netCashToAccount: this is a positive or negative amount of cash change to the account/ netCashToMarket: this is a positive or negative amount of cash change in the marketnetCashToReserve: this is always a positive amount of cash accru... | function _getNetCashAmountsUnderlying(
CashGroupParameters memory cashGroup,
int256 preFeeExchangeRate,
int256 fCashToAccount,
uint256 timeToMaturity
)
private
pure
returns (
int256,
| function _getNetCashAmountsUnderlying(
CashGroupParameters memory cashGroup,
int256 preFeeExchangeRate,
int256 fCashToAccount,
uint256 timeToMaturity
)
private
pure
returns (
int256,
| 65,151 |
15 | // Returns position of `user`/asset Base asset of position/market Market this position was submitted on | function getPosition(address user, address asset, string memory market) public view returns (Position memory) {
bytes32 key = _getPositionKey(user, asset, market);
return positions[key];
}
| function getPosition(address user, address asset, string memory market) public view returns (Position memory) {
bytes32 key = _getPositionKey(user, asset, market);
return positions[key];
}
| 7,000 |
200 | // Create liability | liability = new RobotLiability(robotLiabilityLib);
emit NewLiability(liability);
| liability = new RobotLiability(robotLiabilityLib);
emit NewLiability(liability);
| 54,355 |
0 | // EFFINvault Interface/ | interface IEFFINvaultV1 {
/**
* @dev Returns the token locker lock status.
*/
function LockStatus() external view returns (bool);
/**
* @dev Returns the unix time stamp on when the token locker will be unlocked.
*/
function LockTimeEnd() external view returns (uint256);
/**
* @dev Returns the token add... | interface IEFFINvaultV1 {
/**
* @dev Returns the token locker lock status.
*/
function LockStatus() external view returns (bool);
/**
* @dev Returns the unix time stamp on when the token locker will be unlocked.
*/
function LockTimeEnd() external view returns (uint256);
/**
* @dev Returns the token add... | 38,424 |
5 | // set the DEX router to be used for arbitrage functions | function setRouter(address _router) public override onlyOwner {
router = IUniswapV3Router(_router);
stableCoin.approve(_router, MAX_INT);
}
| function setRouter(address _router) public override onlyOwner {
router = IUniswapV3Router(_router);
stableCoin.approve(_router, MAX_INT);
}
| 18,899 |
37 | // Copying / | contract TestMemoryCopy is MemoryTest {
function testImpl() internal {
bytes memory bts = hex"ffaaffaaffaaffaaffaaffaaffaaffffaaffaaffaaffaaffaaffaaffaaffffaaffaaffaaffaaffaaffaaffaaff";
var (src, len) = Memory.fromBytes(bts);
var dest = Memory.allocate(len);
Memory.copy(src, dest, l... | contract TestMemoryCopy is MemoryTest {
function testImpl() internal {
bytes memory bts = hex"ffaaffaaffaaffaaffaaffaaffaaffffaaffaaffaaffaaffaaffaaffaaffffaaffaaffaaffaaffaaffaaffaaff";
var (src, len) = Memory.fromBytes(bts);
var dest = Memory.allocate(len);
Memory.copy(src, dest, l... | 40,660 |
13 | // GetPropertyLength retrieves the number of properties for a domain. _name the name of the domain. / | function GetPropertyLength(string calldata _name) external view returns (uint256);
| function GetPropertyLength(string calldata _name) external view returns (uint256);
| 29,603 |
54 | // Returns the name associated with an ENS node, for reverse records./Defined in EIP181./node The ENS node to query./ return The associated name. | function name(bytes32 node) public view returns (string memory) {
return records[node].name;
}
| function name(bytes32 node) public view returns (string memory) {
return records[node].name;
}
| 40,815 |
1 | // This emits when ownership of a contract changes. | event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
| event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
| 23,378 |
7 | // solium-disable-next-line security/no-call-value | (success, returnData) = _tx.target.call{value: _tx.value}(_tx.data);
| (success, returnData) = _tx.target.call{value: _tx.value}(_tx.data);
| 16,139 |
1 | // The bytecode of the BitcoinPrice request that will be sent to Witnet | contract BitcoinPriceRequest is WitnetRequestInitializableBase {
function initialize() public {
WitnetRequestInitializableBase.initialize(hex"0ac701124c0801123a68747470733a2f2f6170692e62696e616e63652e636f6d2f6170692f76332f7469636b65722f70726963653f73796d626f6c3d425443555344541a0c8218778218646570726963651259080112... | contract BitcoinPriceRequest is WitnetRequestInitializableBase {
function initialize() public {
WitnetRequestInitializableBase.initialize(hex"0ac701124c0801123a68747470733a2f2f6170692e62696e616e63652e636f6d2f6170692f76332f7469636b65722f70726963653f73796d626f6c3d425443555344541a0c8218778218646570726963651259080112... | 46,838 |
111 | // Emitted every time a token is unstaked Emitted in unstake()by address that unstaked the NFT time block timestamp the NFT were staked at tokenId token ID of NFT that was unstaken stakedAt when the NFT initially staked at reward how many tokens user got for thestaking of the NFT / | event Unstaked(address indexed by, uint256 indexed tokenId, uint256 time, uint256 stakedAt, uint256 reward);
| event Unstaked(address indexed by, uint256 indexed tokenId, uint256 time, uint256 stakedAt, uint256 reward);
| 39,422 |
3 | // Inner representation of the original ERC20 `_balances`. | mapping(address => uint256) private _innerBalances;
| mapping(address => uint256) private _innerBalances;
| 2,617 |
57 | // exchangeRate = invoke Exchange Rate Stored() // If redeemTokensIn > 0: //We calculate the exchange rate and the amount of underlying to be redeemed: redeemTokens = redeemTokensIn redeemAmount = redeemTokensIn x exchangeRateCurrent / | vars.redeemTokens = redeemTokensIn;
| vars.redeemTokens = redeemTokensIn;
| 8,181 |
38 | // modifier to check if caller is owner | modifier isOwner() {
require(msg.sender == contractOwner, "Caller is not owner");
_;
}
| modifier isOwner() {
require(msg.sender == contractOwner, "Caller is not owner");
_;
}
| 8,720 |
17 | // Convert a debt amount for a series from base to fyToken terms./Think about rounding if using, since we are dividing. | function debtFromBase(bytes6 seriesId, uint128 base)
external
returns (uint128 art);
| function debtFromBase(bytes6 seriesId, uint128 base)
external
returns (uint128 art);
| 35,146 |
3 | // Permissions mapping system | struct Perms {
bool Grantee;
bool Burner;
}
| struct Perms {
bool Grantee;
bool Burner;
}
| 11,654 |
117 | // Build huffman table for literal/length codes | err = _construct(lencode, lengths, nlen, 0);
if (
err != ErrorCode.ERR_NONE &&
(err == ErrorCode.ERR_NOT_TERMINATED ||
err == ErrorCode.ERR_OUTPUT_EXHAUSTED ||
nlen != lencode.counts[0] + lencode.counts[1])
) {
| err = _construct(lencode, lengths, nlen, 0);
if (
err != ErrorCode.ERR_NONE &&
(err == ErrorCode.ERR_NOT_TERMINATED ||
err == ErrorCode.ERR_OUTPUT_EXHAUSTED ||
nlen != lencode.counts[0] + lencode.counts[1])
) {
| 27,004 |
7 | // how many taxes were collected during the previous tax interval | function GetLastTaxPool() public view returns (uint256) {
return _lastTaxPool;
}
| function GetLastTaxPool() public view returns (uint256) {
return _lastTaxPool;
}
| 12,734 |
129 | // _stake _voteGap _rewards = ----------------------totalSupply yea + nayoneYear | uint256 _rewards = (_stake.mul(_voteGap).mul(totalSupply)).div((_currentVote.yea.add(_currentVote.nay)).mul(oneYear));
_totalRewards = _totalRewards.add(_rewards);
| uint256 _rewards = (_stake.mul(_voteGap).mul(totalSupply)).div((_currentVote.yea.add(_currentVote.nay)).mul(oneYear));
_totalRewards = _totalRewards.add(_rewards);
| 68,201 |
132 | // Variables/ERC20 fields | string public name = "Wrapped Ether";
uint public total_supply;
mapping(address => uint) internal balances;
mapping(address => mapping (address => uint)) internal allowed;
| string public name = "Wrapped Ether";
uint public total_supply;
mapping(address => uint) internal balances;
mapping(address => mapping (address => uint)) internal allowed;
| 72,691 |
0 | // constructor is called only once when the smart contract is deployed | constructor()
| constructor()
| 14,418 |
8 | // Called by the owner to permission other addresses to generate new. |
function setAuthorization(address _requester, bool _allowed)
external
onlyOwner()
|
function setAuthorization(address _requester, bool _allowed)
external
onlyOwner()
| 51,920 |
10 | // Emitted when a plugin is uninstalled. | event UninstallPlugin(
address indexed owner, IPRBProxy indexed proxy, IPRBProxyPlugin indexed plugin, bytes4[] methods
);
/*//////////////////////////////////////////////////////////////////////////
STRUCTS
| event UninstallPlugin(
address indexed owner, IPRBProxy indexed proxy, IPRBProxyPlugin indexed plugin, bytes4[] methods
);
/*//////////////////////////////////////////////////////////////////////////
STRUCTS
| 33,792 |
9 | // It is important to set this to zero because the recipient can call this function again as part of the receiving call before `send` returns. | pendingDepositReturns[msg.sender] = 0;
if (!msg.sender.send(amount)) {
| pendingDepositReturns[msg.sender] = 0;
if (!msg.sender.send(amount)) {
| 20,166 |
143 | // CalcBPD / | function calcBPD(
uint256 start,
uint256 end,
uint256 shares
| function calcBPD(
uint256 start,
uint256 end,
uint256 shares
| 24,318 |
4 | // Emitted when trying to claim non existent campaign | error NonExistentCampaign();
| error NonExistentCampaign();
| 47,971 |
40 | // Gets the balance of the specified address owner address to query the balance ofreturn uint256 representing the amount owned by the passed address / | function balanceOf(address owner) public view returns (uint256) {
require(owner != address(0));
return _ownedTokensCount[owner];
}
| function balanceOf(address owner) public view returns (uint256) {
require(owner != address(0));
return _ownedTokensCount[owner];
}
| 6,813 |
68 | // Check rollback was effective | require(oldImplementation == _getImplementation(), "ERC1967Upgrade: upgrade breaks further upgrades");
| require(oldImplementation == _getImplementation(), "ERC1967Upgrade: upgrade breaks further upgrades");
| 27,205 |
187 | // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature unique. Appendix F in the Ethereum Yellow paper (https:ethereum.github.io/yellowpaper/paper.pdf), defines the valid range for s in (281): 0 < s < secp256k1n ÷ 2 + 1, and for v in (282): v ∈ {27, 28}. Most signat... | require(
uint256(s) <= 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0,
"ECDSA: invalid signature 's' value"
);
require(v == 27 || v == 28, "ECDSA: invalid signature 'v' value");
| require(
uint256(s) <= 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0,
"ECDSA: invalid signature 's' value"
);
require(v == 27 || v == 28, "ECDSA: invalid signature 'v' value");
| 36,501 |
108 | // Calculate number of tokens of collateral asset to seize given an underlying amount Used in liquidation (called in cToken.liquidateBorrowFresh) cTokenBorrowed The address of the borrowed cToken cTokenCollateral The address of the collateral cToken actualRepayAmount The amount of cTokenBorrowed underlying to convert i... | function liquidateCalculateSeizeTokens(address cTokenBorrowed, address cTokenCollateral, uint actualRepayAmount) external view returns (uint, uint) {
/* Read oracle prices for borrowed and collateral markets */
uint priceBorrowedMantissa = oracle.getUnderlyingPrice(CToken(cTokenBorrowed));
u... | function liquidateCalculateSeizeTokens(address cTokenBorrowed, address cTokenCollateral, uint actualRepayAmount) external view returns (uint, uint) {
/* Read oracle prices for borrowed and collateral markets */
uint priceBorrowedMantissa = oracle.getUnderlyingPrice(CToken(cTokenBorrowed));
u... | 9,115 |
64 | // the value needs to less or equal than a cap which is limit for accepted funds | uint256 public constant CAP = 619 ether;
StandardToken _token;
address private _wallet;
function ICOCrowdsale(
address wallet,
StandardToken token,
uint256 start
)
| uint256 public constant CAP = 619 ether;
StandardToken _token;
address private _wallet;
function ICOCrowdsale(
address wallet,
StandardToken token,
uint256 start
)
| 30,839 |
231 | // Sets the auction duration of the NFT self The NFT configuration auctionDuration The auction duration / | function setAuctionDuration(DataTypes.NftConfigurationMap memory self, uint256 auctionDuration) internal pure {
require(auctionDuration <= MAX_VALID_AUCTION_DURATION, Errors.RC_INVALID_AUCTION_DURATION);
self.data = (self.data & AUCTION_DURATION_MASK) | (auctionDuration << AUCTION_DURATION_START_BIT_POSITION... | function setAuctionDuration(DataTypes.NftConfigurationMap memory self, uint256 auctionDuration) internal pure {
require(auctionDuration <= MAX_VALID_AUCTION_DURATION, Errors.RC_INVALID_AUCTION_DURATION);
self.data = (self.data & AUCTION_DURATION_MASK) | (auctionDuration << AUCTION_DURATION_START_BIT_POSITION... | 64,419 |
63 | // Allows mint long synthetic assets for a market on behalf of some user. To prevent front-running these mints are executed on the next price update from the oracle./poolTier leveraged poolTier index/amount Amount of payment tokens in that token's lowest denomination for which to mint synthetic assets at next price./us... | function mintLongFor(
uint256 poolTier,
uint224 amount,
address user
| function mintLongFor(
uint256 poolTier,
uint224 amount,
address user
| 21,663 |
31 | // ERC677 TokenFallback Function. _wallet The team address can send BTCL tokens to the Seed Round Contract. _value The amount of tokens sent by the team to the BTCL Seed Round Contract. _data The transaction metadata. / | function onTokenTransfer(address _wallet, uint256 _value, bytes memory _data) public {
require(_msgSender() == address(btclToken), "Contract only accepts BTCL Tokens");
require(wallet == _wallet,"Only team wallet is allowed");
emit DepositedTokens(_wallet, _value, _data);
}
| function onTokenTransfer(address _wallet, uint256 _value, bytes memory _data) public {
require(_msgSender() == address(btclToken), "Contract only accepts BTCL Tokens");
require(wallet == _wallet,"Only team wallet is allowed");
emit DepositedTokens(_wallet, _value, _data);
}
| 10,073 |
11 | // Number of NOTES (800 million) | uint256 public constant TOTAL_SUPPLY = 2000 * (10**6) * 10**uint256(decimals);
| uint256 public constant TOTAL_SUPPLY = 2000 * (10**6) * 10**uint256(decimals);
| 38,609 |
6 | // // Available amount to claim _recipient Recipient to lookup / | function available(address _recipient) public view returns (uint256) {
uint256 vested = _totalVestedOf(_recipient, block.timestamp);
return vested - totalClaimed[_recipient];
}
| function available(address _recipient) public view returns (uint256) {
uint256 vested = _totalVestedOf(_recipient, block.timestamp);
return vested - totalClaimed[_recipient];
}
| 1,805 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.