# Interactions

### **Pool Deployment**

#### **createPool**

Creates a new SPA with all associated contracts in a single transaction.

```solidity
function createPool(CreatePoolArgument memory argument) external returns (WSPAToken wspaToken, Keeper keeper, ParameterRegistry parameterRegistry);

```

**Parameters**

| Name       | Type                 | Description                                     |
| ---------- | -------------------- | ----------------------------------------------- |
| `argument` | `CreatePoolArgument` | Struct containing pool configuration parameters |

**Returns**

| Name                | Type                | Description                             |
| ------------------- | ------------------- | --------------------------------------- |
| `wspaToken`         | `WSPAToken`         | The wrapped SPA token contract address  |
| `keeper`            | `Keeper`            | The governance keeper contract address  |
| `parameterRegistry` | `ParameterRegistry` | The parameter registry contract address |

**CreatePoolArgument Structure:**

```solidity
struct CreatePoolArgument {
    address tokenA;                      // Address of token A
    address tokenB;                      // Address of token B
    TokenType tokenAType;                // Type of token A (Standard, Oracle, Rebasing, ERC4626)
    address tokenAOracle;                // Oracle address for token A (if Oracle type)
    bytes tokenARateFunctionSig;         // Rate function signature for token A oracle
    bytes tokenADecimalsFunctionSig;     // Decimals function signature for token A oracle
    TokenType tokenBType;                // Type of token B
    address tokenBOracle;                // Oracle address for token B (if Oracle type)
    bytes tokenBRateFunctionSig;         // Rate function signature for token B oracle
    bytes tokenBDecimalsFunctionSig;     // Decimals function signature for token B oracle
}

```

#### **Default Parameter Management**

#### **setGovernor**

Sets the default governor address for newly deployed pools.

```solidity
function setGovernor(address _governor) external;

```

**Parameters**

| Name        | Type      | Description              |
| ----------- | --------- | ------------------------ |
| `_governor` | `address` | The new governor address |

**Access:** only Owner

#### **setMintFee**

Sets the default mint fee for newly deployed pools.

```solidity
function setMintFee(uint256 _mintFee) external;

```

**Parameters**

| Name       | Type      | Description                                                                                                                  |
| ---------- | --------- | ---------------------------------------------------------------------------------------------------------------------------- |
| `_mintFee` | `uint256` | The new default mint fee value. Uses 10 decimal precision (denominator = 10^10). Examples: 1e6 = 0.01%, 1e7 = 0.1%, 1e8 = 1% |

**Access:** only Owner

#### **setSwapFee**

Sets the default swap fee for newly deployed pools.

```solidity
function setSwapFee(uint256 _swapFee) external;

```

**Parameters**

| Name       | Type      | Description                                                                                                                  |
| ---------- | --------- | ---------------------------------------------------------------------------------------------------------------------------- |
| `_swapFee` | `uint256` | The new default swap fee value. Uses 10 decimal precision (denominator = 10^10). Examples: 1e6 = 0.01%, 1e7 = 0.1%, 1e8 = 1% |

**Access:** Owner only

#### **setRedeemFee**

Sets the default redeem fee for newly deployed pools.

```solidity
function setRedeemFee(uint256 _redeemFee) external;

```

**Parameters**

| Name         | Type      | Description                                                                                                                    |
| ------------ | --------- | ------------------------------------------------------------------------------------------------------------------------------ |
| `_redeemFee` | `uint256` | The new default redeem fee value. Uses 10 decimal precision (denominator = 10^10). Examples: 1e6 = 0.01%, 1e7 = 0.1%, 1e8 = 1% |

**Access:** Owner only

#### **setOffPegFeeMultiplier**

Sets the default off-peg fee multiplier for newly deployed pools.

```solidity
function setOffPegFeeMultiplier(uint256 _offPegFeeMultiplier) external;

```

**Parameters**

| Name                   | Type      | Description                                  |
| ---------------------- | --------- | -------------------------------------------- |
| `_offPegFeeMultiplier` | `uint256` | The new default off-peg fee multiplier value |

**Access:** only Owner

#### **setA**

Sets the default amplification coefficient for newly deployed pools.

```solidity
function setA(uint256 _A) external;

```

**Parameters**

| Name | Type      | Description                       |
| ---- | --------- | --------------------------------- |
| `_A` | `uint256` | The new default A parameter value |

**Access:** only Owner

#### **setMinRampTime**

Sets the default minimum ramp time for newly deployed pools.

```solidity
function setMinRampTime(uint256 _minRampTime) external;

```

**Parameters**

| Name           | Type      | Description                                  |
| -------------- | --------- | -------------------------------------------- |
| `_minRampTime` | `uint256` | The new default minimum ramp time in seconds |

**Access:** only Owner

#### **setExchangeRateFeeFactor**

Sets the default exchange rate fee factor for newly deployed pools.

```solidity
function setExchangeRateFeeFactor(uint256 _exchangeRateFeeFactor) external;

```

**Parameters**

| Name                     | Type      | Description                                    |
| ------------------------ | --------- | ---------------------------------------------- |
| `_exchangeRateFeeFactor` | `uint256` | The new default exchange rate fee factor value |

**Access:** only Owner

#### **setBufferPercent**

Sets the default buffer percentage for newly deployed pools.

```solidity
function setBufferPercent(uint256 _bufferPercent) external;

```

**Parameters**

| Name             | Type      | Description                             |
| ---------------- | --------- | --------------------------------------- |
| `_bufferPercent` | `uint256` | The new default buffer percentage value |

**Access:** only Owner

### **Contract Management**

#### **upgradeTo**

Upgrades the factory contract implementation.

```solidity
function upgradeTo(address newImplementation) external;

```

**Parameters**

| Name                | Type      | Description                            |
| ------------------- | --------- | -------------------------------------- |
| `newImplementation` | `address` | The new factory implementation address |

**Access:** only Owner

#### **setKeeperImplementation**

```solidity
function setKeeperImplementation(address _keeperImplementation) external;
```

**Parameters**

| Name                    | Type    | Description                                    |
| ----------------------- | ------- | ---------------------------------------------- |
| `_keeperImplementation` | address | The new keeper implementation contract address |

**Access:** only Owner
