-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfix_storage_layout.sh
More file actions
38 lines (30 loc) · 1.36 KB
/
fix_storage_layout.sh
File metadata and controls
38 lines (30 loc) · 1.36 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
38
#!/bin/bash
# Script para adicionar StorageLayout derives para todas as estruturas que precisam
echo "Adicionando StorageLayout derives..."
# Lista de arquivos e estruturas que precisam do derive
declare -A files_structs=(
["migration_system.rs"]="MigrationRecord"
["compatibility_layer.rs"]="VersionConfig"
["proxy_monitoring.rs"]="HealthStatus AlertThresholds"
["token_custody_system.rs"]="ProjectTokenDeposit BuyerAllocation AirdropCampaign"
["governance_system.rs"]="VotingSession VoterSubmission VoterProfile ReputationWeight ProjectPerformance SuccessMetrics VerificationStatus SybilScore"
["web3_connection_tdd.rs"]="WalletSession KYCThresholds"
)
for file in "${!files_structs[@]}"; do
if [ -f "$file" ]; then
echo "Processando $file..."
structs=${files_structs[$file]}
for struct in $structs; do
echo " Adicionando StorageLayout para $struct"
# Procurar pela definição da struct e adicionar o derive
sed -i '' "/pub struct $struct {/i\\
#[cfg_attr(feature = \"std\", derive(ink::storage::traits::StorageLayout))]
" "$file"
# Também para enums
sed -i '' "/pub enum $struct {/i\\
#[cfg_attr(feature = \"std\", derive(ink::storage::traits::StorageLayout))]
" "$file"
done
fi
done
echo "StorageLayout derives adicionados!"