Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added teams/nickpatric/course-1-kitty-item.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added teams/nickpatric/course-1-miner-setup.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 24 additions & 0 deletions teams/nickpatric/homework-2.md
Original file line number Diff line number Diff line change
@@ -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
}
}


```
4 changes: 4 additions & 0 deletions teams/nickpatric/homework-3.md
Original file line number Diff line number Diff line change
@@ -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)
55 changes: 55 additions & 0 deletions teams/nickpatric/homework-4.md
Original file line number Diff line number Diff line change
@@ -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)
}
}
}

```