Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: SetProtocol/set-protocol-v2
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v0.1.9
Choose a base ref
...
head repository: SetProtocol/set-protocol-v2
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
Loading
Showing with 24,053 additions and 10,043 deletions.
  1. +49 −35 .circleci/config.yml
  2. +2 −0 .github/semantic.yml
  3. +1 −0 .gitignore
  4. +1 −1 .solhint.json
  5. +1 −0 .solhintignore
  6. +14 −0 README.md
  7. +56 −0 contracts/interfaces/IAirdropModule.sol
  8. +8 −1 contracts/interfaces/IBasicIssuanceModule.sol
  9. +46 −0 contracts/interfaces/IClaimModule.sol
  10. +41 −0 contracts/interfaces/IIssuanceModule.sol
  11. +176 −0 contracts/interfaces/IPerpV2BasisTradingModule.sol
  12. +8 −28 contracts/interfaces/{IPerpV2LeverageModule.sol → IPerpV2LeverageModuleV2.sol}
  13. +32 −0 contracts/interfaces/ISetTokenCreator.sol
  14. +13 −3 contracts/interfaces/IStreamingFeeModule.sol
  15. +35 −0 contracts/interfaces/ITradeModule.sol
  16. +63 −0 contracts/interfaces/IWrapModuleV2.sol
  17. +68 −0 contracts/interfaces/IWrappedFCash.sol
  18. +9 −0 contracts/interfaces/IWrappedFCashFactory.sol
  19. +1 −1 contracts/interfaces/external/ICErc20.sol
  20. +5 −0 contracts/interfaces/external/INotionalProxy.sol
  21. +30 −0 contracts/interfaces/external/IStableSwapPool.sol
  22. +4 −2 contracts/interfaces/external/perp-v2/IAccountBalance.sol
  23. +24 −0 contracts/interfaces/external/perp-v2/IClearingHouseConfig.sol
  24. +23 −0 contracts/interfaces/external/perp-v2/IIndexPrice.sol
  25. +0 −38 contracts/interfaces/external/perp-v2/IMarketRegistry.sol
  26. +1 −0 contracts/lib/AddressArrayUtils.sol
  27. +49 −0 contracts/lib/BytesArrayUtils.sol
  28. +16 −6 contracts/lib/PreciseUnitMath.sol
  29. +61 −0 contracts/lib/StringArrayUtils.sol
  30. +13 −2 contracts/lib/UnitConversionUtils.sol
  31. +31 −0 contracts/mocks/BytesArrayUtilsMock.sol
  32. +139 −0 contracts/mocks/PositionV2Mock.sol
  33. +4 −0 contracts/mocks/PreciseUnitMathMock.sol
  34. +45 −0 contracts/mocks/StringArrayUtilsMock.sol
  35. +50 −0 contracts/mocks/WrappedfCashFactoryMock.sol
  36. +175 −0 contracts/mocks/WrappedfCashMock.sol
  37. +91 −0 contracts/mocks/external/CurveStableswapMock.sol
  38. +54 −0 contracts/mocks/external/TribePegExchangerMock.sol
  39. +29 −30 contracts/mocks/external/ZeroExMock.sol
  40. +156 −0 contracts/mocks/protocol/integration/lib/PerpV2LibraryV2Mock.sol
  41. +110 −0 contracts/mocks/protocol/integration/lib/PerpV2PositionsMock.sol
  42. +106 −0 contracts/mocks/protocol/lib/ModuleBaseV2Mock.sol
  43. +3 −4 contracts/mocks/protocol/module/DebtModuleMock.sol
  44. +132 −0 contracts/product/APYRescue.sol
  45. +59 −0 contracts/product/TokenEnabler.sol
  46. +0 −109 contracts/product/UniswapYieldHook.sol
  47. +252 −0 contracts/protocol-viewers/PerpV2LeverageModuleViewer.sol
  48. +2 −2 contracts/protocol-viewers/StreamingFeeModuleViewer.sol
  49. +178 −0 contracts/protocol/integration/exchange/CurveExchangeAdapter.sol
  50. +205 −0 contracts/protocol/integration/exchange/CurveStEthExchangeAdapter.sol
  51. +172 −0 contracts/protocol/integration/exchange/UniswapV3ExchangeAdapterV2.sol
  52. +52 −37 contracts/protocol/integration/exchange/ZeroExApiAdapter.sol
  53. +1 −5 contracts/protocol/integration/lib/PerpV2.sol
  54. +347 −0 contracts/protocol/integration/lib/PerpV2LibraryV2.sol
  55. +208 −0 contracts/protocol/integration/lib/PerpV2Positions.sol
  56. +99 −0 contracts/protocol/integration/wrap/RgtMigrationWrapAdapter.sol
  57. +10 −0 contracts/protocol/integration/wrap/notional/WrappedfCash.sol
  58. +8 −0 contracts/protocol/integration/wrap/notional/WrappedfCashFactory.sol
  59. +7 −0 contracts/protocol/integration/wrap/notional/nBeaconProxy.sol
  60. +11 −0 contracts/protocol/integration/wrap/notional/nUpgradeableBeacon.sol
  61. +237 −0 contracts/protocol/lib/ModuleBaseV2.sol
  62. +262 −0 contracts/protocol/lib/PositionV2.sol
  63. +0 −296 contracts/protocol/modules/IssuanceModule.sol
  64. +89 −89 contracts/protocol/modules/{ → v1}/AaveLeverageModule.sol
  65. +15 −15 contracts/protocol/modules/{ → v1}/AirdropModule.sol
  66. +28 −28 contracts/protocol/modules/{ → v1}/AmmModule.sol
  67. +8 −8 contracts/protocol/modules/{ → v1}/BasicIssuanceModule.sol
  68. +14 −14 contracts/protocol/modules/{ → v1}/ClaimModule.sol
  69. +8 −8 contracts/protocol/modules/{ → v1}/CompoundLeverageModule.sol
  70. +11 −11 contracts/protocol/modules/{ → v1}/CustomOracleNAVIssuanceModule.sol
  71. +16 −16 contracts/protocol/modules/{ → v1}/DebtIssuanceModule.sol
  72. +22 −22 contracts/protocol/modules/{ → v1}/DebtIssuanceModuleV2.sol
  73. +10 −10 contracts/protocol/modules/{ → v1}/GeneralIndexModule.sol
  74. +6 −6 contracts/protocol/modules/{ → v1}/GovernanceModule.sol
  75. +41 −0 contracts/protocol/modules/v1/IssuanceModule.sol
  76. +681 −0 contracts/protocol/modules/v1/NotionalTradeModule.sol
  77. +16 −16 contracts/protocol/modules/{ → v1}/SingleIndexModule.sol
  78. +29 −15 contracts/protocol/modules/{ → v1}/SlippageIssuanceModule.sol
  79. +16 −16 contracts/protocol/modules/{ → v1}/StakingModule.sol
  80. +4 −4 contracts/protocol/modules/{ → v1}/StreamingFeeModule.sol
  81. +10 −10 contracts/protocol/modules/{ → v1}/TradeModule.sol
  82. +17 −17 contracts/protocol/modules/{ → v1}/WrapModule.sol
  83. +17 −17 contracts/protocol/modules/{ → v1}/WrapModuleV2.sol
  84. +599 −0 contracts/protocol/modules/v2/PerpV2BasisTradingModule.sol
  85. +1,121 −0 contracts/protocol/modules/v2/PerpV2LeverageModuleV2.sol
  86. 0 {contracts/protocol/integration/wrap → deprecated}/AGIMigrationWrapAdapter.sol
  87. 0 {contracts/protocol/integration/governance → deprecated}/AaveGovernanceAdapter.sol
  88. 0 {contracts/protocol/integration/wrap → deprecated}/AaveMigrationWrapAdapter.sol
  89. 0 {contracts/protocol/integration/wrap → deprecated}/AaveWrapAdapter.sol
  90. 0 {contracts/protocol/integration/wrap → deprecated}/AxieInfinityMigrationWrapAdapter.sol
  91. 0 {contracts/protocol/integration/wrap → deprecated}/CompoundWrapAdapter.sol
  92. 0 {contracts/protocol/integration/wrap → deprecated}/DgMigrationWrapAdapter.sol
  93. 0 {contracts/protocol/integration/wrap → deprecated}/KyberMigrationAdapter.sol
  94. 0 {contracts/protocol/modules → deprecated}/NAVIssuanceModule.sol
  95. +169 −100 {contracts/protocol/modules → deprecated}/PerpV2LeverageModule.sol
  96. 0 {contracts/protocol/integration/wrap → deprecated}/YearnWrapAdapter.sol
  97. +0 −8 external/abi/aave/v1/AToken.json
  98. +0 −8 external/abi/aave/v1/AavePropositionPower.json
  99. +0 −8 external/abi/aave/v1/AaveProtoGovernance.json
  100. +0 −8 external/abi/aave/v1/AssetVotingWeightProvider.json
  101. +0 −8 external/abi/aave/v1/CoreLibrary.json
  102. +0 −8 external/abi/aave/v1/DefaultReserveInterestRateStrategy.json
  103. +0 −8 external/abi/aave/v1/GovernanceParamsProvider.json
  104. +0 −8 external/abi/aave/v1/LendToAaveMigrator.json
  105. +0 −8 external/abi/aave/v1/LendingPool.json
  106. +0 −8 external/abi/aave/v1/LendingPoolAddressesProvider.json
  107. +0 −7 external/abi/aave/v1/LendingPoolConfigurator.json
  108. +0 −9 external/abi/aave/v1/LendingPoolCore.json
  109. +0 −8 external/abi/aave/v1/LendingPoolDataProvider.json
  110. +0 −8 external/abi/aave/v1/LendingRateOracle.json
  111. 0 external/abi/aave/{v1 → v2}/AaveGovernanceV2.json
  112. 0 external/abi/aave/{v1 → v2}/AaveTokenV2Mintable.json
  113. 0 external/abi/aave/{v1 → v2}/Executor.json
  114. 0 external/abi/aave/{v1 → v2}/GovernanceStrategy.json
  115. +0 −207 external/abi/axie_infinity/tokenSwap.json
  116. +0 −382 external/abi/decentral_games/DGLight.json
  117. +0 −284 external/abi/decentral_games/dgToken.json
  118. +1 −0 external/abi/notional/BatchAction.json
  119. +1 −0 external/abi/notional/ERC1155Action.json
  120. +1 −0 external/abi/notional/Router.json
  121. +0 −5 external/abi/singularityNET/singularityNetToken.json
  122. +27 −5 hardhat.config.ts
  123. +39 −18 package.json
  124. +12 −0 scripts/clean.sh
  125. +20 −0 scripts/prepublish_only.sh
  126. +23 −0 scripts/release_hardhat.sh
  127. +23 −0 scripts/release_latest.sh
  128. +252 −0 subgraph/test/deploy-state-multi-token.ts
  129. +169 −0 subgraph/test/deploy-state.ts
  130. +0 −178 test/integration/aaveGovernanceModule.spec.ts
  131. +0 −179 test/integration/aaveMigrationWrapModule.spec.ts
  132. +0 −191 test/integration/aaveWrapModule.spec.ts
  133. +0 −137 test/integration/agiMigrationWrapModule.spec.ts
  134. +158 −0 test/integration/apyRescue.spec.ts
  135. +0 −205 test/integration/compoundWrapModule.spec.ts
  136. +552 −0 test/integration/curveExchangeALM.spec.ts
  137. +559 −0 test/integration/curveStEthALM.spec.ts
  138. +849 −0 test/integration/notionalTradeModule/notionalTradeModule.spec.ts
  139. +187 −0 test/integration/notionalTradeModule/utils.ts
  140. +1,040 −0 test/integration/perpV2BasisTradingSlippageIssuance.spec.ts
  141. +240 −100 test/integration/{perpV2LeverageSlippageIssuance.spec.ts → perpV2LeverageV2SlippageIssuance.spec.ts}
  142. +37 −35 test/integration/{dgMigrationWrapModule.spec.ts → rgtMigrationWrapModule.spec.ts}
  143. +1 −1 test/integration/sushiswapExchangeTradeModule.spec.ts
  144. +1 −1 test/integration/uniswapV2ExchangeTradeModule.spec.ts
  145. +0 −207 test/integration/yearnWrapModule.spec.ts
  146. +106 −0 test/lib/bytesArrayUtils.spec.ts
  147. +57 −0 test/lib/preciseUnitMath.spec.ts
  148. +121 −0 test/lib/stringArrayUtils.spec.ts
  149. +355 −0 test/product/apyRescue.spec.ts
  150. +19 −7 test/product/assetLimitHook.spec.ts
  151. +118 −0 test/product/tokenEnabler.spec.ts
  152. +0 −441 test/product/uniswapYieldHook.spec.ts
  153. +604 −0 test/protocol-viewers/perpV2LeverageModuleViewer.spec.ts
  154. +395 −0 test/protocol/integration/exchange/curveExchangeAdapter.spec.ts
  155. +299 −0 test/protocol/integration/exchange/curveStEthExchangeAdapter.spec.ts
  156. +274 −0 test/protocol/integration/exchange/uniswapV3ExchangeAdapterV2.spec.ts
  157. +302 −93 test/protocol/integration/exchange/zeroExApiAdapter.spec.ts
  158. +0 −201 test/protocol/integration/governance/aaveGovernanceAdapter.spec.ts
  159. +2 −2 test/protocol/integration/governance/aaveGovernanceV2Adapter.spec.ts
  160. +608 −0 test/protocol/integration/lib/perpV2LibraryV2.spec.ts
  161. +437 −0 test/protocol/integration/lib/perpV2Positions.spec.ts
  162. +0 −168 test/protocol/integration/wrap/aaveMigrationWrapAdapter.spec.ts
  163. +0 −239 test/protocol/integration/wrap/aaveWrapAdapter.spec.ts
  164. +0 −167 test/protocol/integration/wrap/agiMigrationWrapAdapter.spec.ts
  165. +0 −229 test/protocol/integration/wrap/axieInfinityMigrationWrapAdapter.spec.ts
  166. +0 −165 test/protocol/integration/wrap/compoundWrapAdapter.spec.ts
  167. +0 −152 test/protocol/integration/wrap/dgMigrationWrapAdapter.spec.ts
  168. +0 −170 test/protocol/integration/wrap/kyberMigrationWrapAdapter.spec.ts
  169. +114 −0 test/protocol/integration/wrap/rgtMigrationWrapAdapter.spec.ts
  170. +675 −0 test/protocol/lib/moduleBaseV2.spec.ts
  171. +797 −0 test/protocol/lib/positionV2.spec.ts
  172. +0 −499 test/protocol/modules/issuanceModule.spec.ts
  173. +0 −3,395 test/protocol/modules/navIssuanceModule.spec.ts
  174. +19 −0 test/protocol/modules/{ → v1}/aaveLeverageModule.spec.ts
  175. 0 test/protocol/modules/{ → v1}/airdropModule.spec.ts
  176. 0 test/protocol/modules/{ → v1}/ammModule.spec.ts
  177. 0 test/protocol/modules/{ → v1}/basicIssuanceModule.spec.ts
  178. 0 test/protocol/modules/{ → v1}/claimModule.spec.ts
  179. 0 test/protocol/modules/{ → v1}/compoundLeverageModule.spec.ts
  180. 0 test/protocol/modules/{ → v1}/compoundLeverageModule2.spec.ts
  181. +1 −1 test/protocol/modules/{ → v1}/customOracleNAVIssuanceModule.spec.ts
  182. +2 −2 test/protocol/modules/{ → v1}/debtIssuanceModule.spec.ts
  183. +2 −2 test/protocol/modules/{ → v1}/debtIssuanceModuleV2.spec.ts
  184. 0 test/protocol/modules/{ → v1}/generalIndexModule.spec.ts
  185. 0 test/protocol/modules/{ → v1}/governanceModule.spec.ts
  186. +46 −0 test/protocol/modules/v1/issuanceModule.spec.ts
  187. +1,494 −0 test/protocol/modules/v1/notionalTradeModule.spec.ts
  188. 0 test/protocol/modules/{ → v1}/singleIndexModule.spec.ts
  189. +44 −3 test/protocol/modules/{ → v1}/slippageIssuanceModule.spec.ts
  190. 0 test/protocol/modules/{ → v1}/stakingModule.spec.ts
  191. 0 test/protocol/modules/{ → v1}/streamingFeeModule.spec.ts
  192. +277 −3 test/protocol/modules/{ → v1}/tradeModule.spec.ts
  193. 0 test/protocol/modules/{ → v1}/wrapModule.spec.ts
  194. 0 test/protocol/modules/{ → v1}/wrapModuleV2.spec.ts
  195. +2,287 −0 test/protocol/modules/v2/perpV2BasisTradingModule.spec.ts
  196. +262 −122 test/protocol/modules/{perpV2LeverageModule.spec.ts → v2/perpV2LeverageModuleV2.spec.ts}
  197. +29 −0 tsconfig.hardhat.json
  198. +1 −1 tsconfig.json
  199. +4 −1 utils/common/index.ts
  200. +6 −5 utils/common/mathUtils.ts
  201. +97 −41 utils/common/perpV2Utils.ts
  202. +0 −16 utils/contracts/aave.ts
  203. +0 −2 utils/contracts/axieInfinity.ts
  204. +1 −0 utils/contracts/curve.ts
  205. +0 −2 utils/contracts/dg.ts
  206. +26 −15 utils/contracts/index.ts
  207. +3 −0 utils/contracts/notional.ts
  208. +0 −2 utils/contracts/singularityNet.ts
  209. +12 −1 utils/deploys/dependencies.ts
  210. +153 −107 utils/deploys/deployAdapters.ts
  211. +45 −175 utils/deploys/deployExternal.ts
  212. +19 −1 utils/deploys/deployLibraries.ts
  213. +83 −4 utils/deploys/deployMocks.ts
  214. +65 −37 utils/deploys/deployModules.ts
  215. +20 −10 utils/deploys/deployProduct.ts
  216. +17 −1 utils/deploys/deployViewers.ts
  217. +0 −151 utils/fixtures/aaveFixture.ts
  218. +1 −1 utils/fixtures/aaveV2Fixture.ts
  219. +9 −0 utils/fixtures/curveFixture.ts
  220. +0 −1 utils/fixtures/index.ts
  221. +6 −2 utils/fixtures/perpV2Fixture.ts
  222. +3 −3 utils/fixtures/systemFixture.ts
  223. +4 −1 utils/test/accountUtils.ts
  224. +0 −2 utils/test/index.ts
  225. +2 −5 utils/types.ts
  226. +2,506 −126 yarn.lock
