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

Enhance Fee and Commission Payment Routing for Marketplace and Policies #66

Merged

Conversation

kevin-fruitful
Copy link
Contributor

@kevin-fruitful kevin-fruitful commented May 26, 2023

Title: Implementation of Customizable Fee Schedules for Marketplace and Policy Premiums

Description:

This pull request introduces customizable fee schedules to better accommodate diverse business requirements. Key changes are as follows:

  1. Fee Schedule: An array of fee receivers, identifiable by fee schedule IDs, are now stored in AppStorage.feeSchedules.

  2. Marketplace Fees: Buyers are responsible for fees when purchasing initial participation tokens. This applies even if the initial tokens don't yet exist when a market order is placed. Customizable fee schedules can be applied per market order (AppStorage.offers.feeSchedule).

  3. Policy Premium Fees: Policies adopt the default policy fee schedule upon creation. However, if the entity creating the policy has a custom fee schedule, that will be used instead.

  4. Custom Fee Schedules: Admins can assign custom fee schedules to specific entities using unique fee schedule IDs. Custom schedules will override the default.

  5. Global Marketplace Fee: A system-wide marketplace fee can be set for order makers by an admin.

These changes provide flexibility in fee assignment and collection. Future enhancements may include group-specific fee schedules to simplify the process for entities requiring customized fees.

@melks
Copy link

melks commented May 26, 2023

@amarinkovic amarinkovic force-pushed the CU-861mu78f5_Smart-Contract-Updates---Fees-UpdateEntity branch from 6b9dbb2 to 2945812 Compare June 13, 2023 08:12
@amarinkovic amarinkovic changed the base branch from main to dev June 16, 2023 09:17
Copy link

@github-advanced-security github-advanced-security bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Slither found more than 10 potential problems in the proposed changes. Check the Files changed tab for more details.

