Documentation ¶
Index ¶
- type ERC20DeployedContract
- type EthManager
- func (m *EthManager) AddTestCase(tc ...TestCase)
- func (m *EthManager) Configure(cfg *conf.EthCaseConf, evmCfg *evm.GethConfig)
- func (m *EthManager) PreCreateWallets(walletCount int, initCount uint64) ([]*pkg.EthWallet, error)
- func (m *EthManager) Prepare(ctx context.Context) error
- func (m *EthManager) Run(ctx context.Context) error
- type SwapStep
- type TPSStats
- type TestCase
- type TestContract
- type TestData
- type UniswapV2AccuracyTestCase
- type UniswapV2DeployedContracts
- type UniswapV2TPSStatisticsTestCase
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ERC20DeployedContract ¶
type ERC20DeployedContract struct {
// contains filtered or unexported fields
}
type EthManager ¶
type EthManager struct {
// contains filtered or unexported fields
}
func (*EthManager) AddTestCase ¶
func (m *EthManager) AddTestCase(tc ...TestCase)
func (*EthManager) Configure ¶
func (m *EthManager) Configure(cfg *conf.EthCaseConf, evmCfg *evm.GethConfig)
func (*EthManager) PreCreateWallets ¶
type TestContract ¶
type TestData ¶
type TestData struct { TestUsers []*pkg.EthWallet `json:"testUsers"` TestContracts []TestContract }
type UniswapV2AccuracyTestCase ¶
type UniswapV2AccuracyTestCase struct { CaseName string // contains filtered or unexported fields }
func NewUniswapV2AccuracyTestCase ¶
func NewUniswapV2AccuracyTestCase(name string, count int, initial uint64) *UniswapV2AccuracyTestCase
func (*UniswapV2AccuracyTestCase) Name ¶
func (ca *UniswapV2AccuracyTestCase) Name() string
func (*UniswapV2AccuracyTestCase) Prepare ¶
func (ca *UniswapV2AccuracyTestCase) Prepare(ctx context.Context, m *pkg.WalletManager) (TestData, error)
func (*UniswapV2AccuracyTestCase) Run ¶
func (ca *UniswapV2AccuracyTestCase) Run(ctx context.Context, m *pkg.WalletManager) error
type UniswapV2DeployedContracts ¶
type UniswapV2DeployedContracts struct {
// contains filtered or unexported fields
}
type UniswapV2TPSStatisticsTestCase ¶
type UniswapV2TPSStatisticsTestCase struct { MaxUsers int NonConflict bool TestUsers int DeployedUsers int CaseName string // contains filtered or unexported fields }
func (*UniswapV2TPSStatisticsTestCase) Name ¶
func (cd *UniswapV2TPSStatisticsTestCase) Name() string
func (*UniswapV2TPSStatisticsTestCase) Prepare ¶
func (cd *UniswapV2TPSStatisticsTestCase) Prepare(ctx context.Context, m *pkg.WalletManager) error
func (*UniswapV2TPSStatisticsTestCase) Run ¶
func (cd *UniswapV2TPSStatisticsTestCase) Run(ctx context.Context, m *pkg.WalletManager) error
Run TestUniswapTPS is a test case to measure the transactions per second (TPS) of Uniswap. The test case follows these steps: 1. Arrange
- Create a deployer user with sufficient balance
- Create multiple test users with initial balance
- Deploy Uniswap core contracts (WETH9, UniswapV2Factory, UniswapV2Router01)
- Deploy a set of ERC20 token contracts
- Approve the router contract to spend tokens on behalf of test users
- Distribute the test tokens to each test user
- Generate all possible token pairs from the deployed ERC20 tokens
- Add liquidity to the token pairs on Uniswap
2. Act
- Each test user performs a series of token swaps on Uniswap
- The swaps are performed concurrently to simulate real-world usage
3. Assert
- Calculate and report the transactions per second (TPS) achieved during the test
Click to show internal directories.
Click to hide internal directories.