Skip to content

Commit

Permalink
Remove POD (#2175)
Browse files Browse the repository at this point in the history
  • Loading branch information
onnovisser authored Jun 3, 2024
1 parent b59bdd3 commit 97c7763
Show file tree
Hide file tree
Showing 35 changed files with 258 additions and 1,081 deletions.
63 changes: 0 additions & 63 deletions .github/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,69 +18,6 @@ Setup pure proxy to sign transactions (whitelisting & transfer tokens).
3. Copy the resulting pure proxy address and add it to the env varibles: `MEMBERLIST_ADMIN_PURE_PROXY` (onboarding-api) and `REACT_APP_MEMBERLIST_ADMIN_PURE_PROXY` (centrifuge-app)
4. Enable onboarding for each new pool under /issuer/<poolId>/investors

### Asset Originator POD Access

When setting up an Asset Originator for a pool, the account on the POD needs to be manually created

1. Create AO on the Access tab of the Issuers Pool page
2. Copy the address of the newly created AO proxy
3. Get a jw3t auth token. Needs to be signed as Eve on behalf of Eve with proxy type `PodAdmin`. Example token: `ewogImFsZ29yaXRobSI6ICJzcjI1NTE5IiwKICJ0b2tlbl90eXBlIjogIkpXM1QiLAogImFkZHJlc3NfdHlwZSI6ICJzczU4Igp9.ewogImFkZHJlc3MiOiAiNUhHaldBZUZEZkZDV1BzakZRZFZWMk1zdnoyWHRNa3R2Z29jRVpjQ2o2OGtVTWF3IiwKICJpc3N1ZWRfYXQiOiAiMTY4MTk5Mzc4MCIsCiAiZXhwaXJlc19hdCI6ICIxOTk3MzUzNzgwIiwKICJvbl9iZWhhbGZfb2YiOiAiNUhHaldBZUZEZkZDV1BzakZRZFZWMk1zdnoyWHRNa3R2Z29jRVpjQ2o2OGtVTWF3IiwKICJub3RfYmVmb3JlIjogIjE2ODE5OTM3ODAiLAogInByb3h5X3R5cGUiOiAiUG9kQWRtaW4iCn0.-BJ7Y6WurKYwesCMfkTrudsH5ZVseMviVNdZ0kFZmEnAtAYvdxqxN56aVwRR5QvEjK8Of4TVtY_-oPK4hP7Dhg`

A token can be created with the code below:

```js
const keyring = new Keyring({ type: 'sr25519' })
const EveKeyRing = keyring.addFromUri('//Eve')

const centrifuge = new Centrifuge({
polkadotWsUrl: 'wss://fullnode-relay.development.cntrfg.com',
centrifugeWsUrl: 'wss://fullnode.development.cntrfg.com',
signingAddress: AliceKeyRing,
})

const token = await centrifuge.auth.generateJw3t(EveKeyRing, undefined, {
onBehalfOf: EveKeyRing.address,
proxyType: 'PodAdmin',
expiresAt: String(Math.floor(Date.now() / 1000) + 60 * 60 * 24 * 365 * 10), // 10 years
})
```

`PodAdmin` is a special proxy type that only exists on the POD and not on-chain.

4. Call `https://pod.development.cntrfg.com/v2/accounts/generate` (More details about the request here: https://app.swaggerhub.com/apis/centrifuge.io/cent-node/2.1.0#/Accounts/generate_account_v2) with the token in the Authorization header. Example below:

```bash
curl --request POST \
--url https://pod.development.cntrfg.com/v2/accounts/generate \
--header 'Authorization: Bearer ewogImFsZ29yaXRobSI6ICJzcjI1NTE5IiwKICJ0b2tlbl90eXBlIjogIkpXM1QiLAogImFkZHJlc3NfdHlwZSI6ICJzczU4Igp9.ewogImFkZHJlc3MiOiAiNUhHaldBZUZEZkZDV1BzakZRZFZWMk1zdnoyWHRNa3R2Z29jRVpjQ2o2OGtVTWF3IiwKICJpc3N1ZWRfYXQiOiAiMTY4MTIwNjk4NCIsCiAiZXhwaXJlc19hdCI6ICIxNjgzNzk4OTg0IiwKICJvbl9iZWhhbGZfb2YiOiAiNUhHaldBZUZEZkZDV1BzakZRZFZWMk1zdnoyWHRNa3R2Z29jRVpjQ2o2OGtVTWF3IiwKICJub3RfYmVmb3JlIjogIjE2ODEyMDY5ODQiLAogInByb3h5X3R5cGUiOiAiUG9kQWRtaW4iCn0.oLovvmVzXJRz-eY1V0wHFNdF6HnVa1unx684xEoMhgBOdCyV8I4yZvUjMx4qLK1vj9Oeh42dAmJ5_vAti9D4jQ' \
--header 'Content-Type: application/json' \
--data '{
"account": {
"identity": "0x3fe43572af486a48cf27e038fd42a2657cd8495c5f4f1a5553833135eb75b316",
"precommit_enabled": true,
"webhook_url": "https://centrifuge.io"
}
}'
```

`identity` is the hex formatted address for the account you want to create.
The response will look something like:

```json
{
"identity": "0x3fe43572af486a48cf27e038fd42a2657cd8495c5f4f1a5553833135eb75b316",
"webhook_url": "https://centrifuge.io",
"precommit_enabled": true,
"document_signing_public_key": "0x85d46bae1577ead77f00931fc63618e2587486d8c95dc7fc8637a63fde0668ed",
"p2p_public_signing_key": "0xafed109165d041b83f2a42a8863a28277e0fa35e900e9544d0c46e2e2772b488",
"pod_operator_account_id": "0x1cbd2d43530a44705ad088af313e18f80b53ef16b36177cd4b77b846f2a5f07c"
}
```

5. Copy `document_signing_public_key`, `p2p_public_signing_key` and `pod_operator_account_id` of the returned result and paste those in the AO section on the Access tab
6. Add hot wallets to the AO and submit the form
7. If successful, the hot wallets should now be able to authenticate with the POD and be able to create assets.

## Notes

To add other repositories to this monorepo while preserving the Git history, we can use the following steps: https://medium.com/@filipenevola/how-to-migrate-to-mono-repository-without-losing-any-git-history-7a4d80aa7de2
Expand Down
1 change: 0 additions & 1 deletion centrifuge-app/.env-config/.env.altair
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
REACT_APP_COLLATOR_WSS_URL=wss://fullnode.altair.centrifuge.io
REACT_APP_DEFAULT_NODE_URL=
REACT_APP_DEFAULT_UNLIST_POOLS=false
REACT_APP_FAUCET_URL=''
REACT_APP_IPFS_GATEWAY=https://centrifuge.mypinata.cloud/
Expand Down
1 change: 0 additions & 1 deletion centrifuge-app/.env-config/.env.catalyst
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
REACT_APP_COLLATOR_WSS_URL=wss://fullnode.catalyst.cntrfg.com
REACT_APP_DEFAULT_NODE_URL=
REACT_APP_DEFAULT_UNLIST_POOLS=true
REACT_APP_FAUCET_URL=
REACT_APP_IPFS_GATEWAY=https://centrifuge.mypinata.cloud/
Expand Down
1 change: 0 additions & 1 deletion centrifuge-app/.env-config/.env.demo
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
REACT_APP_COLLATOR_WSS_URL=wss://fullnode-apps.demo.k-f.dev
REACT_APP_DEFAULT_NODE_URL=https://pod-demo.k-f.dev
REACT_APP_DEFAULT_UNLIST_POOLS=true
REACT_APP_FAUCET_URL=https://europe-central2-peak-vista-185616.cloudfunctions.net/faucet-api-demo
REACT_APP_IPFS_GATEWAY=https://centrifuge.mypinata.cloud/
Expand Down
1 change: 0 additions & 1 deletion centrifuge-app/.env-config/.env.development
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
REACT_APP_COLLATOR_WSS_URL=wss://fullnode.development.cntrfg.com
REACT_APP_DEFAULT_NODE_URL=https://pod-development.k-f.dev
REACT_APP_DEFAULT_UNLIST_POOLS=false
REACT_APP_FAUCET_URL=https://europe-central2-peak-vista-185616.cloudfunctions.net/faucet-api-dev
REACT_APP_IPFS_GATEWAY=https://centrifuge.mypinata.cloud/
Expand Down
1 change: 0 additions & 1 deletion centrifuge-app/.env-config/.env.example
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
REACT_APP_COLLATOR_WSS_URL=wss://fullnode.development.cntrfg.com
REACT_APP_DEFAULT_NODE_URL=https://pod.development.cntrfg.com
REACT_APP_DEFAULT_UNLIST_POOLS=
REACT_APP_FAUCET_URL=https://europe-central2-peak-vista-185616.cloudfunctions.net/faucetDev
REACT_APP_IPFS_GATEWAY=https://centrifuge.mypinata.cloud/
Expand Down
1 change: 0 additions & 1 deletion centrifuge-app/.env-config/.env.ff-prod
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
REACT_APP_COLLATOR_WSS_URL=wss://fullnode.parachain.centrifuge.io
REACT_APP_DEFAULT_NODE_URL=''
REACT_APP_DEFAULT_UNLIST_POOLS=false
REACT_APP_FAUCET_URL=
REACT_APP_IPFS_GATEWAY=https://centrifuge.mypinata.cloud/
Expand Down
1 change: 0 additions & 1 deletion centrifuge-app/.env-config/.env.production
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
REACT_APP_COLLATOR_WSS_URL=wss://fullnode.parachain.centrifuge.io
REACT_APP_DEFAULT_NODE_URL=''
REACT_APP_DEFAULT_UNLIST_POOLS=false
REACT_APP_FAUCET_URL=
REACT_APP_IPFS_GATEWAY=https://centrifuge.mypinata.cloud/
Expand Down
1 change: 0 additions & 1 deletion centrifuge-app/declarations.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ interface ImportMetaEnv {
REACT_APP_WHITELISTED_ACCOUNTS: string
REACT_APP_NETWORK: 'altair' | 'centrifuge'
REACT_APP_POOL_CREATION_TYPE: 'immediate' | 'propose' | 'notePreimage'
REACT_APP_DEFAULT_NODE_URL: string
REACT_APP_FAUCET_URL: string
REACT_APP_ONBOARDING_API_URL: string
REACT_APP_TINLAKE_NETWORK: 'goerli' | 'mainnet'
Expand Down
10 changes: 0 additions & 10 deletions centrifuge-app/src/components/DebugFlags/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,11 @@ export type Key =
| 'editPoolVisibility'
| 'showAdvancedAccounts'
| 'editAdminConfig'
| 'showPodAccountCreation'
| 'convertAddress'
| 'showTestNets'
| 'showSwaps'
| 'showOracle'
| 'poolCreationType'
| 'podAdminSeed'
| 'assetSnapshots'
| 'showTokenYields'
| 'showOracleTx'
Expand Down Expand Up @@ -104,10 +102,6 @@ export const flagsConfig: Record<Key, DebugFlagConfig> = {
default: !!localStorage.getItem('debugFlags'),
type: 'checkbox',
},
podAdminSeed: {
default: '//Eve',
type: 'text',
},
poolCreationType: {
default: config.poolCreationType || 'immediate',
options: {
Expand All @@ -131,10 +125,6 @@ export const flagsConfig: Record<Key, DebugFlagConfig> = {
default: false,
type: 'checkbox',
},
showPodAccountCreation: {
default: false,
type: 'checkbox',
},
showSwaps: {
default: false,
type: 'checkbox',
Expand Down
41 changes: 0 additions & 41 deletions centrifuge-app/src/components/PodAuthSection.tsx

This file was deleted.

7 changes: 0 additions & 7 deletions centrifuge-app/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,9 @@ type EnvironmentConfig = {
baseCurrency: 'USD'
assetClasses: Record<'Public credit' | 'Private credit', string[]>
poolCreationType: TransactionOptions['createType']
useDocumentNfts: boolean
defaultPodUrl: string
}

const poolCreationType = import.meta.env.REACT_APP_POOL_CREATION_TYPE || 'immediate'
const defaultPodUrl = import.meta.env.REACT_APP_DEFAULT_NODE_URL || ''
export const isTestEnv =
(window.location.hostname.endsWith('k-f.dev') && !window.location.hostname.includes('production')) ||
window.location.hostname === 'localhost'
Expand All @@ -98,8 +95,6 @@ const ALTAIR: EnvironmentConfig = {
baseCurrency: 'USD',
assetClasses: { 'Private credit': ['Art NFTs'], 'Public credit': [] },
poolCreationType,
useDocumentNfts: true,
defaultPodUrl,
}

const CENTRIFUGE: EnvironmentConfig = {
Expand All @@ -125,8 +120,6 @@ const CENTRIFUGE: EnvironmentConfig = {
'Public credit': ['Corporate bonds', 'US treasuries'],
},
poolCreationType,
useDocumentNfts: true,
defaultPodUrl,
}

const ethNetwork = import.meta.env.REACT_APP_TINLAKE_NETWORK || 'mainnet'
Expand Down
10 changes: 0 additions & 10 deletions centrifuge-app/src/pages/IssuerCreatePool/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,6 @@ const initialValues: CreatePoolValues = {
maxReserve: '',
epochHours: 23, // in hours
epochMinutes: 50, // in minutes
podEndpoint: config.defaultPodUrl ?? '',
listed: !import.meta.env.REACT_APP_DEFAULT_UNLIST_POOLS,

issuerName: '',
Expand Down Expand Up @@ -673,15 +672,6 @@ function CreatePoolForm() {
)}
</Field>
</Box>
<Box gridColumn="span 2">
<FieldWithErrorMessage
validate={validate.podEndpoint}
name="podEndpoint"
as={TextInput}
label={`POD endpoint`}
placeholder="https://"
/>
</Box>
</Grid>
</PageSection>
<PageSection title="Issuer">
Expand Down
1 change: 0 additions & 1 deletion centrifuge-app/src/pages/IssuerCreatePool/validate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ export const validate = {
assetClass: required(),
subAssetClass: required(),
maxReserve: combine(required(), nonNegativeNumber(), max(Number.MAX_SAFE_INTEGER)),
podEndpoint: pattern(/^https?:\/\/.{4,}/, 'Not a valid URL'),
poolType: required(),

epochHours: combine(required(), nonNegativeNumber(), integer(), max(24 * 7 /* 1 week */)),
Expand Down
Loading

0 comments on commit 97c7763

Please sign in to comment.