Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: migrate onft to use x/nft base structure and keepers #107

Merged
merged 14 commits into from
Oct 28, 2023
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ on:
workflow_dispatch:

env:
GO_VERSION: "1.20.5"
GO_VERSION: "1.21.3"

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:
- '**.go'

env:
GO_VERSION: '1.20.0'
GO_VERSION: '1.21.3'

permissions:
contents: read
Expand All @@ -26,10 +26,10 @@ jobs:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v3
- uses: actions/setup-go@v4
with:
go-version: ${{env.GO_VERSION}}
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
Expand Down
8 changes: 7 additions & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ issues:
text: "SA1019:"
linters:
- staticcheck
- path: cli
linters:
- goconst
- text: "leading space"
linters:
- nolintlint
Expand Down Expand Up @@ -71,11 +74,14 @@ linters-settings:
rules:
- name: var-naming
disabled: true
govet:
excludes:
- SA1019
maligned:
# print struct with more effective memory layout or not, false by default
suggest-new: true
nolintlint:
allow-unused: false
allow-leading-space: true
require-explanation: false
require-specific: false
require-specific: false
4 changes: 2 additions & 2 deletions app/keepers/keepers.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ import (
allockeeper "github.com/OmniFlix/omniflixhub/v2/x/alloc/keeper"
alloctypes "github.com/OmniFlix/omniflixhub/v2/x/alloc/types"

onftkeeper "github.com/OmniFlix/onft/keeper"
onfttypes "github.com/OmniFlix/onft/types"
onftkeeper "github.com/OmniFlix/omniflixhub/v2/x/onft/keeper"
onfttypes "github.com/OmniFlix/omniflixhub/v2/x/onft/types"

marketplacekeeper "github.com/OmniFlix/omniflixhub/v2/x/marketplace/keeper"
marketplacetypes "github.com/OmniFlix/omniflixhub/v2/x/marketplace/types"
Expand Down
2 changes: 1 addition & 1 deletion app/keepers/keys.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (
globalfeetypes "github.com/OmniFlix/omniflixhub/v2/x/globalfee/types"
itctypes "github.com/OmniFlix/omniflixhub/v2/x/itc/types"
marketplacetypes "github.com/OmniFlix/omniflixhub/v2/x/marketplace/types"
onfttypes "github.com/OmniFlix/omniflixhub/v2/x/onft/types"
tokenfactorytypes "github.com/OmniFlix/omniflixhub/v2/x/tokenfactory/types"
onfttypes "github.com/OmniFlix/onft/types"
streampaytypes "github.com/OmniFlix/streampay/v2/x/streampay/types"
storetypes "github.com/cosmos/cosmos-sdk/store/types"
sdk "github.com/cosmos/cosmos-sdk/types"
Expand Down
7 changes: 4 additions & 3 deletions app/modules.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ package app
import (
appparams "github.com/OmniFlix/omniflixhub/v2/app/params"
"github.com/OmniFlix/omniflixhub/v2/x/globalfee"

"github.com/cosmos/cosmos-sdk/types/module"
"github.com/cosmos/cosmos-sdk/x/auth"
authsims "github.com/cosmos/cosmos-sdk/x/auth/simulation"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
"github.com/cosmos/cosmos-sdk/x/consensus"
consensusparamtypes "github.com/cosmos/cosmos-sdk/x/consensus/types"
"github.com/cosmos/cosmos-sdk/x/group"
"github.com/cosmos/cosmos-sdk/x/nft"

"github.com/cosmos/cosmos-sdk/x/auth/vesting"
vestingtypes "github.com/cosmos/cosmos-sdk/x/auth/vesting/types"
Expand Down Expand Up @@ -79,8 +79,8 @@ import (
"github.com/OmniFlix/omniflixhub/v2/x/alloc"
alloctypes "github.com/OmniFlix/omniflixhub/v2/x/alloc/types"

"github.com/OmniFlix/onft"
onfttypes "github.com/OmniFlix/onft/types"
"github.com/OmniFlix/omniflixhub/v2/x/onft"
onfttypes "github.com/OmniFlix/omniflixhub/v2/x/onft/types"

"github.com/OmniFlix/omniflixhub/v2/x/marketplace"
marketplacetypes "github.com/OmniFlix/omniflixhub/v2/x/marketplace/types"
Expand Down Expand Up @@ -144,6 +144,7 @@ var (
tokenfactorytypes.ModuleName: {authtypes.Minter, authtypes.Burner},
globalfee.ModuleName: nil,
alloctypes.ModuleName: {authtypes.Minter, authtypes.Burner, authtypes.Staking},
nft.ModuleName: nil,
onfttypes.ModuleName: nil,
marketplacetypes.ModuleName: nil,
streampaytypes.ModuleName: nil,
Expand Down
2 changes: 1 addition & 1 deletion app/upgrades/v2/upgrades.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
alloctypes "github.com/OmniFlix/omniflixhub/v2/x/alloc/types"
itctypes "github.com/OmniFlix/omniflixhub/v2/x/itc/types"
marketplacetypes "github.com/OmniFlix/omniflixhub/v2/x/marketplace/types"
onfttypes "github.com/OmniFlix/omniflixhub/v2/x/onft/types"
tokenfactorytypes "github.com/OmniFlix/omniflixhub/v2/x/tokenfactory/types"
onfttypes "github.com/OmniFlix/onft/types"
streampaytypes "github.com/OmniFlix/streampay/v2/x/streampay/types"
"github.com/cosmos/cosmos-sdk/baseapp"
sdk "github.com/cosmos/cosmos-sdk/types"
Expand Down
3 changes: 1 addition & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ module github.com/OmniFlix/omniflixhub/v2
go 1.20

require (
github.com/OmniFlix/onft v0.6.1-0.20230923181114-30842581416b
github.com/OmniFlix/streampay/v2 v2.1.1-0.20230922163133-93e80c4663ef
github.com/cometbft/cometbft v0.37.2
github.com/cometbft/cometbft-db v0.8.0
Expand Down Expand Up @@ -135,7 +134,7 @@ require (
github.com/mtibben/percent v0.2.1 // indirect
github.com/pelletier/go-toml/v2 v2.0.8 // indirect
github.com/petermattis/goid v0.0.0-20230317030725-371a4b8eda08 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pkg/errors v0.9.1
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/prometheus/client_golang v1.14.0 // indirect
github.com/prometheus/client_model v0.3.0 // indirect
Expand Down
2 changes: 0 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -227,8 +227,6 @@ github.com/DataDog/zstd v1.5.0/go.mod h1:g4AWEaM3yOg3HYfnJ3YIawPnVdXJh9QME85blwS
github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0=
github.com/Microsoft/go-winio v0.6.0 h1:slsWYD/zyx7lCXoZVlvQrj0hPTM1HI4+v1sIda2yDvg=
github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5 h1:TngWCqHvy9oXAN6lEVMRuU21PR1EtLVZJmdB18Gu3Rw=
github.com/OmniFlix/onft v0.6.1-0.20230923181114-30842581416b h1:K59wrzZyVey3GZFfE5VaODw3iIS2+nwxvC/OOTaTkKI=
github.com/OmniFlix/onft v0.6.1-0.20230923181114-30842581416b/go.mod h1:57nDQZxRTJIfyNlu/mGv7nPag5nRt4Si6mAUQCFv90M=
github.com/OmniFlix/streampay/v2 v2.1.1-0.20230922163133-93e80c4663ef h1:odIDkcCWx5PTTGM01OgKicnuIx2KaxjNAxrUqdBgtHE=
github.com/OmniFlix/streampay/v2 v2.1.1-0.20230922163133-93e80c4663ef/go.mod h1:geZrSHVaGHERqTn1tuFfoH3PIHV5TOwaRErzi4Jnbcw=
github.com/OneOfOne/xxhash v1.2.2 h1:KMrpdQIwFcEqXDklaen+P1axHaj9BSKzvpUUfnHldSE=
Expand Down
1 change: 1 addition & 0 deletions proto/OmniFlix/itc/v1/itc.proto
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ message NFTDetails {
bool extensible = 8;
bool nsfw = 9;
string data = 10;
string uri_hash = 11;
}

message Claim {
Expand Down
13 changes: 13 additions & 0 deletions proto/OmniFlix/onft/v1beta1/genesis.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
syntax = "proto3";
package OmniFlix.onft.v1beta1;

import "gogoproto/gogo.proto";
import "OmniFlix/onft/v1beta1/onft.proto";
import "OmniFlix/onft/v1beta1/params.proto";
option go_package = "github.com/OmniFlix/omniflixhub/v2/x/onft/types";

// GenesisState defines the nft module's genesis state.
message GenesisState {
repeated Collection collections = 1 [(gogoproto.nullable) = false];
Params params = 2 [(gogoproto.nullable) = false];
}
124 changes: 124 additions & 0 deletions proto/OmniFlix/onft/v1beta1/onft.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
syntax = "proto3";
package OmniFlix.onft.v1beta1;

import "gogoproto/gogo.proto";
import "google/protobuf/timestamp.proto";

option go_package = "github.com/OmniFlix/omniflixhub/v2/x/onft/types";
option (gogoproto.goproto_getters_all) = false;

// Collection
message Collection {
option (gogoproto.equal) = true;

Denom denom = 1 [(gogoproto.nullable) = false];
repeated ONFT onfts = 2 [(gogoproto.customname) = "ONFTs", (gogoproto.nullable) = false];
}

message IDCollection {
option (gogoproto.equal) = true;

string denom_id = 1 [(gogoproto.moretags) = "yaml:\"denom_id\""];
repeated string onft_ids = 2 [(gogoproto.moretags) = "yaml:\"onft_ids\""];
}

message Denom {
option (gogoproto.equal) = true;

string id = 1;
string symbol = 2;
string name = 3;
string schema = 4;
string creator = 5;
string description = 6;
string preview_uri = 7 [
(gogoproto.moretags) = "yaml:\"preview_uri\"",
(gogoproto.customname) = "PreviewURI"
];
string uri = 8;
string uri_hash = 9;
string data = 10;
}

message DenomMetadata {
string creator = 1;
string schema = 2;
string description = 3;
string preview_uri = 4;
string data = 5;
string uri_hash = 6;
}

//ASSET or ONFT
message ONFT {
option (gogoproto.equal) = true;

string id = 1;
Metadata metadata = 2 [(gogoproto.nullable) = false];
string data = 3;
string owner = 4;
bool transferable = 5;
bool extensible = 6;
google.protobuf.Timestamp created_at = 7 [
(gogoproto.nullable) = false,
(gogoproto.stdtime) = true,
(gogoproto.moretags) = "yaml:\"created_at\""
];
bool nsfw = 8;
string royalty_share = 9 [
(gogoproto.nullable) = false,
(gogoproto.moretags) = "yaml:\"royalty_share\"",
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec"
];
}

message Metadata {
option (gogoproto.equal) = true;

string name = 1 [(gogoproto.moretags) = "yaml:\"name\""];
string description = 2 [(gogoproto.moretags) = "yaml:\"description\""];
string media_uri = 3 [
(gogoproto.moretags) = "yaml:\"media_uri\"",
(gogoproto.customname) = "MediaURI"
];
string preview_uri = 4 [
(gogoproto.moretags) = "yaml:\"preview_uri\"",
(gogoproto.customname) = "PreviewURI"
];
string uri_hash = 5;
}

message ONFTMetadata {
string name = 1;
string description =2;
string preview_uri = 3 [
(gogoproto.moretags) = "yaml:\"preview_uri\"",
(gogoproto.customname) = "PreviewURI"
];
string data = 4;
bool transferable = 5;
bool extensible = 6;
google.protobuf.Timestamp created_at = 7 [
(gogoproto.nullable) = false,
(gogoproto.stdtime) = true,
(gogoproto.moretags) = "yaml:\"created_at\""
];
bool nsfw = 8;
string royalty_share = 9 [
(gogoproto.nullable) = false,
(gogoproto.moretags) = "yaml:\"royalty_share\"",
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec"
];
string uri_hash = 10;
}

message Owner {
option (gogoproto.equal) = true;

string address = 1;
repeated IDCollection id_collections = 2 [
(gogoproto.moretags) = "yaml:\"idcs\"",
(gogoproto.customname) = "IDCollections",
(gogoproto.nullable) = false
];
}
18 changes: 18 additions & 0 deletions proto/OmniFlix/onft/v1beta1/params.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
syntax = "proto3";
package OmniFlix.onft.v1beta1;

import "gogoproto/gogo.proto";
import "cosmos/base/v1beta1/coin.proto";

option go_package = "github.com/OmniFlix/omniflixhub/v2/x/onft/types";
option (gogoproto.goproto_getters_all) = false;



message Params {
cosmos.base.v1beta1.Coin denom_creation_fee = 1 [
(gogoproto.moretags) = "yaml:\"denom_creation_fee\"",
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Coin",
(gogoproto.nullable) = false
];
}
Loading
Loading