added args to contracts
@@ -24,6 +24,8 @@ import (
"path"
"strings"
+ "github.com/onflow/flow-cli/pkg/flowcli"
+
"github.com/onflow/cadence/runtime/ast"
"github.com/onflow/cadence/runtime/common"
"github.com/onflow/cadence/runtime/parser2"
@@ -39,6 +41,7 @@ type Contract struct {
source string
target flow.Address
code string
+ args []flowcli.CadenceArgument
program *ast.Program
dependencies map[string]*Contract
aliases map[string]flow.Address
@@ -50,6 +53,7 @@ func newContract(
contractSource,
contractCode string,
target flow.Address,
+ args []flowcli.CadenceArgument,
) (*Contract, error) {
program, err := parser2.ParseProgram(contractCode)
if err != nil {
@@ -63,6 +67,7 @@ func newContract(
target: target,
code: contractCode,
program: program,
+ args: args,
dependencies: make(map[string]*Contract),
aliases: make(map[string]flow.Address),
}, nil
@@ -80,6 +85,10 @@ func (c *Contract) Code() string {
return c.code
}
+func (c *Contract) Args() []flowcli.CadenceArgument {
+ return c.args
+}
+
func (c *Contract) TranspiledCode() string {
code := c.code
@@ -177,6 +186,7 @@ func (p *Preprocessor) AddContractSource(
contractName,
contractSource string,
target flow.Address,
+ args []flowcli.CadenceArgument,
) error {
contractCode, err := p.loader.Load(contractSource)
if err != nil {
@@ -189,6 +199,7 @@ func (p *Preprocessor) AddContractSource(
contractSource,
contractCode,
target,
+ args,
)
if err != nil {
return err
