Skip to content

Commit

Permalink
fix(interfaces): Add protocol interfaces for set-v2-strategies [SIM-1…
Browse files Browse the repository at this point in the history
…24] (#226)
  • Loading branch information
cgewecke authored Mar 24, 2022
1 parent c2dbb92 commit 0bd5ca4
Show file tree
Hide file tree
Showing 6 changed files with 124 additions and 4 deletions.
41 changes: 41 additions & 0 deletions contracts/interfaces/IIssuanceModule.sol
Original file line number Diff line number Diff line change
@@ -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;
}
32 changes: 32 additions & 0 deletions contracts/interfaces/ISetTokenCreator.sol
Original file line number Diff line number Diff line change
@@ -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);
}
16 changes: 13 additions & 3 deletions contracts/interfaces/IStreamingFeeModule.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
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;
}
35 changes: 35 additions & 0 deletions contracts/interfaces/ITradeModule.sol
Original file line number Diff line number Diff line change
@@ -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;
}
2 changes: 2 additions & 0 deletions contracts/interfaces/external/perp-v2/IAccountBalance.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
2 changes: 1 addition & 1 deletion contracts/protocol-viewers/StreamingFeeModuleViewer.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down

0 comments on commit 0bd5ca4

Please sign in to comment.