getter_utils.gno
0.42 Kb ยท 26 lines
1package staker
2
3import "gno.land/p/nt/avl"
4
5func cloneWarmups(warmups []Warmup) []Warmup {
6 if warmups == nil {
7 return nil
8 }
9
10 copied := make([]Warmup, len(warmups))
11 copy(copied, warmups)
12 return copied
13}
14
15func cloneAvlTree(tree *avl.Tree) *avl.Tree {
16 if tree == nil {
17 return nil
18 }
19
20 cloned := avl.NewTree()
21 tree.Iterate("", "", func(key string, value any) bool {
22 cloned.Set(key, value)
23 return false
24 })
25 return cloned
26}