Skip to content

Commit

Permalink
createPool
Browse files Browse the repository at this point in the history
  • Loading branch information
0xKurt committed Feb 7, 2024
1 parent 0337f36 commit fae78b5
Show file tree
Hide file tree
Showing 16 changed files with 7,849 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
RPC_URL=http://127.0.0.1:8545/
SIGNER_PRIVATE_KEY=
# ALLO_REGISTRY_ADDRESS=0x4AAcca72145e1dF2aeC137E1f3C5E3D75DB8b5f3
# ALLO_MAIN_ADDRESS=0x1133eA7Af70876e64665ecD07C0A0476d09465a1
50 changes: 50 additions & 0 deletions HOW_TO.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Steps to Create a Pool:

## 1. Pool Operator Profile Creation:

The pool operator initiates the process by creating a registry profile. (see [README/Scripts/Create Profile](README.md#1-create-profile))

## 2. Strategy Deployment:

A strategy needs to be deployed. This can be done by anyone. (see [README/Scripts/Deploy the strategy](README.md#2-deploy-the-strategy))

## 3. Superfluid Integration:

Superfluid needs to allow the strategy to create super apps on Superfluid.

## 4. Decoded Pool Initialization Parameters:

Initialization parameters need to be defined: `bool useRegistryAnchor`, `bool metadataRequired`, `address passportDecoder`, `address superfluidHost`, `address allocationSuperToken`, `uint64 registrationStartTime`, `uint64 registrationEndTime`, `uint64 allocationStartTime`, `uint64 allocationEndTime`, `uint256 minPassportScore`, and `uint256 initialSuperAppBalance`

## 5. Pool Creation Parameter (Allo Contract):

The pool operator defines pool parameters used to call `createPoolWithCustomStrategy` function on the Allo contract.
Parameters include:
`bytes32 _profileId`: created in the first step
`address _strategy`: created in the second step
`bytes memory _initStrategyData`: encoded initialize parameters, see step 4
`address _token`: Pool Token (matching token)
`uint256 _amount`: 0 - match amount, not needed at this point
`Metadata memory _metadata`: consider uploading to IPFS for additional details.
`address[] memory _managers`: Pool Manager Address Array

## 6. Allo Contract Invocation:

The pool operator calls the `createPoolWithCustomStrategy` function on the Allo contract (0x1133eA7Af70876e64665ecD07C0A0476d09465a1) to create the pool.
```
createPoolWithCustomStrategy(
bytes32 _profileId,
address _strategy,
bytes memory _initStrategyData,
address _token,
uint256 _amount,
Metadata memory _metadata,
address[] memory _managers
) external payable returns (uint256 poolId);
```

This can be done by a script, see: [README/Scripts/Create a pool](README.md#3-create-a-pool)

## 7. Pool Funding:

Anyone can fund the pool with the allowed super token (_token) to pre-fund the recipients super apps with the `initialSuperAppBalance`. This can be done by a simple token transfer to the strategy.
52 changes: 52 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# SQFSuperfluidStrategy Scripts

Strategy can be found [here](https://github.com/allo-protocol/allo-v2/tree/main/contracts/strategies/_poc/sqf-superfluid).

## Installation

1. Clone the repository:

```bash
git clone [email protected]:allo-protocol/sqf-scripts.git
```

2. Install dependencies:

```bash
yarn install
```

3. Create a .env file at the root of the repository and add the following variables:

- `RPC_URL` - Your Infura RPC URL
- `SIGNER_PRIVATE_KEY` - The private key of the pool manager/address that will call contracts
- `ALLO_REGISTRY_ADDRESS` - The address of the Allo Protocol registry
- `ALLO_MAIN_ADDRESS` - The address of the Allo Protocol main contract

## Scripts

1. Create Profile
To create a pool on Allo you need a Registry profile. If you don't have one yet, you can create one using this script.

- Open `src/create-profile.ts`
- Fill out the `profile` config params (lines 8-15)
- save and run:

```shell
yarn create-profile
```

2. Deploy the strategy.

```shell
yarn deploy-strategy
```

3. Create a pool
- Open `src/create-pool.ts`
- Fill out the `initData` and `poolData` config params (lines 8-35)
- save and run:

```shell
yarn run create-pool
```
Loading

0 comments on commit fae78b5

Please sign in to comment.