@@ -72,29 +72,68 @@ func (p *reserveService) Start(serviceCtx context.Context, interval time.Duratio
7272
7373// todo: Don't hardcode Jeffy
7474func (p * reserveService ) UpdateAllLaunchpadCurrencyReserves (ctx context.Context ) error {
75- jeffyMintAccount , _ := common .NewAccountFromPublicKeyString ("52MNGpgvydSwCtC2H4qeiZXZ1TxEuRVCRGa8LAfk2kSj" )
76- jeffyVaultAccount , _ := common .NewAccountFromPublicKeyString ("BFDanLgELhpCCGTtaa7c8WGxTXcTxgwkf9DMQd4qheSK" )
77- coreMintVaultAccount , _ := common .NewAccountFromPublicKeyString ("A9NVHVuorNL4y2YFxdwdU3Hqozxw1Y1YJ81ZPxJsRrT4" )
78-
79- var tokenAccount token.Account
80- ai , err := p .data .GetBlockchainAccountInfo (ctx , jeffyVaultAccount .PublicKey ().ToBase58 (), solana .CommitmentFinalized )
81- if err != nil {
82- return err
83- }
84- tokenAccount .Unmarshal (ai .Data )
85- jeffyVaultBalance := tokenAccount .Amount
75+ err1 := func () error {
76+ jeffyMintAccount , _ := common .NewAccountFromPublicKeyString ("52MNGpgvydSwCtC2H4qeiZXZ1TxEuRVCRGa8LAfk2kSj" )
77+ jeffyVaultAccount , _ := common .NewAccountFromPublicKeyString ("BFDanLgELhpCCGTtaa7c8WGxTXcTxgwkf9DMQd4qheSK" )
78+ coreMintVaultAccount , _ := common .NewAccountFromPublicKeyString ("A9NVHVuorNL4y2YFxdwdU3Hqozxw1Y1YJ81ZPxJsRrT4" )
79+
80+ var tokenAccount token.Account
81+ ai , err := p .data .GetBlockchainAccountInfo (ctx , jeffyVaultAccount .PublicKey ().ToBase58 (), solana .CommitmentFinalized )
82+ if err != nil {
83+ return err
84+ }
85+ tokenAccount .Unmarshal (ai .Data )
86+ jeffyVaultBalance := tokenAccount .Amount
87+
88+ ai , err = p .data .GetBlockchainAccountInfo (ctx , coreMintVaultAccount .PublicKey ().ToBase58 (), solana .CommitmentFinalized )
89+ if err != nil {
90+ return err
91+ }
92+ tokenAccount .Unmarshal (ai .Data )
93+ coreMintVaultBalance := tokenAccount .Amount
94+
95+ return p .data .PutCurrencyReserve (ctx , & currency.ReserveRecord {
96+ Mint : jeffyMintAccount .PublicKey ().ToBase58 (),
97+ SupplyFromBonding : currencycreator .DefaultMintMaxQuarkSupply - jeffyVaultBalance ,
98+ CoreMintLocked : coreMintVaultBalance ,
99+ Time : time .Now (),
100+ })
101+ }()
102+
103+ err2 := func () error {
104+ knicksNightMintAccount , _ := common .NewAccountFromPublicKeyString ("497Wy6cY9BjWBiaDHzJ7TcUZqF2gE1Qm7yXtSj1vSr5W" )
105+ knicksNightVaultAccount , _ := common .NewAccountFromPublicKeyString ("GEJGcTHfggJ4P82AwrmNWji2AkLq5eRUDM2hQSZ5SXpt" )
106+ coreMintVaultAccount , _ := common .NewAccountFromPublicKeyString ("AZN7RinWLBtjxtJL6rLxFgb2rtcbpUJ67pfcq71Z3mKk" )
86107
87- ai , err = p .data .GetBlockchainAccountInfo (ctx , coreMintVaultAccount .PublicKey ().ToBase58 (), solana .CommitmentFinalized )
88- if err != nil {
89- return err
108+ var tokenAccount token.Account
109+ ai , err := p .data .GetBlockchainAccountInfo (ctx , knicksNightVaultAccount .PublicKey ().ToBase58 (), solana .CommitmentFinalized )
110+ if err != nil {
111+ return err
112+ }
113+ tokenAccount .Unmarshal (ai .Data )
114+ knicksNightVaultBalance := tokenAccount .Amount
115+
116+ ai , err = p .data .GetBlockchainAccountInfo (ctx , coreMintVaultAccount .PublicKey ().ToBase58 (), solana .CommitmentFinalized )
117+ if err != nil {
118+ return err
119+ }
120+ tokenAccount .Unmarshal (ai .Data )
121+ coreMintVaultBalance := tokenAccount .Amount
122+
123+ return p .data .PutCurrencyReserve (ctx , & currency.ReserveRecord {
124+ Mint : knicksNightMintAccount .PublicKey ().ToBase58 (),
125+ SupplyFromBonding : currencycreator .DefaultMintMaxQuarkSupply - knicksNightVaultBalance ,
126+ CoreMintLocked : coreMintVaultBalance ,
127+ Time : time .Now (),
128+ })
129+ }()
130+
131+ if err1 != nil {
132+ return err1
90133 }
91- tokenAccount .Unmarshal (ai .Data )
92- coreMintVaultBalance := tokenAccount .Amount
93-
94- return p .data .PutCurrencyReserve (ctx , & currency.ReserveRecord {
95- Mint : jeffyMintAccount .PublicKey ().ToBase58 (),
96- SupplyFromBonding : currencycreator .DefaultMintMaxQuarkSupply - jeffyVaultBalance ,
97- CoreMintLocked : coreMintVaultBalance ,
98- Time : time .Now (),
99- })
134+ if err2 != nil {
135+ return err2
136+ }
137+
138+ return nil
100139}
0 commit comments