Skip to content

Commit

Permalink
community announcement via community factory contract (#79)
Browse files Browse the repository at this point in the history
It works on manual testing on testnet.

Basically this pr
- add a simple community factory and a community contract.
- in create_community, create foo.communities.devhub.near account, add
access key, deploy contract, grant social db access to devhub.near
- in update_community, call social.near to update profile name and image
is updated
- in delete community, call foo.communities.devhub.near to self destroy

TODO:
- [x] add back community_addon and update_community test as workspace
test because unit test no longer work due to cross contract call in
create_community
- [x] add workspace tests for this PR
- [ ] (**After this PR approved**) manual deploy community factory to
community.devhub.near and manual call create_community_account for
existing communities.

Note: doing migration and self-upgrade community factory similar to main
contract should work, but I think it doesn't worth the effort:
- These contracts are unlikely need to be changed it has granted full
social db write access to devhub.near.
- And it's also not a real migration: we can add create factory account,
deploy factory contract and create_community_accounts as a migration,
but it doesn't actually migrate any state.
- Self-upgrade needs more thought. Most of time factory contract is not
changed, we should detect this to prevent unnecessary self upgrade on
every commit. We'll also need to all update community contracts that
deployed by the factory contract, but factory contract doesn't keep
track of that, only devhub contract does. So this has to be implement on
devhub contract and considering gas limit. It will be much easier to
upgrade with a client side script.
  • Loading branch information
ailisp authored Jan 8, 2024
1 parent 48270be commit d956d42
Show file tree
Hide file tree
Showing 21 changed files with 8,877 additions and 711 deletions.
8 changes: 7 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ jobs:
default: true
- uses: Swatinem/rust-cache@v1
- run: rustup target add wasm32-unknown-unknown
- name: Build community contract
run: cd community && ./build.sh
- name: Build community factory contract
run: cd community-factory && ./build.sh
- name: Build devhub contract
run: ./build.sh
- name: Unit tests
run: |
cargo test
cargo test
6 changes: 5 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,11 @@ jobs:
default: true
- uses: Swatinem/rust-cache@v1
- run: rustup target add wasm32-unknown-unknown
- name: Build contract
- name: Build community contract
run: cd community && ./build.sh
- name: Build community factory contract
run: cd community-factory && ./build.sh
- name: Build devhub contract
run: ./build.sh
- name: Install near CLI
run: |
Expand Down
Loading

0 comments on commit d956d42

Please sign in to comment.