Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev #792

Merged
merged 189 commits into from
Jun 23, 2023
Merged

Dev #792

Show file tree
Hide file tree
Changes from 180 commits
Commits
Show all changes
189 commits
Select commit Hold shift + click to select a range
c481344
feat(bulker): add base contract
Rubilmax Apr 7, 2023
1ad0ea2
refactor(bulker): rename contract
Rubilmax Apr 7, 2023
92573c8
fix(bulker): add default return value
Rubilmax Apr 7, 2023
5e2803b
refactor: decode in lower functions
pakim249CAL Apr 7, 2023
669e009
Merge pull request #764 from morpho-dao/feat/bulker-1
pakim249CAL Apr 9, 2023
e6a7f02
chore: remove unnecessary natspecs
pakim249CAL Apr 9, 2023
469c40c
chore: move errors to interface
pakim249CAL Apr 9, 2023
4cb2eb3
chore: remove morpho change from this PR
pakim249CAL Apr 9, 2023
19a5639
chore: remove other morpho change
pakim249CAL Apr 9, 2023
ebfc383
feat: remove swaps
pakim249CAL Apr 9, 2023
f207be2
feat: make amount zero errors consistent
pakim249CAL Apr 9, 2023
a578355
feat: approval helper and add more separation between internal
pakim249CAL Apr 9, 2023
c70f6d0
chore: add back removed comment in morpho
pakim249CAL Apr 9, 2023
550c11c
chore: remove swap router interface
pakim249CAL Apr 9, 2023
fc3945c
chore: remove router
pakim249CAL Apr 11, 2023
3c74dde
fix: remove router from interface
pakim249CAL Apr 11, 2023
f9a8059
test: add test layout and approve test
pakim249CAL Apr 11, 2023
f4ea949
test: add helpers
pakim249CAL Apr 11, 2023
9b72c95
test: add wrap eth and transfer tests
pakim249CAL Apr 12, 2023
33908dd
test: add more tests
pakim249CAL Apr 13, 2023
7834862
fix: approve condition backwards
pakim249CAL Apr 13, 2023
19a3f38
Merge remote-tracking branch 'origin/feat/bulker' into test/bulker
pakim249CAL Apr 13, 2023
c1bf392
test: fix supply test
pakim249CAL Apr 13, 2023
57c5ceb
test: add more tests except rewards
pakim249CAL Apr 13, 2023
56680f0
feat: remove ops and output amounts and add skim
pakim249CAL Apr 13, 2023
a5700ea
Merge branch 'feat/bulker-2' into test/bulker
pakim249CAL Apr 13, 2023
5f0fc19
test: adjust for merge
pakim249CAL Apr 13, 2023
573fb17
test: add skim test
pakim249CAL Apr 13, 2023
da9e06e
test: add eth receive test
pakim249CAL Apr 14, 2023
4182780
test: add getter test
pakim249CAL Apr 14, 2023
f48bef1
chore: remove morpho dao
pakim249CAL Apr 14, 2023
ea07000
Merge branch 'feat/bulker-2' into test/bulker
pakim249CAL Apr 14, 2023
688d470
Merge pull request #769 from morpho-dao/feat/bulker-2
pakim249CAL Apr 14, 2023
a054251
refactor: use calldata
pakim249CAL Apr 14, 2023
d39a8c3
Merge branch 'feat/bulker' into test/bulker
pakim249CAL Apr 14, 2023
3b08d28
test: add multiple action test and various fixes
pakim249CAL Apr 14, 2023
25d2501
test: fix test error message
pakim249CAL Apr 14, 2023
8dd9fba
chore: update license
pakim249CAL Apr 17, 2023
ae6a323
chore: move test
pakim249CAL Apr 17, 2023
02d1f5f
chore: remove redundancy in permit2 integration tests
pakim249CAL Apr 17, 2023
98f82e2
chore: add receiver check to unwrap eth
pakim249CAL Apr 17, 2023
383eba3
Merge remote-tracking branch 'origin/feat/bulker' into test/bulker
pakim249CAL Apr 17, 2023
64f4d66
test: increase withdraw test tolerance
pakim249CAL Apr 17, 2023
a43ded5
test: fix some errors
pakim249CAL Apr 18, 2023
f961a1a
test: rename file
pakim249CAL Apr 18, 2023
518c4fc
Merge pull request #765 from morpho-dao/test/bulker
pakim249CAL Apr 18, 2023
1a027b2
chore: check that bulker is not transferring to self
pakim249CAL Apr 18, 2023
6c02c66
chore: address comments
pakim249CAL Apr 19, 2023
9bd8617
Merge branch 'main' of github.com:morpho-dao/morpho-aave-v3 into feat…
Rubilmax Apr 20, 2023
41803ac
docs: add missing natspec to contract
MerlinEgalite Apr 20, 2023
070357b
docs: notice -> dev for internal functions
MerlinEgalite Apr 20, 2023
46598cf
perf: claim rewards last
MerlinEgalite Apr 20, 2023
d217b63
Merge pull request #780 from morpho-dao/perf/bulker
MerlinEgalite Apr 20, 2023
e471aff
feat: initial vault layout and consolidate extensions
pakim249CAL Apr 20, 2023
a3434d9
chore: make consistent naming, fix some comments
pakim249CAL Apr 21, 2023
e33a121
chore: remove some unnecessary comments
pakim249CAL Apr 21, 2023
cdcc8b0
chore: remove inconsistent relative import paths
pakim249CAL Apr 21, 2023
361eb8b
chore: use immutable naming convention
pakim249CAL Apr 21, 2023
9bb01d1
test: add some layout
pakim249CAL Apr 21, 2023
239eb1c
chore: make separators consistent
pakim249CAL Apr 21, 2023
0f4fead
test: copy and adjust tests from tokenized vaults. still needs much m…
pakim249CAL Apr 21, 2023
eca89d6
test: make some progress on fuzzing and error approximations
pakim249CAL Apr 22, 2023
389d766
fix: no reward logic if rewards manager is zero
pakim249CAL Apr 23, 2023
9ec6b86
test: fix most of the reward tests problems, separate out rewards tes…
pakim249CAL Apr 24, 2023
c0015c2
test: fix one test
pakim249CAL Apr 24, 2023
ffc0f24
test: add rewards test
pakim249CAL Apr 24, 2023
d50db84
Merge pull request #790 from morpho-dao/merge/main-to-dev
pakim249CAL Apr 24, 2023
fe07eca
test: add some roundings to previous reward tests
pakim249CAL Apr 24, 2023
59943ba
Merge branch 'feat/bulker' into feat/vault
pakim249CAL Apr 24, 2023
60715dd
chore: move extensions
pakim249CAL Apr 24, 2023
39da425
Merge pull request #763 from morpho-dao/feat/bulker
pakim249CAL Apr 25, 2023
e5dae7d
refactor: use submodules of morpho-utils
pakim249CAL Apr 27, 2023
66771a5
refactor: extension interfaces moved
pakim249CAL Apr 27, 2023
a98c468
Merge branch 'refactor/submodules' into feat/vault
pakim249CAL Apr 27, 2023
5f0cee9
Merge branch 'refactor/extension' into feat/vault
pakim249CAL Apr 27, 2023
3c4e7c5
refactor: remove rewards
pakim249CAL Apr 27, 2023
9dc6a7a
chore: remove outdated comment and rearrange some imports
pakim249CAL Apr 28, 2023
2fa90a7
test: rename tests to run with integration tests
pakim249CAL Apr 28, 2023
70a3177
Merge pull request #798 from morpho-dao/refactor/submodules
pakim249CAL Apr 28, 2023
c0f75dc
Merge pull request #799 from morpho-dao/refactor/extension
pakim249CAL Apr 28, 2023
6f1c41a
Merge remote-tracking branch 'origin/dev' into feat/vault
pakim249CAL Apr 28, 2023
ad1dc84
refactor: address comments and remove transfer rewards
pakim249CAL Apr 28, 2023
0d824df
test: address comments and rename file
pakim249CAL Apr 28, 2023
d7b7060
refactor: remove morpho token and add some test improvements
pakim249CAL Apr 30, 2023
fb2ec7d
refactor: remove supply vault base
pakim249CAL May 1, 2023
6fed9bc
fix: comment
pakim249CAL May 2, 2023
9a54829
Merge pull request #808 from morpho-dao/feat/vault-1
pakim249CAL May 2, 2023
c1f19e4
refactor: storage recipient, integrate interface
pakim249CAL May 2, 2023
e344105
fix: move recipient initializaiton
pakim249CAL May 2, 2023
ea7a3af
chore: amend some comments, add to interface
pakim249CAL May 2, 2023
c5907f8
chore: change pool token comment
pakim249CAL May 3, 2023
16a1fdb
fix: add zero address check for skim
pakim249CAL May 3, 2023
2ab55b7
chore: minor optis
pakim249CAL May 3, 2023
a7cf9bc
refactor: use uint96 for maxIterations
pakim249CAL May 3, 2023
980fc08
refactor: use immutable underlying
pakim249CAL May 3, 2023
9944fb4
refactor: immutable underlying
pakim249CAL May 4, 2023
3844e13
chore: cleanup imports and inline error
pakim249CAL May 5, 2023
27eff89
refactor: harmonize imports
MerlinEgalite May 9, 2023
3884f92
docs: harmonize natspecs with Morpho
MerlinEgalite May 9, 2023
197436c
refactor: clean a bit the code
MerlinEgalite May 9, 2023
62f9a6d
Merge branch 'feat/vault' of github.com:morpho-dao/morpho-aave-v3 int…
MerlinEgalite May 9, 2023
a5641ff
chore: remove wrong import
MerlinEgalite May 9, 2023
e253a0d
refactor: remove useless function
MerlinEgalite May 9, 2023
c9e3be2
test: reorder event and refine some more tests
pakim249CAL May 9, 2023
eea8aab
Merge pull request #820 from morpho-org/refactor/vault-0
pakim249CAL May 9, 2023
25e81bb
test: increase tolerance by 1 for repay eth test
pakim249CAL May 9, 2023
d1cc13a
test: add proxy admin check for receiver
pakim249CAL May 9, 2023
d8a516e
perf: disable init of implem
MerlinEgalite May 10, 2023
9b9346b
Merge pull request #826 from morpho-org/main
Rubilmax May 10, 2023
bbf55c7
chore: revert CI fixes
pakim249CAL May 10, 2023
b0f6ccb
Merge remote-tracking branch 'origin/dev' into feat/vault
pakim249CAL May 10, 2023
5da2d00
Merge pull request #823 from morpho-org/perf/disable-init
MerlinEgalite May 10, 2023
affa6a6
Merge pull request #783 from morpho-org/feat/vault
MerlinEgalite May 11, 2023
445d816
feat: change supply vault to ownable 2 step
pakim249CAL May 12, 2023
b2e2e9e
Merge branch 'main' of github.com:morpho-dao/morpho-aave-v3 into dev
Rubilmax May 15, 2023
ae333a1
test(borrow): move setAssetPrice before borrow call
Rubilmax May 15, 2023
92abed8
test(rewards): add multiple rewards
Rubilmax May 12, 2023
e633585
test(integration): increase tolerance
Rubilmax May 12, 2023
8a2a305
refactor(mock): remove redundant event definition
Rubilmax May 15, 2023
c767eea
test(rewards): add repay/withdraw test case
Rubilmax May 15, 2023
95a79d0
Merge pull request #839 from morpho-org/merge/main-dev-2
Rubilmax May 15, 2023
1085122
test(rewards): add emission set to zero test
Rubilmax May 15, 2023
ba0a477
Merge pull request #835 from morpho-org/test/rewards-manager
Rubilmax May 17, 2023
b33ba89
Merge pull request #841 from morpho-org/test/rewards-manager-emission…
Rubilmax May 17, 2023
09d9f5e
Merge pull request #838 from morpho-org/feat/supply-vault-ownable-2step
pakim249CAL May 19, 2023
80194e2
test(prod): add production test setup
Rubilmax May 30, 2023
e362f03
fix(bulker): missleading comment
julien-devatom May 30, 2023
d46ed0d
fix: add min in wrap/unwrap/supply
MerlinEgalite May 30, 2023
f0ac10b
test: move bulker to extension folder
MerlinEgalite May 30, 2023
b8a2ca5
chore: remove vaults folder
MerlinEgalite May 30, 2023
83fd286
test(prod): add lifecycle test
Rubilmax May 30, 2023
f3aebab
Merge pull request #844 from morpho-org/fix/missleading-eth-comment-i…
julien-devatom May 30, 2023
e9d77fb
test(prod): make it pass
Rubilmax May 31, 2023
dec9081
test(prod): simplify testflow
Rubilmax May 31, 2023
193f049
test(prod): add subltv test
Rubilmax May 31, 2023
667451c
refactor: implemen suggestion
MerlinEgalite May 31, 2023
1a0cb1d
feat: min for _wrapEth
MerlinEgalite May 31, 2023
e13e4be
refactor: apply suggestions
MerlinEgalite May 31, 2023
5523e50
test(prod): apply suggestions
Rubilmax Jun 1, 2023
a33f5eb
Merge pull request #845 from morpho-org/fix/bulker-roundings
MerlinEgalite Jun 1, 2023
2c01456
Merge branch 'dev' of github.com:morpho-dao/morpho-aave-v3 into test/…
MerlinEgalite Jun 1, 2023
4f1e0c9
Merge pull request #846 from morpho-org/test/move-to-extensions
MerlinEgalite Jun 1, 2023
d424f50
test(prod): refine errors
Rubilmax Jun 1, 2023
51d38e8
test(prod): harmonize tolerance
Rubilmax Jun 1, 2023
2ebdb24
test(production): fix setup
Rubilmax Jun 2, 2023
50d92e2
Merge pull request #847 from morpho-org/test/prod/lifecycle-tests
Rubilmax Jun 5, 2023
bba4eb3
refactor(vault): use asset instead of underlying
Rubilmax Jun 7, 2023
9a66cb0
refactor(interfaces): remove dead code
Rubilmax Jun 8, 2023
5ac135d
fix(vault): events and checks at initialization
Rubilmax Jun 8, 2023
6534e03
refactor(supply-vault): update interface
Rubilmax Jun 8, 2023
cdc9002
Merge pull request #851 from morpho-org/refactor/supply-vault
Rubilmax Jun 8, 2023
e18a426
refactor(bulker): remove redundant early reverts
Rubilmax Jun 8, 2023
9976759
test(bulker): add integration tests
Rubilmax Jun 8, 2023
e8506bd
Merge branch 'dev' of github.com:morpho-dao/morpho-aave-v3 into fix/v…
Rubilmax Jun 8, 2023
535891d
test(bulker): increase tolerance
Rubilmax Jun 8, 2023
87dda44
fix(supply-vault): initial deposit to address zero
Rubilmax Jun 8, 2023
0133491
refactor(iweth): add parameter name
Rubilmax Jun 8, 2023
fb14efa
refactor(test): rename test
Rubilmax Jun 8, 2023
f38a0af
docs(bulker): add notice about edge case
Rubilmax Jun 8, 2023
561cbb7
Merge pull request #855 from morpho-org/main
Rubilmax Jun 8, 2023
126132d
Merge pull request #852 from morpho-org/fix/dead-code
Rubilmax Jun 8, 2023
fe8cc2d
Merge pull request #853 from morpho-org/fix/vault-interface
Rubilmax Jun 8, 2023
2f5d3c0
Merge pull request #858 from morpho-org/fix/iwsteth
Rubilmax Jun 8, 2023
27c30db
Merge pull request #859 from morpho-org/docs/bulker
Rubilmax Jun 8, 2023
f2fc7d0
Merge branch 'dev' of github.com:morpho-dao/morpho-aave-v3 into fix/v…
Rubilmax Jun 8, 2023
0118976
Merge pull request #856 from morpho-org/fix/early-reverts
Rubilmax Jun 9, 2023
b2266bb
Merge pull request #854 from morpho-org/fix/vault-initialization
Rubilmax Jun 9, 2023
35c1650
fix(bulker): remove overwhelming early revert
Rubilmax Jun 9, 2023
ff03d09
Merge pull request #862 from morpho-org/fix/bulker-withdraw-collateral
Rubilmax Jun 10, 2023
ba29502
refactor(supply-vault): mint shares to 0xdead
Rubilmax Jun 12, 2023
aabaca5
Merge pull request #857 from morpho-org/fix/vault-skim-shares
Rubilmax Jun 12, 2023
c882a65
Merge pull request #864 from morpho-org/main
Rubilmax Jun 13, 2023
58bc5bf
docs(supply-vault): add eip4626 non-compliance warning
Rubilmax Jun 13, 2023
3c6ce70
Update src/extensions/SupplyVault.sol
Rubilmax Jun 14, 2023
de96f92
docs(vault): update eip wording
Rubilmax Jun 14, 2023
f6c112d
Merge pull request #865 from morpho-org/docs/eip4626-compliance
MerlinEgalite Jun 14, 2023
41e28da
test: fix bulker withdraw test
pakim249CAL Jun 14, 2023
93adbda
Merge pull request #867 from morpho-org/fix/bulker-test
pakim249CAL Jun 16, 2023
95ec064
chore: add audit on RM, bulker and vault
MerlinEgalite Jun 21, 2023
2694aa8
Merge pull request #868 from morpho-org/feat/audit-rm-bulker-vault
MerlinEgalite Jun 21, 2023
36a4dc0
test: avoid proxy admin
MerlinEgalite Jun 21, 2023
9f5574e
test: add invalid address
pakim249CAL Jun 20, 2023
3dbb8b9
Merge pull request #869 from morpho-org/fix/ci
MerlinEgalite Jun 21, 2023
7d8a48b
refactor(test): revert renaming
Rubilmax Jun 22, 2023
de1e00b
refactor(test): rename utility
Rubilmax Jun 22, 2023
f06444b
fix: remove underlying in the fuzz
Tristan22400 Jun 22, 2023
5f1a00f
fix: remove delegator fuzz
Tristan22400 Jun 22, 2023
24efe27
Merge pull request #871 from morpho-org/fix/remove-delegator-fuzz
MerlinEgalite Jun 22, 2023
852ad38
Merge pull request #870 from morpho-org/fix/ci-2
MerlinEgalite Jun 22, 2023
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
11 changes: 0 additions & 11 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,6 @@
path = lib/forge-std
url = https://github.com/foundry-rs/forge-std
branch = v1.5.2

