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

Crt release v1 #4871

Merged
merged 214 commits into from
Nov 2, 2023
Merged
Show file tree
Hide file tree
Changes from 211 commits
Commits
Show all changes
214 commits
Select commit Hold shift + click to select a range
e883436
chore: add unit test file for amm
ignazio-bovo Oct 26, 2022
026d075
chore: add test for unbonding & activation
ignazio-bovo Oct 27, 2022
cb96bb2
Revert "chore: add public functions"
ignazio-bovo Oct 27, 2022
61c5a93
chore: add tests on activate amm
ignazio-bovo Oct 31, 2022
12fd60b
fix: cargo fmt
ignazio-bovo Oct 31, 2022
aaf173f
Merge branch 'carthage' into carthage-amm
ignazio-bovo Oct 31, 2022
3dbdecf
fix: build errors for tests
ignazio-bovo Oct 31, 2022
61d4edb
continue on implementing amm activation
ignazio-bovo Oct 31, 2022
0548768
fix: run fomatting
ignazio-bovo Oct 31, 2022
d8a4ccd
chore: add extra activate behavior
ignazio-bovo Nov 1, 2022
c18ce80
feat: add tests for bonding curve parm validation
ignazio-bovo Nov 1, 2022
9da9454
feat: remove parameters validation for bonding curve
ignazio-bovo Nov 2, 2022
7708730
chore: setup BondFixture
ignazio-bovo Nov 2, 2022
4b6c543
feat: add bond tests
ignazio-bovo Nov 3, 2022
45b69b4
feat: add `creator_member_id` to `TokenData`
ignazio-bovo Nov 3, 2022
0fab514
fix: all test except `timestamp` fixed
ignazio-bovo Nov 4, 2022
a74dc3b
fix: remove commented code
ignazio-bovo Nov 4, 2022
2dfbd8f
fix: test formatting
ignazio-bovo Nov 4, 2022
47828d1
fix: add timestamp and slippage errors
ignazio-bovo Nov 5, 2022
01f4193
feat: finish tests for `bond` extrinsic
ignazio-bovo Nov 5, 2022
b21e572
feat: add unbonding tests
ignazio-bovo Nov 5, 2022
e293365
fix: review and correct `unbond` tests
ignazio-bovo Nov 5, 2022
294c109
fix: all tests passing
ignazio-bovo Nov 5, 2022
bd445c9
feat: add `deactivate_amm` tests
ignazio-bovo Nov 6, 2022
90e139d
fix: all tests passing
ignazio-bovo Nov 6, 2022
f793f5e
fix: pricing function computation
ignazio-bovo Nov 7, 2022
a97b01b
fix: all tests passing
ignazio-bovo Nov 9, 2022
bf16a7f
fix: quick refactor
ignazio-bovo Nov 9, 2022
4c67c05
fix: slippage calculations and clippy errors
ignazio-bovo Nov 10, 2022
19f8a5f
fix: added events
ignazio-bovo Nov 10, 2022
dfd333a
feat: add event deposit and tests
ignazio-bovo Nov 10, 2022
30c72a1
chore: add comments
ignazio-bovo Nov 14, 2022
76b71d1
fix: clippy
ignazio-bovo Nov 14, 2022
bd53c80
fix: all tests passing
ignazio-bovo Nov 14, 2022
4be0b99
fix: benchmark tests
ignazio-bovo Nov 14, 2022
af88c11
Update runtime-modules/project-token/src/errors.rs
Nov 16, 2022
945f13f
Update runtime-modules/project-token/src/errors.rs
Nov 16, 2022
2a70e90
Update runtime-modules/project-token/src/errors.rs
Nov 16, 2022
b8eac81
Update runtime-modules/project-token/src/tests/bonding_curve.rs
Nov 16, 2022
20f8048
Update runtime-modules/project-token/src/lib.rs
Nov 16, 2022
51174a4
Update runtime-modules/project-token/src/lib.rs
Nov 16, 2022
440f884
Update runtime-modules/project-token/src/lib.rs
Nov 16, 2022
39e376c
Update runtime-modules/project-token/src/lib.rs
Nov 16, 2022
8efbd13
Update runtime-modules/project-token/src/lib.rs
Nov 16, 2022
8e2120f
Update runtime-modules/project-token/src/lib.rs
Nov 16, 2022
7a39487
Update runtime-modules/project-token/src/lib.rs
Nov 16, 2022
1ddf971
Update runtime-modules/project-token/src/lib.rs
Nov 16, 2022
eb9b4f7
Update runtime-modules/project-token/src/lib.rs
Nov 16, 2022
e28be40
Update runtime-modules/project-token/src/lib.rs
Nov 16, 2022
b0d0221
Update runtime-modules/project-token/src/lib.rs
Nov 16, 2022
a6f0c1d
Update runtime-modules/project-token/src/lib.rs
Nov 16, 2022
462bb86
Update runtime-modules/project-token/src/lib.rs
Nov 16, 2022
a42adeb
Update runtime-modules/project-token/src/lib.rs
Nov 16, 2022
89c7472
Update runtime-modules/project-token/src/lib.rs
Nov 16, 2022
3aec1a9
Update runtime-modules/project-token/src/lib.rs
Nov 16, 2022
3c899e2
Update runtime-modules/project-token/src/lib.rs
Nov 16, 2022
3da3e57
Update runtime-modules/project-token/src/tests/bonding_curve.rs
Nov 16, 2022
e6ae2fa
fix: add correct value check
ignazio-bovo Nov 16, 2022
e4f8164
fix: activate / deactivate now are methods
ignazio-bovo Nov 16, 2022
7713a64
fix: new mechanism for deactivation amm
ignazio-bovo Nov 16, 2022
b871360
fix: deactivate amm + timestamp tests
ignazio-bovo Nov 17, 2022
c93dcf3
feat: add tx fees logic
ignazio-bovo Nov 17, 2022
e4d82c2
feat: add content related extrinsics for amm
ignazio-bovo Nov 17, 2022
f75f359
fix: misc + renamed events
ignazio-bovo Nov 18, 2022
751a3a3
fix: cargo checks
ignazio-bovo Nov 18, 2022
d06743f
fix: AmmControl permission
ignazio-bovo Nov 18, 2022
43d3b66
fix: update token data on benchmarks
ignazio-bovo Nov 21, 2022
23037f3
Update runtime-modules/project-token/src/lib.rs
Nov 22, 2022
ba4613e
Update runtime-modules/project-token/src/errors.rs
Nov 22, 2022
cc0c39e
Update runtime-modules/project-token/src/lib.rs
Nov 22, 2022
7cd0228
fix: misc fixes
ignazio-bovo Nov 22, 2022
e257c40
fix: renaming
ignazio-bovo Nov 23, 2022
d431739
chore: generate types and metadata
ignazio-bovo Nov 23, 2022
4ccbe86
chore: generate types and metadata
ignazio-bovo Nov 23, 2022
01bb915
Merge branch 'mainnet' into carthage-amm
ignazio-bovo Nov 23, 2022
70804b5
Update runtime-modules/project-token/src/lib.rs
Nov 24, 2022
2cbb8c5
Update runtime-modules/project-token/src/lib.rs
Nov 24, 2022
66cd46f
Update runtime-modules/project-token/src/events.rs
Nov 24, 2022
2ce5c0e
Update runtime-modules/project-token/src/lib.rs
Nov 24, 2022
50a1c71
Update runtime-modules/project-token/src/tests/amm.rs
Nov 24, 2022
14e4338
Update runtime-modules/project-token/src/lib.rs
Nov 24, 2022
038d06f
Update runtime-modules/project-token/src/lib.rs
Nov 24, 2022
a3aa6d3
Update runtime-modules/project-token/src/tests/amm.rs
Nov 24, 2022
81f7963
Update runtime-modules/project-token/src/events.rs
Nov 24, 2022
8583cdd
Update runtime-modules/project-token/src/tests/amm.rs
Nov 24, 2022
3aa7205
Update runtime-modules/project-token/src/tests/amm.rs
Nov 24, 2022
4f8fe65
Update runtime-modules/project-token/src/errors.rs
Nov 24, 2022
b211249
Update runtime-modules/project-token/src/types.rs
Nov 24, 2022
c30a7f2
fix: transfer logic fix
ignazio-bovo Nov 24, 2022
e3040e9
Merge branch 'mainnet' into carthage-amm
ignazio-bovo Nov 24, 2022
f27c7af
fix: amm curve on BM
ignazio-bovo Nov 24, 2022
a6e7118
Update runtime-modules/project-token/src/tests/fixtures.rs
Nov 25, 2022
749911c
fix: eval function logic edit
ignazio-bovo Nov 28, 2022
a43f90c
fix: remove unused error
ignazio-bovo Nov 29, 2022
70b0bdd
Merge pull request #4434 from ignazio-bovo/carthage-amm
Dec 6, 2022
12b8ff5
Merge branch 'crt_release' into nara_crt_release
May 4, 2023
5232ca0
fix: update types and metadata
May 8, 2023
a57c9f9
fix: chain metadata
May 8, 2023
77b9e35
fix: add metadata to qn from previous releases
May 8, 2023
7be5630
feat: bump spec version
May 8, 2023
920fa16
feat: generate chain metadata
May 8, 2023
bdbdc85
fix: query node failing checks
May 9, 2023
e615bb1
fix: lint
May 9, 2023
a002591
Merge branch 'nara' into nara_crt_release
May 9, 2023
d39b948
fix: re enable backward event compatibility
May 9, 2023
fe01f13
fix: bump cargo version
May 9, 2023
08ffbf8
fix: cargo lock
May 9, 2023
232e2c6
fix: post runtime cheks
May 9, 2023
8898461
fix: commented out faling scenario
May 10, 2023
d4fda63
fix: event versioning
May 10, 2023
2826d51
Merge pull request #4749 from ignazio-bovo/nara_crt_release
mnaamani May 11, 2023
7b2e007
Merge branch 'nara' into crt_release
Sep 4, 2023
8dc29f3
chore: :rotating_light: update chain metadata and types
Sep 5, 2023
ff188bc
fix: :rotating_light: silence yarn cargo-checks
Sep 5, 2023
244ec8d
feat: add bm for uby on amm
ignazio-bovo Nov 28, 2022
a94cb05
feat: add benchmark for `sell_on_amm`
ignazio-bovo Nov 28, 2022
88c9580
chore: add `activate_amm` bm
ignazio-bovo Nov 28, 2022
b07d790
feat: add `deactivate_amm` bm
ignazio-bovo Nov 28, 2022
4df610a
feat: add tests on benchmarks
ignazio-bovo Nov 28, 2022
94bf5e0
feat: add weights on project token
ignazio-bovo Nov 28, 2022
0f06a23
fix: cargo test errors on benchmarks
ignazio-bovo Dec 2, 2022
c2247bb
fix: benchmarks
ignazio-bovo Dec 2, 2022
3eb6752
feat: generate weights
ignazio-bovo Dec 5, 2022
7f48c3f
feat: add max yearly patronage rate
ignazio-bovo Dec 7, 2022
171473a
feat: add propsal for patronage rate update
ignazio-bovo Dec 8, 2022
f75410a
fix: bound input on multi-transfer
ignazio-bovo Dec 8, 2022
e723c0e
fix: deadline & max tranfer bound
ignazio-bovo Dec 12, 2022
421d2a8
fix: transfer outputs now statically bounded
ignazio-bovo Dec 12, 2022
406e621
fix: patronage rate computation
ignazio-bovo Dec 15, 2022
73cdb73
refactor: patronage test
ignazio-bovo Dec 16, 2022
f7bd7f3
fix: interest rate approximation
ignazio-bovo Dec 19, 2022
25696a2
fix: all tests passing
ignazio-bovo Dec 19, 2022
b5451fc
fix: patronage rate computation
ignazio-bovo Dec 20, 2022
dd7f71c
chore: add test with >100% rate
ignazio-bovo Dec 20, 2022
e8ca2be
chore: add some explanatory comments
ignazio-bovo Dec 20, 2022
1f8ec8e
feat: add test for slope parameter too low
Mar 6, 2023
cf61e1d
feat: add slope parameter check & fix test values
Mar 6, 2023
2b04121
fix: adjust content pallet & fix warnings
Mar 7, 2023
5ad1d61
fix: adjust chain_spec file with slope parameter
Mar 7, 2023
4e87123
fix: build error
Mar 7, 2023
d238b16
fix: add numerical computation
Mar 7, 2023
d7ebfe0
fix: integrate computation with token pallet
Mar 7, 2023
8877137
fix: failing tests
Mar 8, 2023
3cae66e
fix: failing tests & build errors
Mar 8, 2023
15a0611
fix: failing tests & build errors
Mar 8, 2023
8a87cf7
refactor: type traits
Mar 10, 2023
05bde61
fix: build errors
Mar 10, 2023
35e7a8f
fix: benchmarks cargo checks errors
Mar 11, 2023
2ebd16b
fix: build error and generte types and metadata
Mar 13, 2023
ac67a8c
fix: linter
May 11, 2023
b1afeb6
fix: misc error after merged
May 11, 2023
eb21457
fix: linter
May 11, 2023
1dccef6
Update runtime-modules/project-token/src/tests/patronage.rs
May 11, 2023
0bc8300
Update runtime-modules/project-token/src/tests/patronage.rs
May 11, 2023
de0b741
fix: crt benchmarks
May 11, 2023
5a70d9f
fix: content benchmarks
May 11, 2023
9ac69c4
fix: remove dead code
May 11, 2023
1e2f2fa
fix: macro
May 12, 2023
79fe644
fix: error
May 12, 2023
567bbec
fix: TryInto error
May 12, 2023
ccec401
fix: timestamp not needed
May 12, 2023
2f7a95e
fix: macro
May 12, 2023
51118f5
fix: macro days
May 12, 2023
a61ce7a
fix: macro
May 15, 2023
fe404a5
fix: macro
May 15, 2023
ae6393d
fix: clippy
May 15, 2023
cbc0bdf
fix: testing propsals
May 15, 2023
0168146
fix: playground proposal config
May 15, 2023
ae9c219
Update runtime-modules/project-token/src/benchmarking.rs
May 18, 2023
f013811
fix: rename
May 18, 2023
eaebad9
fix: replace magic numbers in patronage
May 18, 2023
a637f52
fix: address changes
May 18, 2023
e1535bf
fix: amm test
May 19, 2023
9fe6e76
fix: make eval a method
May 19, 2023
a52af08
fix: clippy useless conversion
May 19, 2023
a46e709
fix: refactor test constants
May 19, 2023
2777caf
fix: benchmarks
May 19, 2023
009e01d
fix: content benchmarks
May 19, 2023
f7d3fbc
fix: :rotating_light: slice indexing warning by clippy
Sep 4, 2023
28e77ab
fix: :rotating_light: post rebase fixes
Sep 5, 2023
6ab18b5
Merge branch 'docker-compose-orion' into crt-release
Sep 7, 2023
558b584
fix: add video trailer id
Jun 1, 2023
12abd84
chore: :package: update chain metadata and types
Sep 7, 2023
ac679c2
feat: :art: symbol on the metaprotocol layer
Sep 7, 2023
e68447b
feat: :art: creator token add extr to update token metadata
Sep 11, 2023
6359eec
feat: update metadata for token
Sep 11, 2023
18aee8e
Merge branch 'docker-compose-orion' into crt-release-v1
Sep 13, 2023
7021214
Update metadata-protobuf/package.json
Sep 13, 2023
4c79aae
Update types/package.json
Sep 13, 2023
450d99a
fix: :green_heart: metadata to benchmarking params
Sep 13, 2023
71d0b31
fix: :green_heart: content benchmark build errors
Sep 14, 2023
c1b36ca
feat: :art: generate types and metadata for v12.2003
Sep 14, 2023
da1276c
Update types/package.json
Sep 18, 2023
c505ea3
fix(crt-v1): :sparkles: remove deadline from amm extr.s
Sep 18, 2023
564e4e0
fix: :ambulance: remove claim_and_withdraw extr
Sep 19, 2023
0d8c4ef
Merge branch 'nara-restric-curators-del-powers' into crt-release-v1
Sep 19, 2023
5d2df02
Merge branch 'nara' into crt-release-v1
Oct 3, 2023
1924cb7
Merge branch 'nara' into crt-release-v1
Oct 4, 2023
a37473d
Merge branch 'nara_crt_constraints' into crt-release-v1
Oct 4, 2023
837533a
fix: build errors
Oct 4, 2023
ead0209
fix: :rocket: restore filtered extr.s and restore previous chain meta…
Oct 4, 2023
d091d56
feat: :ambulance: add migration for treasury account
Oct 6, 2023
d69e7aa
feat: :art: add benchmark for crt issuer remark
Oct 6, 2023
5982035
fix: :zap: benchmarks fix
Oct 16, 2023
5926bfa
fix: :bug: version for channel create / update events
Oct 16, 2023
8594cd0
fix: :bug: fix benchmarks and add check for module balance account
Oct 17, 2023
3066093
fix: :art: remove unnecessary migration
Oct 18, 2023
bf4b872
feat: :art: Amm parameters adjustment
Oct 18, 2023
0fc94bd
Revert "feat: :art: Amm parameters adjustment"
Oct 18, 2023
58ec1a8
Merge branch 'nara' into crt-release-v1
Oct 19, 2023
87ad9a6
feat: update with nara
Oct 19, 2023
8e0a5f6
fix: :sparkles: address minor issues during PR review
Oct 25, 2023
19e6a23
Merge branch 'nara' into crt-release-v1
Oct 25, 2023
a9f5645
feat: :lock: max outputs for transfer extrinsics
Oct 27, 2023
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
2 changes: 2 additions & 0 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion chain-metadata.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion distributor-node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"@joystream/metadata-protobuf": "^2.8.0",
"@joystream/opentelemetry": "1.0.0",
"@joystream/storage-node-client": "^3.0.0",
"@joystream/types": "^3.0.0",
"@joystream/types": "^4.0.0",
"@oclif/command": "^1",
"@oclif/config": "^1",
"@oclif/plugin-help": "^3",
Expand Down
2 changes: 1 addition & 1 deletion joystreamjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
},
"dependencies": {
"@joystream/metadata-protobuf": "^2.8.1",
"@joystream/types": "^3.0.0",
"@joystream/types": "^4.0.0",
"@polkadot/util-crypto": "9.5.1",
"axios": "^1.2.1",
"buffer": "^6.0.3",
Expand Down
14 changes: 10 additions & 4 deletions metadata-protobuf/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@joystream/metadata-protobuf",
"version": "2.8.1",
"version": "2.9.0",
"description": "Joystream Metadata Protobuf Library",
"main": "lib/index.js",
"types": "lib/index.d.ts",
Expand All @@ -13,9 +13,15 @@
},
"typesVersions": {
"*": {
"lib/index.d.ts": ["lib/index.d.ts"],
"json": [ "lib/json/index.d.ts" ],
"*": [ "lib/*" ]
"lib/index.d.ts": [
"lib/index.d.ts"
],
"json": [
"lib/json/index.d.ts"
],
"*": [
"lib/*"
]
}
},
"repository": "https://github.com/joystream/joystream",
Expand Down
35 changes: 35 additions & 0 deletions metadata-protobuf/proto/Token.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
syntax = "proto2";
message CreatorTokenIssuerRemarked {
oneof creator_token_issuer_remarked {
UpdateTokenMetadata update_token_metadata = 1;
}
}

