GithubHelp home page GithubHelp logo

crossbell-box / crossbell-contracts Goto Github PK

View Code? Open in Web Editor NEW
53.0 3.0 7.0 13.09 MB

Crossbell Contracts: The protocol for an ownership platform.

Home Page: https://crossbell-box.github.io/Crossbell-Contracts

Solidity 96.86% TypeScript 1.78% Shell 1.05% JavaScript 0.07% Makefile 0.25%

crossbell-contracts's Introduction

CrossSync Logo

Crossbell

Cross-platform, ring a bell.


Explore the Wiki »

View Website · Join Discord · Report Bug

Docs lint tests checks Mythx Security Analysis codecov

🐳 Introduction

Crossbell is an ownership platform composed of

  1. an EVM-compatible blockchain
  2. a protocol implemented by a set of smart contracts

Specifically, the information generated from social activities will be the initial form of data-ownership by users on Crossbell.

This repository is the implementation of the protocol.

⚙ Development

Install foundry if you don't have one:

# install foundry
curl -L https://foundry.paradigm.xyz | bash
foundryup

Compile and run tests:

yarn
yarn test
#run single test function using --match-test
forge test --match-test testXXX  -vvvvv
#run single test contract using --match-contract
forge test --match-contract xxxTest  -vvvvv
#run a group of tests using --match-path
forge test --match-path test/...  -vvvvv

Deploy:

forge script scripts/Deploy.s.sol:Deploy --private-key $PRIVATE_KEY --broadcast --legacy --rpc-url $RPC_URL --ffi                   
forge script scripts/Deploy.s.sol:Deploy --sig 'sync()' --private-key $PRIVATE_KEY --broadcast --legacy --rpc-url $RPC_URL --ffi

crossbell-contracts's People

Contributors

