Skip to content

Commit

Permalink
Clean some react and architecture API
Browse files Browse the repository at this point in the history
  • Loading branch information
tupui committed Aug 4, 2024
1 parent 962baef commit 7fbb763
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 24 deletions.
39 changes: 22 additions & 17 deletions website/docs/developers/architecture.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ sidebar_position: 2

![General diagram flow](./architecture.png)



:::note

Maintainer: a person which is part of a project’s team. This is not necessarily tight to any specific role nor commit rights.
Expand All @@ -24,37 +22,44 @@ Maintainer: a person which is part of a project’s team. This is not necessaril
The Soroban contract handles all on-chain features of the projects from registration, administration, to pushing new code versions. It provides the following minimal Application Programming Interface (API):

```rust
fn register(maintainer: address, name: bytes, maintainers: vec<address>, url: bytes, hash: bytes) -> bytes
fn register(maintainer: Address, name: String, maintainers: Vec<Address>, url: String, hash: String, domain_contract_id: Address) -> Bytes

fn update_config(maintainer: address, key: bytes, maintainers: vec<address>, url: bytes, hash: bytes)
fn update_config(maintainer: Address, key: Bytes, maintainers: Vec<Address>, url: String, hash: String)

fn commit(maintainer: address, project_key: bytes, hash: bytes)
fn commit(maintainer: Address, project_key: Bytes, hash: String)

fn get_commit(project_key: bytes) -> bytes
fn get_commit(project_key: Bytes) -> String

#[contracttype]
struct Config {
hash: bytes,
url: bytes
hash: String,
url: String
}

#[contracttype]
struct Project {
config: Config,
maintainers: vec<address>,
name: bytes
maintainers: Vec<Address>,
name: String
}

#[contracttype]
enum ProjectKey {
Key(bytes),
LastHash(bytes)
Key(Bytes),
LastHash(Bytes)
}

enum ContractErrors {
UnexpectedError = 0,
InvalidKey = 1,
ProjectAlreadyExist = 2,
UnregisteredMaintainer = 3,
NoHashFound = 4,
InvalidDomainError = 5,
MaintainerNotDomainOwner = 6,
}
```

When maintainers register their projects, a unique hash based on the project name is created. This serves as a project_key to uniquely identify a project and is stored as a data entry on the ledger.
When maintainers register their projects, a unique hash based on the project name is created. This serves as a `project_key` to uniquely identify a project and is stored as a data entry on the ledger.

We intend to use Soroban domain as a way to prevent name squatting and other nefarious registration. The community will have easy tools to report issues. This will effectively prevent misuse of our contract. We would then use the node address provided by Soroban domain as a project_key.
We intend to use Soroban domain as a way to prevent name squatting and other nefarious registration. The community will have easy tools to report issues. This will effectively prevent misuse of our contract. We would then use the node address provided by Soroban domain as a `project_key`.

Each project stores 3 elements on-chain:

Expand Down
2 changes: 1 addition & 1 deletion website/docs/intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ sidebar_position: 1

# Welcome to Tansu!


Tansu adds an extra layer of security when developing Open Source projects. In essence, it proposes a solution to track code changes and enable anyone to verify that the code hosted on GitHub is indeed the same. Coupled with other best practices, such as, code signing and attestation of provenance, Tansu guarantees that the code history has not been tempered with.
9 changes: 5 additions & 4 deletions website/src/components/HomepageFeatures/index.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
import clsx from 'clsx';
import Heading from '@theme/Heading';
import styles from './styles.module.css';
import React from "react";

type FeatureItem = {
title: string;
Svg: React.ComponentType<React.ComponentProps<'svg'>>;
description: JSX.Element;
description: React.JSX.Element;
};

const FeatureList: FeatureItem[] = [
{
title: 'Built with Soroban',
title: 'Secure',
Svg: require('@site/static/img/soroban-wordmark-temp.svg').default,
description: (
<>
Expand All @@ -19,7 +20,7 @@ const FeatureList: FeatureItem[] = [
),
},
{
title: 'Git on-chain',
title: 'Decentralized',
Svg: require('@site/static/img/git-logo.svg').default,
description: (
<>
Expand Down Expand Up @@ -52,7 +53,7 @@ function Feature({title, Svg, description}: FeatureItem) {
);
}

export default function HomepageFeatures(): JSX.Element {
export default function HomepageFeatures(): React.JSX.Element {
return (
<section className={styles.features}>
<div className="container">
Expand Down
5 changes: 3 additions & 2 deletions website/src/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import HomepageFeatures from '@site/src/components/HomepageFeatures';
import Heading from '@theme/Heading';

import styles from './index.module.css';
import React from "react";

function HomepageHeader() {
const {siteConfig} = useDocusaurusContext();
Expand All @@ -28,12 +29,12 @@ function HomepageHeader() {
);
}

export default function Home(): JSX.Element {
export default function Home(): React.JSX.Element {
const {siteConfig} = useDocusaurusContext();
return (
<Layout
title={`${siteConfig.title}`}
description="Description will go into a meta tag in <head />">
description="Tansu - Where Git meet the blockchain">
<HomepageHeader />
<main>
<HomepageFeatures />
Expand Down

0 comments on commit 7fbb763

Please sign in to comment.