Let txgen accepts contract address for contract source
@@ -6,12 +6,14 @@ import (
"fmt"
"log"
"math/big"
+ "os"
"sync/atomic"
"text/template"
"time"
"github.com/pkg/errors"
+ "github.com/icon-project/goloop/common"
"github.com/icon-project/goloop/common/wallet"
"github.com/icon-project/goloop/module"
)
@@ -69,6 +71,7 @@ func (m *CallMaker) Prepare(client *Client) error {
return errors.New("Coin Transfer FAIL")
}
+ if _, err := os.Stat(m.SourcePath); err == nil {
deploy, err := makeDeploy(m.NID, m.owner, m.SourcePath,
m.InstallParams)
if err != nil {
@@ -85,6 +88,13 @@ func (m *CallMaker) Prepare(client *Client) error {
return errors.New("DeployFailed")
}
m.contract = r.SCOREAddress
+ } else {
+ addr := new(common.Address)
+ if err := addr.SetString(m.SourcePath); err != nil {
+ return err
+ }
+ m.contract = addr
+ }
m.index = 0
return nil