atlasoin avatar dependabot[bot] avatar fooooooooooox avatar iavl avatar pseudoyu avatar renovate[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

crossbell-contracts's Issues

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Warning

These dependencies are deprecated:

Datasource Name Replacement PR?
npm @nomiclabs/hardhat-etherscan Unavailable

Rate-Limited

These updates are currently rate-limited. Click on a checkbox below to force their creation now.

  • chore(deps): update dependency @nomiclabs/hardhat-etherscan to v3.1.8
  • chore(deps): update dependency hardhat-gas-reporter to v1.0.10
  • chore(deps): update dependency ts-node to v10.9.2
  • chore(deps): update dependency chai to v4.5.0
  • chore(deps): update dependency dotenv to v16.4.5
  • chore(deps): update actions/configure-pages action to v5
  • chore(deps): update actions/setup-python action to v5
  • chore(deps): update codecov/codecov-action action to v4
  • chore(deps): update dependency chai to v5
  • chore(deps): update dependency hardhat-gas-reporter to v2
  • chore(deps): update dependency husky to v9
  • chore(deps): update dependency solhint to v5
  • chore(deps): update github/codeql-action action to v3
  • chore(deps): update peaceiris/actions-gh-pages action to v4
  • 🔐 Create all rate-limited PRs at once 🔐

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Ignored or Blocked

These are blocked by an existing closed PR and will not be recreated unless you click a checkbox below.

Detected dependencies

github-actions
.github/workflows/checks.yml
  • actions/checkout v4@b4ffde65f46336ab88eb53be808477a3936bae11
  • actions/setup-node v3
  • actions/checkout v4@b4ffde65f46336ab88eb53be808477a3936bae11
  • codespell-project/actions-codespell v2.0
  • actions/checkout v4@b4ffde65f46336ab88eb53be808477a3936bae11
  • actions/setup-node v3
  • actions/checkout v4@b4ffde65f46336ab88eb53be808477a3936bae11
  • actions/setup-node v3
  • foundry-rs/foundry-toolchain v1
  • actions/checkout v4@b4ffde65f46336ab88eb53be808477a3936bae11
  • actions/setup-node v3
  • actions/checkout v4@b4ffde65f46336ab88eb53be808477a3936bae11
  • actions/setup-node v3
  • crytic/slither-action v0.3.0
  • github/codeql-action v2
.github/workflows/docs.yml
  • actions/checkout v4@b4ffde65f46336ab88eb53be808477a3936bae11
  • actions/setup-node v3
  • foundry-rs/foundry-toolchain v1
  • actions/configure-pages v3
  • peaceiris/actions-gh-pages v3
.github/workflows/lint.yml
  • actions/checkout v4@b4ffde65f46336ab88eb53be808477a3936bae11
  • actions/setup-node v3
.github/workflows/mythx.yml
  • actions/checkout v4@b4ffde65f46336ab88eb53be808477a3936bae11
  • actions/setup-node v3
  • actions/setup-python v4
.github/workflows/tests.yml
  • actions/checkout v4@b4ffde65f46336ab88eb53be808477a3936bae11
  • actions/setup-node v3
  • foundry-rs/foundry-toolchain v1
  • codecov/codecov-action v3
npm
package.json
  • @nomiclabs/hardhat-ethers ^2.0.6
  • @nomiclabs/hardhat-etherscan ^3.1.0
  • @nomiclabs/hardhat-waffle ^2.0.3
  • @openzeppelin/contracts 4.9.0
  • @typechain/ethers-v5 ^7.0.1
  • @typechain/hardhat ^7.0.0
  • @types/mocha ^10.0.0
  • chai ^4.3.6
  • dotenv ^16.0.0
  • ethereum-waffle ^3.4.4
  • ethers ^5.6.9
  • hardhat ^2.12.7
  • hardhat-contract-sizer ^2.8.0
  • hardhat-gas-reporter ^1.0.9
  • husky ^8.0.3
  • lint-staged ^14.0.0
  • prettier ^3.0.0-alpha.5
  • prettier-plugin-solidity ^1.1.3
  • solhint ^3.4.0
  • ts-node ^10.9.1
  • typechain ^5.1.2
  • typescript ^5.0.0

  • Check this box to trigger a request for Renovate to run again on this repository

Addtional content when linking notes

Right now, linkNote can be served to link notes for different purposes by assigning different linkTypes, but it's quite limited, cuz the linkType is bytes32 and can only be used to store a small amount of information. Imagine a scenario when you liked a bunch of posts on Xlog but you want to tag them with different bookmarks and organize them into different lists, the linkTypes alone won't be enough.
We got 2 options to improve this:

  1. add a linkNoteWithUri method in Web3Entry.sol.
  /**
   * @notice  linkNoteWithUri creates a link between a character and a note, and at the same 
              time attaches a uri to the link.
   * @param   vars The linkNoteData struct containing the following parameters:
   *      * fromCharacterId: The character id of the linker.
   *      * toCharacterId: The character id of the note owner.
   *      * toNoteId: The note id of the note to link.
   *      * linkType: The link type to use, for example, `LikeLinkType`.
   *      * data: The data input for link module, if any.
   * @param   uri The uri attached to the link, which can contain anything depending on how 
              you want to use it.
   */
function linkNoteWithUri(struct DataTypes.linkNoteData vars, string uri) external {}

This uri can be anything, we can put the tags we want in it.

  1. leave the existing interfaces unchanged, but upgrade Web3Entry.sol to distinguish between the Events of link and `linkTag'.
    When you want to link notes with tags, your linkNoteData might be like this:
{
  "fromCharacterId": ,
  "toCharacterId": ,
  "toNoteId": ,
  "linkType": "tag: bc's reading list",
  "data":
}

In order to make some differences with the emitted events so that indexer can easily tell if this is a normal link or a linkTag, Web3Entry would process the input data and when the linkType starts with "tag: " the linklistId in the emitted LinkNote event would be 0(normally the linklistId should be linker's linklist ID).

What do you think, Which one is better? 🤖

use named parameters in mapping types

solidity 0.8.18 introduced named parameters in mapping types. I would make sense to implement this new feature to increase the code readability.

here is an example:

mapping(uint256 characterId => mapping(address operator => uint256 permissionsBitMap)) internal _operatorsPermissionBitMap; // slot 25

The burn function of linklist contract always returns execution error

It seems that the burn function of linklist contract doesn't work properly.

request:

curl 'https://rpc.crossbell.io' \
  -X POST \
  -H "Content-Type: application/json" \
  --data '{"method":"eth_call","params":[{"from":"0x9308Add42293f9d3AbbC6A83045707C5dD128428","to":"0xFc8C75bD5c26F50798758f387B698f207a016b6A","data":"0x42966c680000000000000000000000000000000000000000000000000000000000001ceb"}, "latest"],"id":1,"jsonrpc":"2.0"}'

response:

{"jsonrpc":"2.0","id":1,"error":{"code":3,"message":"execution reverted: ERC721: operator query for nonexistent token","data":"0x08c379a00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000002c4552433732313a206f70657261746f7220717565727920666f72206e6f6e6578697374656e7420746f6b656e0000000000000000000000000000000000000000"}}

Given that a linklist nft is a character bound token, it stores both the linking and linkType of specific character. Hence, it's advisable to support burning the linklist via the web3Entry contract( burnLinklist) and then remove the associated linking and linkType

Extend operator to an array of address

  1. One possible scenario is, we may need to grant multiple parties permission to post notes on our behalf.
  2. Another reasonable scenario is to have an organization character account and some members of this organization should have permission to post.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.