Search Apps Documentation Source Content File Folder Download Copy Actions Download

init.gno

0.52 Kb ยท 32 lines
 1package v1
 2
 3import (
 4	"gno.land/r/gnoswap/router"
 5)
 6
 7const (
 8	defaultSwapFeeBPS = uint64(15) // 0.15%
 9)
10
11func init() {
12	registerRouterV1()
13}
14
15func registerRouterV1() {
16	router.RegisterInitializer(cross, func(routerStore router.IRouterStore) router.IRouter {
17		err := initStoreData(routerStore)
18		if err != nil {
19			panic(err)
20		}
21
22		return NewRouterV1(routerStore)
23	})
24}
25
26func initStoreData(routerStore router.IRouterStore) error {
27	if !routerStore.HasSwapFeeKey() {
28		return routerStore.SetSwapFee(defaultSwapFeeBPS)
29	}
30
31	return nil
32}