-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathfactory.go
More file actions
37 lines (30 loc) · 1.12 KB
/
factory.go
File metadata and controls
37 lines (30 loc) · 1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package scenarios
import (
"strings"
"github.com/sei-protocol/sei-load/config"
)
// ScenarioFactory is a function type that creates a new scenario instance
type ScenarioFactory func(s config.Scenario) TxGenerator
// scenarioFactories maps scenario names to their factory functions
var scenarioFactories = map[string]ScenarioFactory{
// Manual entries for non-contract scenarios
EVMTransfer: NewEVMTransferScenario,
EVMTransferFast: NewEVMTransferFastScenario,
EVMTransferNoop: NewEVMTransferNoopScenario,
// Auto-generated entries will be added below this line by make generate
// DO NOT EDIT BELOW THIS LINE - AUTO-GENERATED CONTENT
Disperse: NewDisperseScenario,
ERC20Conflict: NewERC20ConflictScenario,
ERC20Noop: NewERC20NoopScenario,
ERC20: NewERC20Scenario,
ERC721: NewERC721Scenario,
// DO NOT EDIT ABOVE THIS LINE - AUTO-GENERATED CONTENT
}
// CreateScenario creates a new scenario instance by name
func CreateScenario(s config.Scenario) TxGenerator {
factory, exists := scenarioFactories[strings.ToLower(s.Name)]
if !exists {
panic("Unknown scenario: " + s.Name)
}
return factory(s)
}