Partners Agreement - deep-dive

Design

Partners Agreement is used for integrating natively SkillWallet in other platforms as a decentralized authentication system. By signing the Partners Agreement, SkillWallet deploys two contracts to manage the community - one for membership and one for the interaction rules.

Community Contract

The first step of completing the integration is deploying the Community Contract. It holds all the information regarding the amount of community and core team members. The community will not be active until the owner joins it and creates their SkillWallet.

Community Details

The Integrator is prompted to add details for their community - name, description, avatar, and roles. These details are stored as metadata of the community. The community contract also has the function for joining the community and creating the SkillWallet. The users that create SkillWallets from the partners' platform are members of this community.

Roles

There are two types of roles inside a SkillWallet Community - Core team roles and member roles.
In a SkillWallet community, 10% of the users' slots are reserved for Core Team Members and the other 90% are reserved for Community members. A user can join as Core Team Member only after their address has been whitelisted from the SkillWallet Dashboard. The Community owner (the user that signs the Partners Agreement) is automatically whitelisted as a core team member.
The core team roles are predefined - Core Team, Investor, Advisor.
The community member roles are customizable when signing the Partners Agreement.

Community Roles

The Integrator adds 2 or 3 roles to their Partners Agreement. These roles have positional values - 24, 12, or 6. These values have the meaning of how crucial is a certain role for the community. When the users create their SkillWallets they pick one of the 2/3 roles and are associated with it. The partner can track how healthy the community is, depending on how many users there are from each role. In a healthy community, the members should be distributed in the following way:
  1. 1.
    If the partner has selected 3 roles:
    • 1st role should be assigned to 57% of the members
    • 2nd role should be assigned to 29% of the members
    • 3rd role should be assigned to 14% of the members
  2. 2.
    If the partner has selected 2 roles:
    • 1st role should be assigned to 57% of the members
    • 2nd role should be assigned to 43% of the members

Permissioned vs Permissionless access

The community contract allows customization when it comes to access. If the community is marked as permissionless everyone can join it as long as there are still free spots left.
If the community is permissioned, the community owner can attach an ERC721 contract, as a permission badge. The community members will be able to join only if they own at least one NFT from this contract. The Core Team Member roles are not affected by this setting. Core team members can join if they are whitelisted.

Community Contract Interface

This is the interface that the community contract implements. You can query all those view functions for your own community!
interface ICommunity {
event MemberAdded(address indexed _member, uint256 _skillWalletTokenId);
event CoreTeamMemberAdded(address _member);
// check if it's called only from deployer.
function joinNewMember(string memory uri, uint256 role) external;
function getMembers() external view returns (uint256[] memory);
function getMemberAddresses() external view returns (address[] memory);
function owner() external view returns (address);
function getSkillWalletAddress() external view returns (address);
function setMetadataUri(string calldata uri) external;
function isMember(address member) external view returns (bool);
function setPermissionBadgeAddress(address _permissionBadgeAddr) external;
function isCoreTeamMember(address member) external view returns (bool);
function coreTeamMembersCount() external view returns (uint256);
function addNewCoreTeamMembers(address member) external;
function getCoreTeamMembers() external view returns (address[] memory);
}

Partners Agreement Contract

Partners agreement contract holds the information about all the customizations when it comes to the authentication system - URLs allowed to use the web component, commitment level required by the members, interaction NFTs and partners contracts imported that are going to be tracked by SkillWallet.

Events & Interactions

Each partners agreement has a contract Activities.sol linked to it. This contract implements the concept of tasks and events.
There are 3 types of Activities
enum Type {
None,
CoreTeamTask,
DiscordPoll,
CommunityCall
}
  1. 1.
    Core Team Tasks
The core team tasks can be created and managed from the SkillWallet dashboard. The core team members can create them. Each task is assigned to a role, and only a SkillWallet holder with this role can take it and work on it. Once a task is finalized the taker receives an interaction for it.
Core team tasks lifecycle
  1. 1.
    From the SkillWallet Dashboard, a core team member creates a Task and assigns it to a Role.
  2. 2.
    Another core team member, with the role assigned to the task, takes it.
  3. 3.
    The taker finishes the work on the task and submits it.
  4. 4.
    The Creator of the task finalizes it.
  5. 5.
    The protocol increases the Interaction counter of the Taker.
2. Polls
A core team member can create Polls from the dashboard and assign them a role. The poll is published to their Discord Server (Please check the Discord Bot section). Each Poll has a duration. Once the poll expires, the Discord Bot finalizes it on chain, by also adding as IPFS metadata json the results and increases the interactions counter of all participants who have connected their DiscordID to their SkillWallet and they are assigned to the same role as the poll.
3. Community calls
Stay Tuned! They are still in progress!

[WIP] Interactions

TODO: redo
The integrator can add contract addresses to be tracked by the PartnersAgreement. These contracts should be deployed by the address signing the create Partners Agreement transaction.
When a Partners Agreement is created an ERC1155 InteractionNFT contract is deployed for the partner. The classes of the ERC1155 are the different roles. Initially, the contract mints the amount of No of Interactions imputed by the Integrator, distributed by roles.
Example: In the Integrator selects 100 No of Interactions, and 2 roles - 100 initial NFTs are minted - 57 of class Role1, 43 of class Role2.
Every time the SkillWallet holder interacts with one of the addresses that the Integrator has imported, one of those NFTs is being transferred to this user.

[WIP] Interaction tracker

TODO: redo
For tracking the interactions made, the PartnersAgreement uses Chainlink external adapter and Covalent API.
There's a recurring job server, which triggers queries for interactions for each member of the community once a day. It calls PartnersAgreement queryForNewInteractions(userAddress) , it calls an external adapter, which using Covalent API query calculates how many transactions have been signed from this address with one of the contracts imported by the Integrator. It returns an integer representing the number of interactions, the callback function transfers the InteractionNFTs to the user.
Interactions tracker