Skip to content
This repository has been archived by the owner on Oct 6, 2023. It is now read-only.

[WIP] Endowment Allowlists as Iterable Mappings #321

Merged
merged 23 commits into from
Aug 14, 2023

Conversation

SovereignAndrey
Copy link
Contributor

Explanation of the solution

Make Allowlists as iterable mappings. Creates EndowmentResponse for use where we would previously return the raw Endowment struct (allows minimal changes for downstream consumers of the EndowmentDetails query endpoint as AllowLists are popluated in there from Mapping Keys lists).

Instructions on making this work

  • run yarn or yarn install to install npm dependencies

@SovereignAndrey SovereignAndrey added the enhancement New feature or request label Aug 11, 2023
@SovereignAndrey SovereignAndrey self-assigned this Aug 11, 2023
Base automatically changed from allowlist-checks to daf-endowment-type August 14, 2023 02:31
@SovereignAndrey SovereignAndrey merged commit 0ac6018 into daf-endowment-type Aug 14, 2023
1 check failed
@SovereignAndrey SovereignAndrey deleted the allowlists-iterablemappings branch August 14, 2023 06:53
SovereignAndrey added a commit that referenced this pull request Aug 17, 2023
* DAF Type added + logic to restrict withdrawals to Endowments + mapping to track DAF Approved Endows;

* update tests for withdraws & create; add tests for UpdateDafApprovedEndowment endpoint;

* fees refactored; exempt all endowment<>endowment transfers; fix tests;

* update fee calculation logic: check combined withdraw fees @ each level; calc Endow-level fees after Protocol-level fees are deducted; Add non-Charity Deposit fee; Simplify Fees for Charity vs all other Types; Don't apply fees on Endowment<>Endowment transfers;

* withdraw fee fixed

* move checks up for better gas

* closing an endowment now applies withdraws now (sans index fund beneficiaries, for now)

* add tokens for locked/liquid into arrays for withdraw msgs sending

* minor fixes; switch gasManager facet to IterableMapping for token balances;

* small fixes

* fix test

* yarn format

* refactor tests - first pass

* break out fee calculation/transfers into separate internal function

* clean-up new function

* check for Endow<>Endow before fee calc function;

* fix bug with deposit AP fee; Split refactoring; Tests reworked;

* clean up fee settings & split to liquid @ creation time;

* bug fixed

* more tests added and refinements

* add clear way to signify internal Endow<>Endow transfers; Tests work;

* transfer logic moved to own internal function;

* more withdraw tests work;

* merge && update AccountStrategy + GasFwd;

* SafeMath swapped out for FixedPointMath lib

* getter/setter for DafApprovedEndowments mapping in Accounts Test Facet;

* DAF tests; Other test tweaks;

* refactor and simplify fees logic; DRY up code;

* remove redundant zero fee setting steps in tests;

* pull withdraw fees function back into main function;

* more withdraw tests clean up;

* lint

* check amountLefterover > 0 before doing transfers

* fix fee type applied in deposit tests

* move withdraw fees logic into internal function

* merge changes

* deposit tests cleaned up & ready; deposit fees code tweaks;

* withdraw tests clean up work;

* withdraw tests clean up work;

* await all teh things; no async describe; add erc20 zero deposit amount test;

* dial back awaits

* fix merge dups

* lint

* more tests added & fixes to contract logic

* Allowlist Checks Helpers + Clean Up (#314)

* contributor allowlist checks on deposit

* beneficiary allowlist checks done against Beneficiary Address not sender; move allowlist checks before final transfer; clean up comment lines;

* fix maturity check logic

* allowlist check code moved into generic internal function

* allowances allowlist checks use helper fnct; moved helper function to LibAccounts;

* refactor helper function into address lib;

* remove async for allowance test describes

* tests added for deposit reversion @ maturity & checks of allowlistedContributors;

* PR nit fix

* remove unused function

---------

Co-authored-by: Andrey <SovereignAndrey>

* check index fund sender; fixes for tests;

* charity >> charity-type transfers only; add test for this scenario;

* [WIP] Endowment Allowlists as Iterable Mappings (#321)

* contributor allowlist checks on deposit

* beneficiary allowlist checks done against Beneficiary Address not sender; move allowlist checks before final transfer; clean up comment lines;

* fix maturity check logic

* allowlist check code moved into generic internal function

* allowances allowlist checks use helper fnct; moved helper function to LibAccounts;

* refactor helper function into address lib;

* remove async for allowance test describes

* tests added for deposit reversion @ maturity & checks of allowlistedContributors;

* PR nit fix

* Endowment Allowlists as Iterable Mappings

* add tests for new AllowList Update endpoint; Minor tweaks to contract logic;

* yarn format

---------

Co-authored-by: Andrey <SovereignAndrey>

* test fixes for allowances

* remove allowlists from default endowment struct

* fix create endowment tests

* fix index fund tests

* yarn format

* test fixes & typescript clean up

* yarn format

* refactor allowlist mappings to use AllowlistType;

* fix query facet tests

* closing logic work;

* refactor closing + withdraw logic to allow for withdraws from closed endowments, but only to beneficiary of record;

* fix donation match tests

* first round of PR review fixes

* tighter incr/decr IterableMappingAddr logic + errors added

* move charity fee corrections to applications multisig

* remove unused function again

* fix ts errors

* Endow mapping refactor and namings sync'd-up (#325)

* balances moved to nested mapping w/ VaultType key

* activeStrategies mapping moved out of STATES

* mapping namings synced to CamelCase

* remove vaultType checks for balances and use the type itself in mapping;

* fix test param

---------

Co-authored-by: Andrey <SovereignAndrey>

* little fixes

* gasManager bug fix

* more tests clean up

* non-iterable balances; Allowlists mappings use bool not uint; fixes to closing logic & add more tests; check Daf Approved endow != AST on add & add test; EndowType Normal >> AST;

* tsc fixes

* update utils enum for FeeTypes; Add test for fee type combined withdraw fees & single fees cannot meet/exceed 100%;

* test name fix

---------

Co-authored-by: Andrey <SovereignAndrey>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request WIP
Projects
No open projects
Status: Done
Development

Successfully merging this pull request may close these issues.

1 participant