Skip to content

Commit

Permalink
[vault create sdk] update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
mike-diamond committed Jul 30, 2024
1 parent 803bb8d commit 9cd4d6f
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 29 deletions.
22 changes: 11 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1147,17 +1147,17 @@ You can retrieve the vault factory contract using the helper function: `sdk.getV
#### Arguments:
| Name | Type | Required | Description |
|----------------|------------------------------------|----------|------------------------------------------------------------------------------------------------------------------------------------------------------------|
| userAddress | `string` | **Yes** | The address of the user initiating the action. This address will become the vault admin |
| type | `VaultType` | **No** | Allowed vault types: Default, Private, or Blocklist. Available vault types can be found in the `enum VaultType` which you can be imported from the library |
| vaultToken | `{ name: string, symbol: string }` | **No** | If provided, the vault will be created with its own ERC20 token |
| capacity | `bigint` | **No** | If provided, should be defined in gwei. By default, capacity is `MaxUint256`; the minimum allowed capacity is `parseEther('32')` |
| keysManagerFee | `number` | **No** | If provided, should be between `0` and `100`, inclusive with a maximum of two decimal digits allowed (e.g., `15.35`). By default, the fee is `0` |
| isOwnMevEscrow | `boolean` | **No** | Defines whether to send block rewards to the Smoothing Pool (`false`) or keep them only to your Vault (`true`). By default, this value is `false` |
| image | `string` | **No** | The vault image in base64 string format (will be uploaded to IPFS; maximum size is 1 MB) |
| displayName | `string` | **No** | The vault display name (will be uploaded to IPFS; maximum size is 30 characters) |
| description | `string` | **No** | The vault description (will be uploaded to IPFS; maximum size is 1000 characters) |
| Name | Type | Required | Description |
|----------------|------------------------------------|----------|---------------------------------------------------------------------------------------------------------------------------------------------------|
| userAddress | `string` | **Yes** | The address of the user initiating the action. This address will become the vault admin |
| type | `VaultType` | **No** | Allowed vault types: Default, Private. Available vault types can be found in the `enum VaultType` which you can be imported from the library |
| vaultToken | `{ name: string, symbol: string }` | **No** | If provided, the vault will be created with its own ERC20 token |
| capacity | `bigint` | **No** | If provided, should be defined in gwei. By default, capacity is `MaxUint256`; the minimum allowed capacity is `parseEther('32')` |
| keysManagerFee | `number` | **No** | If provided, should be between `0` and `100`, inclusive with a maximum of two decimal digits allowed (e.g., `15.35`). By default, the fee is `0` |
| isOwnMevEscrow | `boolean` | **No** | Defines whether to send block rewards to the Smoothing Pool (`false`) or keep them only to your Vault (`true`). By default, this value is `false` |
| image | `string` | **No** | The vault image in base64 string format (will be uploaded to IPFS; maximum size is 1 MB) |
| displayName | `string` | **No** | The vault display name (will be uploaded to IPFS; maximum size is 30 characters) |
| description | `string` | **No** | The vault description (will be uploaded to IPFS; maximum size is 1000 characters) |
#### Example:
Expand Down
22 changes: 11 additions & 11 deletions changelog/next-release.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,17 @@ You can retrieve the vault factory contract using the helper function: `sdk.getV

#### Arguments:

