refactor: move all remaining files to orig/ directory
Completed clean root directory structure: - Root now contains only: .git, .env, docs/, orig/ - Moved all remaining files and directories to orig/: - Config files (.claude, .dockerignore, .drone.yml, etc.) - All .env variants (except active .env) - Git config (.gitconfig, .github, .gitignore, etc.) - Tool configs (.golangci.yml, .revive.toml, etc.) - Documentation (*.md files, @prompts) - Build files (Dockerfiles, Makefile, go.mod, go.sum) - Docker compose files - All source directories (scripts, tests, tools, etc.) - Runtime directories (logs, monitoring, reports) - Dependency files (node_modules, lib, cache) - Special files (--delete) - Removed empty runtime directories (bin/, data/) V2 structure is now clean: - docs/planning/ - V2 planning documents - orig/ - Complete V1 codebase preserved - .env - Active environment config (not in git) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
73
orig/scripts/generate-key.go
Normal file
73
orig/scripts/generate-key.go
Normal file
@@ -0,0 +1,73 @@
|
||||
//go:build tools
|
||||
// +build tools
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"math/big"
|
||||
"os"
|
||||
|
||||
"github.com/fraktal/mev-beta/internal/logger"
|
||||
"github.com/fraktal/mev-beta/pkg/security"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// Get encryption key from environment
|
||||
encryptionKey := os.Getenv("MEV_BOT_ENCRYPTION_KEY")
|
||||
if encryptionKey == "" {
|
||||
fmt.Println("❌ MEV_BOT_ENCRYPTION_KEY environment variable is required")
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
// Create key manager configuration
|
||||
keyManagerConfig := &security.KeyManagerConfig{
|
||||
KeystorePath: "keystore",
|
||||
EncryptionKey: encryptionKey,
|
||||
KeyRotationDays: 30,
|
||||
MaxSigningRate: 100,
|
||||
SessionTimeout: 3600,
|
||||
AuditLogPath: "logs/audit.log",
|
||||
BackupPath: "backups",
|
||||
}
|
||||
|
||||
// Initialize logger
|
||||
log := logger.New("info", "text", "")
|
||||
|
||||
// Create key manager
|
||||
fmt.Println("🔑 Creating key manager...")
|
||||
keyManager, err := security.NewKeyManager(keyManagerConfig, log)
|
||||
if err != nil {
|
||||
fmt.Printf("❌ Failed to create key manager: %v\n", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
// Generate a trading key
|
||||
fmt.Println("🔑 Generating trading key...")
|
||||
permissions := security.KeyPermissions{
|
||||
CanSign: true,
|
||||
CanTransfer: true,
|
||||
MaxTransferWei: big.NewInt(1000000000000000000), // 1 ETH
|
||||
AllowedContracts: []string{},
|
||||
RequireConfirm: false,
|
||||
}
|
||||
|
||||
address, err := keyManager.GenerateKey("trading", permissions)
|
||||
if err != nil {
|
||||
fmt.Printf("❌ Failed to generate key: %v\n", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
fmt.Printf("✅ Trading key generated successfully: %s\n", address.Hex())
|
||||
|
||||
// Test retrieving the key
|
||||
fmt.Println("🔍 Testing key retrieval...")
|
||||
_, err = keyManager.GetActivePrivateKey()
|
||||
if err != nil {
|
||||
fmt.Printf("❌ Failed to retrieve key: %v\n", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
fmt.Println("✅ Key retrieval successful!")
|
||||
fmt.Printf("📋 Key manager ready for production use\n")
|
||||
}
|
||||
Reference in New Issue
Block a user