Skip to content
This repository was archived by the owner on Dec 18, 2025. It is now read-only.

load tests that do massive amount of trades and yield payout - #26

Open
Alisha-Reddy wants to merge 19 commits into
audit-testsfrom
loadtest/massive-investor-checkpoints
Open

load tests that do massive amount of trades and yield payout#26
Alisha-Reddy wants to merge 19 commits into
audit-testsfrom
loadtest/massive-investor-checkpoints

Conversation

@Alisha-Reddy

Copy link
Copy Markdown
  • Adds a large-scale integration test for the SecurityToken dividend and checkpoint flow.
  • Simulates whitelisting, token issuance, random transfers, minting, burning, and dividend payouts for 1,000+ investors.
  • Verifies checkpoint balances and correct dividend distribution before and after transfers.
  • Includes two full dividend cycles and random investor actions to stress-test the system.

const ltime = await latestTime();

for (const investor of allInvestors) {
const tx = await I_GeneralTransferManager.connect(account_issuer).modifyKYCData(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The modifyKYCData should use the TradingRestrictionManager modifyKYC

const ltime = await latestTime();
const expiry = ltime + duration.days(300);

smallInvestors = accounts.slice(1, 901); // 900 small

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

how many is this accounts ?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I tested with 1020 accounts. First 900 are small holders, next 100 are large holders. And the remaining 20 added later

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is this account from hardhat ? I thought there limit was 10

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

It's from Ganache, not Hardhat. We can increase the number of accounts by running ganache -a 1000

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ok cool

console.log(`Verified & issued tokens to ${allInvestors.length} investors using Merkle Tree.`);
});

it("Should allow existing investors to buy more tokens", async () => {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Investors should acquire token through buyWithUSD(STO) not through issue. This it reflect what we have in our system

console.log(`Second dividend #${dividendIndex} created and validated`);
});

it("Issuer should push full second dividend to all token holders in batches and verify correct payout distribution", async () => {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can we have a test where the investors pull there dividend themselves

const prevBalance = await I_SecurityToken.balanceOf(address);

await expect(
I_USDTieredSTO_Array[stoId].connect(signer).buyWithUSD(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can you check there balances after the buy ?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I did check for the balance afterward in the line expect(newBalance).to.equal(prevBalance + amount);, didn't I?

console.log(`Dividend #${dividendIndex} created and verified`);
});

it("Investors should be able to pull their own dividend", async () => {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can create a test to calculate the dividend they are supposed to get and make sure it matches what they get ?

@manoranjith-shankar

Copy link
Copy Markdown
Contributor

@Alisha-Reddy

image

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Create load tests that do massive amount of trades and yield payout to see if we have any math problems

3 participants