message UpdateTokenMetadata {
optional TokenMetadata new_metadata = 1;
}

message TokenMetadata {
optional string name = 1; // Title
optional string symbol = 2; // Symbol
optional string description = 3; // token description
oneof avatar {
uint32 avatar_object = 4; // avatar for token - index into external [assets array](#.Assets)
string avatar_uri = 5; // Url to member's avatar
}
repeated Benefit benefits = 6; // benefits for tokne
optional string whitelist_application_note = 7; // note for applicant
optional string whitelist_application_apply_link = 8; // link to application process
optional uint64 trailer_video_id = 9; // runtime id for video trailer
}

message Benefit {
optional string title = 1;
optional string description = 2;
optional string emoji = 3;
optional uint32 display_order = 4;
}

message SaleMetadata {
optional string terms_and_conditions = 1;
}
2 changes: 1 addition & 1 deletion query-node/chain-metadata/2002.json

Large diffs are not rendered by default.

30 changes: 20 additions & 10 deletions query-node/mappings/src/content/channel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@
import {
convertChannelOwnerToMemberOrCuratorGroup,
convertContentActor,
mapAgentPermission,
processAppActionMetadata,
processChannelMetadata,
u8aToBytes,
Expand All @@ -71,29 +70,32 @@
import { DecodedMetadataObject } from '@joystream/metadata-protobuf/types'
import { BaseModel } from '@joystream/warthog'
import { AccountId32, Balance } from '@polkadot/types/interfaces'
import { PalletContentIterableEnumsChannelActionPermission } from '@polkadot/types/lookup'
import { PalletContentIterableEnumsChannelActionPermission as PalletContentIterableEnumsChannelActionPermission_V1001 } from '../../generated/types/1001/types-lookup'
import { PalletContentIterableEnumsChannelActionPermission as PalletContentIterableEnumsChannelActionPermission_V2002 } from '../../generated/types/2002/types-lookup'
import BN from 'bn.js'
import {
Content_ChannelAgentRemarkedEvent_V1001 as ChannelAgentRemarkedEvent_V1001,
Content_ChannelAssetsDeletedByModeratorEvent_V1001 as ChannelAssetsDeletedByModeratorEvent_V1001,
Content_ChannelAssetsRemovedEvent_V1001 as ChannelAssetsRemovedEvent_V1001,
Content_ChannelCreatedEvent_V1001 as ChannelCreatedEvent_V1001,
Content_ChannelCreatedEvent_V1001 as ChannelCreatedEvent,
Content_ChannelDeletedByModeratorEvent_V1001 as ChannelDeletedByModeratorEvent_V1001,
Content_ChannelDeletedEvent_V1001 as ChannelDeletedEvent_V1001,
Content_ChannelFundsWithdrawnEvent_V1001 as ChannelFundsWithdrawnEvent_V1001,
Content_ChannelOwnerRemarkedEvent_V1001 as ChannelOwnerRemarkedEvent_V1001,
Content_ChannelPayoutsUpdatedEvent_V2001 as ChannelPayoutsUpdatedEvent_V2001,
Content_ChannelRewardClaimedAndWithdrawnEvent_V1001 as ChannelRewardClaimedAndWithdrawnEvent_V1001,
Content_ChannelRewardUpdatedEvent_V2001 as ChannelRewardUpdatedEvent_V2001,
Content_ChannelUpdatedEvent_V1001 as ChannelUpdatedEvent_V1001,
Content_ChannelUpdatedEvent_V1001 as ChannelUpdatedEvent,
Content_ChannelVisibilitySetByModeratorEvent_V1001 as ChannelVisibilitySetByModeratorEvent_V1001,
} from '../../generated/types'

export async function content_ChannelCreated(ctx: EventContext & StoreContext): Promise<void> {
const { store, event } = ctx
const { store, event, block } = ctx
const { specVersion } = block.runtimeVersion

Check warning on line 94 in query-node/mappings/src/content/channel.ts

View workflow job for this annotation

GitHub Actions / Ubuntu Checks (18.x)

'specVersion' is assigned a value but never used

Check warning on line 94 in query-node/mappings/src/content/channel.ts

View workflow job for this annotation

GitHub Actions / MacOS Checks (18.x)

'specVersion' is assigned a value but never used

// read event data
const [channelId, { owner, dataObjects, channelStateBloatBond }, channelCreationParameters, rewardAccount] =
new ChannelCreatedEvent_V1001(event).params
new ChannelCreatedEvent(event).params

// prepare channel owner (handles fields `ownerMember` and `ownerCuratorGroup`)
const channelOwner = await convertChannelOwnerToMemberOrCuratorGroup(store, owner)
Expand Down Expand Up @@ -160,9 +162,10 @@
}

export async function content_ChannelUpdated(ctx: EventContext & StoreContext): Promise<void> {
const { store, event } = ctx
const { store, event, block } = ctx

Check warning on line 165 in query-node/mappings/src/content/channel.ts

View workflow job for this annotation

GitHub Actions / Ubuntu Checks (18.x)

'block' is assigned a value but never used

Check warning on line 165 in query-node/mappings/src/content/channel.ts

View workflow job for this annotation

GitHub Actions / MacOS Checks (18.x)

'block' is assigned a value but never used

// read event data
const [, channelId, channelUpdateParameters, newDataObjects] = new ChannelUpdatedEvent_V1001(event).params
const [, channelId, channelUpdateParameters, newDataObjects] = new ChannelUpdatedEvent(event).params

// load channel
const channel = await store.get(Channel, {
Expand Down Expand Up @@ -385,7 +388,12 @@
async function updateChannelAgentsPermissions(
store: DatabaseManager,
channel: Channel,
collaboratorsPermissions: BTreeMap<u64, BTreeSet<PalletContentIterableEnumsChannelActionPermission>>
collaboratorsPermissions: BTreeMap<
u64,
BTreeSet<
PalletContentIterableEnumsChannelActionPermission_V1001 | PalletContentIterableEnumsChannelActionPermission_V2002
>
>
) {
// safest way to update permission is to delete existing and creating new ones

Expand All @@ -402,7 +410,9 @@
const collaborator = new Collaborator({
channel: new Channel({ id: channel.id.toString() }),
member: new Membership({ id: memberId.toString() }),
permissions: Array.from(permissions).map(mapAgentPermission),
permissions: Array.from(permissions).map((permissions) => {
return permissions.toString()
}),
})

await store.save(collaborator)
Expand Down
20 changes: 14 additions & 6 deletions query-node/mappings/src/content/curatorGroup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@ eslint-disable @typescript-eslint/naming-convention
import { DatabaseManager, EventContext, StoreContext } from '@joystream/hydra-common'
import { Curator, CuratorGroup, CuratorAgentPermissions } from 'query-node/dist/model'
import { inconsistentState, logger } from '../common'
import { mapAgentPermission } from './utils'
import { BTreeSet } from '@polkadot/types'
// Joystream types
import { PalletContentIterableEnumsChannelActionPermission } from '@polkadot/types/lookup'
import { PalletContentIterableEnumsChannelActionPermission as PalletContentIterableEnumsChannelActionPermission_V1001 } from '../../generated/types/1001/types-lookup'
import { PalletContentIterableEnumsChannelActionPermission as PalletContentIterableEnumsChannelActionPermission_V2002 } from '../../generated/types/2002/types-lookup'
import {
Content_CuratorAddedEvent_V2002 as CuratorAddedEvent_V2002,
Content_CuratorAddedEvent_V1001 as CuratorAddedEvent_V1001,
Content_CuratorGroupCreatedEvent_V1001 as CuratorGroupCreatedEvent_V1001,
Content_CuratorGroupStatusSetEvent_V1001 as CuratorGroupStatusSetEvent_V1001,
Expand Down Expand Up @@ -82,9 +83,12 @@ export async function content_CuratorGroupStatusSet({ store, event }: EventConte
logger.info('Curator group status has been set', { id: curatorGroupId, isActive })
}

export async function content_CuratorAdded({ store, event }: EventContext & StoreContext): Promise<void> {
export async function content_CuratorAdded({ store, event, block }: EventContext & StoreContext): Promise<void> {
// read event data
const [curatorGroupId, curatorId, permissions] = new CuratorAddedEvent_V1001(event).params
const { specVersion } = block.runtimeVersion

const [curatorGroupId, curatorId, permissions] =
specVersion < 2002 ? new CuratorAddedEvent_V1001(event).params : new CuratorAddedEvent_V2002(event).params

// load curator group
const curatorGroup = await store.get(CuratorGroup, {
Expand Down Expand Up @@ -139,7 +143,9 @@ async function updateCuratorAgentPermissions(
store: DatabaseManager,
curatorGroup: CuratorGroup,
curator: Curator,
permissions?: BTreeSet<PalletContentIterableEnumsChannelActionPermission>
permissions?: BTreeSet<
PalletContentIterableEnumsChannelActionPermission_V1001 | PalletContentIterableEnumsChannelActionPermission_V2002
>
) {
// safest way to update permission is to delete existing and creating new ones

Expand All @@ -160,7 +166,9 @@ async function updateCuratorAgentPermissions(
const curatorAgentPermissions = new CuratorAgentPermissions({
curatorGroup: new CuratorGroup({ id: curatorGroup.id.toString() }),
curator: new Curator({ id: curator.id.toString() }),
permissions: permissionsArray.map(mapAgentPermission),
permissions: permissionsArray.map((permissions) => {
return permissions.toString()
}),
})

await store.save(curatorAgentPermissions)
Expand Down
2 changes: 1 addition & 1 deletion query-node/mappings/src/membership.ts
Original file line number Diff line number Diff line change
Expand Up @@ -607,7 +607,7 @@ export async function members_MemberRemarked(ctx: EventContext & StoreContext):
const { event, store, block } = ctx
const { specVersion } = block.runtimeVersion
const [memberId, metadataBytes, payment] =
specVersion === 1001 ? new MemberRemarkedEvent_V1001(event).params : new MemberRemarkedEvent_V2001(event).params
specVersion >= 2001 ? new MemberRemarkedEvent_V2001(event).params : new MemberRemarkedEvent_V1001(event).params

try {
const metadata = deserializeMetadata(MemberRemarked, metadataBytes)
Expand Down
16 changes: 13 additions & 3 deletions query-node/mappings/src/proposals.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
eslint-disable @typescript-eslint/naming-convention
*/
import { SubstrateEvent, DatabaseManager, EventContext, StoreContext } from '@joystream/hydra-common'
import { PalletProposalsCodexProposalDetails as RuntimeProposalDetails } from '@polkadot/types/lookup'
import { PalletProposalsCodexProposalDetails as RuntimeProposalDetails_V1001 } from '../generated/types/1001/types-lookup'
import { PalletProposalsCodexProposalDetails as RuntimeProposalDetails_V2002 } from '../generated/types/2002/types-lookup'
import BN from 'bn.js'
import {
Proposal,
Expand Down Expand Up @@ -70,6 +71,7 @@ import {
} from './common'
import {
ProposalsCodex_ProposalCreatedEvent_V1001 as ProposalCreatedEvent_V1001,
ProposalsCodex_ProposalCreatedEvent_V2002 as ProposalCreatedEvent_V2002,
ProposalsEngine_ProposalCancelledEvent_V1001 as ProposalCancelledEvent_V1001,
ProposalsEngine_ProposalDecisionMadeEvent_V1001 as ProposalDecisionMadeEvent_V1001,
ProposalsEngine_ProposalExecutedEvent_V1001 as ProposalExecutedEvent_V1001,
Expand All @@ -80,6 +82,8 @@ import { createWorkingGroupOpeningMetadata } from './workingGroups'
import { blake2AsHex } from '@polkadot/util-crypto'
import { Bytes } from '@polkadot/types'

type RuntimeProposalDetails = RuntimeProposalDetails_V1001 | RuntimeProposalDetails_V2002

async function getProposal(store: DatabaseManager, id: string) {
const proposal = await store.get(Proposal, { where: { id } })
if (!proposal) {
Expand Down Expand Up @@ -333,9 +337,15 @@ async function handleRuntimeUpgradeProposalExecution(event: SubstrateEvent, stor
)
}

export async function proposalsCodex_ProposalCreated({ store, event }: EventContext & StoreContext): Promise<void> {
export async function proposalsCodex_ProposalCreated({
store,
event,
block,
}: EventContext & StoreContext): Promise<void> {
const specVersion = block.runtimeVersion.specVersion
const [proposalId, generalProposalParameters, runtimeProposalDetails, proposalThreadId] =
new ProposalCreatedEvent_V1001(event).params
specVersion >= 2002 ? new ProposalCreatedEvent_V2002(event).params : new ProposalCreatedEvent_V1001(event).params
ignazio-bovo marked this conversation as resolved.
Show resolved Hide resolved

const eventTime = new Date(event.blockTimestamp)
const proposalDetails = await parseProposalDetails(event, store, runtimeProposalDetails)

Expand Down
2 changes: 1 addition & 1 deletion runtime-modules/common/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
deny(clippy::panic_in_result_fn),
deny(clippy::unwrap_used),
deny(clippy::expect_used),
deny(clippy::indexing_slicing),
deny(clippy::integer_arithmetic),
deny(clippy::match_on_vec_items),
deny(clippy::unreachable)
Expand All @@ -20,6 +19,7 @@ pub mod locks;
pub mod membership;
pub mod merkle_tree;
pub mod no_panic;
pub mod numerical;
pub mod storage;
pub mod working_group;

Expand Down
Loading
Loading