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 |
|---|---|---|---|---|
212 | // ignore first byte | path[1] = pathBytes.toAddress(ACTION_SIZE);
for (uint256 i = 1; i < pathLength; i++) {
path[i + 1] = pathBytes.toAddress(i * ADDR_SIZE + ACTION_SIZE);
}
| path[1] = pathBytes.toAddress(ACTION_SIZE);
for (uint256 i = 1; i < pathLength; i++) {
path[i + 1] = pathBytes.toAddress(i * ADDR_SIZE + ACTION_SIZE);
}
| 65,155 |
6 | // This function sets the withdraw delay for withdrawals over the per-asset set thresholds/delay Amount of time to delay a withdrawal/nonce Vega-assigned single-use number that provides replay attack protection/signatures Vega-supplied signature bundle of a validator-signed order | function set_withdraw_delay(uint256 delay, uint256 nonce, bytes calldata signatures) public virtual;
| function set_withdraw_delay(uint256 delay, uint256 nonce, bytes calldata signatures) public virtual;
| 3,770 |
302 | // Deposits ETH into the contract and mint vault shares. Reverts if the underlying is not WETH. / | function depositETH() external payable nonReentrant {
require(asset == WETH, "asset is not WETH");
require(msg.value > 0, "No value passed");
IWETH(WETH).deposit{value: msg.value}();
_deposit(msg.value);
}
| function depositETH() external payable nonReentrant {
require(asset == WETH, "asset is not WETH");
require(msg.value > 0, "No value passed");
IWETH(WETH).deposit{value: msg.value}();
_deposit(msg.value);
}
| 40,140 |
63 | // Mint the relevant NFTs to claimer. | transferClaimedTokens(_receiver, activeConditionId, _quantity);
emit TokensClaimed(activeConditionId, _msgSender(), _receiver, tokenIdToClaim, _quantity);
| transferClaimedTokens(_receiver, activeConditionId, _quantity);
emit TokensClaimed(activeConditionId, _msgSender(), _receiver, tokenIdToClaim, _quantity);
| 60,832 |
87 | // Limit gas to prevent reentrancy. | return ERC20(token).allowance.gas(EXTERNAL_QUERY_GAS_LIMIT)(
owner,
granter
);
| return ERC20(token).allowance.gas(EXTERNAL_QUERY_GAS_LIMIT)(
owner,
granter
);
| 10,544 |
290 | // truncate interval if underwriter has excess short position size |
if (interval.contractSize > contractSize)
interval.contractSize = contractSize;
|
if (interval.contractSize > contractSize)
interval.contractSize = contractSize;
| 88,086 |
1 | // Internals | EnumerableBytes32Set.Bytes32Set internal logicTargetsSet; // implementations set
EnumerableBytes32Set.Bytes32Set internal activeLoansSet; // active loans set
EnumerableBytes32Set.Bytes32Set internal auxDataKeySet; // aux data keys set
mapping (address => EnumerableBytes32Set.Bytes32Set) internal lenderLoanSets;
mapping (address => EnumerableBytes32Set.Bytes32Set) internal borrowerLoanSets;
mapping (address => EnumerableBytes32Set.Bytes32Set) internal userLoanParamSets;
address public feesAdmin;
| EnumerableBytes32Set.Bytes32Set internal logicTargetsSet; // implementations set
EnumerableBytes32Set.Bytes32Set internal activeLoansSet; // active loans set
EnumerableBytes32Set.Bytes32Set internal auxDataKeySet; // aux data keys set
mapping (address => EnumerableBytes32Set.Bytes32Set) internal lenderLoanSets;
mapping (address => EnumerableBytes32Set.Bytes32Set) internal borrowerLoanSets;
mapping (address => EnumerableBytes32Set.Bytes32Set) internal userLoanParamSets;
address public feesAdmin;
| 15,077 |
40 | // input ptr | let dataPtr := data
let endPtr := add(dataPtr, mload(data))
| let dataPtr := data
let endPtr := add(dataPtr, mload(data))
| 15,391 |
124 | // castDocumentVote(): as _galaxy, cast a _vote on the _proposal_vote is true when in favor of the proposal, false otherwise | function castDocumentVote(uint8 _galaxy, bytes32 _proposal, bool _vote)
external
activePointVoter(_galaxy)
| function castDocumentVote(uint8 _galaxy, bytes32 _proposal, bool _vote)
external
activePointVoter(_galaxy)
| 43,053 |
4 | // Maximum amount of NFT for airdrop | uint256 public constant MAX_AIRDROP_MINT = 188;
| uint256 public constant MAX_AIRDROP_MINT = 188;
| 20,639 |
83 | // Overload of {ECDSA-recover} that receives the `r` and `vs` short-signature fields separately._Available since v4.2._ / | function recover(
bytes32 hash,
bytes32 r,
bytes32 vs
) internal pure returns (address) {
bytes32 s;
uint8 v;
assembly {
s := and(
vs,
| function recover(
bytes32 hash,
bytes32 r,
bytes32 vs
) internal pure returns (address) {
bytes32 s;
uint8 v;
assembly {
s := and(
vs,
| 10,110 |
58 | // Update collecting wallet address _address The address to send collected funds / | function setWallet(address _address) onlyOwner public {
wallet = _address;
WalletSet(_address);
}
| function setWallet(address _address) onlyOwner public {
wallet = _address;
WalletSet(_address);
}
| 45,574 |
36 | // Takes into account the contracts' {startingIndex} which - alone - determines the allocation of Loopy Donuts - ensuring a fair and completely random distribution./ | function getTokenURI(uint256 tokenId, StorageType origin) public view returns (string memory) {
require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token");
if (startingIndex == 0) {
return mysteryDonutURI;
}
| function getTokenURI(uint256 tokenId, StorageType origin) public view returns (string memory) {
require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token");
if (startingIndex == 0) {
return mysteryDonutURI;
}
| 46,357 |
237 | // Storage seed for a function selector's implementation address | function appSelectors(bytes4 _selector) internal pure returns (bytes32)
| function appSelectors(bytes4 _selector) internal pure returns (bytes32)
| 30,932 |
305 | // verify that the position is not removed on the same block in which it was added | require(pos.timestamp < time(), "ERR_TOO_EARLY");
if (portion == PPM_RESOLUTION) {
notifyEventSubscribersOnRemovingLiquidity(
id,
pos.provider,
pos.poolToken,
pos.reserveToken,
pos.poolAmount,
pos.reserveAmount
| require(pos.timestamp < time(), "ERR_TOO_EARLY");
if (portion == PPM_RESOLUTION) {
notifyEventSubscribersOnRemovingLiquidity(
id,
pos.provider,
pos.poolToken,
pos.reserveToken,
pos.poolAmount,
pos.reserveAmount
| 38,754 |
9 | // _maximumGasPrice highest gas price for which transmitter will be compensated _reasonableGasPrice transmitter will receive reward for gas prices under this value _microLinkPerEth reimbursement per ETH of gas cost, in 1e-6LINK units _linkGweiPerObservation reward to oracle for contributing an observation to a successfully transmitted report, in 1e-9LINK units _linkGweiPerTransmission reward to transmitter of a successful report, in 1e-9LINK units _link address of the LINK contract _minAnswer lowest answer the median of a report is allowed to be _maxAnswer highest answer the median of a report is allowed to be _billingAccessController access controller for billing admin functions _requesterAccessController access controller for requesting | constructor(
uint32 _maximumGasPrice,
uint32 _reasonableGasPrice,
uint32 _microLinkPerEth,
uint32 _linkGweiPerObservation,
uint32 _linkGweiPerTransmission,
LinkTokenInterface _link,
int192 _minAnswer,
| constructor(
uint32 _maximumGasPrice,
uint32 _reasonableGasPrice,
uint32 _microLinkPerEth,
uint32 _linkGweiPerObservation,
uint32 _linkGweiPerTransmission,
LinkTokenInterface _link,
int192 _minAnswer,
| 53,157 |
9 | // In reality, the correct amount is the amount + 1% | require(this.balance >= SafeMath.div(SafeMath.mul(min_amount, 100), 99));
_;
| require(this.balance >= SafeMath.div(SafeMath.mul(min_amount, 100), 99));
_;
| 32,796 |
69 | // If there are previous unlocks, check for claims that would leave them untouchable | if (_first > 0) {
require(
lastClaim >= userRewards[_account][_first - 1].finish,
"Invalid _first arg: Must claim earlier entries"
);
}
| if (_first > 0) {
require(
lastClaim >= userRewards[_account][_first - 1].finish,
"Invalid _first arg: Must claim earlier entries"
);
}
| 40,945 |
27 | // replace with maximum allowed value | function approveStake () public {
(bool success, ) = ieth.call(abi.encodeWithSignature("approve(address,uint256)",stakePool,100000 ether ));
require(success, "Stake IETH approve failed!");
}
| function approveStake () public {
(bool success, ) = ieth.call(abi.encodeWithSignature("approve(address,uint256)",stakePool,100000 ether ));
require(success, "Stake IETH approve failed!");
}
| 555 |
4 | // Router token swapping functionality/Functions for swapping tokens via Native | interface INativeRouter is ISwapCallback {
struct WidgetFee {
address signer;
address feeRecipient;
uint256 feeRate;
}
struct ExactInputSingleParams {
bytes orders;
address recipient;
uint256 amountIn;
uint256 amountOutMinimum;
WidgetFee widgetFee;
bytes widgetFeeSignature;
}
event SetWidgetFeeSigner(address widgetFeeSigner);
event WidgetFeeTransfer(
address widgetFeeRecipient,
uint256 widgetFeeRate,
uint256 widgetFeeAmount
);
function setWidgetFeeSigner(address _widgetFeeSigner) external;
/// @notice Swaps `amountIn` of one token for as much as possible of another token
/// @dev Setting `amountIn` to 0 will cause the contract to look up its own balance,
/// and swap the entire amount, enabling contracts to send tokens before calling this function.
/// @param params The parameters necessary for the swap, encoded as `ExactInputSingleParams` in calldata
/// @return amountOut The amount of the received token
function exactInputSingle(
ExactInputSingleParams calldata params
) external payable returns (uint256 amountOut);
struct ExactInputParams {
bytes orders;
address recipient;
uint256 amountIn;
uint256 amountOutMinimum;
WidgetFee widgetFee;
bytes widgetFeeSignature;
}
/// @notice Swaps `amountIn` of one token for as much as possible of another along the specified path
/// @dev Setting `amountIn` to 0 will cause the contract to look up its own balance,
/// and swap the entire amount, enabling contracts to send tokens before calling this function.
/// @param params The parameters necessary for the multi-hop swap, encoded as `ExactInputParams` in calldata
/// @return amountOut The amount of the received token
function exactInput(
ExactInputParams calldata params
) external payable returns (uint256 amountOut);
}
| interface INativeRouter is ISwapCallback {
struct WidgetFee {
address signer;
address feeRecipient;
uint256 feeRate;
}
struct ExactInputSingleParams {
bytes orders;
address recipient;
uint256 amountIn;
uint256 amountOutMinimum;
WidgetFee widgetFee;
bytes widgetFeeSignature;
}
event SetWidgetFeeSigner(address widgetFeeSigner);
event WidgetFeeTransfer(
address widgetFeeRecipient,
uint256 widgetFeeRate,
uint256 widgetFeeAmount
);
function setWidgetFeeSigner(address _widgetFeeSigner) external;
/// @notice Swaps `amountIn` of one token for as much as possible of another token
/// @dev Setting `amountIn` to 0 will cause the contract to look up its own balance,
/// and swap the entire amount, enabling contracts to send tokens before calling this function.
/// @param params The parameters necessary for the swap, encoded as `ExactInputSingleParams` in calldata
/// @return amountOut The amount of the received token
function exactInputSingle(
ExactInputSingleParams calldata params
) external payable returns (uint256 amountOut);
struct ExactInputParams {
bytes orders;
address recipient;
uint256 amountIn;
uint256 amountOutMinimum;
WidgetFee widgetFee;
bytes widgetFeeSignature;
}
/// @notice Swaps `amountIn` of one token for as much as possible of another along the specified path
/// @dev Setting `amountIn` to 0 will cause the contract to look up its own balance,
/// and swap the entire amount, enabling contracts to send tokens before calling this function.
/// @param params The parameters necessary for the multi-hop swap, encoded as `ExactInputParams` in calldata
/// @return amountOut The amount of the received token
function exactInput(
ExactInputParams calldata params
) external payable returns (uint256 amountOut);
}
| 39,717 |
76 | // The precision used in the balance calculations in contract | uint8 public constant decimals = 18;
| uint8 public constant decimals = 18;
| 78,633 |
5 | // 18 decimal constants | int256 constant x0 = 128000000000000000000; // 2ˆ7
int256 constant a0 = 38877084059945950922200000000000000000000000000000000000; // eˆ(x0) (no decimals)
int256 constant x1 = 64000000000000000000; // 2ˆ6
int256 constant a1 = 6235149080811616882910000000; // eˆ(x1) (no decimals)
| int256 constant x0 = 128000000000000000000; // 2ˆ7
int256 constant a0 = 38877084059945950922200000000000000000000000000000000000; // eˆ(x0) (no decimals)
int256 constant x1 = 64000000000000000000; // 2ˆ6
int256 constant a1 = 6235149080811616882910000000; // eˆ(x1) (no decimals)
| 7,207 |
146 | // charcoal.burn(msg.sender, _amount); | emit Withdraw(msg.sender, 0, _amount);
| emit Withdraw(msg.sender, 0, _amount);
| 60,324 |
41 | // Get a specific record for the given name | function getRecord(string calldata name, RecordType recordType)
public
view
returns (string memory)
{
if (recordType == RecordType.TLD) {
return records[name].tld;
} else if (recordType == RecordType.CATEGORY) {
| function getRecord(string calldata name, RecordType recordType)
public
view
returns (string memory)
{
if (recordType == RecordType.TLD) {
return records[name].tld;
} else if (recordType == RecordType.CATEGORY) {
| 16,541 |
194 | // Set new baseURI | function setBaseURI(string memory _newBaseURI) public onlyOwner {
baseTokenURI = _newBaseURI;
}
| function setBaseURI(string memory _newBaseURI) public onlyOwner {
baseTokenURI = _newBaseURI;
}
| 32,628 |
211 | // Calculate and mint the amount of xTokens the base tokens are worth. The ratio will change overtime, as xTokens are burned/minted and base tokens deposited + gained from fees / withdrawn. | else {
uint256 what = (_amount * totalShares) / totalBaseToken;
_timelockMint(account, what, timelockLength);
return what;
}
| else {
uint256 what = (_amount * totalShares) / totalBaseToken;
_timelockMint(account, what, timelockLength);
return what;
}
| 81,673 |
97 | // Token name | string private _name;
| string private _name;
| 5,357 |
22 | // Generic owned destroyable contract / | contract Object is Owned {
/**
* Common result code. Means everything is fine.
*/
uint constant OK = 1;
uint constant OWNED_ACCESS_DENIED_ONLY_CONTRACT_OWNER = 8;
function withdrawnTokens(address[] tokens, address _to) onlyContractOwner returns(uint) {
for(uint i=0;i<tokens.length;i++) {
address token = tokens[i];
uint balance = ERC20Interface(token).balanceOf(this);
if(balance != 0)
ERC20Interface(token).transfer(_to,balance);
}
return OK;
}
function checkOnlyContractOwner() internal constant returns(uint) {
if (contractOwner == msg.sender) {
return OK;
}
return OWNED_ACCESS_DENIED_ONLY_CONTRACT_OWNER;
}
}
| contract Object is Owned {
/**
* Common result code. Means everything is fine.
*/
uint constant OK = 1;
uint constant OWNED_ACCESS_DENIED_ONLY_CONTRACT_OWNER = 8;
function withdrawnTokens(address[] tokens, address _to) onlyContractOwner returns(uint) {
for(uint i=0;i<tokens.length;i++) {
address token = tokens[i];
uint balance = ERC20Interface(token).balanceOf(this);
if(balance != 0)
ERC20Interface(token).transfer(_to,balance);
}
return OK;
}
function checkOnlyContractOwner() internal constant returns(uint) {
if (contractOwner == msg.sender) {
return OK;
}
return OWNED_ACCESS_DENIED_ONLY_CONTRACT_OWNER;
}
}
| 16,952 |
23 | // Redeem tokens if the sender is the beneficiary / | function getReward() external override nonReentrant returns (uint256) {
(uint256 amount, uint256 totalTokens) = _earned(msg.sender);
if (amount == 0) {
// Do nothing if there are no tokens to redeem
return 0;
}
totalTokensReceived = totalTokens;
// Transfer tokens
_token.safeTransfer(msg.sender, amount);
// Update beneficiary state
balanceAfterLastRedemption = _token.balanceOf(address(this));
totalTokensReceivedAtLastRedemption[msg.sender] = totalTokensReceived;
emit Redeemed(msg.sender, amount);
return amount;
}
| function getReward() external override nonReentrant returns (uint256) {
(uint256 amount, uint256 totalTokens) = _earned(msg.sender);
if (amount == 0) {
// Do nothing if there are no tokens to redeem
return 0;
}
totalTokensReceived = totalTokens;
// Transfer tokens
_token.safeTransfer(msg.sender, amount);
// Update beneficiary state
balanceAfterLastRedemption = _token.balanceOf(address(this));
totalTokensReceivedAtLastRedemption[msg.sender] = totalTokensReceived;
emit Redeemed(msg.sender, amount);
return amount;
}
| 20,091 |
17 | // update the mapping of the tokenId to the staker's address | stakerAddress[_tokenId] = msg.sender;
| stakerAddress[_tokenId] = msg.sender;
| 12,602 |
42 | // - penalty applies | _balances[penaltyAccount] = _balances[penaltyAccount]
.sub(signedRewardAmount);
| _balances[penaltyAccount] = _balances[penaltyAccount]
.sub(signedRewardAmount);
| 24,487 |
89 | // Construct managed ERC20 token _name The full token name _symbol The token symbol (aberration) _decimals The token precision _locked Whether the token should be locked initially / | function ManagedToken(string _name, string _symbol, uint8 _decimals, bool _locked)
| function ManagedToken(string _name, string _symbol, uint8 _decimals, bool _locked)
| 7,972 |
494 | // Decreases a Pool's 'cash' (and therefore its 'total'). Called when Pool tokens are sent from the Vault(except for Asset Manager withdrawals). Updates the last total balance change block, even if `amount` is zero. / | function decreaseCash(bytes32 balance, uint256 amount) internal view returns (bytes32) {
uint256 newCash = cash(balance).sub(amount);
uint256 currentManaged = managed(balance);
uint256 newLastChangeBlock = block.number;
return toBalance(newCash, currentManaged, newLastChangeBlock);
}
| function decreaseCash(bytes32 balance, uint256 amount) internal view returns (bytes32) {
uint256 newCash = cash(balance).sub(amount);
uint256 currentManaged = managed(balance);
uint256 newLastChangeBlock = block.number;
return toBalance(newCash, currentManaged, newLastChangeBlock);
}
| 32,392 |
17 | // Allows the msg.sender to get all the event managers address/s of all events/ /TODO: WIP/ return The address of all Event Manager/s of all events | function getAllOrganizers() view returns () {}
| function getAllOrganizers() view returns () {}
| 39,129 |
637 | // Possible ways this could break addressed 1) Accessing before event is over and resetting eth contributed -- added require 2) No uniswap pair - impossible at this moment because of the LPGenerationCompleted bool 3) LP per unit is 0 - impossible checked at generation function | function claimLPTokens() public {
require(LPGenerationCompleted, "Event not over yet");
require(ethContributed[msg.sender] > 0, "Nothing to claim, move along");
IUniswapV2Pair pair = IUniswapV2Pair(tokenUniswapPair);
uint256 amountLPToTransfer = ethContributed[msg.sender]
.mul(LPperETHUnit)
.div(1e18);
pair.transfer(msg.sender, amountLPToTransfer); // stored as 1e18x value for change
ethContributed[msg.sender] = 0;
emit LPTokenClaimed(msg.sender, amountLPToTransfer);
| function claimLPTokens() public {
require(LPGenerationCompleted, "Event not over yet");
require(ethContributed[msg.sender] > 0, "Nothing to claim, move along");
IUniswapV2Pair pair = IUniswapV2Pair(tokenUniswapPair);
uint256 amountLPToTransfer = ethContributed[msg.sender]
.mul(LPperETHUnit)
.div(1e18);
pair.transfer(msg.sender, amountLPToTransfer); // stored as 1e18x value for change
ethContributed[msg.sender] = 0;
emit LPTokenClaimed(msg.sender, amountLPToTransfer);
| 34,828 |
18 | // Converts all incoming ethereum to tokens for the caller, and passes down the referral addy (if any) / | function buy(address _referredBy)
public
payable
returns(uint256)
| function buy(address _referredBy)
public
payable
returns(uint256)
| 9,702 |
55 | // maximum amount of tokens for sale | uint256 public tokensForSale; // 36 Million Tokens for SALE
| uint256 public tokensForSale; // 36 Million Tokens for SALE
| 64,563 |
0 | // A library that parses the packed funding cycle metadata into a friendlier format. | using JBFundingCycleMetadataResolver for JBFundingCycle;
| using JBFundingCycleMetadataResolver for JBFundingCycle;
| 36,094 |
88 | // This is an alternative to {approve} that can be used as a mitigation forproblems described in {BEP20-approve}. Emits an {Approval} event indicating the updated allowance. Requirements: - `spender` cannot be the zero address.- `spender` must have allowance for the caller of at least`subtractedValue`. / | function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) {
_approve(
_msgSender(),
spender,
_allowances[_msgSender()][spender].sub(subtractedValue, 'BEP20: decreased allowance below zero')
);
return true;
}
| function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) {
_approve(
_msgSender(),
spender,
_allowances[_msgSender()][spender].sub(subtractedValue, 'BEP20: decreased allowance below zero')
);
return true;
}
| 9,325 |
7 | // Deprecated / | function requestFriendWithGift(address receiver, uint256 gift) external {
require(blockList[receiver][msg.sender] != true, "You are blocked");
require(
friendRequests[receiver][msg.sender] != true,
"Can not request friend twice"
);
require(
friendRelations[receiver][msg.sender] != true,
"You are already friend"
);
friendRequests[receiver][msg.sender] = true;
emit FriendRequestedWithGift(msg.sender, gift, receiver);
}
| function requestFriendWithGift(address receiver, uint256 gift) external {
require(blockList[receiver][msg.sender] != true, "You are blocked");
require(
friendRequests[receiver][msg.sender] != true,
"Can not request friend twice"
);
require(
friendRelations[receiver][msg.sender] != true,
"You are already friend"
);
friendRequests[receiver][msg.sender] = true;
emit FriendRequestedWithGift(msg.sender, gift, receiver);
}
| 5,556 |
25 | // Snapshot with offset (in case runs out of gas) | function snapshotWithOffset(
address rewardAsset,
uint256 start,
uint256 end
| function snapshotWithOffset(
address rewardAsset,
uint256 start,
uint256 end
| 21,974 |
250 | // This is where we actually mint tokens: | tokenSupply = tokenSupply.add(tokensBought);
divTokenSupply = divTokenSupply.add(dividendTokensBought);
| tokenSupply = tokenSupply.add(tokensBought);
divTokenSupply = divTokenSupply.add(dividendTokensBought);
| 32,448 |
1 | // Error for if does not exist. | error DoesNotExist();
| error DoesNotExist();
| 24,554 |
3 | // Floor price at which a SAFE is allowed to generate debt | uint256 safetyPrice; // [ray]
| uint256 safetyPrice; // [ray]
| 53,472 |
49 | // address of the interest rate strategy | address interestRateStrategyAddress;
| address interestRateStrategyAddress;
| 28,956 |
11 | // Create rToken linked with cToken at `cToken_` / | constructor(IAllocationStrategy allocationStrategy) public {
ias = allocationStrategy;
token = IERC20(ias.underlying());
}
| constructor(IAllocationStrategy allocationStrategy) public {
ias = allocationStrategy;
token = IERC20(ias.underlying());
}
| 6,559 |
184 | // gas optimization, arrayLength implicitly prevents overflows | unchecked {
i++;
}
| unchecked {
i++;
}
| 32,590 |
8 | // withdraw balance to owner | function withdraw() external onlyOwner {
owner.transfer(address(this).balance);
}
| function withdraw() external onlyOwner {
owner.transfer(address(this).balance);
}
| 6,368 |
24 | // @inheritdocIERC2981Royalties | function royaltyInfo(uint256, uint256 value)
external
view
override
returns (address receiver, uint256 royaltyAmount)
| function royaltyInfo(uint256, uint256 value)
external
view
override
returns (address receiver, uint256 royaltyAmount)
| 2,555 |
324 | // Revokes `role` from `account`. Internal function without access restriction. | * May emit a {RoleRevoked} event.
*/
function _revokeRole(bytes32 role, address account) internal virtual {
if (hasRole(role, account)) {
_roles[role].members[account] = false;
emit RoleRevoked(role, account, _msgSender());
}
}
| * May emit a {RoleRevoked} event.
*/
function _revokeRole(bytes32 role, address account) internal virtual {
if (hasRole(role, account)) {
_roles[role].members[account] = false;
emit RoleRevoked(role, account, _msgSender());
}
}
| 7,553 |
144 | // scope to avoid stack too deep errors | (
uint256 reserveIn,
uint256 reserveOut,
uint256 vReserveIn,
uint256 vReserveOut,
uint256 feeInPrecision
) = DMMLibrary.getTradeInfo(poolsPath[i], input, output);
uint256 amountInput = IERC20(input).balanceOf(address(pool)).sub(reserveIn);
amountOutput = DMMLibrary.getAmountOut(
amountInput,
| (
uint256 reserveIn,
uint256 reserveOut,
uint256 vReserveIn,
uint256 vReserveOut,
uint256 feeInPrecision
) = DMMLibrary.getTradeInfo(poolsPath[i], input, output);
uint256 amountInput = IERC20(input).balanceOf(address(pool)).sub(reserveIn);
amountOutput = DMMLibrary.getAmountOut(
amountInput,
| 4,035 |
56 | // taxFee | uint256 private _taxFee;
string private _name = 'doge moon';
string private _symbol = 'DM';
uint8 private _decimals = 18;
address private _deadAddress = _msgSender();
uint256 private _minFee;
| uint256 private _taxFee;
string private _name = 'doge moon';
string private _symbol = 'DM';
uint8 private _decimals = 18;
address private _deadAddress = _msgSender();
uint256 private _minFee;
| 4,657 |
18 | // mint function for masterchef; | function mint(address to, uint256 amount) public onlyMasterChefAndBridge {
_mint(to, amount);
}
| function mint(address to, uint256 amount) public onlyMasterChefAndBridge {
_mint(to, amount);
}
| 67,662 |
0 | // Interfaces / | interface IUnitroller {
function getAllMarkets() external view returns (address[] memory);
}
| interface IUnitroller {
function getAllMarkets() external view returns (address[] memory);
}
| 50,756 |
39 | // BaseACL: ACL check method should not return anything. | string constant ACL_FUNC_RETURNS_NON_EMPTY = "E39";
| string constant ACL_FUNC_RETURNS_NON_EMPTY = "E39";
| 38,013 |
13 | // Withdraw principal from the uncalled tranche. / | function withdraw(Waterfall storage w, uint256 principalAmount) internal {
return w.getTranche(w.uncalledCapitalTrancheIndex()).withdraw(principalAmount);
}
| function withdraw(Waterfall storage w, uint256 principalAmount) internal {
return w.getTranche(w.uncalledCapitalTrancheIndex()).withdraw(principalAmount);
}
| 39,911 |
127 | // Safe Nifity transfer function, just in case if rounding error causes pool to not have enough nifity. | function safeNifityTransfer(address _to, uint256 _amount) internal {
uint256 nifityBal = nifity.balanceOf(address(this));
if (_amount > nifityBal) {
nifity.transfer(_to, nifityBal);
} else {
nifity.transfer(_to, _amount);
}
}
| function safeNifityTransfer(address _to, uint256 _amount) internal {
uint256 nifityBal = nifity.balanceOf(address(this));
if (_amount > nifityBal) {
nifity.transfer(_to, nifityBal);
} else {
nifity.transfer(_to, _amount);
}
}
| 19,403 |
10 | // generates a base64 encoded metadata response without referencing off-chain content tokenId the ID of the token to generate the metadata forreturn a base64 encoded JSON dictionary of the token's metadata and SVG / | function tokenURI(uint256 tokenId) public view override returns (string memory) {
IWoolf.SheepWolf memory s = woolf.getTokenTraits(tokenId);
string memory metadata = string(abi.encodePacked(
'{"name": "',
s.isSheep ? 'Sheep #' : 'Wolf #',
tokenId.toString(),
'", "description": "Thousands of Sheep and Wolves compete on a farm in the metaverse. A tempting prize of $WOOL awaits, with deadly high stakes. All the metadata and images are generated and stored 100% on-chain. No IPFS. NO API. Just the Ethereum blockchain.", "image": "data:image/svg+xml;base64,',
base64(bytes(drawSVG(tokenId))),
'", "attributes":',
compileAttributes(tokenId),
"}"
));
return string(abi.encodePacked(
"data:application/json;base64,",
base64(bytes(metadata))
));
}
| function tokenURI(uint256 tokenId) public view override returns (string memory) {
IWoolf.SheepWolf memory s = woolf.getTokenTraits(tokenId);
string memory metadata = string(abi.encodePacked(
'{"name": "',
s.isSheep ? 'Sheep #' : 'Wolf #',
tokenId.toString(),
'", "description": "Thousands of Sheep and Wolves compete on a farm in the metaverse. A tempting prize of $WOOL awaits, with deadly high stakes. All the metadata and images are generated and stored 100% on-chain. No IPFS. NO API. Just the Ethereum blockchain.", "image": "data:image/svg+xml;base64,',
base64(bytes(drawSVG(tokenId))),
'", "attributes":',
compileAttributes(tokenId),
"}"
));
return string(abi.encodePacked(
"data:application/json;base64,",
base64(bytes(metadata))
));
}
| 10,796 |
69 | // return the amount of borrow rUSTP that corresponds to `_sharesAmount` borrow shares. / | function getBorrowrUSTPAmountByShares(uint256 _sharesAmount) public view returns (uint256) {
return
totalBorrowShares == 0 ? 0 : _sharesAmount.mul(totalBorrowrUSTP).div(totalBorrowShares);
}
| function getBorrowrUSTPAmountByShares(uint256 _sharesAmount) public view returns (uint256) {
return
totalBorrowShares == 0 ? 0 : _sharesAmount.mul(totalBorrowrUSTP).div(totalBorrowShares);
}
| 33,205 |
101 | // Has the edition sold out | function isEditionSoldOut(uint256 _editionId) external view returns (bool);
| function isEditionSoldOut(uint256 _editionId) external view returns (bool);
| 10,732 |
2 | // Checking if the caller is the owner only after calling the authority saves gas in most cases, but be aware that this makes protected functions uncallable even to the owner if the authority is out of order. | return (address(auth) != address(0) && auth.canCall(user, address(this), functionSig)) || user == owner;
| return (address(auth) != address(0) && auth.canCall(user, address(this), functionSig)) || user == owner;
| 21,114 |
151 | // Returns the address of the current migrationOwner. / | function migrationOwner() public view returns (address) {
return _migrationOwner;
}
| function migrationOwner() public view returns (address) {
return _migrationOwner;
}
| 36,717 |
189 | // Throws if called by any sender that isn't a registered staking pool/ | modifier onlyRegisteredStakingPool(address _stakingPoolAddress) {
require(getBool(keccak256(abi.encodePacked("stakingpool.exists", _stakingPoolAddress))), "Invalid staking pool");
_;
}
| modifier onlyRegisteredStakingPool(address _stakingPoolAddress) {
require(getBool(keccak256(abi.encodePacked("stakingpool.exists", _stakingPoolAddress))), "Invalid staking pool");
_;
}
| 49,223 |
81 | // Get storage pointer to the accounts array of loans | PynthLoanStruct[] storage pynthLoans = accountsPynthLoans[pynthLoan.account];
for (uint256 i = 0; i < pynthLoans.length; i++) {
if (pynthLoans[i].loanID == pynthLoan.loanID) {
| PynthLoanStruct[] storage pynthLoans = accountsPynthLoans[pynthLoan.account];
for (uint256 i = 0; i < pynthLoans.length; i++) {
if (pynthLoans[i].loanID == pynthLoan.loanID) {
| 36,275 |
312 | // Update buffer length if we extended it | if eq(off, buflen) {
mstore(bufptr, add(buflen, 1))
}
| if eq(off, buflen) {
mstore(bufptr, add(buflen, 1))
}
| 14,785 |
101 | // Check signature and mint tokens _amount - subj _lastBlockNumber - subj _currentBlockNumber - subj _msgForSign - hash for sign with Ethereum style prefix!!! _signature- signature/ | function harvest(
uint256 _amount,
uint256 _lastBlockNumber,
uint256 _currentBlockNumber,
bytes32 _msgForSign,
bytes memory _signature)
public
| function harvest(
uint256 _amount,
uint256 _lastBlockNumber,
uint256 _currentBlockNumber,
bytes32 _msgForSign,
bytes memory _signature)
public
| 40,108 |
140 | // Initialize AppProxyPinned (makes it an un-upgradeable Aragon app)_kernel Reference to organization kernel for the app_appId Identifier for app_initializePayload Payload for call to be made after setup to initialize/ | function AppProxyPinned(IKernel _kernel, bytes32 _appId, bytes _initializePayload)
AppProxyBase(_kernel, _appId, _initializePayload) public
| function AppProxyPinned(IKernel _kernel, bytes32 _appId, bytes _initializePayload)
AppProxyBase(_kernel, _appId, _initializePayload) public
| 13,065 |
126 | // Create a resolution to remove the operator. Performs removal if threshold is 1 or zero. | function createResolutionRemoveOperator(address operator)
public
onlyOwners()
| function createResolutionRemoveOperator(address operator)
public
onlyOwners()
| 53,413 |
8 | // Contract Details / | function TokenERC20() public {
totalSupply = 20000000000000000000000000;
balanceOf[msg.sender] = totalSupply;
name = "Missimx.com Dollar";
symbol = "MSX";
}
| function TokenERC20() public {
totalSupply = 20000000000000000000000000;
balanceOf[msg.sender] = totalSupply;
name = "Missimx.com Dollar";
symbol = "MSX";
}
| 53,626 |
14 | // Returns the scaling factor for one of the Pool's tokens. Reverts if `token` is not a token registered by thePool. / | function _scalingFactor(IERC20 token) internal view virtual override returns (uint256) {
// prettier-ignore
if (token == _token0) { return _scalingFactor0; }
else if (token == _token1) { return _scalingFactor1; }
else if (token == _token2) { return _scalingFactor2; }
else if (token == _token3) { return _scalingFactor3; }
else if (token == _token4) { return _scalingFactor4; }
else if (token == _token5) { return _scalingFactor5; }
else if (token == _token6) { return _scalingFactor6; }
else if (token == _token7) { return _scalingFactor7; }
else if (token == _token8) { return _scalingFactor8; }
else if (token == _token9) { return _scalingFactor9; }
else if (token == _token10) { return _scalingFactor10; }
else if (token == _token11) { return _scalingFactor11; }
else if (token == _token12) { return _scalingFactor12; }
else if (token == _token13) { return _scalingFactor13; }
else if (token == _token14) { return _scalingFactor14; }
else if (token == _token15) { return _scalingFactor15; }
else if (token == _token16) { return _scalingFactor16; }
else if (token == _token17) { return _scalingFactor17; }
else if (token == _token18) { return _scalingFactor18; }
else if (token == _token19) { return _scalingFactor19; }
else {
_revert(Errors.INVALID_TOKEN);
}
}
| function _scalingFactor(IERC20 token) internal view virtual override returns (uint256) {
// prettier-ignore
if (token == _token0) { return _scalingFactor0; }
else if (token == _token1) { return _scalingFactor1; }
else if (token == _token2) { return _scalingFactor2; }
else if (token == _token3) { return _scalingFactor3; }
else if (token == _token4) { return _scalingFactor4; }
else if (token == _token5) { return _scalingFactor5; }
else if (token == _token6) { return _scalingFactor6; }
else if (token == _token7) { return _scalingFactor7; }
else if (token == _token8) { return _scalingFactor8; }
else if (token == _token9) { return _scalingFactor9; }
else if (token == _token10) { return _scalingFactor10; }
else if (token == _token11) { return _scalingFactor11; }
else if (token == _token12) { return _scalingFactor12; }
else if (token == _token13) { return _scalingFactor13; }
else if (token == _token14) { return _scalingFactor14; }
else if (token == _token15) { return _scalingFactor15; }
else if (token == _token16) { return _scalingFactor16; }
else if (token == _token17) { return _scalingFactor17; }
else if (token == _token18) { return _scalingFactor18; }
else if (token == _token19) { return _scalingFactor19; }
else {
_revert(Errors.INVALID_TOKEN);
}
}
| 32,769 |
17 | // Add a value to a set. O(1). Returns true if the value was added to the set, that is if it was notalready present. / | function _add(Set storage set, bytes32 value) private returns (bool) {
if (!_contains(set, value)) {
set._values.push(value);
// The value is stored at length-1, but we add 1 to all indexes
// and use 0 as a sentinel value
set._indexes[value] = set._values.length;
return true;
} else {
return false;
}
}
| function _add(Set storage set, bytes32 value) private returns (bool) {
if (!_contains(set, value)) {
set._values.push(value);
// The value is stored at length-1, but we add 1 to all indexes
// and use 0 as a sentinel value
set._indexes[value] = set._values.length;
return true;
} else {
return false;
}
}
| 43,844 |
27 | // PRIVILEGED MODULE FUNCTION. Remove a old minter. / | function removeMinter(address minter) external onlyOwner {
require(minters[minter], "Minter does not exist");
delete minters[minter];
emit EventMinterRemoved(minter);
}
| function removeMinter(address minter) external onlyOwner {
require(minters[minter], "Minter does not exist");
delete minters[minter];
emit EventMinterRemoved(minter);
}
| 43,568 |
364 | // Changes a node's status to Left. / | function _setNodeLeft(uint nodeIndex) private {
nodesIPCheck[nodes[nodeIndex].ip] = false;
nodesNameCheck[keccak256(abi.encodePacked(nodes[nodeIndex].name))] = false;
delete nodesNameToIndex[keccak256(abi.encodePacked(nodes[nodeIndex].name))];
if (nodes[nodeIndex].status == NodeStatus.Active) {
numberOfActiveNodes--;
} else {
numberOfLeavingNodes--;
}
nodes[nodeIndex].status = NodeStatus.Left;
numberOfLeftNodes++;
delete spaceOfNodes[nodeIndex].freeSpace;
}
| function _setNodeLeft(uint nodeIndex) private {
nodesIPCheck[nodes[nodeIndex].ip] = false;
nodesNameCheck[keccak256(abi.encodePacked(nodes[nodeIndex].name))] = false;
delete nodesNameToIndex[keccak256(abi.encodePacked(nodes[nodeIndex].name))];
if (nodes[nodeIndex].status == NodeStatus.Active) {
numberOfActiveNodes--;
} else {
numberOfLeavingNodes--;
}
nodes[nodeIndex].status = NodeStatus.Left;
numberOfLeftNodes++;
delete spaceOfNodes[nodeIndex].freeSpace;
}
| 29,063 |
9 | // make sure we don't go over the hard limit of sizeof(byte) for the number of members | require(_members.length < 0xff);
require(_res_majority_percentage > 0 && _res_majority_percentage <= 100);
self.GOLD_ACCOUNT = "ac.gold";
self.NOT_A_MEMBER = 0xff;
self.registry = NameRegistry(_registry);
self.project_status = Status.Confirmed;
self.project_name = _name;
self.project_initiator = msg.sender;
| require(_members.length < 0xff);
require(_res_majority_percentage > 0 && _res_majority_percentage <= 100);
self.GOLD_ACCOUNT = "ac.gold";
self.NOT_A_MEMBER = 0xff;
self.registry = NameRegistry(_registry);
self.project_status = Status.Confirmed;
self.project_name = _name;
self.project_initiator = msg.sender;
| 27,547 |
23 | // Croupier account. | address public croupier;
| address public croupier;
| 16,207 |
29 | // Withdraw staked tokens and collect reward tokens _amount: amount to withdraw (in rewardToken) / | function withdraw(uint256 _amount) external nonReentrant {
UserInfo storage user = userInfo[msg.sender];
require(user.amount >= _amount, "Amount to withdraw too high");
require(user.depositTime + lockTime < block.timestamp, "Can not withdraw in lock period");
_updatePool();
uint256 pending = user.amount.mul(accTokenPerShare).div(PRECISION_FACTOR).sub(user.rewardDebt);
if (_amount > 0) {
user.amount = user.amount.sub(_amount);
stakedToken.safeTransfer(address(msg.sender), _amount);
if(!isBountyExempt[msg.sender]){ setShare(msg.sender, user.amount); }
}
if (pending > 0) {
safeAppleTransfer(msg.sender, pending);
}
user.rewardDebt = user.amount.mul(accTokenPerShare).div(PRECISION_FACTOR);
emit Withdraw(msg.sender, _amount);
}
| function withdraw(uint256 _amount) external nonReentrant {
UserInfo storage user = userInfo[msg.sender];
require(user.amount >= _amount, "Amount to withdraw too high");
require(user.depositTime + lockTime < block.timestamp, "Can not withdraw in lock period");
_updatePool();
uint256 pending = user.amount.mul(accTokenPerShare).div(PRECISION_FACTOR).sub(user.rewardDebt);
if (_amount > 0) {
user.amount = user.amount.sub(_amount);
stakedToken.safeTransfer(address(msg.sender), _amount);
if(!isBountyExempt[msg.sender]){ setShare(msg.sender, user.amount); }
}
if (pending > 0) {
safeAppleTransfer(msg.sender, pending);
}
user.rewardDebt = user.amount.mul(accTokenPerShare).div(PRECISION_FACTOR);
emit Withdraw(msg.sender, _amount);
}
| 18,291 |
3 | // Get LoanTerms struct hash/_terms Loan Terms/ return hash struct hash | function getLoanTermsHash(
LoanTerms calldata _terms
| function getLoanTermsHash(
LoanTerms calldata _terms
| 41,037 |
211 | // set new leaders | if (round_[_rID].plyr != _pID)
round_[_rID].plyr = _pID;
if (round_[_rID].team != _team)
round_[_rID].team = _team;
| if (round_[_rID].plyr != _pID)
round_[_rID].plyr = _pID;
if (round_[_rID].team != _team)
round_[_rID].team = _team;
| 32,285 |
26 | // can't remove immutable functions -- functions defined directly in the diamond | require(
oldFacetAddressAndSelectorPosition.facetAddress != address(this),
"LibDiamondCut: Can't remove immutable function."
);
| require(
oldFacetAddressAndSelectorPosition.facetAddress != address(this),
"LibDiamondCut: Can't remove immutable function."
);
| 25,785 |
34 | // start of vesting period as a timestamp | uint256 public start;
| uint256 public start;
| 18,761 |
134 | // Gets the token name.return string representing the token name / | function name() external view returns (string memory) {
return _name;
}
| function name() external view returns (string memory) {
return _name;
}
| 11,492 |
14 | // Kills a Loan, and reward the Killer a part of the fees of the LoanSend the reward fees to the Killer, then return the loaned tokens and the fees to the PalPool, and destroy the contract_killer Address of the Loan Killer_killerRatio Percentage of the fees to reward to the killer (scale 1e18)/ | function killLoan(address _killer, uint _killerRatio) external motherPoolOnly {
IERC20 _underlying = IERC20(underlying);
//Send the killer reward to the killer
//Then return the borrowed amount and the fees to the pool
uint _killerAmount = feesAmount.mul(_killerRatio).div(uint(1e18));
uint _balance = _underlying.balanceOf(address(this));
uint _poolAmount = _balance.sub(_killerAmount);
_underlying.safeTransfer(_killer, _killerAmount);
_underlying.safeTransfer(motherPool, _poolAmount);
registry.clearDelegate("");
//Destruct the contract, so it's not usable anymore
selfdestruct(motherPool);
}
| function killLoan(address _killer, uint _killerRatio) external motherPoolOnly {
IERC20 _underlying = IERC20(underlying);
//Send the killer reward to the killer
//Then return the borrowed amount and the fees to the pool
uint _killerAmount = feesAmount.mul(_killerRatio).div(uint(1e18));
uint _balance = _underlying.balanceOf(address(this));
uint _poolAmount = _balance.sub(_killerAmount);
_underlying.safeTransfer(_killer, _killerAmount);
_underlying.safeTransfer(motherPool, _poolAmount);
registry.clearDelegate("");
//Destruct the contract, so it's not usable anymore
selfdestruct(motherPool);
}
| 55,711 |
20 | // Read and consume the next 16 bytes from the buffer as an `uint128`._buffer An instance of `BufferLib.Buffer`. return The `uint128` value of the next 16 bytes in the buffer counting from the cursor position./ | function readUint128(Buffer memory _buffer) internal pure notOutOfBounds(_buffer.cursor + 15, _buffer.data.length) returns (uint128) {
bytes memory bytesValue = _buffer.data;
uint32 offset = _buffer.cursor;
uint128 value;
assembly {
value := mload(add(add(bytesValue, 16), offset))
}
_buffer.cursor += 16;
return value;
}
| function readUint128(Buffer memory _buffer) internal pure notOutOfBounds(_buffer.cursor + 15, _buffer.data.length) returns (uint128) {
bytes memory bytesValue = _buffer.data;
uint32 offset = _buffer.cursor;
uint128 value;
assembly {
value := mload(add(add(bytesValue, 16), offset))
}
_buffer.cursor += 16;
return value;
}
| 29,009 |
3 | // Wallet 3 (2%): | address public owner3 = 0xf08e0469565d481d4193de46D5f98b7c6463FC3d;
| address public owner3 = 0xf08e0469565d481d4193de46D5f98b7c6463FC3d;
| 84,600 |
100 | // Amount of RUBC to be locked in gas pool on opening troves | uint constant public RUBC_GAS_COMPENSATION = 20_000e18;
| uint constant public RUBC_GAS_COMPENSATION = 20_000e18;
| 21,415 |
179 | // Value Liquidity (VALUE) with Governance Alpha | contract ValueLiquidityToken is ERC20 {
using SafeERC20 for IERC20;
using SafeMath for uint256;
IERC20 public yfv;
address public governance;
uint256 public cap;
uint256 public yfvLockedBalance;
mapping(address => bool) public minters;
event Deposit(address indexed dst, uint amount);
event Withdrawal(address indexed src, uint amount);
constructor (IERC20 _yfv, uint256 _cap) public ERC20("Value Liquidity", "VALUE") {
governance = msg.sender;
yfv = _yfv;
cap = _cap;
}
function mint(address _to, uint256 _amount) public {
require(msg.sender == governance || minters[msg.sender], "!governance && !minter");
_mint(_to, _amount);
_moveDelegates(address(0), _delegates[_to], _amount);
}
function burn(uint256 _amount) public {
_burn(msg.sender, _amount);
_moveDelegates(_delegates[msg.sender], address(0), _amount);
}
function burnFrom(address _account, uint256 _amount) public {
uint256 decreasedAllowance = allowance(_account, msg.sender).sub(_amount, "ERC20: burn amount exceeds allowance");
_approve(_account, msg.sender, decreasedAllowance);
_burn(_account, _amount);
_moveDelegates(_delegates[_account], address(0), _amount);
}
function setGovernance(address _governance) public {
require(msg.sender == governance, "!governance");
governance = _governance;
}
function addMinter(address _minter) public {
require(msg.sender == governance, "!governance");
minters[_minter] = true;
}
function removeMinter(address _minter) public {
require(msg.sender == governance, "!governance");
minters[_minter] = false;
}
function setCap(uint256 _cap) public {
require(msg.sender == governance, "!governance");
require(_cap.add(yfvLockedBalance) >= totalSupply(), "_cap (plus yfvLockedBalance) is below current supply");
cap = _cap;
}
function deposit(uint256 _amount) public {
yfv.safeTransferFrom(msg.sender, address(this), _amount);
yfvLockedBalance = yfvLockedBalance.add(_amount);
_mint(msg.sender, _amount);
_moveDelegates(address(0), _delegates[msg.sender], _amount);
Deposit(msg.sender, _amount);
}
function withdraw(uint256 _amount) public {
yfvLockedBalance = yfvLockedBalance.sub(_amount, "There is not enough locked YFV to withdraw");
yfv.safeTransfer(msg.sender, _amount);
_burn(msg.sender, _amount);
_moveDelegates(_delegates[msg.sender], address(0), _amount);
Withdrawal(msg.sender, _amount);
}
// This function allows governance to take unsupported tokens out of the contract.
// This is in an effort to make someone whole, should they seriously mess up.
// There is no guarantee governance will vote to return these.
// It also allows for removal of airdropped tokens.
function governanceRecoverUnsupported(IERC20 _token, address _to, uint256 _amount) external {
require(msg.sender == governance, "!governance");
if (_token == yfv) {
uint256 yfvBalance = yfv.balanceOf(address(this));
require(_amount <= yfvBalance.sub(yfvLockedBalance), "cant withdraw more then stuck amount");
}
_token.safeTransfer(_to, _amount);
}
/**
* @dev See {ERC20-_beforeTokenTransfer}.
*
* Requirements:
*
* - minted tokens must not cause the total supply to go over the cap.
*/
function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual override {
super._beforeTokenTransfer(from, to, amount);
if (from == address(0)) {// When minting tokens
require(totalSupply().add(amount) <= cap.add(yfvLockedBalance), "ERC20Capped: cap exceeded");
}
}
// Copied and modified from YAM code:
// https://github.com/yam-finance/yam-protocol/blob/master/contracts/token/YAMGovernanceStorage.sol
// https://github.com/yam-finance/yam-protocol/blob/master/contracts/token/YAMGovernance.sol
// Which is copied and modified from COMPOUND:
// https://github.com/compound-finance/compound-protocol/blob/master/contracts/Governance/Comp.sol
/// @dev A record of each accounts delegate
mapping(address => address) internal _delegates;
/// @notice A checkpoint for marking number of votes from a given block
struct Checkpoint {
uint32 fromBlock;
uint256 votes;
}
/// @notice A record of votes checkpoints for each account, by index
mapping(address => mapping(uint32 => Checkpoint)) public checkpoints;
/// @notice The number of checkpoints for each account
mapping(address => uint32) public numCheckpoints;
/// @notice The EIP-712 typehash for the contract's domain
bytes32 public constant DOMAIN_TYPEHASH = keccak256("EIP712Domain(string name,uint256 chainId,address verifyingContract)");
/// @notice The EIP-712 typehash for the delegation struct used by the contract
bytes32 public constant DELEGATION_TYPEHASH = keccak256("Delegation(address delegatee,uint256 nonce,uint256 expiry)");
/// @notice A record of states for signing / validating signatures
mapping(address => uint) public nonces;
/// @notice An event thats emitted when an account changes its delegate
event DelegateChanged(address indexed delegator, address indexed fromDelegate, address indexed toDelegate);
/// @notice An event thats emitted when a delegate account's vote balance changes
event DelegateVotesChanged(address indexed delegate, uint previousBalance, uint newBalance);
/**
* @notice Delegate votes from `msg.sender` to `delegatee`
* @param delegator The address to get delegatee for
*/
function delegates(address delegator)
external
view
returns (address)
{
return _delegates[delegator];
}
/**
* @notice Delegate votes from `msg.sender` to `delegatee`
* @param delegatee The address to delegate votes to
*/
function delegate(address delegatee) external {
return _delegate(msg.sender, delegatee);
}
/**
* @notice Delegates votes from signatory to `delegatee`
* @param delegatee The address to delegate votes to
* @param nonce The contract state required to match the signature
* @param expiry The time at which to expire the signature
* @param v The recovery byte of the signature
* @param r Half of the ECDSA signature pair
* @param s Half of the ECDSA signature pair
*/
function delegateBySig(
address delegatee,
uint nonce,
uint expiry,
uint8 v,
bytes32 r,
bytes32 s
)
external
{
bytes32 domainSeparator = keccak256(
abi.encode(
DOMAIN_TYPEHASH,
keccak256(bytes(name())),
getChainId(),
address(this)
)
);
bytes32 structHash = keccak256(
abi.encode(
DELEGATION_TYPEHASH,
delegatee,
nonce,
expiry
)
);
bytes32 digest = keccak256(
abi.encodePacked(
"\x19\x01",
domainSeparator,
structHash
)
);
address signatory = ecrecover(digest, v, r, s);
require(signatory != address(0), "VALUE::delegateBySig: invalid signature");
require(nonce == nonces[signatory]++, "VALUE::delegateBySig: invalid nonce");
require(now <= expiry, "VALUE::delegateBySig: signature expired");
return _delegate(signatory, delegatee);
}
/**
* @notice Gets the current votes balance for `account`
* @param account The address to get votes balance
* @return The number of current votes for `account`
*/
function getCurrentVotes(address account)
external
view
returns (uint256)
{
uint32 nCheckpoints = numCheckpoints[account];
return nCheckpoints > 0 ? checkpoints[account][nCheckpoints - 1].votes : 0;
}
/**
* @notice Determine the prior number of votes for an account as of a block number
* @dev Block number must be a finalized block or else this function will revert to prevent misinformation.
* @param account The address of the account to check
* @param blockNumber The block number to get the vote balance at
* @return The number of votes the account had as of the given block
*/
function getPriorVotes(address account, uint blockNumber)
external
view
returns (uint256)
{
require(blockNumber < block.number, "VALUE::getPriorVotes: not yet determined");
uint32 nCheckpoints = numCheckpoints[account];
if (nCheckpoints == 0) {
return 0;
}
// First check most recent balance
if (checkpoints[account][nCheckpoints - 1].fromBlock <= blockNumber) {
return checkpoints[account][nCheckpoints - 1].votes;
}
// Next check implicit zero balance
if (checkpoints[account][0].fromBlock > blockNumber) {
return 0;
}
uint32 lower = 0;
uint32 upper = nCheckpoints - 1;
while (upper > lower) {
uint32 center = upper - (upper - lower) / 2; // ceil, avoiding overflow
Checkpoint memory cp = checkpoints[account][center];
if (cp.fromBlock == blockNumber) {
return cp.votes;
} else if (cp.fromBlock < blockNumber) {
lower = center;
} else {
upper = center - 1;
}
}
return checkpoints[account][lower].votes;
}
function _delegate(address delegator, address delegatee)
internal
{
address currentDelegate = _delegates[delegator];
uint256 delegatorBalance = balanceOf(delegator); // balance of underlying VALUEs (not scaled);
_delegates[delegator] = delegatee;
emit DelegateChanged(delegator, currentDelegate, delegatee);
_moveDelegates(currentDelegate, delegatee, delegatorBalance);
}
function _moveDelegates(address srcRep, address dstRep, uint256 amount) internal {
if (srcRep != dstRep && amount > 0) {
if (srcRep != address(0)) {
// decrease old representative
uint32 srcRepNum = numCheckpoints[srcRep];
uint256 srcRepOld = srcRepNum > 0 ? checkpoints[srcRep][srcRepNum - 1].votes : 0;
uint256 srcRepNew = srcRepOld.sub(amount);
_writeCheckpoint(srcRep, srcRepNum, srcRepOld, srcRepNew);
}
if (dstRep != address(0)) {
// increase new representative
uint32 dstRepNum = numCheckpoints[dstRep];
uint256 dstRepOld = dstRepNum > 0 ? checkpoints[dstRep][dstRepNum - 1].votes : 0;
uint256 dstRepNew = dstRepOld.add(amount);
_writeCheckpoint(dstRep, dstRepNum, dstRepOld, dstRepNew);
}
}
}
function _writeCheckpoint(
address delegatee,
uint32 nCheckpoints,
uint256 oldVotes,
uint256 newVotes
)
internal
{
uint32 blockNumber = safe32(block.number, "VALUE::_writeCheckpoint: block number exceeds 32 bits");
if (nCheckpoints > 0 && checkpoints[delegatee][nCheckpoints - 1].fromBlock == blockNumber) {
checkpoints[delegatee][nCheckpoints - 1].votes = newVotes;
} else {
checkpoints[delegatee][nCheckpoints] = Checkpoint(blockNumber, newVotes);
numCheckpoints[delegatee] = nCheckpoints + 1;
}
emit DelegateVotesChanged(delegatee, oldVotes, newVotes);
}
function safe32(uint n, string memory errorMessage) internal pure returns (uint32) {
require(n < 2 ** 32, errorMessage);
return uint32(n);
}
function getChainId() internal pure returns (uint) {
uint256 chainId;
assembly {chainId := chainid()}
return chainId;
}
}
| contract ValueLiquidityToken is ERC20 {
using SafeERC20 for IERC20;
using SafeMath for uint256;
IERC20 public yfv;
address public governance;
uint256 public cap;
uint256 public yfvLockedBalance;
mapping(address => bool) public minters;
event Deposit(address indexed dst, uint amount);
event Withdrawal(address indexed src, uint amount);
constructor (IERC20 _yfv, uint256 _cap) public ERC20("Value Liquidity", "VALUE") {
governance = msg.sender;
yfv = _yfv;
cap = _cap;
}
function mint(address _to, uint256 _amount) public {
require(msg.sender == governance || minters[msg.sender], "!governance && !minter");
_mint(_to, _amount);
_moveDelegates(address(0), _delegates[_to], _amount);
}
function burn(uint256 _amount) public {
_burn(msg.sender, _amount);
_moveDelegates(_delegates[msg.sender], address(0), _amount);
}
function burnFrom(address _account, uint256 _amount) public {
uint256 decreasedAllowance = allowance(_account, msg.sender).sub(_amount, "ERC20: burn amount exceeds allowance");
_approve(_account, msg.sender, decreasedAllowance);
_burn(_account, _amount);
_moveDelegates(_delegates[_account], address(0), _amount);
}
function setGovernance(address _governance) public {
require(msg.sender == governance, "!governance");
governance = _governance;
}
function addMinter(address _minter) public {
require(msg.sender == governance, "!governance");
minters[_minter] = true;
}
function removeMinter(address _minter) public {
require(msg.sender == governance, "!governance");
minters[_minter] = false;
}
function setCap(uint256 _cap) public {
require(msg.sender == governance, "!governance");
require(_cap.add(yfvLockedBalance) >= totalSupply(), "_cap (plus yfvLockedBalance) is below current supply");
cap = _cap;
}
function deposit(uint256 _amount) public {
yfv.safeTransferFrom(msg.sender, address(this), _amount);
yfvLockedBalance = yfvLockedBalance.add(_amount);
_mint(msg.sender, _amount);
_moveDelegates(address(0), _delegates[msg.sender], _amount);
Deposit(msg.sender, _amount);
}
function withdraw(uint256 _amount) public {
yfvLockedBalance = yfvLockedBalance.sub(_amount, "There is not enough locked YFV to withdraw");
yfv.safeTransfer(msg.sender, _amount);
_burn(msg.sender, _amount);
_moveDelegates(_delegates[msg.sender], address(0), _amount);
Withdrawal(msg.sender, _amount);
}
// This function allows governance to take unsupported tokens out of the contract.
// This is in an effort to make someone whole, should they seriously mess up.
// There is no guarantee governance will vote to return these.
// It also allows for removal of airdropped tokens.
function governanceRecoverUnsupported(IERC20 _token, address _to, uint256 _amount) external {
require(msg.sender == governance, "!governance");
if (_token == yfv) {
uint256 yfvBalance = yfv.balanceOf(address(this));
require(_amount <= yfvBalance.sub(yfvLockedBalance), "cant withdraw more then stuck amount");
}
_token.safeTransfer(_to, _amount);
}
/**
* @dev See {ERC20-_beforeTokenTransfer}.
*
* Requirements:
*
* - minted tokens must not cause the total supply to go over the cap.
*/
function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual override {
super._beforeTokenTransfer(from, to, amount);
if (from == address(0)) {// When minting tokens
require(totalSupply().add(amount) <= cap.add(yfvLockedBalance), "ERC20Capped: cap exceeded");
}
}
// Copied and modified from YAM code:
// https://github.com/yam-finance/yam-protocol/blob/master/contracts/token/YAMGovernanceStorage.sol
// https://github.com/yam-finance/yam-protocol/blob/master/contracts/token/YAMGovernance.sol
// Which is copied and modified from COMPOUND:
// https://github.com/compound-finance/compound-protocol/blob/master/contracts/Governance/Comp.sol
/// @dev A record of each accounts delegate
mapping(address => address) internal _delegates;
/// @notice A checkpoint for marking number of votes from a given block
struct Checkpoint {
uint32 fromBlock;
uint256 votes;
}
/// @notice A record of votes checkpoints for each account, by index
mapping(address => mapping(uint32 => Checkpoint)) public checkpoints;
/// @notice The number of checkpoints for each account
mapping(address => uint32) public numCheckpoints;
/// @notice The EIP-712 typehash for the contract's domain
bytes32 public constant DOMAIN_TYPEHASH = keccak256("EIP712Domain(string name,uint256 chainId,address verifyingContract)");
/// @notice The EIP-712 typehash for the delegation struct used by the contract
bytes32 public constant DELEGATION_TYPEHASH = keccak256("Delegation(address delegatee,uint256 nonce,uint256 expiry)");
/// @notice A record of states for signing / validating signatures
mapping(address => uint) public nonces;
/// @notice An event thats emitted when an account changes its delegate
event DelegateChanged(address indexed delegator, address indexed fromDelegate, address indexed toDelegate);
/// @notice An event thats emitted when a delegate account's vote balance changes
event DelegateVotesChanged(address indexed delegate, uint previousBalance, uint newBalance);
/**
* @notice Delegate votes from `msg.sender` to `delegatee`
* @param delegator The address to get delegatee for
*/
function delegates(address delegator)
external
view
returns (address)
{
return _delegates[delegator];
}
/**
* @notice Delegate votes from `msg.sender` to `delegatee`
* @param delegatee The address to delegate votes to
*/
function delegate(address delegatee) external {
return _delegate(msg.sender, delegatee);
}
/**
* @notice Delegates votes from signatory to `delegatee`
* @param delegatee The address to delegate votes to
* @param nonce The contract state required to match the signature
* @param expiry The time at which to expire the signature
* @param v The recovery byte of the signature
* @param r Half of the ECDSA signature pair
* @param s Half of the ECDSA signature pair
*/
function delegateBySig(
address delegatee,
uint nonce,
uint expiry,
uint8 v,
bytes32 r,
bytes32 s
)
external
{
bytes32 domainSeparator = keccak256(
abi.encode(
DOMAIN_TYPEHASH,
keccak256(bytes(name())),
getChainId(),
address(this)
)
);
bytes32 structHash = keccak256(
abi.encode(
DELEGATION_TYPEHASH,
delegatee,
nonce,
expiry
)
);
bytes32 digest = keccak256(
abi.encodePacked(
"\x19\x01",
domainSeparator,
structHash
)
);
address signatory = ecrecover(digest, v, r, s);
require(signatory != address(0), "VALUE::delegateBySig: invalid signature");
require(nonce == nonces[signatory]++, "VALUE::delegateBySig: invalid nonce");
require(now <= expiry, "VALUE::delegateBySig: signature expired");
return _delegate(signatory, delegatee);
}
/**
* @notice Gets the current votes balance for `account`
* @param account The address to get votes balance
* @return The number of current votes for `account`
*/
function getCurrentVotes(address account)
external
view
returns (uint256)
{
uint32 nCheckpoints = numCheckpoints[account];
return nCheckpoints > 0 ? checkpoints[account][nCheckpoints - 1].votes : 0;
}
/**
* @notice Determine the prior number of votes for an account as of a block number
* @dev Block number must be a finalized block or else this function will revert to prevent misinformation.
* @param account The address of the account to check
* @param blockNumber The block number to get the vote balance at
* @return The number of votes the account had as of the given block
*/
function getPriorVotes(address account, uint blockNumber)
external
view
returns (uint256)
{
require(blockNumber < block.number, "VALUE::getPriorVotes: not yet determined");
uint32 nCheckpoints = numCheckpoints[account];
if (nCheckpoints == 0) {
return 0;
}
// First check most recent balance
if (checkpoints[account][nCheckpoints - 1].fromBlock <= blockNumber) {
return checkpoints[account][nCheckpoints - 1].votes;
}
// Next check implicit zero balance
if (checkpoints[account][0].fromBlock > blockNumber) {
return 0;
}
uint32 lower = 0;
uint32 upper = nCheckpoints - 1;
while (upper > lower) {
uint32 center = upper - (upper - lower) / 2; // ceil, avoiding overflow
Checkpoint memory cp = checkpoints[account][center];
if (cp.fromBlock == blockNumber) {
return cp.votes;
} else if (cp.fromBlock < blockNumber) {
lower = center;
} else {
upper = center - 1;
}
}
return checkpoints[account][lower].votes;
}
function _delegate(address delegator, address delegatee)
internal
{
address currentDelegate = _delegates[delegator];
uint256 delegatorBalance = balanceOf(delegator); // balance of underlying VALUEs (not scaled);
_delegates[delegator] = delegatee;
emit DelegateChanged(delegator, currentDelegate, delegatee);
_moveDelegates(currentDelegate, delegatee, delegatorBalance);
}
function _moveDelegates(address srcRep, address dstRep, uint256 amount) internal {
if (srcRep != dstRep && amount > 0) {
if (srcRep != address(0)) {
// decrease old representative
uint32 srcRepNum = numCheckpoints[srcRep];
uint256 srcRepOld = srcRepNum > 0 ? checkpoints[srcRep][srcRepNum - 1].votes : 0;
uint256 srcRepNew = srcRepOld.sub(amount);
_writeCheckpoint(srcRep, srcRepNum, srcRepOld, srcRepNew);
}
if (dstRep != address(0)) {
// increase new representative
uint32 dstRepNum = numCheckpoints[dstRep];
uint256 dstRepOld = dstRepNum > 0 ? checkpoints[dstRep][dstRepNum - 1].votes : 0;
uint256 dstRepNew = dstRepOld.add(amount);
_writeCheckpoint(dstRep, dstRepNum, dstRepOld, dstRepNew);
}
}
}
function _writeCheckpoint(
address delegatee,
uint32 nCheckpoints,
uint256 oldVotes,
uint256 newVotes
)
internal
{
uint32 blockNumber = safe32(block.number, "VALUE::_writeCheckpoint: block number exceeds 32 bits");
if (nCheckpoints > 0 && checkpoints[delegatee][nCheckpoints - 1].fromBlock == blockNumber) {
checkpoints[delegatee][nCheckpoints - 1].votes = newVotes;
} else {
checkpoints[delegatee][nCheckpoints] = Checkpoint(blockNumber, newVotes);
numCheckpoints[delegatee] = nCheckpoints + 1;
}
emit DelegateVotesChanged(delegatee, oldVotes, newVotes);
}
function safe32(uint n, string memory errorMessage) internal pure returns (uint32) {
require(n < 2 ** 32, errorMessage);
return uint32(n);
}
function getChainId() internal pure returns (uint) {
uint256 chainId;
assembly {chainId := chainid()}
return chainId;
}
}
| 15,431 |
241 | // increment the bid count | bidCount[catId] += 1;
| bidCount[catId] += 1;
| 11,025 |
6 | // Network fees have three tier, but it is sufficient to have minimun and maximun amount of tier 2Tier 1: deposit amount < minimun amount of tier 2Tier 2: minimun amount of tier 2 <= deposit amount <= maximun amount of tier 2Tier 3: amount > maximun amount of tier 2 / | uint256[] memory oldNetworkFeeTier2 = networkFeeTier2;
networkFeeTier2 = _networkFeeTier2;
emit SetNetworkFeeTier2(oldNetworkFeeTier2, _networkFeeTier2);
| uint256[] memory oldNetworkFeeTier2 = networkFeeTier2;
networkFeeTier2 = _networkFeeTier2;
emit SetNetworkFeeTier2(oldNetworkFeeTier2, _networkFeeTier2);
| 17,775 |
25 | // Withdraws staked creature NFTs/tokenIds The tokenIds of the NFTs which will be withdrawn | function withdrawCreatures(uint256[] memory tokenIds) external nonReentrant updateReward(msg.sender) {
require(tokenIds.length > 0, "SwampStaking: No tokenIds provided");
uint256 amount;
for (uint256 i; i < tokenIds.length;) {
// Check if the user who withdraws is the owner
require(stakedCreatures[tokenIds[i]] == msg.sender, "SwampStaking: Not the staker of the token");
// Transfer NFTs back to the owner
creatureToken.safeTransferFrom(address(this), msg.sender, tokenIds[i]);
// Increment the amount which will be withdrawn
unchecked { amount++; }
// Cleanup stakedAssets for the current tokenId
stakedCreatures[tokenIds[i]] = address(0);
unchecked { i++; }
}
unchecked { userInfo[msg.sender].stakedCreatureCount -= amount; }
emit Withdrawn(msg.sender, amount, tokenIds, 1);
}
| function withdrawCreatures(uint256[] memory tokenIds) external nonReentrant updateReward(msg.sender) {
require(tokenIds.length > 0, "SwampStaking: No tokenIds provided");
uint256 amount;
for (uint256 i; i < tokenIds.length;) {
// Check if the user who withdraws is the owner
require(stakedCreatures[tokenIds[i]] == msg.sender, "SwampStaking: Not the staker of the token");
// Transfer NFTs back to the owner
creatureToken.safeTransferFrom(address(this), msg.sender, tokenIds[i]);
// Increment the amount which will be withdrawn
unchecked { amount++; }
// Cleanup stakedAssets for the current tokenId
stakedCreatures[tokenIds[i]] = address(0);
unchecked { i++; }
}
unchecked { userInfo[msg.sender].stakedCreatureCount -= amount; }
emit Withdrawn(msg.sender, amount, tokenIds, 1);
}
| 5,377 |
19 | // i < tokenBalanceOwner because tokenBalanceOwner is 1-indexed | for (uint256 i = 0; i < tokenBalanceOwner; i++) {
| for (uint256 i = 0; i < tokenBalanceOwner; i++) {
| 11,645 |
157 | // Add the user liqudation fee with the arc liquidation fee / | function totalLiquidationSpread()
public
view
returns (Decimal.D256 memory)
| function totalLiquidationSpread()
public
view
returns (Decimal.D256 memory)
| 32,811 |
7 | // Constructor ------------------------------------------------------------------------ | constructor()
ERC721GasOptimization("BlackandBlueCosmos", "BBC",0)
EIP712("BlackandBlueCosmos", "1.0.0")
| constructor()
ERC721GasOptimization("BlackandBlueCosmos", "BBC",0)
EIP712("BlackandBlueCosmos", "1.0.0")
| 29,625 |
186 | // This cannot happen - just in case | last_point.slope = 0;
| last_point.slope = 0;
| 48,112 |
53 | // eslint-ignore | ICash Dollars;
mapping(address=>Account) private _shareBalances;
mapping (address => mapping (address => uint256)) private _allowedShares;
bool reEntrancyMintMutex;
address public _euroMinter;
mapping (address => uint256) private _euroDividendPoints;
mapping (address => bool) public _debased;
bool public debaseOn;
| ICash Dollars;
mapping(address=>Account) private _shareBalances;
mapping (address => mapping (address => uint256)) private _allowedShares;
bool reEntrancyMintMutex;
address public _euroMinter;
mapping (address => uint256) private _euroDividendPoints;
mapping (address => bool) public _debased;
bool public debaseOn;
| 14,415 |
442 | // Sends a message associated with a transfer to a contract on another chain. _receiver The address of the destination app contract. _token The address of the token to be sent. _amount The amount of tokens to be sent. _dstChainId The destination chain ID. _nonce A number input to guarantee uniqueness of transferId. Can be timestamp in practice. _maxSlippage The max slippage accepted, given as percentage in point (pip). Eg. 5000 means 0.5%. Must be greater than minimalMaxSlippage. Receiver is guaranteed to receive at least (100% - max slippage percentage)amount or the transfer can be refunded. | * Only applicable to the {MsgDataTypes.BridgeSendType.Liquidity}.
* @param _message Arbitrary message bytes to be decoded by the destination app contract.
* If message is empty, only the token transfer will be sent
* @param _bridgeSendType One of the {BridgeSendType} enum.
* @param _fee The fee amount to pay to MessageBus.
* @return The transfer ID.
*/
function sendMessageWithTransfer(
address _receiver,
address _token,
uint256 _amount,
uint64 _dstChainId,
uint64 _nonce,
uint32 _maxSlippage,
bytes memory _message,
MsgDataTypes.BridgeSendType _bridgeSendType,
uint256 _fee
) internal returns (bytes32) {
return
MessageSenderLib.sendMessageWithTransfer(
_receiver,
_token,
_amount,
_dstChainId,
_nonce,
_maxSlippage,
_message,
_bridgeSendType,
messageBus,
_fee
);
}
| * Only applicable to the {MsgDataTypes.BridgeSendType.Liquidity}.
* @param _message Arbitrary message bytes to be decoded by the destination app contract.
* If message is empty, only the token transfer will be sent
* @param _bridgeSendType One of the {BridgeSendType} enum.
* @param _fee The fee amount to pay to MessageBus.
* @return The transfer ID.
*/
function sendMessageWithTransfer(
address _receiver,
address _token,
uint256 _amount,
uint64 _dstChainId,
uint64 _nonce,
uint32 _maxSlippage,
bytes memory _message,
MsgDataTypes.BridgeSendType _bridgeSendType,
uint256 _fee
) internal returns (bytes32) {
return
MessageSenderLib.sendMessageWithTransfer(
_receiver,
_token,
_amount,
_dstChainId,
_nonce,
_maxSlippage,
_message,
_bridgeSendType,
messageBus,
_fee
);
}
| 5,325 |
12 | // This function should be called only by account with MANAGE_GROUPS permissions_groupName name of the group in storage_a address which will be removed from the group with name _groupNamethis function remove address _a from group name with name _groupName in storage/ | function removeGroupMember(string _groupName, address _a) public isCanDoOrByOwner(MANAGE_GROUPS) {
emit DaoBaseRemoveGroupMember(_groupName, _a);
daoStorage.removeGroupMember(stringHash(_groupName), _a);
}
| function removeGroupMember(string _groupName, address _a) public isCanDoOrByOwner(MANAGE_GROUPS) {
emit DaoBaseRemoveGroupMember(_groupName, _a);
daoStorage.removeGroupMember(stringHash(_groupName), _a);
}
| 10,288 |
24 | // contracts/interfaces/ILoanFactory.sol/ pragma solidity 0.6.11; / | interface ILoanFactory {
function CL_FACTORY() external view returns (uint8);
function FL_FACTORY() external view returns (uint8);
function INTEREST_CALC_TYPE() external view returns (uint8);
function LATEFEE_CALC_TYPE() external view returns (uint8);
function PREMIUM_CALC_TYPE() external view returns (uint8);
function globals() external view returns (address);
function loansCreated() external view returns (uint256);
function loans(uint256) external view returns (address);
function isLoan(address) external view returns (bool);
function loanFactoryAdmins(address) external view returns (bool);
function setGlobals(address) external;
function createLoan(address, address, address, address, uint256[5] memory, address[3] memory) external returns (address);
function setLoanFactoryAdmin(address, bool) external;
function pause() external;
function unpause() external;
}
| interface ILoanFactory {
function CL_FACTORY() external view returns (uint8);
function FL_FACTORY() external view returns (uint8);
function INTEREST_CALC_TYPE() external view returns (uint8);
function LATEFEE_CALC_TYPE() external view returns (uint8);
function PREMIUM_CALC_TYPE() external view returns (uint8);
function globals() external view returns (address);
function loansCreated() external view returns (uint256);
function loans(uint256) external view returns (address);
function isLoan(address) external view returns (bool);
function loanFactoryAdmins(address) external view returns (bool);
function setGlobals(address) external;
function createLoan(address, address, address, address, uint256[5] memory, address[3] memory) external returns (address);
function setLoanFactoryAdmin(address, bool) external;
function pause() external;
function unpause() external;
}
| 6,359 |
34 | // To exclude division by zero There is a check for a non zero eend.allWhiteCollateral above Cell 26 | eend.whiteCoefficient = wdiv(eend.allBlackCollateral, eend.allWhiteCollateral);
emit WhiteCefficient(eend.whiteCoefficient);
| eend.whiteCoefficient = wdiv(eend.allBlackCollateral, eend.allWhiteCollateral);
emit WhiteCefficient(eend.whiteCoefficient);
| 26,205 |
105 | // This amount must be determined before arNxm burn. | uint256 wNxmAmount = wNxmValue(_arAmount);
| uint256 wNxmAmount = wNxmValue(_arAmount);
| 20,034 |
1 | // Mint statuses. | enum Status {
Paused,
Whitelist,
Mintpass,
Public
}
| enum Status {
Paused,
Whitelist,
Mintpass,
Public
}
| 40,738 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.