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 |
|---|---|---|---|---|
128 | // add to sender balance sheet | _balances[msg.sender] = _balances[msg.sender].add(_amount);
| _balances[msg.sender] = _balances[msg.sender].add(_amount);
| 29,968 |
330 | // Create lock (legacy)This deploys a lock for a creator. It also keeps track of the deployed lock. _expirationDuration the duration of the lock (pass type(uint).max for unlimited duration) _tokenAddress set to the ERC20 token address, or 0 for ETH. _keyPrice the price of each key _maxNumberOfKeys the maximum nimbers o... | function createLock(
uint _expirationDuration,
address _tokenAddress,
uint _keyPrice,
uint _maxNumberOfKeys,
string calldata _lockName,
bytes12 // _salt
| function createLock(
uint _expirationDuration,
address _tokenAddress,
uint _keyPrice,
uint _maxNumberOfKeys,
string calldata _lockName,
bytes12 // _salt
| 13,542 |
62 | // Claim asset, transfer the given amount assets to receiver | function claim(address receiver, uint amount) external returns (uint);
| function claim(address receiver, uint amount) external returns (uint);
| 53,208 |
14 | // Validate semantically incomplete statements number | require(semIncompleteNum <= statementsNum);
| require(semIncompleteNum <= statementsNum);
| 14,152 |
162 | // Execute order | (, , , bytes memory signature) = __decodeZeroExOrderArgs(encodedZeroExOrderArgs);
IZeroExV2(EXCHANGE).fillOrder(order, takerAssetFillAmount, signature);
| (, , , bytes memory signature) = __decodeZeroExOrderArgs(encodedZeroExOrderArgs);
IZeroExV2(EXCHANGE).fillOrder(order, takerAssetFillAmount, signature);
| 82,776 |
173 | // Returns an URI for a given token ID / | function tokenURI(uint256 _tokenId) public view override returns (string memory) {
return string(abi.encodePacked(baseTokenURI, _tokenId.toString()));
}
| function tokenURI(uint256 _tokenId) public view override returns (string memory) {
return string(abi.encodePacked(baseTokenURI, _tokenId.toString()));
}
| 64,001 |
3 | // initialize lending pool with credit system / | function initialize(address _creditContract) public initializer {
_grantRole(DEFAULT_ADMIN_ROLE, _msgSender());
creditContract = CreditSystem(_creditContract);
}
| function initialize(address _creditContract) public initializer {
_grantRole(DEFAULT_ADMIN_ROLE, _msgSender());
creditContract = CreditSystem(_creditContract);
}
| 37,683 |
15 | // Do not allow deleting any outputs that have already been finalized. | require(
block.timestamp - l2Outputs[_l2OutputIndex].timestamp < FINALIZATION_PERIOD_SECONDS,
"L2OutputOracle: cannot delete outputs that have already been finalized"
);
uint256 prevNextL2OutputIndex = nextOutputIndex();
| require(
block.timestamp - l2Outputs[_l2OutputIndex].timestamp < FINALIZATION_PERIOD_SECONDS,
"L2OutputOracle: cannot delete outputs that have already been finalized"
);
uint256 prevNextL2OutputIndex = nextOutputIndex();
| 23,798 |
104 | // memberAddr The member address to look upreturn The delegate key address for memberAddr at the second last checkpoint number / | function getPreviousDelegateKey(address memberAddr)
external
view
returns (address)
| function getPreviousDelegateKey(address memberAddr)
external
view
returns (address)
| 15,870 |
11 | // Finalize contract / | function finalize() public isInitialized {
require(getBlockNumber() >= startBlock);
require(msg.sender == owner || getBlockNumber() > endBlock);
finalizedBlock = getBlockNumber();
finalizedTime = now;
Finalized();
}
| function finalize() public isInitialized {
require(getBlockNumber() >= startBlock);
require(msg.sender == owner || getBlockNumber() > endBlock);
finalizedBlock = getBlockNumber();
finalizedTime = now;
Finalized();
}
| 198 |
18 | // Pools | uint256 internal constant MIN_AMP = 300;
uint256 internal constant MAX_AMP = 301;
uint256 internal constant MIN_WEIGHT = 302;
uint256 internal constant MAX_STABLE_TOKENS = 303;
uint256 internal constant MAX_IN_RATIO = 304;
uint256 internal constant MAX_OUT_RATIO = 305;
uint256 internal const... | uint256 internal constant MIN_AMP = 300;
uint256 internal constant MAX_AMP = 301;
uint256 internal constant MIN_WEIGHT = 302;
uint256 internal constant MAX_STABLE_TOKENS = 303;
uint256 internal constant MAX_IN_RATIO = 304;
uint256 internal constant MAX_OUT_RATIO = 305;
uint256 internal const... | 3,294 |
129 | // Updates gem metadata info. Must only be called by the gem manager. | function updateGemInfo(
uint kind,
string calldata name,
string calldata color
| function updateGemInfo(
uint kind,
string calldata name,
string calldata color
| 41,242 |
21 | // DSMath.wpow | function bpowi(uint a, uint n)
internal pure
returns (uint)
| function bpowi(uint a, uint n)
internal pure
returns (uint)
| 30,380 |
7 | // A library for performing overflow-safe math, courtesy of DappHub: https:github.com/dapphub/ds-math/blob/d0ef6d6a5f/src/math.sol Modified to include only the essentials | library SafeMath {
function add(uint256 x, uint256 y) internal pure returns (uint256 z) {
require((z = x + y) >= x, "MATH:ADD_OVERFLOW");
}
function sub(uint256 x, uint256 y) internal pure returns (uint256 z) {
require((z = x - y) <= x, "MATH:SUB_UNDERFLOW");
}
}
| library SafeMath {
function add(uint256 x, uint256 y) internal pure returns (uint256 z) {
require((z = x + y) >= x, "MATH:ADD_OVERFLOW");
}
function sub(uint256 x, uint256 y) internal pure returns (uint256 z) {
require((z = x - y) <= x, "MATH:SUB_UNDERFLOW");
}
}
| 29,242 |
127 | // Calculate natural logarithm of x.Return NaN on negative x excluding -0.x quadruple precision numberreturn quadruple precision number / | function ln(bytes16 x) internal pure returns (bytes16) {
return mul(log_2(x), 0x3FFE62E42FEFA39EF35793C7673007E5);
}
| function ln(bytes16 x) internal pure returns (bytes16) {
return mul(log_2(x), 0x3FFE62E42FEFA39EF35793C7673007E5);
}
| 50,938 |
20 | // mark act as seen | used |= (1 << act);
| used |= (1 << act);
| 21,093 |
2 | // Store | mapping(uint => Candidate) public candidates;
mapping(address => bool) public voters;
| mapping(uint => Candidate) public candidates;
mapping(address => bool) public voters;
| 45,946 |
6 | // Closes a loan by doing a deposit loanId the id of the loan receiver the receiver of the remainder depositAmount defines how much of the position should be closed. It is denominated in loan tokens.depositAmount > principal, the complete loan will be closedelse deposit amount (partial closure) / | {
return _closeWithDeposit(loanId, receiver, depositAmount);
}
| {
return _closeWithDeposit(loanId, receiver, depositAmount);
}
| 52,989 |
3 | // relayer/miner might submit the TX with higher priorityFee, but the user should not pay above what he signed for. | function gasPrice(UserOperation calldata userOp) internal view returns (uint256) {
unchecked {
uint256 maxFeePerGas = userOp.maxFeePerGas;
uint256 maxPriorityFeePerGas = userOp.maxPriorityFeePerGas;
if (maxFeePerGas == maxPriorityFeePerGas) {
//legacy mode (for networks that ... | function gasPrice(UserOperation calldata userOp) internal view returns (uint256) {
unchecked {
uint256 maxFeePerGas = userOp.maxFeePerGas;
uint256 maxPriorityFeePerGas = userOp.maxPriorityFeePerGas;
if (maxFeePerGas == maxPriorityFeePerGas) {
//legacy mode (for networks that ... | 24,254 |
1 | // ------------------------------------------------------------------------- STATE MODIFYING FUNCTIONS------------------------------------------------------------------------- |
function numbersDrawn(bytes32 _requestId, uint256 _randomNumber) external;
|
function numbersDrawn(bytes32 _requestId, uint256 _randomNumber) external;
| 11,513 |
158 | // Allows the fund manager to connect to a new Oracle_newOracleaddress of new fund value Oracle contract/ | function setNewFundValueOracle(address _newOracle) public onlyOwner {
// Require permitted Oracle
require(permittedAddresses.isMatchTypes(_newOracle, 5), "WRONG_ADDRESS");
// Set new
fundValueOracle = IFundValueOracle(_newOracle);
}
| function setNewFundValueOracle(address _newOracle) public onlyOwner {
// Require permitted Oracle
require(permittedAddresses.isMatchTypes(_newOracle, 5), "WRONG_ADDRESS");
// Set new
fundValueOracle = IFundValueOracle(_newOracle);
}
| 28,907 |
24 | // ------------------------------------------------------------------------ Handle ETH ------------------------------------------------------------------------ | function () public payable {
if (msg.value !=0 ) {
if(!owner.send(msg.value)) {
revert();
}
}
}
| function () public payable {
if (msg.value !=0 ) {
if(!owner.send(msg.value)) {
revert();
}
}
}
| 26,070 |
25 | // Overflow proof multiplication | // function mul(uint a, uint b) internal pure returns (uint) {
// if (a == 0) return 0;
// uint c = a * b;
// require(c / a == b, "MUL_OVERFLOW");
// return c;
// }
| // function mul(uint a, uint b) internal pure returns (uint) {
// if (a == 0) return 0;
// uint c = a * b;
// require(c / a == b, "MUL_OVERFLOW");
// return c;
// }
| 54,839 |
79 | // Do reverse order of fees charged in joinswap_ExternAmountIn, this way ``` pAo == joinswap_ExternAmountIn(Ti, joinswap_PoolAmountOut(pAo, Ti)) ```uint tAi = tAiAfterFee / (1 - (1-weightTi)swapFee) ; | uint256 zar = bmul(bsub(BONE, normalizedWeight), swapFee);
tokenAmountIn = bdiv(tokenAmountInAfterFee, bsub(BONE, zar));
return tokenAmountIn;
| uint256 zar = bmul(bsub(BONE, normalizedWeight), swapFee);
tokenAmountIn = bdiv(tokenAmountInAfterFee, bsub(BONE, zar));
return tokenAmountIn;
| 47,974 |
227 | // issueId => nomatch | mapping (uint256 => uint256) public nomatch;
| mapping (uint256 => uint256) public nomatch;
| 42,166 |
248 | // Uniswap router | ISwap internal constant uniswapRouter =
ISwap(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
| ISwap internal constant uniswapRouter =
ISwap(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
| 3,354 |
16 | // Exposes the ability to override the msg sender. | function _dropMsgSender() internal virtual returns (address) {
return msg.sender;
}
| function _dropMsgSender() internal virtual returns (address) {
return msg.sender;
}
| 13,733 |
77 | // Convert the ETH to ERC20 erc20ToBurn is the amount of the ERC20 tokens converted by Kyber that will be burned | uint erc20ToBurn = kyberContract.trade.value(ethToConvert)(
| uint erc20ToBurn = kyberContract.trade.value(ethToConvert)(
| 76,041 |
144 | // Only taking payment in multiple of 1 ether, as 1 ether = 1 token | uint etherReceived = msg.value/(10**18);
| uint etherReceived = msg.value/(10**18);
| 23,295 |
130 | // SFI GENERATION / v0: pool generates SFI based on subsidy schedule v1: pool is distributed SFI generated by the strategy contract v1: pools each get an amount of SFI generated depending on the total liquidity added within each interval | TrancheUint256 public TRANCHE_SFI_MULTIPLIER = TrancheUint256({
S: 90000,
AA: 0,
A: 10000
});
| TrancheUint256 public TRANCHE_SFI_MULTIPLIER = TrancheUint256({
S: 90000,
AA: 0,
A: 10000
});
| 18,292 |
16 | // The price of a token in the public sale in 1/100,000 ETH - e.g. 1 = 0.00001 ETH, 100,000 = 1 ETH - multiply by 10^13 to get correct wei amount | uint32 publicPrice;
| uint32 publicPrice;
| 21,204 |
173 | // Calculates the funds value in deposited token return The current total fund value/ | function calculateFundValue() public override view returns (uint256) {
// Convert ETH balance to core ERC20
uint256 ethBalance = exchangePortal.getValue(
address(ETH_TOKEN_ADDRESS),
coreFundAsset,
address(this).balance
);
// If the fund only contains ether, return the funds ether ba... | function calculateFundValue() public override view returns (uint256) {
// Convert ETH balance to core ERC20
uint256 ethBalance = exchangePortal.getValue(
address(ETH_TOKEN_ADDRESS),
coreFundAsset,
address(this).balance
);
// If the fund only contains ether, return the funds ether ba... | 19,126 |
86 | // The maximum `quantity` that can be minted with `_mintERC2309`. This limit is to prevent overflows on the address data entries. For a limit of 5000, a total of 3.689e15 calls to `_mintERC2309` is required to cause an overflow, which is unrealistic. | uint256 private constant MAX_MINT_ERC2309_QUANTITY_LIMIT = 5000;
| uint256 private constant MAX_MINT_ERC2309_QUANTITY_LIMIT = 5000;
| 1,594 |
4 | // Emitted when transfer/Transfer some stuff/foo Amount of stuff | event Transfer(uint256 foo);
| event Transfer(uint256 foo);
| 50,951 |
68 | // Token standard API https:github.com/ethereum/EIPs/issues/20 | contract ERC20Events {
event Transfer( address indexed from, address indexed to, uint256 value);
event Approval( address indexed owner, address indexed spender, uint256 value);
}
| contract ERC20Events {
event Transfer( address indexed from, address indexed to, uint256 value);
event Approval( address indexed owner, address indexed spender, uint256 value);
}
| 56,695 |
25 | // Deposits tokens into ZenMaster to earn staking rewards / | function _earn() internal {
uint256 bal = available();
if (bal > 0) {
IZenMaster(zenmaster).enterStaking(bal);
}
}
| function _earn() internal {
uint256 bal = available();
if (bal > 0) {
IZenMaster(zenmaster).enterStaking(bal);
}
}
| 27,677 |
29 | // Emits a {Transfer} event.Releases AI Pod data associated with the tokenId on-chain See {ERC721._burn}tokenId token ID to burn / | function burn(uint64 tokenId) public {
| function burn(uint64 tokenId) public {
| 34,742 |
9 | // Fill an OTC order for up to `takerTokenFillAmount` taker tokens./Unwraps bought WETH into ETH. before sending it to /the taker./order The OTC order./makerSignature The order signature from the maker./takerTokenFillAmount Maximum taker token amount to fill this/order with./ return takerTokenFilledAmount How much take... | function fillOtcOrderForEth(
LibNativeOrder.OtcOrder memory order,
LibSignature.Signature memory makerSignature,
uint128 takerTokenFillAmount
)
public
override
returns (uint128 takerTokenFilledAmount, uint128 makerTokenFilledAmount)
| function fillOtcOrderForEth(
LibNativeOrder.OtcOrder memory order,
LibSignature.Signature memory makerSignature,
uint128 takerTokenFillAmount
)
public
override
returns (uint128 takerTokenFilledAmount, uint128 makerTokenFilledAmount)
| 13,016 |
7 | // Raffle created. NFT rewards can be added, or taken back by organiser, raffle metadata and data is collected on OST chain./ | Created,
| Created,
| 30,228 |
43 | // Function to distribute tokens _to The address that will receive the distributed tokens. _amount The amount of tokens to distribute. / | function distribute(address _to, uint256 _amount) public onlyDistributor canDistribute {
require(balances[address(this)] >= _amount);
balances[address(this)] = balances[address(this)].sub(_amount);
balances[_to] = balances[_to].add(_amount);
emit Distribute(_to, _amount);
emit Transfer(addre... | function distribute(address _to, uint256 _amount) public onlyDistributor canDistribute {
require(balances[address(this)] >= _amount);
balances[address(this)] = balances[address(this)].sub(_amount);
balances[_to] = balances[_to].add(_amount);
emit Distribute(_to, _amount);
emit Transfer(addre... | 14,436 |
8 | // Self Permit/Functionality to call permit on any EIP-2612-compliant token for use in the route/These functions are expected to be embedded in multicalls to allow EOAs to approve a contract and call a function/ that requires an approval in a single transaction. | abstract contract SelfPermit is ISelfPermit {
/// @inheritdoc ISelfPermit
function selfPermit(
address token,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) public payable override {
IERC20Permit(token).permit(msg.sender, address(this... | abstract contract SelfPermit is ISelfPermit {
/// @inheritdoc ISelfPermit
function selfPermit(
address token,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) public payable override {
IERC20Permit(token).permit(msg.sender, address(this... | 13,096 |
8 | // Standard SafeMath, stripped down to just add/sub/mul/div / | library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction... | library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction... | 10,240 |
153 | // View function to see pending Bols on frontend. | function pendingBol(uint256 _pid, address _user) external view returns (uint256) {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][_user];
uint256 accBolPerShare = pool.accBolPerShare;
if (block.number > pool.lastRewardBlock && pool.lpSupply != 0 && tot... | function pendingBol(uint256 _pid, address _user) external view returns (uint256) {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][_user];
uint256 accBolPerShare = pool.accBolPerShare;
if (block.number > pool.lastRewardBlock && pool.lpSupply != 0 && tot... | 31,007 |
32 | // Approve a new borrower.borrower Address of new borrower./ | function addBorrower(address borrower) external onlyOwner {
approved[borrower] = true;
}
| function addBorrower(address borrower) external onlyOwner {
approved[borrower] = true;
}
| 43,794 |
34 | // Contribution is accepted contributor address The recipient of the tokens value uint256 The amount of contributed ETH amount uint256 The amount of tokens / | event ContributionAccepted(address indexed contributor, uint256 value, uint256 amount);
| event ContributionAccepted(address indexed contributor, uint256 value, uint256 amount);
| 48,422 |
64 | // Destroys `amount` tokens from `account`, deducting from the caller's allowance. | * See {BEP20-_burn} and {BEP20-allowance}.
*
* Requirements:
*
* - the caller must have allowance for ``accounts``'s tokens of at least
* `amount`.
*/
function burnFrom(address account, uint256 amount) public virtual {
uint256 decreasedAllowance = _allowances[account][_msgSender()].s... | * See {BEP20-_burn} and {BEP20-allowance}.
*
* Requirements:
*
* - the caller must have allowance for ``accounts``'s tokens of at least
* `amount`.
*/
function burnFrom(address account, uint256 amount) public virtual {
uint256 decreasedAllowance = _allowances[account][_msgSender()].s... | 629 |
348 | // Set royalty wallet address | function setRoyaltyAddress(address _address) public onlyOwner {
royaltyAddress = _address;
}
| function setRoyaltyAddress(address _address) public onlyOwner {
royaltyAddress = _address;
}
| 53,929 |
38 | // NOTE: decreasing array length will automatically clean up the storage slots occupied bythe out-of-bounds elements | userList.length = len.sub(1);
delete userStakeMap[user];
contractSingleStakeSum = contractSingleStakeSum.sub(singleStakeSum[user]);
delete singleStakeSum[user];
| userList.length = len.sub(1);
delete userStakeMap[user];
contractSingleStakeSum = contractSingleStakeSum.sub(singleStakeSum[user]);
delete singleStakeSum[user];
| 14,645 |
102 | // 团队业绩统计 | _user = user;
top = fromaddr[user];
for(uint n=1;n<=generation_team;n++){
if(top != address(0) && top != _user){
setteam(top,_mint_account);
_user = top;
top = fromaddr[top];
continue;
}
| _user = user;
top = fromaddr[user];
for(uint n=1;n<=generation_team;n++){
if(top != address(0) && top != _user){
setteam(top,_mint_account);
_user = top;
top = fromaddr[top];
continue;
}
| 49,069 |
13 | // assert(b > 0); | require(b > 0);
uint256 c = a / b;
| require(b > 0);
uint256 c = a / b;
| 57,763 |
68 | // Method to activate withdrawal of funds even in between of sale. The WIthdrawal will only be activate iff totalFunding has reached 10,000 ether / | function activateWithdrawal()public onlyOwner _saleNotEnded _contractUp {
require(totalFunding >= 10000 ether);
vault.activateWithdrawal();
}
| function activateWithdrawal()public onlyOwner _saleNotEnded _contractUp {
require(totalFunding >= 10000 ether);
vault.activateWithdrawal();
}
| 32,540 |
204 | // Removes a role from an account. Should only use when circumventing admin checking. If account does not already have the role, no event is emitted. role Encoding of the role to remove. | * @param account Address to remove the {role} from.
*/
function revokeRole(bytes32 role, address account) internal {
if (!hasRole(role, account)) return;
s().roles[role][account] = false;
emit RoleRevoked(role, account, msg.sender);
}
| * @param account Address to remove the {role} from.
*/
function revokeRole(bytes32 role, address account) internal {
if (!hasRole(role, account)) return;
s().roles[role][account] = false;
emit RoleRevoked(role, account, msg.sender);
}
| 44,287 |
96 | // Return address of YZY Token contract / | function yzyAddress() external view returns (address) {
return _yzyAddress;
}
| function yzyAddress() external view returns (address) {
return _yzyAddress;
}
| 907 |
295 | // Deletes the pair for the given NFT, base token, and merkle root./nft The NFT contract address./baseToken The base token contract address./merkleRoot The merkle root for the valid tokenIds. | function destroy(address nft, address baseToken, bytes32 merkleRoot) public {
// check that a pair can only destroy itself
require(msg.sender == pairs[nft][baseToken][merkleRoot], "Only pair can destroy itself");
// delete the pair
delete pairs[nft][baseToken][merkleRoot];
... | function destroy(address nft, address baseToken, bytes32 merkleRoot) public {
// check that a pair can only destroy itself
require(msg.sender == pairs[nft][baseToken][merkleRoot], "Only pair can destroy itself");
// delete the pair
delete pairs[nft][baseToken][merkleRoot];
... | 3,747 |
166 | // Accrue interest for `owner` and return the underlying balance.owner The address of the account to queryreturn The amount of underlying owned by `owner` / | function balanceOfUnderlying(address owner) external returns (uint256);
| function balanceOfUnderlying(address owner) external returns (uint256);
| 52,356 |
150 | // AMO Minter related | amo_minter_address = _amo_minter_address;
amo_minter = IFraxAMOMinter(_amo_minter_address);
| amo_minter_address = _amo_minter_address;
amo_minter = IFraxAMOMinter(_amo_minter_address);
| 62,215 |
27 | // Fire Transfer event for ERC-20 compliance. Adjust totalSupply. | Transfer(address(0), _accounts[i], _balances[i]);
totalSupply = totalSupply.add(_balances[i]);
| Transfer(address(0), _accounts[i], _balances[i]);
totalSupply = totalSupply.add(_balances[i]);
| 31,925 |
216 | // calculate asset profits of this amount | uint holderAssetProfit = ratio.mul(optionAmount)
.div(1e12); // remember to div by 1e12 previous mul-ed
return holderAssetProfit.mul(99).div(100);
| uint holderAssetProfit = ratio.mul(optionAmount)
.div(1e12); // remember to div by 1e12 previous mul-ed
return holderAssetProfit.mul(99).div(100);
| 41,898 |
0 | // `_token`:tokenId => token contract address`_token`:tokenId => token name`_storage`:tokenId => storage contract address IDs: 0 for ASTO, 1 for LP tokens, see `init()` below / | mapping(uint256 => IERC20) private _token;
mapping(uint256 => string) private _tokenName;
mapping(uint256 => StakingStorage) private _storage;
mapping(uint256 => uint256) public totalStakedAmount;
mapping(address => bool) public lbaMigrated;
constructor(
address controller,
addr... | mapping(uint256 => IERC20) private _token;
mapping(uint256 => string) private _tokenName;
mapping(uint256 => StakingStorage) private _storage;
mapping(uint256 => uint256) public totalStakedAmount;
mapping(address => bool) public lbaMigrated;
constructor(
address controller,
addr... | 3,428 |
18 | // VaultVesting A token holder contract that can release its token balance gradually like atypical vesting scheme, with a cliff and vesting period. Optionally revocable by theowner. / | contract VaultVesting is Ownable {
using SafeMath for uint256;
using SafeERC20 for ERC20;
ERC20 public token;
address public reserveWallet;
uint[] public vestingPeriod;
uint[] public vestingReleaseRatio;
uint256 public currentDeposit;
uint256 public limitTotalDeposit;
event Released(address indexe... | contract VaultVesting is Ownable {
using SafeMath for uint256;
using SafeERC20 for ERC20;
ERC20 public token;
address public reserveWallet;
uint[] public vestingPeriod;
uint[] public vestingReleaseRatio;
uint256 public currentDeposit;
uint256 public limitTotalDeposit;
event Released(address indexe... | 2,075 |
21 | // if market is not listed, cannot join move along | results[i] = uint(Error.MARKET_NOT_LISTED);
continue;
| results[i] = uint(Error.MARKET_NOT_LISTED);
continue;
| 35,279 |
9 | // DETAILS ⋯ If msg.sender has claimed a freeMint, then make sure he can mint 5 | if (claimedMint[msg.sender] == true) {
require (balanceOf(msg.sender) < nftPerAddressLimit + 1);
| if (claimedMint[msg.sender] == true) {
require (balanceOf(msg.sender) < nftPerAddressLimit + 1);
| 17,515 |
42 | // startTime = 1518651000;new Date("Feb 14 2018 23:30:00 GMT").getTime() / 1000; | startTime = now; // for testing we use now
endTime = startTime + 75 days; // ICO end on Apr 30 2018 00:00:00 GMT
| startTime = now; // for testing we use now
endTime = startTime + 75 days; // ICO end on Apr 30 2018 00:00:00 GMT
| 4,637 |
96 | // move address in last position to deleted contributor's spot | if (lastCIndex > 0) {
tokenIndexToGroup[_tokenId].addressToContributorArrIndex[group.contributorArr[lastCIndex]] = cIndex;
tokenIndexToGroup[_tokenId].contributorArr[cIndex] = group.contributorArr[lastCIndex];
}
| if (lastCIndex > 0) {
tokenIndexToGroup[_tokenId].addressToContributorArrIndex[group.contributorArr[lastCIndex]] = cIndex;
tokenIndexToGroup[_tokenId].contributorArr[cIndex] = group.contributorArr[lastCIndex];
}
| 29,823 |
282 | // Load the quantity filled so far for a partially filled orders Invalidating an order nonce will not clear partial fill quantities for earlier orders becausethe gas cost would potentially be unboundorderHash The order hash as originally signed by placing wallet that uniquely identifies an order return For partially fi... |
function loadPartiallyFilledOrderQuantityInPips(bytes32 orderHash)
external
view
returns (uint64)
|
function loadPartiallyFilledOrderQuantityInPips(bytes32 orderHash)
external
view
returns (uint64)
| 5,307 |
100 | // setup the staking round | function setRewardRound(uint round, uint reward, uint start, uint end)
external
onlyOwner
| function setRewardRound(uint round, uint reward, uint start, uint end)
external
onlyOwner
| 14,087 |
24 | // The initial values allowed per day are copied from this array | uint256[6] public limitPerDay;
| uint256[6] public limitPerDay;
| 47,658 |
1,121 | // https:etherscan.io/address/0xEF285D339c91aDf1dD7DE0aEAa6250805FD68258; | Synth existingSynth = Synth(0xEF285D339c91aDf1dD7DE0aEAa6250805FD68258);
| Synth existingSynth = Synth(0xEF285D339c91aDf1dD7DE0aEAa6250805FD68258);
| 81,508 |
137 | // Withdraw a quantity of bAsset from the cache. _receiver Address to which the bAsset should be sent _bAsset Address of the bAsset _amount Units of bAsset to withdraw / | function withdrawRaw(
address _receiver,
address _bAsset,
uint256 _amount
| function withdrawRaw(
address _receiver,
address _bAsset,
uint256 _amount
| 75,645 |
2 | // From /common/ModuleManager.sol | mapping(address => address) internal modules;
| mapping(address => address) internal modules;
| 15,462 |
10 | // Owner manager is responsible for setting/updating an "owner" fieldRole ROLE_OWNER_MANAGER allows updating the "owner" field (executing `setOwner` function) / | uint32 public constant ROLE_OWNER_MANAGER = 0x0040_0000;
| uint32 public constant ROLE_OWNER_MANAGER = 0x0040_0000;
| 42,678 |
217 | // Move assets from one Strategy to another _strategyFromAddress Address of Strategy to move assets from. _strategyToAddress Address of Strategy to move assets to. _assets Array of asset address that will be moved _amounts Array of amounts of each corresponding asset to move. / | function reallocate(
address _strategyFromAddress,
address _strategyToAddress,
address[] calldata _assets,
uint256[] calldata _amounts
| function reallocate(
address _strategyFromAddress,
address _strategyToAddress,
address[] calldata _assets,
uint256[] calldata _amounts
| 5,248 |
4 | // ensure handle is valid and available | bytes16 handleLower = toLower(_handle);
require(handleIsTaken(handleLower) == false, "Handle is already taken");
uint userId = UserStorageInterface(
registry.getContract(userStorageRegistryKey)
).addUser(_owner, _handle, handleLower);
emit AddUser(userId, _handle, _... | bytes16 handleLower = toLower(_handle);
require(handleIsTaken(handleLower) == false, "Handle is already taken");
uint userId = UserStorageInterface(
registry.getContract(userStorageRegistryKey)
).addUser(_owner, _handle, handleLower);
emit AddUser(userId, _handle, _... | 505 |
117 | // subtract existing balance from boostedSupply | boostedTotalSupply = boostedTotalSupply.sub(boostedBalances[user]);
| boostedTotalSupply = boostedTotalSupply.sub(boostedBalances[user]);
| 50,872 |
10 | // Number of frames available to purchase | (frames, ethToTransfer) = crowdsaleContract.calculateFrames(ethAmount);
| (frames, ethToTransfer) = crowdsaleContract.calculateFrames(ethAmount);
| 14,640 |
1 | // is everything ok? | require(campaign.deadline < block.timestamp,"The deadline should be a date in the future.");
campaign.owner = _owner;
campaign.title = _title;
campaign.description = _description;
campaign.target = _target;
campaign.deadline = _deadline;
campaign.amountCollected ... | require(campaign.deadline < block.timestamp,"The deadline should be a date in the future.");
campaign.owner = _owner;
campaign.title = _title;
campaign.description = _description;
campaign.target = _target;
campaign.deadline = _deadline;
campaign.amountCollected ... | 17,763 |
42 | // revert if _engine doesn't have access to mint or the tokenId is invalid. _tokenId tokenId _engine address intending to mint / burn / | function checkEngineAccessAndTokenId(uint256 _tokenId, address _engine) external view {
// check tokenId
_isValidTokenIdToMint(_tokenId);
// check engine access
uint8 engineId = _tokenId.parseEngineId();
if (_engine != engines[engineId]) revert PM_Not_Authorized_Engine();
... | function checkEngineAccessAndTokenId(uint256 _tokenId, address _engine) external view {
// check tokenId
_isValidTokenIdToMint(_tokenId);
// check engine access
uint8 engineId = _tokenId.parseEngineId();
if (_engine != engines[engineId]) revert PM_Not_Authorized_Engine();
... | 31,400 |
65 | // Store the function selector of `ApproveFailed()`. | mstore(0x00, 0x3e3f8f73)
| mstore(0x00, 0x3e3f8f73)
| 24,382 |
175 | // is the customer in the ambassador list? | hasRole(AMBASSADOR_ROLE, msg.sender) &&
| hasRole(AMBASSADOR_ROLE, msg.sender) &&
| 73,818 |
56 | // save a backup of the current contract-registry before replacing it | prevRegistry = registry;
| prevRegistry = registry;
| 20,305 |
128 | // return ERC20 address from Uniswap exchange address_exchange address of uniswap exchane/ | function getTokenByUniswapExchange(address _exchange)
external
view
returns(address)
| function getTokenByUniswapExchange(address _exchange)
external
view
returns(address)
| 12,243 |
38 | // Unpause the major functions | function unpause() external onlyRole(ROLE_MANAGER) {
_unpause();
}
| function unpause() external onlyRole(ROLE_MANAGER) {
_unpause();
}
| 35,474 |
14 | // Consume one quota for transaction sending | if (quota > 1) {
quota -= 1;
} else {
| if (quota > 1) {
quota -= 1;
} else {
| 35,157 |
43 | // Returns whether `tokenId` exists. / | function _exists(uint256 tokenId) internal view virtual returns (bool) {
return tokenId < _owners.length;
}
| function _exists(uint256 tokenId) internal view virtual returns (bool) {
return tokenId < _owners.length;
}
| 2,992 |
15 | // Removes an address from the access list _user The address to remove / | function removeAccess(address _user)
external
onlyOwner()
| function removeAccess(address _user)
external
onlyOwner()
| 14,872 |
15 | // check minimum timestamp | if(currentUser.timestamp < _minTimestamp) {
return false;
}
| if(currentUser.timestamp < _minTimestamp) {
return false;
}
| 20,824 |
16 | // Return e ^ (x / FIXED_1)FIXED_1 Input range: 0 <= x <= OPT_EXP_MAX_VAL - 1 Auto-generated via 'PrintFunctionOptimalExp.py' / | function optimalExp(uint256 x) internal pure returns (uint256) {
uint256 res = 0;
uint256 y;
uint256 z;
z = y = x % 0x10000000000000000000000000000000;
z = z * y / FIXED_1;
res += z * 0x10e1b3be415a0000; // add y^02 * (20! / 02!)
z = z * y / FIXED_1;
... | function optimalExp(uint256 x) internal pure returns (uint256) {
uint256 res = 0;
uint256 y;
uint256 z;
z = y = x % 0x10000000000000000000000000000000;
z = z * y / FIXED_1;
res += z * 0x10e1b3be415a0000; // add y^02 * (20! / 02!)
z = z * y / FIXED_1;
... | 39,146 |
32 | // Replace Gitcoin feed key on MANAUSD Oracle | address[] memory drops = new address[](1);
drops[0] = GITCOIN_FEED_OLD;
MedianAbstract(MEDIAN_MANAUSD).drop(drops);
address[] memory lifts = new address[](1);
lifts[0] = GITCOIN_FEED_NEW;
MedianAbstract(MEDIAN_MANAUSD).lift(lifts);
| address[] memory drops = new address[](1);
drops[0] = GITCOIN_FEED_OLD;
MedianAbstract(MEDIAN_MANAUSD).drop(drops);
address[] memory lifts = new address[](1);
lifts[0] = GITCOIN_FEED_NEW;
MedianAbstract(MEDIAN_MANAUSD).lift(lifts);
| 38,182 |
36 | // function update from initial Smart contract | function claim() external returns (bool) {
require(_claimUnlocked(), "claiming not allowed yet");
if (!_initialClaimDone[msg.sender]) {
require(claimable[msg.sender] > 0, "nothing to claim");
} else {
require(
(_firstVestingAmount[msg.sender] > 0 &&
... | function claim() external returns (bool) {
require(_claimUnlocked(), "claiming not allowed yet");
if (!_initialClaimDone[msg.sender]) {
require(claimable[msg.sender] > 0, "nothing to claim");
} else {
require(
(_firstVestingAmount[msg.sender] > 0 &&
... | 73,890 |
237 | // We still alow anyone to withdraw these funds for the account owner | function withdrawFromMerkleTree(
ExchangeData.State storage S,
ExchangeData.MerkleProof calldata merkleProof
)
public
| function withdrawFromMerkleTree(
ExchangeData.State storage S,
ExchangeData.MerkleProof calldata merkleProof
)
public
| 57,532 |
107 | // enable/disable transfer | function enableTransfer(bool state) public onlyOwner {
isTransferable = state;
}
| function enableTransfer(bool state) public onlyOwner {
isTransferable = state;
}
| 22,046 |
18 | // determine if addr has roleaddr addressroleName the name of the role return bool/ | function hasRole(RolesManager storage rolesManager, address addr, string memory roleName) internal view returns (bool)
| function hasRole(RolesManager storage rolesManager, address addr, string memory roleName) internal view returns (bool)
| 56,375 |
84 | // 既に承認済みの場合はエラーを返す | require(!hasConfirmed(type_, confirmer, proposalId));
| require(!hasConfirmed(type_, confirmer, proposalId));
| 76,188 |
92 | // Change the name and symbol of the token / | function setTokenDetails(string memory _name, string memory _symbol, bool _stakeOpen, uint256 _stakeDuration) public onlyOwner {
name = _name;
symbol = _symbol;
stakeOpen = _stakeOpen;
stakeDuration = _stakeDuration;
}
| function setTokenDetails(string memory _name, string memory _symbol, bool _stakeOpen, uint256 _stakeDuration) public onlyOwner {
name = _name;
symbol = _symbol;
stakeOpen = _stakeOpen;
stakeDuration = _stakeDuration;
}
| 68,895 |
30 | // Encode token address with chainId / | function _encodeTokenWithChainId(address _token, uint256 _chainId) internal pure returns (bytes32) {
return keccak256(abi.encodePacked(_token, _chainId));
}
| function _encodeTokenWithChainId(address _token, uint256 _chainId) internal pure returns (bytes32) {
return keccak256(abi.encodePacked(_token, _chainId));
}
| 25,265 |
8 | // withdraw address | address payable immutable public withdrawAddress;
| address payable immutable public withdrawAddress;
| 41,135 |
8 | // Require a valid location | require(bytes(_location).length > 0);
| require(bytes(_location).length > 0);
| 41,176 |
27 | // Make some basic checks before attempting to liquidate an account. - Require that the msg.sender has the permission to use the liquidator account - Require that the liquid account is liquidatable based on the accounts global value (all assets held and owed, not just what's being liquidated) / | function checkRequirements(
Constants memory constants,
uint256 heldMarket,
uint256 owedMarket,
address[] memory tokenPath
)
private
view
| function checkRequirements(
Constants memory constants,
uint256 heldMarket,
uint256 owedMarket,
address[] memory tokenPath
)
private
view
| 50,848 |
34 | // internally returns the number of mints of an address | function _mintOf(address _owner) internal view returns (uint256) {
return _numberMinted(_owner);
}
| function _mintOf(address _owner) internal view returns (uint256) {
return _numberMinted(_owner);
}
| 53,476 |
5 | // Reverts if non-permissed account calls./ Permissioned accounts are: owner, pool manager, and account manager | modifier onlyPermissioned() {
require(
msg.sender == owner() ||
msg.sender == addressRegistry.poolManagerAddress() ||
msg.sender == addressRegistry.lpSafeAddress(),
"PERMISSIONED_ONLY"
);
_;
}
| modifier onlyPermissioned() {
require(
msg.sender == owner() ||
msg.sender == addressRegistry.poolManagerAddress() ||
msg.sender == addressRegistry.lpSafeAddress(),
"PERMISSIONED_ONLY"
);
_;
}
| 35,227 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.