open-index/open-npm huggingface dataset:
npm package: @gooddollar/bridge-app
Description: Minimalistic bridge
Latest version: 1.6.0

# Bridge app based on block header proofs

- main.ts - entry point for the validator app submiting blocks to the registry
- sdk.ts - sdk for submiting signed blocks from the registry to a bridge

## Running the bridge validator app

- Run the script where you run your validator node
- The docker expects a local `fusenet/config` to exists where the private key is
- Alternatively you can provide a private key or mnemonic via env variables `PRIVATE_KEY` and `MNEMONIC` (see below how to set env variables)

```
curl https://raw.githubusercontent.com/GoodDollar/GoodBridge/master/packages/bridge-app/dockerstart.sh -o dockerstart.sh
chmod u+x dockerstart.sh
./dockerstart.sh
```

## Using the sdk

```
import { BridgeSDK } from "@gooddollar/bridge-app/dist/sdk.js";

// blockheaderregistry contract
const registry = "0x44a1E0A83821E239F9Cef248CECc3AC5b910aeD2";

// your custom bridges contracts implementing BridgeCore, key is chainId and value the bridge contract
const bridges = {"122":"0x...","1":"0x..."};

//the checkpoint update frequency
const stepSize = 10;

const bridgeSDK = new BridgeSDK(
    registry,
    bridges,
    stepSize
  );

// relayTx = async (sourceChainId: number, targetChainId: number, txHash: string, signer: Signer)
// this will fetch the signed block from the registry and the receipt proof for that txHash and submit them
// to the bridge contract
const = { relayTxHash, relayPromise } = await sdk.relayTx(sourceChain, targetChain, txHash, signer)
```

## Advanced configuration via env variables

- Edit the dockerstart.sh script and overwrite env variables with `-e`
- OR create a `.env` file in your local `fusenet/config` folder, env vars defined in this file will override any defined via `-e`

## Env variables

