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

totalSupply() of value units? #8

Open
elmariachi111 opened this issue Dec 6, 2022 · 2 comments
Open

totalSupply() of value units? #8

elmariachi111 opened this issue Dec 6, 2022 · 2 comments

Comments

@elmariachi111
Copy link

Have been looking a for a function that tracks all value mints and burns and can tell me the total "value" distributed among all tokens in a slot. Has this been brought up already? Anything that contradicts that idea on ERC3525?

@tekkac
Copy link

tekkac commented Dec 13, 2022

I was looking for the same thing, it's not in the eip spec but would be nice-to-have.

@YeeTsai
Copy link
Collaborator

YeeTsai commented Feb 28, 2023

In some cases, the meaning of the value is different at different SLOT. It is not suitable as a uniform interface in the EIP Spec. If needed, here is a demo implementation by the functions in the ERC3525SlotEnumerable.

function totalSupply() external returns uint256 {

    uint256 count = slotCount();
    uint256 total = 0;

    for (uint256 index = 0; index < count; index++) {
        uint256 slot = slotByIndex (index);
        uint256 slotSupply =  tokenSupplyInSlot(slot);
        total = total + slotSupply;
    }
    
    return total;
}

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

No branches or pull requests

3 participants