Skip to content

Commit

Permalink
added trusted node dao min member count getter
Browse files Browse the repository at this point in the history
  • Loading branch information
moles1 committed Feb 24, 2021
1 parent fb7d8ed commit eb77374
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
14 changes: 14 additions & 0 deletions dao/trustednode/dao.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,20 @@ func GetMemberDetails(rp *rocketpool.RocketPool, memberAddress common.Address, o
}


// Get the minimum member count
func GetMinimumMemberCount(rp *rocketpool.RocketPool, opts *bind.CallOpts) (uint64, error) {
rocketDAONodeTrusted, err := getRocketDAONodeTrusted(rp)
if err != nil {
return 0, err
}
minMemberCount := new(*big.Int)
if err := rocketDAONodeTrusted.Call(opts, minMemberCount, "getMemberMinRequired"); err != nil {
return 0, fmt.Errorf("Could not get trusted node DAO minimum member count: %w", err)
}
return (*minMemberCount).Uint64(), nil
}


// Get the member count
func GetMemberCount(rp *rocketpool.RocketPool, opts *bind.CallOpts) (uint64, error) {
rocketDAONodeTrusted, err := getRocketDAONodeTrusted(rp)
Expand Down
7 changes: 7 additions & 0 deletions tests/dao/trustednode/dao_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,13 @@ func TestMemberDetails(t *testing.T) {
if err := evm.TakeSnapshot(); err != nil { t.Fatal(err) }
t.Cleanup(func() { if err := evm.RevertSnapshot(); err != nil { t.Fatal(err) } })

// Get & check minimum member count
if minMemberCount, err := trustednodedao.GetMinimumMemberCount(rp, nil); err != nil {
t.Error(err)
} else if minMemberCount == 0 {
t.Error("Incorrect trusted node DAO minimum member count")
}

// Get & check initial member details
if members, err := trustednodedao.GetMembers(rp, nil); err != nil {
t.Error(err)
Expand Down

0 comments on commit eb77374

Please sign in to comment.