Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions contracts/interfaces/external/ICErc20.sol
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

SPDX-License-Identifier: Apache License, Version 2.0
*/

pragma solidity 0.6.10;
Expand Down
2 changes: 2 additions & 0 deletions contracts/interfaces/external/ICEth.sol
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

SPDX-License-Identifier: Apache License, Version 2.0
*/

pragma solidity 0.6.10;
Expand Down
2 changes: 2 additions & 0 deletions contracts/interfaces/external/IComptroller.sol
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

SPDX-License-Identifier: Apache License, Version 2.0
*/

pragma solidity 0.6.10;
Expand Down
1 change: 1 addition & 0 deletions contracts/interfaces/external/IUniswapV2Factory.sol
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// SPDX-License-Identifier: Apache License, Version 2.0
pragma solidity 0.6.10;

interface IUniswapV2Factory {
Expand Down
2 changes: 2 additions & 0 deletions contracts/interfaces/external/IWETH.sol
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

SPDX-License-Identifier: Apache License, Version 2.0
*/

pragma solidity 0.6.10;
Expand Down
10 changes: 5 additions & 5 deletions contracts/mocks/AddressArrayUtilsMock.sol
Original file line number Diff line number Diff line change
Expand Up @@ -51,23 +51,23 @@ contract AddressArrayUtilsMock {
return A.pop(index);
}

function testValidatePairsWithArrayUint(address[] memory A, uint[] memory a) external view {
function testValidatePairsWithArrayUint(address[] memory A, uint[] memory a) external pure {
A.validatePairsWithArray(a);
}

function testValidatePairsWithArrayBool(address[] memory A, bool[] memory a) external view {
function testValidatePairsWithArrayBool(address[] memory A, bool[] memory a) external pure {
A.validatePairsWithArray(a);
}

function testValidatePairsWithArrayString(address[] memory A, string[] memory a) external view {
function testValidatePairsWithArrayString(address[] memory A, string[] memory a) external pure {
A.validatePairsWithArray(a);
}

function testValidatePairsWithArrayAddress(address[] memory A, address[] memory a) external view {
function testValidatePairsWithArrayAddress(address[] memory A, address[] memory a) external pure {
A.validatePairsWithArray(a);
}

function testValidatePairsWithArrayBytes(address[] memory A, bytes[] memory a) external view {
function testValidatePairsWithArrayBytes(address[] memory A, bytes[] memory a) external pure {
A.validatePairsWithArray(a);
}

Expand Down
2 changes: 1 addition & 1 deletion contracts/mocks/external/ComptrollerMock.sol
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ contract ComptrollerMock {
}

// Return empty array
function enterMarkets(address[] memory _cTokens) public returns (uint256[] memory) {
function enterMarkets(address[] memory _cTokens) public pure returns (uint256[] memory) {
return new uint256[](_cTokens.length);
}

Expand Down
6 changes: 4 additions & 2 deletions contracts/mocks/external/SynthetixExchangerMock.sol
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,14 @@ contract SynthetixExchangerMock {
}

function exchange(
address from,
address /* from */,
bytes32 sourceCurrencyKey,
uint256 sourceAmount,
bytes32 destinationCurrencyKey,
address destinationAddress
address /* destinationAddress */
)
external
view
returns (uint256 amountReceived)
{

Expand All @@ -87,6 +88,7 @@ contract SynthetixExchangerMock {
bytes32 _destinationCurrencyKey
)
public
view
returns (
uint256 amountReceived,
uint256 fee,
Expand Down
4 changes: 2 additions & 2 deletions contracts/mocks/integrations/StakingAdapterMock.sol
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ contract StakingAdapterMock {
uint256 _notionalAmount
)
external
view
pure
returns(address, uint256, bytes memory)
{
bytes memory callData = abi.encodeWithSignature("stake(uint256)", _notionalAmount);
Expand All @@ -78,7 +78,7 @@ contract StakingAdapterMock {
uint256 _notionalAmount
)
external
view
pure
returns(address, uint256, bytes memory)
{
bytes memory callData = abi.encodeWithSignature("unstake(uint256)", _notionalAmount);
Expand Down
2 changes: 1 addition & 1 deletion contracts/mocks/integrations/WrapAdapterMock.sol
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ contract WrapAdapterMock is ERC20 {

function getUnwrapCallData(
address _underlyingToken,
address _wrappedToken,
address /* _wrappedToken */,
uint256 _wrappedTokenUnits
) external view returns (address _subject, uint256 _value, bytes memory _calldata) {
bytes memory callData = abi.encodeWithSignature("withdraw(address,uint256)", _underlyingToken, _wrappedTokenUnits);
Expand Down
5 changes: 2 additions & 3 deletions contracts/mocks/protocol/CustomSetValuerMock.sol
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,15 @@ contract CustomSetValuerMock is ISetValuer {
* Gets the valuation of a SetToken using data from the price oracle. Reverts
* if no price exists for a component in the SetToken. Note: this works for external
* positions and negative (debt) positions.
*
*
* Note: There is a risk that the valuation is off if airdrops aren't retrieved or
* debt builds up via interest and its not reflected in the position
*
* @param _setToken SetToken instance to get valuation
* @param _quoteAsset Address of token to quote valuation in
*
* @return SetToken valuation in terms of quote asset in precise units 1e18
*/
function calculateSetTokenValuation(ISetToken _setToken, address _quoteAsset) external view override returns (uint256) {
function calculateSetTokenValuation(ISetToken /* _setToken */, address _quoteAsset) external view override returns (uint256) {
return valuation[_quoteAsset];
}
}
20 changes: 19 additions & 1 deletion contracts/mocks/protocol/module/DebtModuleMock.sol
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
/*
Copyright 2021 Set Labs Inc.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

SPDX-License-Identifier: Apache License, Version 2.0
*/

pragma solidity 0.6.10;
pragma experimental "ABIEncoderV2";

Expand Down Expand Up @@ -37,7 +55,7 @@ contract DebtModuleMock is ModuleBase {

function moduleIssueHook(ISetToken /*_setToken*/, uint256 /*_setTokenQuantity*/) external { moduleIssueHookCalled = true; }
function moduleRedeemHook(ISetToken /*_setToken*/, uint256 /*_setTokenQuantity*/) external { moduleRedeemHookCalled = true; }

function componentIssueHook(
ISetToken _setToken,
uint256 _setTokenQuantity,
Expand Down
9 changes: 7 additions & 2 deletions contracts/protocol-viewers/ERC20Viewer.sol
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
/*
Copyright 2021 Set Labs Inc.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

SPDX-License-Identifier: Apache License, Version 2.0
*/
pragma solidity 0.6.10;

Expand Down Expand Up @@ -41,7 +46,7 @@ contract ERC20Viewer {
{
// Cache length of addresses to fetch balances for
uint256 addressesCount = _tokenAddresses.length;

// Instantiate output array in memory
uint256[] memory balances = new uint256[](addressesCount);

Expand Down Expand Up @@ -72,7 +77,7 @@ contract ERC20Viewer {
{
// Cache length of addresses to fetch allowances for
uint256 addressesCount = _tokenAddresses.length;

// Instantiate output array in memory
uint256[] memory allowances = new uint256[](addressesCount);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,6 @@ contract UniswapV2ExchangeAdapterV2 {
* Note: When selecting the swap for exact tokens function, _sourceQuantity is defined as the max token quantity you are willing to trade, and
* _minDestinationQuantity is the exact quantity of token you are receiving.
*
* @param _sourceToken Address of source token to be sold
* @param _destinationToken Address of destination token to buy
* @param _destinationAddress Address that assets should be transferred to
* @param _sourceQuantity Fixed/Max amount of source token to sell
* @param _destinationQuantity Min/Fixed amount of destination token to buy
Expand All @@ -74,8 +72,8 @@ contract UniswapV2ExchangeAdapterV2 {
* @return bytes Trade calldata
*/
function getTradeCalldata(
address _sourceToken,
address _destinationToken,
address /* _sourceToken */,
address /* _destinationToken */,
address _destinationAddress,
uint256 _sourceQuantity,
uint256 _destinationQuantity,
Expand All @@ -84,7 +82,7 @@ contract UniswapV2ExchangeAdapterV2 {
external
view
returns (address, uint256, bytes memory)
{
{
(
address[] memory path,
bool shouldSwapExactTokensForTokens
Expand All @@ -104,16 +102,16 @@ contract UniswapV2ExchangeAdapterV2 {
/**
* Generate data parameter to be passed to `getTradeCallData`. Returns encoded trade paths and bool to select trade function.
*
* @param _sourceToken Address of the source token to be sold
* @param _sourceToken Address of the source token to be sold
* @param _destinationToken Address of the destination token to buy
* @param _fixIn Boolean representing if input tokens amount is fixed
*
* @return bytes Data parameter to be passed to `getTradeCallData`
*
* @return bytes Data parameter to be passed to `getTradeCallData`
*/
function generateDataParam(address _sourceToken, address _destinationToken, bool _fixIn)
external
pure
returns (bytes memory)
returns (bytes memory)
{
address[] memory path = new address[](2);
path[0] = _sourceToken;
Expand All @@ -138,4 +136,4 @@ contract UniswapV2ExchangeAdapterV2 {
function getUniswapExchangeData(address[] memory _path, bool _shouldSwapExactTokensForTokens) external pure returns (bytes memory) {
return abi.encode(_path, _shouldSwapExactTokensForTokens);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -84,28 +84,28 @@ contract AaveGovernanceAdapter {
/**
* Reverts as AAVE currently does not have a delegation mechanism in governance
*/
function getDelegateCalldata(address /* _delegatee */) external view returns (address, uint256, bytes memory) {
function getDelegateCalldata(address /* _delegatee */) external pure returns (address, uint256, bytes memory) {
revert("No delegation available in AAVE governance");
}

/**
* Reverts as AAVE currently does not have a register mechanism in governance
*/
function getRegisterCalldata(address /* _setToken */) external view returns (address, uint256, bytes memory) {
function getRegisterCalldata(address /* _setToken */) external pure returns (address, uint256, bytes memory) {
revert("No register available in AAVE governance");
}

/**
* Reverts as AAVE currently does not have a revoke mechanism in governance
*/
function getRevokeCalldata() external view returns (address, uint256, bytes memory) {
function getRevokeCalldata() external pure returns (address, uint256, bytes memory) {
revert("No revoke available in AAVE governance");
}

/**
* Reverts as creating a proposal is only available to AAVE genesis team
*/
function getProposeCalldata(bytes memory /* _proposalData */) external view returns (address, uint256, bytes memory) {
function getProposeCalldata(bytes memory /* _proposalData */) external pure returns (address, uint256, bytes memory) {
revert("Creation of new proposal only available to AAVE genesis team");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -132,14 +132,14 @@ contract AaveGovernanceV2Adapter {
/**
* Reverts as AAVE currently does not have a register mechanism in governance
*/
function getRegisterCalldata(address /* _setToken */) external view returns (address, uint256, bytes memory) {
function getRegisterCalldata(address /* _setToken */) external pure returns (address, uint256, bytes memory) {
revert("No register available in AAVE governance");
}

/**
* Reverts as AAVE currently does not have a revoke mechanism in governance
*/
function getRevokeCalldata() external view returns (address, uint256, bytes memory) {
function getRevokeCalldata() external pure returns (address, uint256, bytes memory) {
revert("No revoke available in AAVE governance");
}
}
Loading