github.com/iotexproject/iotex-core@v1.14.1-rc1/action/protocol/rewarding/ethabi/availablebalance_test.go (about)

     1  package ethabi
     2  
     3  import (
     4  	"math/big"
     5  	"testing"
     6  
     7  	"github.com/iotexproject/iotex-proto/golang/iotexapi"
     8  	"github.com/stretchr/testify/require"
     9  )
    10  
    11  func TestAvailableBalanceEncodeToEth(t *testing.T) {
    12  	r := require.New(t)
    13  
    14  	ctx, err := newAvailableBalanceStateContext()
    15  	r.Nil(err)
    16  	r.EqualValues("AvailableBalance", string(ctx.Parameters().MethodName))
    17  
    18  	amount := big.NewInt(10000)
    19  	resp := &iotexapi.ReadStateResponse{
    20  		Data: []byte(amount.String()),
    21  	}
    22  
    23  	data, err := ctx.EncodeToEth(resp)
    24  	r.Nil(err)
    25  	r.EqualValues("0000000000000000000000000000000000000000000000000000000000002710", data)
    26  }