Skip to content

Commit

Permalink
Merge pull request #28 from ipfs-force-community/feat/new_template_cmd
Browse files Browse the repository at this point in the history
Feat/new template cmd
  • Loading branch information
diwufeiwen committed Jun 22, 2022
2 parents 4e719f2 + cbf0095 commit e42fdd2
Show file tree
Hide file tree
Showing 19 changed files with 384 additions and 139 deletions.
86 changes: 57 additions & 29 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 10 additions & 10 deletions examples/erc20/client/client.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package client

import (
bytes "bytes"
context "context"
"bytes"
"context"
contract "erc20/contract"
fmt "fmt"
"fmt"

address "github.com/filecoin-project/go-address"
abi "github.com/filecoin-project/go-state-types/abi"
Expand All @@ -13,7 +13,7 @@ import (
init8 "github.com/filecoin-project/specs-actors/v8/actors/builtin/init"
actors "github.com/filecoin-project/venus/venus-shared/actors"
types "github.com/filecoin-project/venus/venus-shared/types"
types2 "github.com/ipfs-force-community/go-fvm-sdk/sdk/types"
sdkTypes "github.com/ipfs-force-community/go-fvm-sdk/sdk/types"
cid "github.com/ipfs/go-cid"
typegen "github.com/whyrusleeping/cbor-gen"

Expand All @@ -31,9 +31,9 @@ type IErc20TokenClient interface {

Constructor(context.Context, *contract.ConstructorReq) error

GetName(context.Context) (types2.CborString, error)
GetName(context.Context) (sdkTypes.CborString, error)

GetSymbol(context.Context) (types2.CborString, error)
GetSymbol(context.Context) (sdkTypes.CborString, error)

GetDecimal(context.Context) (typegen.CborInt, error)

Expand Down Expand Up @@ -208,7 +208,7 @@ func (c *Erc20TokenClient) Constructor(ctx context.Context, p0 *contract.Constru
return nil
}

func (c *Erc20TokenClient) GetName(ctx context.Context) (types2.CborString, error) {
func (c *Erc20TokenClient) GetName(ctx context.Context) (sdkTypes.CborString, error) {
if c.actor == address.Undef {
return "", fmt.Errorf("unset actor address for call")
}
Expand Down Expand Up @@ -239,14 +239,14 @@ func (c *Erc20TokenClient) GetName(ctx context.Context) (types2.CborString, erro
return "", fmt.Errorf("expect get result for call")
}

result := new(types2.CborString)
result := new(sdkTypes.CborString)
result.UnmarshalCBOR(bytes.NewReader(wait.Receipt.Return))

return *result, nil

}

func (c *Erc20TokenClient) GetSymbol(ctx context.Context) (types2.CborString, error) {
func (c *Erc20TokenClient) GetSymbol(ctx context.Context) (sdkTypes.CborString, error) {
if c.actor == address.Undef {
return "", fmt.Errorf("unset actor address for call")
}
Expand Down Expand Up @@ -277,7 +277,7 @@ func (c *Erc20TokenClient) GetSymbol(ctx context.Context) (types2.CborString, er
return "", fmt.Errorf("expect get result for call")
}

result := new(types2.CborString)
result := new(sdkTypes.CborString)
result.UnmarshalCBOR(bytes.NewReader(wait.Receipt.Return))

return *result, nil
Expand Down
22 changes: 12 additions & 10 deletions examples/erc20/entry.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions examples/erc20/gen/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ require (
github.com/klauspost/cpuid/v2 v2.0.9 // indirect
github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1 // indirect
github.com/minio/sha256-simd v1.0.0 // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/mr-tron/base58 v1.2.0 // indirect
github.com/multiformats/go-base32 v0.0.3 // indirect
github.com/multiformats/go-base36 v0.1.0 // indirect
Expand Down
1 change: 1 addition & 0 deletions examples/erc20/gen/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1283,6 +1283,7 @@ github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJ
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M=
github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
github.com/mr-tron/base58 v1.1.0/go.mod h1:xcD2VGqlgYjBdcBLw+TuYLr8afG+Hj8g2eTVqeSzSU8=
github.com/mr-tron/base58 v1.1.1/go.mod h1:xcD2VGqlgYjBdcBLw+TuYLr8afG+Hj8g2eTVqeSzSU8=
Expand Down
Loading

0 comments on commit e42fdd2

Please sign in to comment.