84 changes: 49 additions & 35 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,22 @@
version: 2
version: 2.1

default_env: &default_env
working_directory: ~/set-protocol-v2
docker:
- image: circleci/node:14.18
environment:
NODE_OPTIONS: --max_old_space_size=8192

commands:
setup_job:
steps:
- restore_cache:
key: compiled-env-{{ .Environment.CIRCLE_SHA1 }}

jobs:
checkout_and_compile:
docker:
- image: circleci/node:12.16.0
environment:
NODE_OPTIONS: --max_old_space_size=8192
<<: *default_env
resource_class: large
working_directory: ~/set-protocol-v2
steps:
- checkout
- restore_cache:
@@ -30,16 +39,10 @@ jobs:
paths:
- ~/set-protocol-v2
test:
docker:
- image: circleci/node:12.16.0
working_directory: ~/set-protocol-v2
<<: *default_env
parallelism: 3
steps:
- restore_cache:
key: compiled-env-{{ .Environment.CIRCLE_SHA1 }}
- run:
name: Set Up Environment Variables
command: cp .env.default .env
- setup_job
- run:
name: Test RPC
command: yarn chain
@@ -51,35 +54,23 @@ jobs:
yarn test ${TEST_FILES}
test_forked_network:
docker:
- image: circleci/node:12.16.0
working_directory: ~/set-protocol-v2
<<: *default_env
steps:
- restore_cache:
key: compiled-env-{{ .Environment.CIRCLE_SHA1 }}
- run:
name: Set Up Environment Variables
command: cp .env.default .env
- setup_job
- run:
name: Hardhat Test
command: yarn test:fork