[submodule "lib/openzeppelin-contracts"]
path = lib/openzeppelin-contracts
url = https://github.com/OpenZeppelin/openzeppelin-contracts
branch = v4.8.2
[submodule "lib/openzeppelin-contracts-upgradeable"]
path = lib/openzeppelin-contracts-upgradeable
url = https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable
branch = v4.8.2

[submodule "lib/solmate"]
path = lib/solmate
url = https://github.com/Rari-Capital/solmate
Expand All @@ -27,7 +17,6 @@
path = lib/aave-v3-periphery
url = https://github.com/aave/aave-v3-periphery
branch = v2.0.1

[submodule "lib/morpho-data-structures"]
path = lib/morpho-data-structures
url = https://github.com/morpho-dao/morpho-data-structures
Expand Down
9 changes: 9 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ test-integration:
test-internal:
@FOUNDRY_MATCH_CONTRACT=TestInternal make test

test-prod:
@FOUNDRY_MATCH_CONTRACT=TestProd make test

test-unit:
@FOUNDRY_MATCH_CONTRACT=TestUnit make test

Expand All @@ -39,6 +42,9 @@ test-integration-%:
test-internal-%:
@FOUNDRY_MATCH_TEST=$* make test-internal

test-prod-%:
@FOUNDRY_MATCH_TEST=$* make test-prod