- POLLING_INTERVAL (default 5000) - How often to query RPCs for new blocks (milliseconds)
- LOG_LEVEL (default info)
- REGISTRY_RPC (default http://172.17.0.1:8545) - RPC to for the blockchain with the registry contract
- FUSE_RPC (default http://172.17.0.1:8545) - RPC for fuse
- BLOCK_REGISTRY_ADDRESS
- CONSENSUS_ADDRESS (default 0x3014ca10b91cb3D0AD85fEf7A3Cb95BCAc9c0f79) - The fuse consensus contract to fetch latest set of validators and sign them
- TEST_MODE (default false) - When true will not submit blocks to registry
- STEP_SIZE (default 10) - Submit signed blockchain block every STEP_SIZE blocks
- CONFIG_DIR (default /config/) - Docker folder where private key json can be found
- DOTENV_FILE (default /config/.env) - Docker folder for .env to override defaults

## Running app/sdk tests

- first deploy dev env by running in the `bridge-contracts` package the command `yarn start:dev`
- run `yarn test`
npm package: @gooddollar/goodcollective-contracts
Description: ## Structs
Latest version: 1.4.2

# Contracts

## Structs

### Pool Settings

-   `nftType`: 1, // when you update the settings with setPoolSettings, `nftType` should always match what has been set when creating the pool
-   `uniquenessValidator`: `ethers.constants.AddressZero`,
-   `rewardPerEvent`: `[100, 300]`,
-   `validEvents`: `[1, 2]`, // to be defined
-   `manager`: `<address of the owner/creator of the pool>`,
-   `membersValidator`: `ethers.constants.AddressZero`, // used to only accept certain members (address zero for anyone can join)
-   `rewardToken`: `'0x62B8B11039FcfE5aB0C56E502b1C372A3d2a9c7A'`, // what token will a steward/member receive. currently only supports production G$'s
-   `allowRewardOverride`: `false`,
npm package: @gooddollar/goodprotocol
Description: GoodDollar Protocol
Author: GoodDollar Community
Latest version: 2.2.1

# GoodProtocol

[![Actions Status](https://github.com/GoodDollar/GoodProtocol/workflows/CI/badge.svg)](https://github.com/GoodDollar/GoodProtocol/actions)
[![Coverage Status](https://coveralls.io/repos/github/GoodDollar/GoodProtocol/badge.svg?branch=master)](https://coveralls.io/github/GoodDollar/GoodProtocol?branch=master)
[![npm version](https://badge.fury.io/js/@gooddollar%2Fgoodprotocol.svg)](https://badge.fury.io/js/@gooddollar%2Fgoodprotocol)

### Versions 2+ of GoodDollar smart contracts

# SuperGoodDollar

_SuperGoodDollar_ is an implementation of the GoodDollar token which adds functionality implemented by the Superfluid protocol, making it a _Super Token_.

SuperGoodDollar is implemented as a [Pure Super Token](https://github.com/superfluid-finance/protocol-monorepo/wiki/About-Super-Token-Classification) - it has no underlying ERC20.  
This is possible because Super Tokens are themselves ERC20 tokens.

The SuperGoodDollar contract is composed like this:
**GoodDollarProxy** is a minimal base contract. It's responsible for state storage and for dispatching calls to the appropriate logic contract via delegatecall.
Its `initialize` method connects the proxy to 2 logic contracts:

1. the canonical **SuperToken** logic of the Superfluid framework
2. the logic specific for the GoodDollar token (**GoodDollarCustom**)
   The proxy's `initialize` then invokes the initializer methods of both connected logic contracts.
   The contract `GoodDollarCustom` overrides some of the method already implemented by the `SuperToken` contract.
   Such overriding across different logic contracts can be done by making external calls to the base implementation.
   For convenience, this is handled by the base contract `SuperTokenBase` which wraps SuperToken methods to be overrided.

Dual upgradeability of the 2 connected logic contracts is achieved this way:

1. upgrades of the SuperToken logic are handled by Superfluid governance, as is the case for other SuperTokens
2. upgrades of the GoodDollar logic is handled by the configured owner(s). The interface is the same (UUPSProxy), but with changed method names in order to avoid naming clashes. See example test case.

The tests in `SuperGoodDollar.ts` aren't comprehensive (not ready for production), but sufficient to prove that the mechanism with 2 logic contracts works.

## Packages or Apps dependencies

The following packages or app repositories are relient on the @gooddollar/goodprotocol package and should be notified to review potential needed updates:

- [GoodWeb3-Mono](https://github.com/GoodDollar/GoodWeb3-Mono)
- [GoodSDKs](https://github.com/GoodDollar/GoodSDKs)
- [GoodProtocolUI](https://github.com/GoodDollar/GoodProtocolUI)
- [GoodCollective](https://github.com/GoodDollar/GoodCollective)
- [GoodWalletV2](https://github.com/GoodDollar/GoodWalletV2)
- [GoodBridge](https://github.com/GoodDollar/GoodBridge)
- [GoodServer](https://github.com/GoodDollar/GoodServer)
npm package: @gooddollar/gun-appendonly
Description: create append only nodes. their keys values can not be modified unless signed by same SEA user
Latest version: 1.0.3

## What
An extension to [gundb](https://github.com/amark/gun).

Allows marking node as append only, this means fields of AO nodes (or refs from AO nodes) can only be added and their value can't be modify.
There is an exception that if the ref is to a SEA signed node then the user of the signed node can change the ref.

## Why

For example its a way to claim a username that reference a profile.
gun.rootAO('indexbyusername').get(username).put(profileId).
This makes the node 'indexbyusername' append only and thus once the key <username> is set to <profileid> it can not be modified. But other keys could be added to 'indexbyusername'.
Once that username is defined no one else could change where it points to. Currently in gundb evereything is world writable, so theoretically anyone could change it.

## How to use

- npm i gun @gooddollar/gun-appendOnly --save
- import Gun from '@gooddollar/gun-appendOnly'
- gun = new Gun()

## API

gun.rootAO(key) - creates a root gundb node that is marked as append only

gun.get(key).putAO(node) - put a ref to <node> at <key> making the node append only

## How it works

Behind the scenes it appends '!@' to the soul of the node (souls in gundb are like ids)
Extends gun wire protocol to check if the node being written to is marked with '!@' and if the put request contains an existing field. (check out the source code)
npm package: @gooddollar/gun-asyncstorage
Description: Use Gun.js in React Native through AsyncStorage
Author: GoodDollar
Latest version: 1.0.3

# Gun AsyncStorage

Interop layer between [Gun.js](https://gun.js.org) and React Native's [AsyncStorage](http://facebook.github.io/react-native/docs/asyncstorage.html). In other words, allows you to use Gun.js in React Native apps!

## Installation

```
npm install gun-asyncstorage
```

## Usage

In `index.ios.js` or `index.android.js` import this before importing anything else related to Gun:

```js
import 'gun-asyncstorage';
```

And that's it, all data that is written to the Gun instance will be stored (and recovered) from AsyncStorage.
npm package: @gooddollar/gun-pk-auth
Description: use privatekey as seed for gun SEA authentication
Latest version: 1.1.0

## Gun SEA determinisic authentication

webcrypto doesnt allow to generate keys based on a seed, so we use `elliptic` for that
SEA user/password login is not reliable.
You can use this package to generate a deterministic SEA keypair for your user based on your existing login method.

This is perfect for dapps(web3) that are based on private keys or some secret signed data by the user private key.
Both a private key and a signature can be used as seed to deterministically generate SEA key pair.

### Installation
`yarn add @gooddollar/gun-pk-auth`
or
`npm i @gooddollar/gun-pk-auth`

### Examples

a seed can be a private key "0x012345678901234567890123456789123456"

```
import { genDeterministicKeyPair, genDeterministicSEAPair, gunAuth} from '@gooddollar/gun-pk-auth'

//helper to generate keypair in JWK format
const jwk = genDeterministicKeyPair(<someseed>)

//generate same key in SEA format
const seaPair = genDeterministicSEAPair(<someseed>)

//use the generated seaPair to do regular gun auth
gun.auth(null, seaPair, <some callabck>)

//or use gunAuth helper to do gun authentication based on promises
const userIs = await gunAuth(gun, <someseed>)
```
npm package: @gooddollar/react-native-webview-crypto
Description: [![npm](https://img.shields.io/npm/v/react-native-webview-crypto?style=flat-square)](https://www.npmjs.com/package/react-native-webview-crypto)
Latest version: 0.0.20

# react-native-webview-crypto

[![npm](https://img.shields.io/npm/v/react-native-webview-crypto?style=flat-square)](https://www.npmjs.com/package/react-native-webview-crypto)

Working version based on /saulshanabrook/react-native-webview-crypto and PR https://github.com/saulshanabrook/react-native-webview-crypto/pull/9

This brings `window.crypto.subtle` to your React Native application. It does this by communicating with a hidden WebView, which performs the actual computation.

Refer to the [`webview-crypto`](https://github.com/saulshanabrook/webview-crypto) repo for most of the code and some caveats.

## Installation

```sh
npm install --save react-native-webview react-native-webview-crypto
react-native link
```

### Android

create a file called blank.html in android/app/src/main/assets

```
<html/>
```

### known issues

if you use react-native-crypto and get warnings about cyclic require make sure to import it before the bridge

```
import 'react-native-crypto'
import WebviewCrypto from 'react-native-webview-crypto'
```

### getRandomValues

for complete compatability with webcrypto (window.crypto.getRandomValues) you can install react-native-crytpo or react-native-get-random-values

## Usage

Rendering the `PolyfillCrypto` will start up a WebView to transparently proxy all the crypto calls to.

```javascript
import React, { Component } from "react";
import { View } from "react-native";

import App from "./app";

import PolyfillCrypto from "react-native-webview-crypto";

class TopLevelComponent extends Component {
  render() {
    return (
      <View>
        <PolyfillCrypto />
        <App />
      </View>
    );
  }
}

AppRegistry.registerComponent("WhateverName", () => TopLevelComponent);
```

Now, in any of your code, you can access `window.crypto.subtle`, just like you would in a browser.

There is also an [example repo](https://github.com/saulshanabrook/react-native-webview-crypto-example) which runs some example crypto using this library.

_This project was funded by [Burke Software and Consulting LLC](http://burkesoftware.com/) for [passit](http://passit.io/)._