Skip to content

Commit

Permalink
use WithValue language for test
Browse files Browse the repository at this point in the history
  • Loading branch information
snissn committed Feb 6, 2023
1 parent f671a3c commit 2673ec3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions itests/fevm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -704,7 +704,7 @@ func TestFEVMRecursiveActorCallEstimate(t *testing.T) {
}

// TestFEVM deploys a contract while sending value to it
func TestFEVMDeployValue(t *testing.T) {
func TestFEVMDeployWithValue(t *testing.T) {
ctx, cancel, client := kit.SetupFEVMTest(t)
defer cancel()

Expand All @@ -716,7 +716,7 @@ func TestFEVMDeployValue(t *testing.T) {
// testValue is sent to DeployValueTest and that amount is
// also sent to NewContract
filenameActor := "contracts/DeployValueTest.hex"
fromAddr, idAddr := client.EVM().DeployContractFromFilenameValue(ctx, filenameActor, testValue)
fromAddr, idAddr := client.EVM().DeployContractFromFilenameWithValue(ctx, filenameActor, testValue)

//call getNewContractBalance to find the value of NewContract
ret, _, err := client.EVM().InvokeContractByFuncName(ctx, fromAddr, idAddr, "getNewContractBalance()", []byte{})
Expand Down
14 changes: 7 additions & 7 deletions itests/kit/evm.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,13 @@ func (f *TestFullNode) EVM() *EVM {
return &EVM{f}
}

func (e *EVM) DeployContractValue(ctx context.Context, sender address.Address, bytecode []byte, value big.Int) eam.CreateReturn {
func (e *EVM) DeployContractWithValue(ctx context.Context, sender address.Address, bytecode []byte, value big.Int) eam.CreateReturn {
require := require.New(e.t)

method := builtintypes.MethodsEAM.CreateExternal
initcode := abi.CborBytes(bytecode)
params, err := actors.SerializeParams(&initcode)
require.NoError(err)
params, errActors := actors.SerializeParams(&initcode)
require.NoError(errActors)

msg := &types.Message{
To: builtintypes.EthereumAddressManagerActorAddr,
Expand Down Expand Up @@ -76,10 +76,10 @@ func (e *EVM) DeployContractValue(ctx context.Context, sender address.Address, b
return result
}
func (e *EVM) DeployContract(ctx context.Context, sender address.Address, bytecode []byte) eam.CreateReturn {
return e.DeployContractValue(ctx, sender, bytecode, big.Zero())
return e.DeployContractWithValue(ctx, sender, bytecode, big.Zero())
}

func (e *EVM) DeployContractFromFilenameValue(ctx context.Context, binFilename string, value big.Int) (address.Address, address.Address) {
func (e *EVM) DeployContractFromFilenameWithValue(ctx context.Context, binFilename string, value big.Int) (address.Address, address.Address) {
contractHex, err := os.ReadFile(binFilename)
require.NoError(e.t, err)

Expand All @@ -92,14 +92,14 @@ func (e *EVM) DeployContractFromFilenameValue(ctx context.Context, binFilename s
fromAddr, err := e.WalletDefaultAddress(ctx)
require.NoError(e.t, err)

result := e.DeployContractValue(ctx, fromAddr, contract, value)
result := e.DeployContractWithValue(ctx, fromAddr, contract, value)

idAddr, err := address.NewIDAddress(result.ActorID)
require.NoError(e.t, err)
return fromAddr, idAddr
}
func (e *EVM) DeployContractFromFilename(ctx context.Context, binFilename string) (address.Address, address.Address) {
return e.DeployContractFromFilenameValue(ctx, binFilename, big.Zero())
return e.DeployContractFromFilenameWithValue(ctx, binFilename, big.Zero())
}

func (e *EVM) InvokeSolidity(ctx context.Context, sender address.Address, target address.Address, selector []byte, inputData []byte) (*api.MsgLookup, error) {
Expand Down

0 comments on commit 2673ec3

Please sign in to comment.