test-unit-%:
@FOUNDRY_MATCH_TEST=$* make test-unit

Expand All @@ -55,6 +61,9 @@ test-integration/%:
test-internal/%:
@FOUNDRY_MATCH_CONTRACT=TestInternal$* make test

test-prod/%:
@FOUNDRY_MATCH_CONTRACT=TestProd$* make test

test-unit/%:
@FOUNDRY_MATCH_CONTRACT=TestUnit$* make test

Expand Down
Binary file added audits/spearbit-rm-bulker-vault-report.pdf
Binary file not shown.
10 changes: 10 additions & 0 deletions config/ConfigLib.sol
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,15 @@ struct Config {
library ConfigLib {
using stdJson for string;

string internal constant CHAIN_ID_PATH = "$.chainId";
string internal constant RPC_ALIAS_PATH = "$.rpcAlias";
string internal constant FORK_BLOCK_NUMBER_PATH = "$.forkBlockNumber";
string internal constant ADDRESSES_PROVIDER_PATH = "$.addressesProvider";
string internal constant WRAPPED_NATIVE_PATH = "$.wrappedNative";
string internal constant LSD_NATIVES_PATH = "$.lsdNatives";
string internal constant MARKETS_PATH = "$.markets";
string internal constant MORPHO_DAO_PATH = "$.morphoDao";
string internal constant MORPHO_ETH_PATH = "$.morphoEth";

function getAddress(Config storage config, string memory key) internal returns (address) {
return config.json.readAddress(string.concat("$.", key));
Expand All @@ -33,6 +35,10 @@ library ConfigLib {
}
}

function getChainId(Config storage config) internal returns (uint256) {
return config.json.readUint(CHAIN_ID_PATH);
}

function getRpcAlias(Config storage config) internal returns (string memory) {
return config.json.readString(RPC_ALIAS_PATH);
}
Expand All @@ -49,6 +55,10 @@ library ConfigLib {
return config.json.readAddress(MORPHO_DAO_PATH);
}

function getMorphoEth(Config storage config) internal returns (address) {
return config.json.readAddress(MORPHO_ETH_PATH);
}

function getWrappedNative(Config storage config) internal returns (address) {
return getAddress(config, config.json.readString(WRAPPED_NATIVE_PATH));
}
Expand Down
9 changes: 4 additions & 5 deletions config/Configured.sol
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ contract Configured is StdChains {

VmSafe private constant vm = VmSafe(address(uint160(uint256(keccak256("hevm cheat code")))));

Chain internal chain;
Config internal config;

address internal dai;
Expand All @@ -33,6 +32,10 @@ contract Configured is StdChains {
}
}

function _rpcAlias() internal virtual returns (string memory) {
return config.getRpcAlias();
}

function _initConfig() internal returns (Config storage) {
if (bytes(config.json).length == 0) {
string memory root = vm.projectRoot();
Expand All @@ -45,10 +48,6 @@ contract Configured is StdChains {
}

function _loadConfig() internal virtual {
string memory rpcAlias = config.getRpcAlias();

chain = getChain(rpcAlias);

dai = config.getAddress("DAI");
usdc = config.getAddress("USDC");
usdt = config.getAddress("USDT");
Expand Down
1 change: 1 addition & 0 deletions config/avalanche-mainnet.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"chainId": 43114,
"rpcAlias": "avalanche",
"forkBlockNumber": 24800000,
"addressesProvider": "0xa97684ead0e402dC232d5A977953DF7ECBaB3CDb",
Expand Down
2 changes: 2 additions & 0 deletions config/ethereum-mainnet.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
{
"chainId": 1,
"rpcAlias": "mainnet",
"forkBlockNumber": 16841312,
"addressesProvider": "0x2f39d218133AFaB8F2B819B1066c7E434Ad94E9e",
"morphoDao": "0xcBa28b38103307Ec8dA98377ffF9816C164f9AFa",
"morphoEth": "0x33333aea097c193e66081E930c33020272b33333",
"DAI": "0x6B175474E89094C44Da98b954EedeAC495271d0F",
"USDC": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
"USDT": "0xdAC17F958D2ee523a2206206994597C13D831ec7",
Expand Down
2 changes: 1 addition & 1 deletion lib/morpho-utils
1 change: 0 additions & 1 deletion lib/openzeppelin-contracts
Submodule openzeppelin-contracts deleted from d00ace
1 change: 0 additions & 1 deletion lib/openzeppelin-contracts-upgradeable
Submodule openzeppelin-contracts-upgradeable deleted from f6c4c9
5 changes: 2 additions & 3 deletions remappings.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@ config/=config/
@morpho-utils/=lib/morpho-utils/src/
@morpho-data-structures/=lib/morpho-data-structures/src/

@openzeppelin/=lib/openzeppelin-contracts/
@openzeppelin/contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts/
@openzeppelin-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts/
@openzeppelin/=lib/morpho-utils/lib/openzeppelin-contracts/
@openzeppelin-upgradeable/=lib/morpho-utils/lib/openzeppelin-contracts-upgradeable/contracts/

@aave-v3-core/=lib/aave-v3-core/contracts/
@aave-v3-periphery/=lib/aave-v3-periphery/contracts/
Expand Down
43 changes: 0 additions & 43 deletions src/RewardsManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -20,26 +20,6 @@ import {Initializable} from "@openzeppelin-upgradeable/proxy/utils/Initializable
contract RewardsManager is IRewardsManager, Initializable {
using SafeCast for uint256;

/* STRUCTS */

struct UserAssetBalance {
address asset; // The rewarded asset (either aToken or debt token).
uint256 scaledBalance; // The user scaled balance of this asset (in asset decimals).
uint256 scaledTotalSupply; // The scaled total supply of this asset.
}

struct UserData {
uint104 index; // The user's index for a specific (asset, reward) pair.
uint128 accrued; // The user's accrued rewards for a specific (asset, reward) pair (in reward token decimals).
}

struct RewardData {
uint104 startingIndex; // The index from which the RewardsManager begins tracking the RewardsController's index.
uint104 index; // The current index for a specific reward token.
uint32 lastUpdateTimestamp; // The last timestamp the index was updated.
mapping(address => UserData) usersData; // Users data. user -> UserData
}

/* IMMUTABLES */

/// @dev The address of Aave's rewards controller.
Expand All @@ -55,29 +35,6 @@ contract RewardsManager is IRewardsManager, Initializable {
/// @dev The local data related to a given asset (either aToken or debt token). asset -> reward -> RewardData
mapping(address => mapping(address => RewardData)) internal _localAssetData;

/* EVENTS */

/// @dev Emitted when rewards of an asset are accrued on behalf of a user.
/// @param asset The address of the incentivized asset.
/// @param reward The address of the reward token.
/// @param user The address of the user that rewards are accrued on behalf of.
/// @param assetIndex The reward index for the asset (same as the user's index for this asset when the event is logged).
/// @param rewardsAccrued The amount of rewards accrued.
event Accrued(
address indexed asset, address indexed reward, address indexed user, uint256 assetIndex, uint256 rewardsAccrued
);

/* ERRORS */

/// @notice Thrown when only the main Morpho contract can call the function.
error OnlyMorpho();

/// @notice Thrown when an invalid asset is passed to accrue rewards.
error InvalidAsset();

/// @notice Thrown when the the zero address is passed as a parameter.
error AddressIsZero();

/* MODIFIERS */

/// @notice Prevents a user to call function allowed for the main Morpho contract only.
Expand Down
Loading