diff --git a/teams/nickpatric/course-1-kitty-item.png b/teams/nickpatric/course-1-kitty-item.png new file mode 100644 index 0000000..8866957 Binary files /dev/null and b/teams/nickpatric/course-1-kitty-item.png differ diff --git a/teams/nickpatric/course-1-miner-setup.png b/teams/nickpatric/course-1-miner-setup.png new file mode 100644 index 0000000..b635aab Binary files /dev/null and b/teams/nickpatric/course-1-miner-setup.png differ diff --git a/teams/nickpatric/homework-2.md b/teams/nickpatric/homework-2.md new file mode 100644 index 0000000..819b847 --- /dev/null +++ b/teams/nickpatric/homework-2.md @@ -0,0 +1,24 @@ +### 创建合约Hash +> 1c9f50a110bf89b4778368ba85dc1268174d5871876ce9c31f54dd9d8d312bf4 +### 调用合约Hash +> 08eba71dc6594045234c723d5d70cb50c8cdfd5db1007ecc2110c6b6acbff600 +### 源代码 + + ```ts + +access(all) contract HelloWorld { + pub let greeting: String + pub event HelloEvent(message: String) + + init() { + self.greeting = "Hello, World!" + } + + pub fun hello(message: String): String { + emit HelloEvent(message: message) + return self.greeting + } +} + + +``` \ No newline at end of file diff --git a/teams/nickpatric/homework-3.md b/teams/nickpatric/homework-3.md new file mode 100644 index 0000000..146f0af --- /dev/null +++ b/teams/nickpatric/homework-3.md @@ -0,0 +1,4 @@ + + +- [DemoNFT](https://flow-view-source.com/testnet/account/0xbf39498652268605/contract/DemoNFT) +- [DemoVoting](https://flow-view-source.com/testnet/account/0xbf39498652268605/contract/DemoApprovalVoting) \ No newline at end of file diff --git a/teams/nickpatric/homework-4.md b/teams/nickpatric/homework-4.md new file mode 100644 index 0000000..e1379a4 --- /dev/null +++ b/teams/nickpatric/homework-4.md @@ -0,0 +1,55 @@ +# Flow Go-SDK + +- Go module file +- +```go +module flow-grants + +go 1.16 + +require ( + github.com/onflow/cadence v0.15.0 // indirect + github.com/onflow/flow-go-sdk v0.19.0 // indirect + google.golang.org/grpc v1.37.1 // indirect +) + + +``` + +- Go-sdk demo codes + +```go + +package main + +import ( + "context" + "fmt" + "github.com/onflow/cadence" + "github.com/onflow/flow-go-sdk/client" + "google.golang.org/grpc" +) + +func main(){ + flowClient, err := client.New("access.devnet.nodes.onflow.org:9000", grpc.WithInsecure()) + if err != nil { + panic(err) + } + + blockEvents, err := flowClient.GetEventsForHeightRange(context.Background(), client.EventRangeQuery{ + Type: "A.7e60df042a9c0868.FlowToken.TokensDeposited", + StartHeight: 31267819, + EndHeight: 31267829, + }) + + for _, blockEvent := range blockEvents { + for _, event := range blockEvent.Events { + amount := event.Value.Fields[0].(cadence.UFix64).ToGoValue().(uint64) + address := event.Value.Fields[1].(cadence.Optional).Value.(cadence.Address).String() + fmt.Println("amount--- ", amount) + fmt.Println("address -- ", address) + } + } +} + +``` \ No newline at end of file