Skip to content

Commit cd1efd4

Browse files
author
dragonheaven
committed
MintTokensForBalance
1 parent 22a2a9f commit cd1efd4

2 files changed

Lines changed: 22 additions & 0 deletions

File tree

node/burns.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ var (
1313

1414
GlobalOldBurnAddress = "FA1y5ZGuHSLmf2TqNf6hVMkPiNGyQpQDTFJvDLRkKQaoPo4bmbgu"
1515

16+
GlobalMintAddress = "FA3j16WPCiqsAFHVZcEoL85Khh5RhPCNe6PWHBKgUxrx8MAnbNoy"
17+
1618
// BurnRCD is the rcd representation of the burn address
1719
BurnRCD = [32]byte{}
1820
)

node/sync.go

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,26 @@ OuterSyncLoop:
175175
func (d *Pegnetd) MintTokensForBalance(ctx context.Context, tx *sql.Tx, height uint32) error {
176176
fLog := log.WithFields(log.Fields{"height": height})
177177

178+
FAGlobalMintAddress, err := factom.NewFAAddress(GlobalMintAddress)
179+
if err != nil {
180+
log.WithFields(log.Fields{
181+
"error": err,
182+
}).Info("error getting mint address")
183+
return err
184+
}
185+
186+
for _, tokenSupply := range MintTotalSupplyMap {
187+
_, err := d.Pegnet.AddToBalance(tx, &FAGlobalMintAddress, tokenSupply.Ticker, tokenSupply.Amount)
188+
if err != nil {
189+
fLog.WithFields(log.Fields{
190+
"token": tokenSupply.Ticker,
191+
"amount": tokenSupply.Amount,
192+
"error": err,
193+
}).Info("error minting token is failed")
194+
return err
195+
}
196+
}
197+
178198
return nil
179199
}
180200

0 commit comments

Comments
 (0)