| Name | Type | Required | Description |
|----------------|------------------------------------|----------|------------------------------------------------------------------------------------------------------------------------------------------------------------|
| userAddress | `string` | **Yes** | The address of the user initiating the action. This address will become the vault admin |
| type | `VaultType` | **No** | Allowed vault types: Default, Private, or Blocklist. Available vault types can be found in the `enum VaultType` which you can be imported from the library |
| vaultToken | `{ name: string, symbol: string }` | **No** | If provided, the vault will be created with its own ERC20 token |
| capacity | `bigint` | **No** | If provided, should be defined in gwei. By default, capacity is `MaxUint256`; the minimum allowed capacity is `parseEther('32')` |
| keysManagerFee | `number` | **No** | If provided, should be between `0` and `100`, inclusive with a maximum of two decimal digits allowed (e.g., `15.35`). By default, the fee is `0` |
| isOwnMevEscrow | `boolean` | **No** | Defines whether to send block rewards to the Smoothing Pool (`false`) or keep them only to your Vault (`true`). By default, this value is `false` |
| image | `string` | **No** | The vault image in base64 string format (will be uploaded to IPFS; maximum size is 1 MB) |
| displayName | `string` | **No** | The vault display name (will be uploaded to IPFS; maximum size is 30 characters) |
| description | `string` | **No** | The vault description (will be uploaded to IPFS; maximum size is 1000 characters) |
| Name | Type | Required | Description |
|----------------|------------------------------------|----------|---------------------------------------------------------------------------------------------------------------------------------------------------|
| userAddress | `string` | **Yes** | The address of the user initiating the action. This address will become the vault admin |
| type | `VaultType` | **No** | Allowed vault types: Default, Private. Available vault types can be found in the `enum VaultType` which you can be imported from the library |
| vaultToken | `{ name: string, symbol: string }` | **No** | If provided, the vault will be created with its own ERC20 token |
| capacity | `bigint` | **No** | If provided, should be defined in gwei. By default, capacity is `MaxUint256`; the minimum allowed capacity is `parseEther('32')` |
| keysManagerFee | `number` | **No** | If provided, should be between `0` and `100`, inclusive with a maximum of two decimal digits allowed (e.g., `15.35`). By default, the fee is `0` |
| isOwnMevEscrow | `boolean` | **No** | Defines whether to send block rewards to the Smoothing Pool (`false`) or keep them only to your Vault (`true`). By default, this value is `false` |
| image | `string` | **No** | The vault image in base64 string format (will be uploaded to IPFS; maximum size is 1 MB) |
| displayName | `string` | **No** | The vault display name (will be uploaded to IPFS; maximum size is 30 characters) |
| description | `string` | **No** | The vault description (will be uploaded to IPFS; maximum size is 1000 characters) |

#### Example:

Expand Down
5 changes: 3 additions & 2 deletions src/methods/vault/transactions/create/createVaultEncode.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import { commonLogic } from './common'
import type { CreateVaultInput } from './types'
import { getMetadataHashMock } from '../util'
import { uploadMetadata } from '../util'


const createVaultEncode = async (values: CreateVaultInput) => {
const { image, displayName, description, ...rest } = values
const { options } = rest

const metadataIpfsHash = getMetadataHashMock({ image, displayName, description })
const metadataIpfsHash = await uploadMetadata({ image, displayName, description, options })
const { vaultFactory, params } = await commonLogic({ metadataIpfsHash, ...rest })

const rx = await vaultFactory.createVault.populateTransaction(...params)
Expand Down
5 changes: 3 additions & 2 deletions src/methods/vault/transactions/operate/multicallEncode.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import { commonLogic } from './common'
import type { MulticallInput } from './types'
import { getMetadataHashMock } from '../util'
import { uploadMetadata } from '../util'
import { getVaultMulticallEncode } from '../../../utils'


const multicallEncode = async (values: MulticallInput): Promise<StakeWise.TransactionData> => {
const { image, displayName, description, ...rest } = values
const { options } = rest

const metadataIpfsHash = getMetadataHashMock({ image, displayName, description })
const metadataIpfsHash = await uploadMetadata({ image, displayName, description, options })
const multicallArgs = await commonLogic({ metadataIpfsHash, ...rest })

return getVaultMulticallEncode(multicallArgs)
Expand Down
2 changes: 1 addition & 1 deletion src/utils/enums.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export enum Network {
export enum VaultType {
Default = 'Default',
Private = 'Private',
Blocklist = 'Blocklist',
// Blocklist = 'Blocklist',
}

export enum AllocatorActionType {
Expand Down
4 changes: 2 additions & 2 deletions src/utils/getVaultFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ const getVaultFactory = ({ vaultType, contracts, isErc20 }: Input) => {
const vaultFactories = isErc20 ? {
[VaultType.Default]: contracts.factories.erc20Vault,
[VaultType.Private]: contracts.factories.erc20PrivateVault,
[VaultType.Blocklist]: contracts.factories.erc20BlocklistVault,
// [VaultType.Blocklist]: contracts.factories.erc20BlocklistVault,
} : {
[VaultType.Default]: contracts.factories.vault,
[VaultType.Private]: contracts.factories.privateVault,
[VaultType.Blocklist]: contracts.factories.blocklistVault,
// [VaultType.Blocklist]: contracts.factories.blocklistVault,
}

return vaultFactories[vaultType]
Expand Down

0 comments on commit 9cd4d6f

Please sign in to comment.