BibliothecaDAO / eternum

onchain eternal game
https://alpha-eternum.realms.world
MIT License
36 stars 30 forks source link

[client] Feat instant amm #1034

Closed aymericdelab closed 5 days ago

aymericdelab commented 6 days ago

PR Type

Enhancement, Bug fix


Description


Changes walkthrough ๐Ÿ“

Relevant files
Enhancement
19 files
contractComponents.ts
Remove `BankAccounts` component definition.                           

client/src/dojo/contractComponents.ts - Removed `BankAccounts` component definition.
+0/-13   
MarketManager.ts
Update slippage calculation logic in `MarketManager`.       

client/src/dojo/modelManager/MarketManager.ts
  • Updated slippage method to include isSellingResource parameter.
  • Adjusted slippage calculation logic.
  • +13/-2   
    useBanks.tsx
    Remove `useBanks` hook and related logic.                               

    client/src/hooks/helpers/useBanks.tsx - Removed `useBanks` hook and related logic.
    +0/-26   
    useEntities.tsx
    Remove `BankAccounts` references and adjust entity queries.

    client/src/hooks/helpers/useEntities.tsx
  • Removed references to BankAccounts component.
  • Adjusted entity queries and related logic.
  • +2/-27   
    useResources.tsx
    Remove `useGetBankAccountOnPosition` hook.                             

    client/src/hooks/helpers/useResources.tsx - Removed `useGetBankAccountOnPosition` hook.
    +0/-24   
    AddLiquidity.tsx
    Add `entity_id` parameter to `add_liquidity` call.             

    client/src/ui/components/bank/AddLiquidity.tsx - Added `entity_id` parameter to `add_liquidity` call.
    +1/-0     
    BankList.tsx
    Update `BankPanel` and remove unused components.                 

    client/src/ui/components/bank/BankList.tsx
  • Removed OpenBankAccount and BankEntityList components.
  • Updated BankPanel to use realmEntityId.
  • Adjusted tabs and components.
  • +11/-59 
    LiquidityResourceRow.tsx
    Add `entityId` parameter to `remove_liquidity` call.         

    client/src/ui/components/bank/LiquidityResourceRow.tsx - Added `entityId` parameter to `remove_liquidity` call.
    +4/-3     
    LiquidityTable.tsx
    Add `entity_id` parameter to `LiquidityResourceRow` component.

    client/src/ui/components/bank/LiquidityTable.tsx - Added `entity_id` parameter to `LiquidityResourceRow` component.
    +7/-8     
    OpenBankAccount.tsx
    Remove `OpenBankAccount` component.                                           

    client/src/ui/components/bank/OpenBankAccount.tsx - Removed `OpenBankAccount` component.
    +0/-31   
    ResourceBar.tsx
    Add margin to `TextInput` component.                                         

    client/src/ui/components/bank/ResourceBar.tsx - Added margin to `TextInput` component.
    +3/-1     
    Swap.tsx
    Update swap operations and fee constants.                               

    client/src/ui/components/bank/Swap.tsx
  • Updated fee constants to use EternumGlobalConfig.
  • Added entity_id parameter to swap operations.
  • Adjusted resource name display.
  • +9/-8     
    Config.tsx
    Remove `Banks` from `OSWindows` type.                                       

    client/src/ui/components/navigation/Config.tsx - Removed `Banks` from `OSWindows` type.
    +0/-2     
    MarketModal.tsx
    Update `MarketModal` to use `useGetBanks` hook.                   

    client/src/ui/components/trading/MarketModal.tsx
  • Updated MarketModal to use useGetBanks hook.
  • Adjusted tab labels and components.
  • +7/-4     
    index.ts
    Add script for setting up admin bank.                                       

    config/bank/index.ts - Added script for setting up admin bank.
    +93/-0   
    global.ts
    Update `EternumGlobalConfig` for bank fees.                           

    sdk/packages/eternum/src/constants/global.ts - Updated `EternumGlobalConfig` for bank fees.
    +2/-1     
    index.ts
    Add `create_admin_bank` method and update liquidity/swap methods.

    sdk/packages/eternum/src/provider/index.ts
  • Added create_admin_bank method.
  • Updated liquidity and swap methods to include entity_id.
  • +18/-8   
    provider.ts
    Add `CreateAdminBankProps` and update interfaces.               

    sdk/packages/eternum/src/types/provider.ts
  • Added CreateAdminBankProps interface.
  • Updated liquidity and swap interfaces to include entity_id.
  • +12/-0   
    set_admin_bank.sh
    Add script for setting up admin bank.                                       

    scripts/set_admin_bank.sh - Added script for setting up admin bank.
    +7/-0     
    Configuration changes
    1 files
    contracts.sh
    Update contract addresses for bank systems.                           

    contracts/scripts/contracts.sh - Updated contract addresses for bank systems.
    +3/-3     

    ๐Ÿ’ก PR-Agent usage: Comment /help on the PR to get a list of all available PR-Agent tools and their descriptions

    vercel[bot] commented 6 days ago

    The latest updates on your projects. Learn more about Vercel for Git โ†—๏ธŽ

    Name Status Preview Comments Updated (UTC)
    eternum โœ… Ready (Inspect) Visit Preview ๐Ÿ’ฌ Add feedback Jun 28, 2024 1:00pm
    github-actions[bot] commented 6 days ago

    PR Reviewer Guide ๐Ÿ”

    โฑ๏ธ Estimated effort to review [1-5] 4
    ๐Ÿงช Relevant tests No
    ๐Ÿ”’ Security concerns No
    โšก Key issues to review Possible Bug:
    The removal of the BankAccounts component and related hooks might cause issues if there are still references to them elsewhere in the code that were not updated or removed in this PR. It's crucial to ensure that all dependencies and references are appropriately handled to avoid runtime errors.
    Performance Concern:
    The new slippage calculation in MarketManager.ts introduces more complex arithmetic operations which could impact performance, especially if called frequently. It's important to assess the performance impact of these changes, possibly through profiling or adding performance benchmarks.
    Data Handling:
    The addition of entity_id in various liquidity and swap operations suggests changes in how entities are identified and managed. This should be carefully reviewed to ensure that it does not introduce any inconsistencies or errors in entity management.
    github-actions[bot] commented 6 days ago

    Failed to generate code suggestions for PR

    edisontim commented 5 days ago

    Just run prettier please