coverage:
docker:
- image: circleci/node:12.16.0
working_directory: ~/set-protocol-v2
<<: *default_env
# When changing the parallelism value, you also
# need to update the `persist_to_workspace` paths
# in this job (below) as well as the list of files passed
# to istanbul-combine in the `report_coverage` job
parallelism: 5
resource_class: medium+
steps:
- restore_cache:
key: compiled-env-{{ .Environment.CIRCLE_SHA1 }}
- run:
name: Set Up Environment Variables
command: cp .env.default .env
- setup_job
- run:
name: Create shared coverage outputs folder
command: mkdir -p /tmp/coverage
@@ -104,14 +95,11 @@ jobs:
- cov_4.json

report_coverage:
docker:
- image: circleci/node:12.16.0
working_directory: ~/set-protocol-v2
<<: *default_env
steps:
- setup_job
- attach_workspace:
at: /tmp/coverage
- restore_cache:
key: compiled-env-{{ .Environment.CIRCLE_SHA1 }}
- run:
name: Combine coverage reports
command: |
@@ -127,6 +115,22 @@ jobs:
command: |
cat coverage/lcov.info | node_modules/.bin/coveralls
release_latest:
<<: *default_env
steps:
- setup_job
- run:
name: Publish "latest" release
command: yarn publish:ci:latest

