pie-dao / pools.piedao.org

pools-piedao-org-flax.vercel.app
Other
24 stars 27 forks source link

changed defi++ to prefer buy over mint #344

Closed jordaniza closed 2 years ago

jordaniza commented 2 years ago

I wanted to look at a clean way to add DEFI++ as an option to buy/sell in the main exchange modal.

Reviewing the codebase, the reason it does not appear is because the setting preferMintOverBuy is set to true

Changing this setting adds the token to the swap list on Tokensswap.svelte and Exchange.svelte, as we want. It also has the following effects on Dashboard.svelte:

                {#if pie.buyButton}
                  {#if pie.useMintOverBuy}
                      <a href={`#/pie/${pie.address}`}>
                        <button class="table-btn highlight-box min-w-70px">
                          {pie.symbol}
                        </button>
                      </a>
                  {:else}
                    <a href={`#/swap`}>
                      <button class="table-btn highlight-box min-w-70px">
                        {pie.symbol}
                      </button>
                    </a>
                  {/if}
                {/if}
              {#if pie.useMintOverBuy}
                <button on:click={() => {
                  modalOption.token = pie.address;
                  modal.open();
                }} class="table-btn highlight-box min-w-70px">
                  {pie.symbol}
                </button>
              {:else}
                <a href={`#/swap`}>
                  <button class="table-btn highlight-box min-w-70px">
                    {pie.symbol}
                  </button>
                </a>
              {/if}
                 {#if pie.buyButton}
                  {#if pie.useMintOverBuy}
                      <a href={pie.symbol == "SLICE" ? '#/slice' : `#/pie/${pie.address}`}>
                        <button class="table-btn highlight-box min-w-70px">
                          {pie.symbol}
                        </button>
                      </a>
                  {:else}
                    <a href={`#/swap`}>
                      <button class="table-btn highlight-box min-w-70px">
                        {pie.symbol}
                      </button>
                    </a>
                  {/if}
                {/if}

In summary: it appears to me to be absolutely fine to make this change, enabling the wider functionality

Alexintosh commented 2 years ago

Change DAI with USDC, check decimals