Skip to content

Add LA Exchange Adapter #14596

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

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft

Add LA Exchange Adapter #14596

wants to merge 5 commits into from

Conversation

laexchange
Copy link

@laexchange laexchange commented May 10, 2025

Name (to be shown on DefiLlama):

LA Exchange

Twitter Link:

https://x.com/LAexchange_ETH

List of audit links if any:

https://cert-api.salusec.io/api/v1/salus/contract/certificate/full/2025/La.Exchange_audit_report_2025-05-08.pdf

Website Link:

https://la.exchange

Logo (High resolution, will be shown with rounded borders):

https://drive.google.com/file/d/1WCgjhaDW6Wra-lLSC6pprbqKb6GDW_iz/view?usp=drive_link

Current TVL:

0

Treasury Addresses (if the protocol has treasury)
Chain:

Ethereum

Coingecko ID (so your TVL can appear on Coingecko, leave empty if not listed): (https://api.coingecko.com/api/v3/coins/list)
Coinmarketcap ID (so your TVL can appear on Coinmarketcap, leave empty if not listed): (https://api.coinmarketcap.com/data-api/v3/map/all?listing_status=active,inactive,untracked&start=1&limit=10000)
Short Description (to be shown on DefiLlama):

LA.Exchange is an innovative all-in-one decentralized platform that combines a Launchpad powered by the Eternal Oversubscribe mechanism with a decentralized exchange (DEX). It is designed to enable continuous, fair, and transparent token distribution, seamlessly connected to on-chain liquidity, trading, and long-term ecosystem growth.

Token address and ticker if any:

Token address: 0xEB7F0CF3F5fdb2c0Ba6c940deF8902Ca4832001A;
Ticker: LA

Category (full list at https://defillama.com/categories) *Please choose only one:

launchpad

Oracle Provider(s): Specify the oracle(s) used (e.g., Chainlink, Band, API3, TWAP, etc.): Chainlink
Implementation Details: Briefly describe how the oracle is integrated into your project:

LA Exchange is a decentralized exchange powered by the Eternal Oversubscribe mechanism. The Eternal Oversubscribe Launchpool supports not only ETH, but also USDT, USDC, and USDX. User allocations are calculated based on the value of each deposited asset, with prices sourced from Chainlink oracles.

Documentation/Proof: Provide links to documentation or any other resources that verify the oracle's usage:

https://la-exchange.gitbook.io/la.exchange-docs/la-eternal-oversubscribe-launchpool

forkedFrom (Does your project originate from another project):
methodology (what is being counted as tvl, how is tvl being calculated):

https://etherscan.io/address/0xf94342d9eb0f42ea6bb6901170db7479e3e88e52#code
function calcTVL(address currency) public view returns(uint currV, uint TVL)

Github org/user (Optional, if your code is open source, we can track activity):

https://github.com/laexchange/contracts

@laexchange laexchange marked this pull request as ready for review May 10, 2025 15:57
@llamabutler
Copy link

The adapter at projects/laexchange exports TVL:

ethereum                  0

total                    0 

const LAUNCHPOOL_CONTRACT = "0x82Bcfb5695a7E5c3cE2a9f49bFAf6e28BB23F486"
const CURRENCY_ADDRESS = "0xdAC17F958D2ee523a2206206994597C13D831ec7" // USDT

const {currV, TVL } = await api.call({
Copy link
Collaborator

Choose a reason for hiding this comment

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

can use erc20:balanceOf or getBalance instead please?

Copy link
Author

Choose a reason for hiding this comment

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

The contract will create many sub-contracts, and the assets will be stored in the sub-contracts respectively. There is a function dedicated to calculating TVL, which can be obtained directly. The specific contract logic is open source, and you can refer to https://etherscan.io/address/0xf94342d9eb0f42ea6bb6901170db7479e3e88e52#code

    function calcTVL(address currency) public view returns(uint currV, uint TVL) {
        for(uint i=0; i<currencies.length; i++) {
            address curr = currencies[i];
            uint v;
            if(curr == USDX)
                v = totalCurrencyLast[curr];
            else if(curr == USDT || curr == USDC)
                v = totalCurrencyLast[curr].mul(1e18/1e6);
            else if(curr == WETH)
                v = totalCurrencyLast[curr].mul(uint(AggregatorInterface(oracleETH).latestAnswer())).div(1e8);
            TVL = TVL.add(v);
            if(curr == currency)
                currV = v;
        }
    }

Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we fetch a list of subcontracts from an API and then use erc20:balanceOf?

Copy link
Author

Choose a reason for hiding this comment

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

Of course we can, but using the server's API will make it more centralized. We prefer an open source and decentralized approach.

Copy link
Collaborator

Choose a reason for hiding this comment

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

We cant use calcTVL()

Copy link
Author

Choose a reason for hiding this comment

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

Could you please explain why?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Because it doesnt give us a breakdown of assets held

Copy link
Author

Choose a reason for hiding this comment

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

totalCurrencyLast is just for the convenience of making a statistical calculation of funds. Its underlying change logic is deposit and withdraw. We will update it at a reasonable position.

    function deposit(uint value) external payable invest(msg.sender) {
        uint amount;
        if(totalSupply == 0)
            amount = value;
        else if(totalCurrencyLast == 0) {        // Finished
            if(msg.value > 0)
                msg.sender.transfer(msg.value);
            return;
        } else
            amount = value.mul(totalSupply).div(totalCurrencyLast);
        if(msg.value >= value && currency == router.WETH())
            IWETH(currency).deposit.value(msg.value)();
        else {
            currency.safeTransferFrom(msg.sender, address(this), value);
            if(msg.value > 0)
                msg.sender.transfer(msg.value);
        }
        balanceOf[msg.sender] = balanceOf[msg.sender].add(amount);
        totalSupply = totalSupply.add(amount);
        totalCurrencyLast  = totalCurrencyLast.add(value);
        lasttimeDepositOf[msg.sender] = now;
        emit Transfer(address(0), msg.sender, amount);
        emit Deposited(msg.sender, value);
    }
    event Deposited(address indexed account, uint value);
    event Transfer(address indexed from, address indexed to, uint value);

    function withdraw(uint value) public invest(msg.sender) returns (uint, uint) {
        uint amount = value.mul(totalSupply).div1(totalCurrencyLast);
        if(amount > balanceOf[msg.sender]) {
            amount = balanceOf[msg.sender];
            value = currencyOf(msg.sender);
        }
        balanceOf[msg.sender] = balanceOf[msg.sender].sub(amount);
        totalSupply = totalSupply.sub(amount);
        emit Transfer(msg.sender, address(0), amount);
        totalCurrencyLast  = totalCurrencyLast.sub(value);

        uint tax = lasttimeDepositOf[msg.sender].add(withdrawTaxSpan) <= now ? 0 : value.mul(withdrawTaxRate).div(1 ether);
        currency.safeTransfer(address(router), tax);
        IUniswapV2Callee(address(router)).uniswapV2Call(underlying, uint(currency), tax, "");
        value = value.sub(tax);

        if(currency == router.WETH()) {
            IWETH(currency).withdraw(value);
            msg.sender.transfer(value);
        } else
            currency.safeTransfer(msg.sender, value);
        emit Withdrawn(msg.sender, value, tax);
        return (value, tax);
    }
    event Withdrawn(address indexed account, uint value, uint tax);

If this is unacceptable, do I need to write a set of APIs to return a bunch of addresses and then balanceOf?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Ideally we would use balanceOf across a list of holder addresses yeah

@waynebruce0x waynebruce0x self-assigned this May 12, 2025
Comment on lines 17 to 18
methodology: 'Counts the amount of deposited ETH in the LPETH contract.',
ethereum: {
Copy link
Collaborator

Choose a reason for hiding this comment

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

please add misrepresentedTokens: true here and we can use the current calcTVL() logic

Copy link
Author

Choose a reason for hiding this comment

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

Added, please check.

@llamabutler
Copy link

The adapter at projects/laexchange exports TVL:

ethereum                  0

total                    0 

@llamabutler
Copy link

The adapter at projects/laexchange exports TVL:

ethereum                  0

total                    0 

@waynebruce0x
Copy link
Collaborator

Is TVL $0 expected? We need nonzero TVL to list

@laexchange
Copy link
Author

laexchange commented May 14, 2025

Is TVL $0 expected? We need nonzero TVL to list

Yes, the project has not started yet, but we want to launch a page on DefiLlama, which we will spread on social media.
Please wait a moment while I discuss this with the team.

@noateden noateden assigned noateden and unassigned waynebruce0x May 31, 2025
@noateden
Copy link
Contributor

hi @laexchange, because we don't list zero tvl project, I will make this PR to be draft, let me know when your project is ready and have tvl, thanks.

@noateden noateden marked this pull request as draft May 31, 2025 12:49
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.

4 participants