release_hardhat:
<<: *default_env
steps:
- setup_job
- run:
name: Publish "hardhat" release
command: yarn publish:ci:hardhat

workflows:
version: 2
build-and-test:
@@ -144,3 +148,13 @@ workflows:
- report_coverage:
requires:
- coverage

# Publish `hardhat` before `latest` second so that repo's package version is set correctly on exit
- release_hardhat:
requires:
- checkout_and_compile
- release_latest:
requires:
- release_hardhat


2 changes: 2 additions & 0 deletions .github/semantic.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
titleOnly: true

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -17,6 +17,7 @@
coverage.json
coverage/
.env
.releaserc.json

/.coverage_cache
/.coverage_contracts
2 changes: 1 addition & 1 deletion .solhint.json
Original file line number Diff line number Diff line change
@@ -2,6 +2,6 @@
"extends": "solhint:recommended",
"rules": {
"reason-string": ["warn", { "maxLength": 50 }],
"compiler-version": ["error", "0.6.10"]
"compiler-version": ["error", ">=0.6.10"]
}
}
1 change: 1 addition & 0 deletions .solhintignore
Original file line number Diff line number Diff line change
@@ -2,3 +2,4 @@ node_modules
contracts/mocks
contracts/Migrations.sol
contracts/external
contracts/protocol/integration/wrap/notional
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -67,6 +67,18 @@ perpSetup = getPerpV2Fixture(...);
[22]: https://www.npmjs.com/package/hardhat
[23]: https://www.npmjs.com/package/typechain