@kevin-fruitful kevin-fruitful force-pushed the CU-861mu78f5_Smart-Contract-Updates---Fees-UpdateEntity branch from b845504 to 8fbec9c Compare June 22, 2023 07:13
@kevin-fruitful kevin-fruitful marked this pull request as ready for review June 23, 2023 09:33
@kevin-fruitful kevin-fruitful merged commit 52d7a08 into dev Jun 23, 2023
@kevin-fruitful kevin-fruitful deleted the CU-861mu78f5_Smart-Contract-Updates---Fees-UpdateEntity branch September 29, 2023 08:03
tgeorgas added a commit that referenced this pull request Oct 2, 2023
* Token symbol uniqueness (#57)

* feat: ensure token symbol is unique

* fix: some typos and comments

* fix: entity token uniqueness mapping and add test

* fix: include external tokens in uniqueness check

* test: LibERC token symbol

* feat: update entity token info

* doc: update generated markdown

* test: entity token info update

* Revert "doc: update generated markdown"

This reverts commit 96ed7ee.

# Conflicts:
#	docs/facets/IEntityFacet.md

* fix: linter issues

* test: failed ERC20 calls

* refactor: fix solidity parser in prettier

* ci: fix branch scopes

* feat: add support for sepolia

* feat: run anvil in docker

* chore: remove a CI step not needed anymore

* ci: reformat test workflow summary

* ci: reformat test workflow summary

* fix: sepolia upgrade hash make target

* Update local node scripts (#64)

* chore: ignore slither vscode files

* feat: scripted scheduling

* fix: update anvil bootstrap script

* refactor: deployment on anvil, makefile

* fix: makefile defaults and addresses

* fix: anvil bootstrap

* fix: anvil upgrade targets

* chore: add sepolia broadcasts

* chore: update sepolia broadcasts

---------

Co-authored-by: Kevin Park <[email protected]>

* chore: add make commands to initialize and upgrade a new diamond on anvil

* refactor: align boostrap with new deployment scripts

* fix: prep upgrade script method ref

* feat: script anvil upgrade flow

* chore: update gitignore for mnemonic files

* ci: fix upgrade hash report

* chore: remove stale goerli broadcasts

* fix: upgrade stack too deep error

* refactor: add some makefile targets for sepolia

* fix: write the array of selectors to the same memory location to avoid stack too deep

* chore: add deploy-contract-sepolia command, commit broadcast files

* chore: minor makefile arg fix

* chore: sepolia upgrade broadcasts

* refactor(prep-upgrade): pull out generate function

* chore: update prettier config

* ci: don't generate upgrade hashes

* chore: bump to v3.5.0

* feat: .env format proposal

* feat: .env format proposal

* chore: add sepolia broadcasts, acl facet updated

* fix: add back simple policy info struct (#68)

struct without the arrays is needed for web3j compatibility

* Hotfix execute limit offer (#67)

* fix(erc20-wrapper): allowance function modifiers

* doc: update interface reference

* fix: remove duplicate target

* feat: add forking makefile targets

* fix: deploy-mainnet-fork permissions

* chore: upgrade sepolia diamond to v3.5.1

* ci: fix coverage env vars

* fix: mainnet fork target for owner balance

* Emit dividend withdrawn event (#59)

* Deployer adapter script (#70)

* feat: initial deployer script adapter

* feat: script upgrade procedure

* feat(deployer): add fork support

* refactor: improve logging

* fix: mainnet fork support

* feat: add dry run option

* refactor: improve flow and arguments for mainnet operation

* refactor: better logging and argument handling

* Enhance Fee and Commission Payment Routing for Marketplace and Policies (#66)

* chore(deployer): fix mainnet fork upgrade flow

* Refactor fees (#72)

* refactor(fees): update fee schedule struct and mapping (WiP)

* fix: compilation errors after refactoring

* fix: trading fee payment

* fix: remove non-default fee schedule

* refactor: make getSigner pure

* refactor: pass fee config externally as arrays instead of struct

* chore: cleanup left over comments

* doc: add replaceMakerBP natspec

* fix: unique id for default fee schedule regardless of type

* refactor: generic fee paid event

* test: dynamic array size for comparing fee schedules

* chore: fix formatting

---------

Co-authored-by: Aleksandar Marinković <[email protected]>

* chore: deployer script output formatting

* chore: upgrade sepolia to v3.6.0

* chore(verification-util): pull out network into vars

* rerfactor: generic fee schedule getter

* chore: bump package version to v3.6.1

* doc: fix natspec

* chore: broadcasts for v3.6.1

* chore: remove hotfix test

this test is no longer relevant

* fix: add view modifier to isObjectTokenizable

* test(fees): trading fees coverage

* test(fees): fix variable name typo

* feat(fees): add zero premium fee support for platform

* fix premium fee tests to consider stakeholder fees

* chore: clean up pre policy setup in tests; clean up unused foundry props

* chore: fix linter

* chore: add platform flag for running docker on ARM CPUs

* Calculate the trading fee on matching offer(s) schedule (#74)

Co-authored-by: Kevin Park <[email protected]>

* Fork Sanity Tests for Contract Upgrades (#76)

* fix: calculate fee allocations breakdown

* fix: setup default fee schedules inthe init diamond

* fix: reintroduce order matching rounding parameter

* fix: dividend withdraw fuzz test

* chore: 4x the number of max rejects for fuzzing

* Update access control part 1 (#77)

* Withdraw restriction (#78)

* fix: add contract verification to deployer script

* chore: ignore macos files

* chore: upgrade sepolia to v3.6.2

* chore: update email in package.json

* Roles part 1  refinement (#79)

* chore: upgrade sepolia to v3.6.3 smart contracts

* refactor: deployer only to verify when not forking

* fix: deployer account resolution

* doc: deployer script explainer

* Prevent role demotion (IM-24357) (#80)

* test: hRoles - pretty print roles

* feat: update SmartDeploy to pass in init diamond address

* feat: command anvil-upgrade-init-addr

* fix: prepare for upgrade, add custom init and getters

* chore: update forge-std

* deployment: add helper commands for anvil deployment; add script to deploy state updating contract

* chore: gitignore generated file

* chore: add custom solhit config in script folder

* test: add cHr helper method to pretty print commission receivers

* chore: remove redundant getter

* chore: fix typos

* chore: remove redundant scripts for deploying contracts

* deployment: update prep-upgrade.js to take in an init contract address

---------

Co-authored-by: Kevin Park <[email protected]>
Co-authored-by: Theodore Georgas <[email protected]>
Co-authored-by: Aleksandar Marinković <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants