-
Notifications
You must be signed in to change notification settings - Fork 26
/
factoryerc721fixed.go
47 lines (37 loc) · 1.11 KB
/
factoryerc721fixed.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package znft
import (
"context"
"math/big"
"github.com/ethereum/go-ethereum/common"
"github.com/pkg/errors"
factory "github.com/0chain/gosdk/znft/contracts/factorymoduleerc721fixed/binding"
)
// Solidity functions
// function createToken(
// address owner,
// string calldata name,
// string calldata symbol,
// string calldata uri,
// uint256 max,
// uint256 price,
// uint256 batch,
// bytes calldata
//) external returns (address) {
type IFactoryFixed interface {
CreateToken(owner, name, symbol, uri string, max, price, batch *big.Int, calldata []byte) error
}
type FactoryFixed struct {
session *factory.BindingSession
ctx context.Context
}
func (s *FactoryFixed) CreateToken(owner, name, symbol, uri string, max, price, batch *big.Int, calldata []byte) error {
ownerAddress := common.HexToAddress(owner)
evmTr, err := s.session.CreateToken(ownerAddress, name, symbol, uri, max, price, batch, calldata)
if err != nil {
err = errors.Wrapf(err, "failed to execute %s", "CreateToken")
Logger.Error(err)
return err
}
Logger.Info("Executed CreateToken, hash: ", evmTr.Hash().Hex())
return nil
}