## Semantic Release

This repository uses [semantic-release][10] to automatically publish in CI on merge to master. To trigger
a release, use the following naming convention in your PR description (or in your squash & merge commit
description):

+ patch release (e.g 1.0.1 -> 1.0.2): `fix(topic): description`
+ example: `fix(perpV2Viewer): return uint256 instead of int256`
+ feature release (e.g 1.1.0 -> 1.2.0): `feat(feature_name): description`
+ example: `feat(PerpV2BasisTrading): Add PerpV2 Basis Trading Module`


## Contributing
We highly encourage participation from the community to help shape the development of Set. If you are interested in developing on top of Set Protocol or have any questions, please ping us on [Discord](https://discord.gg/ZWY66aR).

@@ -116,3 +128,5 @@ If you follow these guidelines when reporting an issue to us, we commit to:
(including an initial confirmation of your report within 72 hours of submission).

* Grant a monetary reward based on the OWASP risk assessment methodology.

[10]: https://semantic-release.gitbook.io/semantic-release/v/beta/
56 changes: 56 additions & 0 deletions contracts/interfaces/IAirdropModule.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
/*
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 { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol";

import { AddressArrayUtils } from "../lib/AddressArrayUtils.sol";
import { ISetToken } from "./ISetToken.sol";

interface IAirdropModule {
using AddressArrayUtils for address[];

struct AirdropSettings {
address[] airdrops; // Array of tokens manager is allowing to be absorbed
address feeRecipient; // Address airdrop fees are sent to
uint256 airdropFee; // Percentage in preciseUnits of airdrop sent to feeRecipient (1e16 = 1%)
bool anyoneAbsorb; // Boolean indicating if any address can call absorb or just the manager
}

struct AirdropReturnSettings {
address feeRecipient;
uint256 airdropFee;
bool anyoneAbsorb;
}

function initialize(ISetToken _setToken, AirdropSettings memory _airdropSettings) external;

function airdropSettings(ISetToken _setToken) external view returns(AirdropReturnSettings memory);
function batchAbsorb(ISetToken _setToken, address[] memory _tokens) external;
function absorb(ISetToken _setToken, IERC20 _token) external;
function addAirdrop(ISetToken _setToken, IERC20 _airdrop) external;
function removeAirdrop(ISetToken _setToken, IERC20 _airdrop) external;
function updateAnyoneAbsorb(ISetToken _setToken, bool _anyoneAbsorb) external;
function updateFeeRecipient(ISetToken _setToken, address _newFeeRecipient) external;
function updateAirdropFee(ISetToken _setToken, uint256 _newFee) external;
function removeModule() external;
function getAirdrops(ISetToken _setToken) external returns(address[] memory);
function isAirdropToken(ISetToken _setToken, IERC20 _token) external returns(bool);
}
9 changes: 8 additions & 1 deletion contracts/interfaces/IBasicIssuanceModule.sol
Original file line number Diff line number Diff line change
@@ -24,4 +24,11 @@ interface IBasicIssuanceModule {
ISetToken _setToken,
uint256 _quantity
) external returns(address[] memory, uint256[] memory);
}

function redeem(
ISetToken _setToken,
uint256 _quantity,
address _to
)
external;
}
46 changes: 46 additions & 0 deletions contracts/interfaces/IClaimModule.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*
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 IClaimModule {
function initialize(
ISetToken _setToken,
bool _anyoneClaim,
address[] calldata _rewardPools,
string[] calldata _integrationNames
) external;

function anyoneClaim(ISetToken _setToken) external view returns(bool);
function claim(ISetToken _setToken, address _rewardPool, string calldata _integrationName) external;
function batchClaim(ISetToken _setToken, address[] calldata _rewardPools, string[] calldata _integrationNames) external;
function updateAnyoneClaim(ISetToken _setToken, bool _anyoneClaim) external;
function addClaim(ISetToken _setToken, address _rewardPool, string calldata _integrationName) external;
function batchAddClaim(ISetToken _setToken, address[] calldata _rewardPools, string[] calldata _integrationNames) external;
function removeClaim(ISetToken _setToken, address _rewardPool, string calldata _integrationName) external;
function batchRemoveClaim(ISetToken _setToken, address[] calldata _rewardPools, string[] calldata _integrationNames) external;
function removeModule() external;
function getRewardPools(ISetToken _setToken) external returns(address[] memory);
function isRewardPool(ISetToken _setToken, address _rewardPool) external returns(bool);
function getRewardPoolClaims(ISetToken _setToken, address _rewardPool) external returns(address[] memory);
function isRewardPoolClaim(ISetToken _setToken, address _rewardPool, string calldata _integrationName) external returns (bool);
function getRewards(ISetToken _setToken, address _rewardPool, string calldata _integrationName) external returns (uint256);
}
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;
}
Loading