Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Advanced factory contract (NethermindEth#219)
* add initial factory * add ownable component * add caller to CounterCreated event * turn counter into campaign * fix Campaign interfaced funcs + implement donate * add _assert_is_ended + update error messages * _assert_active->_assert_campaign_active * _assert_is_ended->_assert_campaign_ended * implement withdraw * add missing assert success in donate * add title & description * update comment * implement upgrade * clean up internal funcs and imports * move hardcoded errors in Errors mod * donate -> contribute + event rename * withdraw -> claim * add store impl for contract addr. array * remove store impl * add dynamic array impl * remove dyn. array * remove descr + convert title to felt + convert target to u128 * implement updating class hashes * Make title ByteArray again + target into u256 + update ctor arg serialization * refactor serialization + add back description * remove unused contracts * add 1 test * add get_description * add correct deps * add alexandria to toml * format factory.cairo * add missing snforge workspace * add missing getters + tests * add factory deploy tests * add class hash update test + event assertions * assert old class hash prior to update * remove commented out test * use common alex. storage workspace in using_lists * add missing newline in toml * move factory tests to separate file * add scaffold docs for contracts * add end_time asserts * refactor private asserts * check if target reached before claiming * add ability to withdraw funds * make contributions into a component (now iterable) * refactor 'withhold' - contrs map to amt_idx * add get_contributors func * get_contributors -> get_contributions * total_contributors->contributor_count * add tests for campaign upgrade and deploy + update all relevant code in factory * add status to campaign * add close fn * pass desired donation token in ctor * merge all getters into get_details * return total_contributions in details * remove rev version from alexandria dep * verbose names * reorg. folder structure * add tag to alexandria dep * campaign_upgrade.cairo->mock_upgrade.cairo * add explicit alexandria rev + make crowdfunding contracts standalone chapters * add status pending * field rename: factory->creator * refund users when upgrading campaign * Make owner the calling address, and creator is the campaign manager * add get_contributor (amount) func * Add successful campaign test * update comment for upgrade * _refund_all->_withdraw_all * update checks for withdraw * rework contribute * rework all funcs * unsuccessful -> failed * calc end_time in start fn * calc end_time in upgrade fn * makes upgrades callable only by creators in factory * fix factory tests * fix crowdfunding tests * reduce total contri. when withdraw from act. camp * add refund fn * refactor withdraw_all to use _refund * pending->draft * fix mock and tests * add test for close * add test for withdraw * upgrade > update end_time only if duration provided * close->cancel * rename to more align with Solidity by example * target->goal * remove comment * err CLOSED->CANCELED + check active in unpledge * contributor->pledger * add campaign doc content * remove draft status * add start_time * remove Status * update doc for campaign * move total_pledges to pledgeable * reorder alphabetically * remove Launched event + upgrade mock * TARGET->GOAL * reorder params in Details * add inline to _refund * add new pledgeable tests * add getX tests + add get_pledge_count * refactor pledger_to_amount_index->pledger_to_amount * Add tests with 1000 pledgers * add test for add + update existing pledger * reenable lib * Add link to adv. factory in crowdfunding point 9 * write the adv. factory chapter * upgrade_campaign_implementation-> upgrade_campaign + comment updates * rename get_pledgers_as_arr->array * Use ERC20Upgradeable instead of ERC20 preset * Add missing token recipient ctor argument in crowdfunding tests --------- Co-authored-by: Nenad <[email protected]>
- Loading branch information