diff --git a/contracts/interfaces/IIssuanceModule.sol b/contracts/interfaces/IIssuanceModule.sol new file mode 100644 index 000000000..a286c6627 --- /dev/null +++ b/contracts/interfaces/IIssuanceModule.sol @@ -0,0 +1,41 @@ +/* + Copyright 2022 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; + +import { ISetToken } from "./ISetToken.sol"; + +/** + * @title IIssuanceModule + * @author Set Protocol + * + * Interface for interacting with Issuance module interface. + */ +interface IIssuanceModule { + function updateIssueFee(ISetToken _setToken, uint256 _newIssueFee) external; + function updateRedeemFee(ISetToken _setToken, uint256 _newRedeemFee) external; + function updateFeeRecipient(ISetToken _setToken, address _newRedeemFee) external; + + function initialize( + ISetToken _setToken, + uint256 _maxManagerFee, + uint256 _managerIssueFee, + uint256 _managerRedeemFee, + address _feeRecipient, + address _managerIssuanceHook + ) external; +} diff --git a/contracts/interfaces/ISetTokenCreator.sol b/contracts/interfaces/ISetTokenCreator.sol new file mode 100644 index 000000000..9465d1e74 --- /dev/null +++ b/contracts/interfaces/ISetTokenCreator.sol @@ -0,0 +1,32 @@ +/* + Copyright 2022 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; + +interface ISetTokenCreator { + function create( + address[] memory _components, + int256[] memory _units, + address[] memory _modules, + address _manager, + string memory _name, + string memory _symbol + ) + external + returns (address); +} diff --git a/contracts/interfaces/IStreamingFeeModule.sol b/contracts/interfaces/IStreamingFeeModule.sol index e964243e3..45ab7d503 100644 --- a/contracts/interfaces/IStreamingFeeModule.sol +++ b/contracts/interfaces/IStreamingFeeModule.sol @@ -19,9 +19,19 @@ pragma solidity 0.6.10; pragma experimental "ABIEncoderV2"; import { ISetToken } from "./ISetToken.sol"; -import { StreamingFeeModule } from "../protocol/modules/StreamingFeeModule.sol"; interface IStreamingFeeModule { - function feeStates(ISetToken _setToken) external view returns (StreamingFeeModule.FeeState memory); + struct FeeState { + address feeRecipient; + uint256 maxStreamingFeePercentage; + uint256 streamingFeePercentage; + uint256 lastStreamingFeeTimestamp; + } + + function feeStates(ISetToken _setToken) external view returns (FeeState memory); function getFee(ISetToken _setToken) external view returns (uint256); -} \ No newline at end of file + function accrueFee(ISetToken _setToken) external; + function updateStreamingFee(ISetToken _setToken, uint256 _newFee) external; + function updateFeeRecipient(ISetToken _setToken, address _newFeeRecipient) external; + function initialize(ISetToken _setToken, FeeState memory _settings) external; +} diff --git a/contracts/interfaces/ITradeModule.sol b/contracts/interfaces/ITradeModule.sol new file mode 100644 index 000000000..5d0059995 --- /dev/null +++ b/contracts/interfaces/ITradeModule.sol @@ -0,0 +1,35 @@ +/* + Copyright 2022 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"; + +import { ISetToken } from "./ISetToken.sol"; + +interface ITradeModule { + function initialize(ISetToken _setToken) external; + + function trade( + ISetToken _setToken, + string memory _exchangeName, + address _sendToken, + uint256 _sendQuantity, + address _receiveToken, + uint256 _minReceiveQuantity, + bytes memory _data + ) external; +} diff --git a/contracts/interfaces/external/perp-v2/IAccountBalance.sol b/contracts/interfaces/external/perp-v2/IAccountBalance.sol index c2db0f302..47ec0993d 100644 --- a/contracts/interfaces/external/perp-v2/IAccountBalance.sol +++ b/contracts/interfaces/external/perp-v2/IAccountBalance.sol @@ -35,4 +35,6 @@ interface IAccountBalance { function getExchange() external view returns (address); function getOrderBook() external view returns (address); function getVault() external view returns (address); + function getTakerPositionSize(address trader, address baseToken) external view returns (int256); + function getTakerOpenNotional(address trader, address baseToken) external view returns (int256); } diff --git a/contracts/protocol-viewers/StreamingFeeModuleViewer.sol b/contracts/protocol-viewers/StreamingFeeModuleViewer.sol index a3c64e62b..b23a59553 100644 --- a/contracts/protocol-viewers/StreamingFeeModuleViewer.sol +++ b/contracts/protocol-viewers/StreamingFeeModuleViewer.sol @@ -49,7 +49,7 @@ contract StreamingFeeModuleViewer { StreamingFeeInfo[] memory feeInfo = new StreamingFeeInfo[](_setTokens.length); for (uint256 i = 0; i < _setTokens.length; i++) { - StreamingFeeModule.FeeState memory feeState = _streamingFeeModule.feeStates(_setTokens[i]); + IStreamingFeeModule.FeeState memory feeState = _streamingFeeModule.feeStates(_setTokens[i]); uint256 unaccruedFees = _streamingFeeModule.getFee(_setTokens[i]); feeInfo[i] = StreamingFeeInfo({