-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Automatic Fungible Token Initialization (#314)
- Loading branch information
Showing
41 changed files
with
1,182 additions
and
133 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package handlers | ||
|
||
import ( | ||
"net/http" | ||
|
||
"github.com/flow-hydraulics/flow-wallet-api/ops" | ||
) | ||
|
||
// Ops is a HTTP server for admin (system) operations. | ||
type Ops struct { | ||
service ops.Service | ||
} | ||
|
||
// NewOps initiates a new ops server. | ||
func NewOps(service ops.Service) *Ops { | ||
return &Ops{service} | ||
} | ||
|
||
// InitMissingFungibleVaults starts the job to initialize missing fungible token vaults. | ||
func (s *Ops) InitMissingFungibleVaults() http.Handler { | ||
return http.HandlerFunc(s.InitMissingFungibleVaultsFunc) | ||
} | ||
|
||
// GetMissingFungibleVaults returns number of accounts that are missing a configured fungible token vault. | ||
func (s *Ops) GetMissingFungibleVaults() http.Handler { | ||
return http.HandlerFunc(s.GetMissingFungibleVaultsFunc) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package handlers | ||
|
||
import ( | ||
"net/http" | ||
) | ||
|
||
// InitMissingFungibleVaultsFunc starts job to init missing fungible token vaults. | ||
func (s *Ops) InitMissingFungibleVaultsFunc(rw http.ResponseWriter, r *http.Request) { | ||
|
||
result, err := s.service.InitMissingFungibleTokenVaults() | ||
if err != nil { | ||
handleError(rw, r, err) | ||
return | ||
} | ||
|
||
handleJsonResponse(rw, http.StatusOK, result) | ||
} | ||
|
||
// GetMissingFungibleVaultsFunc returns number of accounts with missing fungible token vaults. | ||
func (s *Ops) GetMissingFungibleVaultsFunc(rw http.ResponseWriter, r *http.Request) { | ||
|
||
result, err := s.service.GetMissingFungibleTokenVaults() | ||
if err != nil { | ||
handleError(rw, r, err) | ||
return | ||
} | ||
|
||
handleJsonResponse(rw, http.StatusOK, result) | ||
} |
Oops, something went wrong.