Skip to content

Commit

Permalink
Merge pull request #2 from UXDProtocol/uxd_upgrade
Browse files Browse the repository at this point in the history
UXD admin calls integration
  • Loading branch information
sjillen authored Dec 12, 2021
2 parents 8c03691 + 20f85c8 commit 7c3a9bc
Show file tree
Hide file tree
Showing 29 changed files with 2,737 additions and 169 deletions.
5 changes: 3 additions & 2 deletions components/RealmHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@ const RealmHeader = () => {
const isBackNavVisible = realmInfo?.symbol !== REALM // hide backnav for the default realm

const mvpHost =
realmInfo?.symbol === 'MNGO'
? 'dao.mango.markets'
realmInfo?.symbol === 'UXD'
? 'oyster.uxd.fi'
: 'solana-labs.github.io/oyster-gov'

const mvpUrl = `https://${mvpHost}/#/realm/${realmInfo?.realmId.toBase58()}?programId=${realmInfo?.programId.toBase58()}`

return (
Expand Down
2 changes: 2 additions & 0 deletions components/instructions/programs/names.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ export const PROGRAM_NAMES = {
'675kPX9MHTjS2zt1qfr1NYHuzeLXfQM9H24wFSUt1Mp8': 'Raydium AMM Program',
EhhTKczWMGQt46ynNeRX1WfeagwwJd7ufHvCDjRxjo5Q: 'Raydium Staking Program',

CBSkoqgGtB4772H7FqeE6wz56rLbsxxbVjxEG6JmHzwG: 'UXD Protocol Devnet Program',

SysvarRent111111111111111111111111111111111: 'Sysvar: Rent',
SysvarC1ock11111111111111111111111111111111: 'Sysvar: Clock',

Expand Down
362 changes: 362 additions & 0 deletions components/instructions/programs/uxdProtocol.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,362 @@
import { Connection } from '@solana/web3.js'
import { struct, u8, u48 } from 'buffer-layout'
import { AccountMetaData } from '../../../models/accounts'

export const UXD_PROGRAM_INSTRUCTIONS = {
'73yvDSPxhtXmi8Gaheobm32n3jMdbvQzCahXgqqE12My': {
1: {
name: 'UXD - Initialize Controller',
accounts: [
'authority',
'payer',
'controller',
'redeemableMint',
'systemProgram',
'tokenProgram',
'rent',
],
getDataUI: (
_connection: Connection,
data: Uint8Array,
_accounts: AccountMetaData[]
) => {
const dataLayout = struct([
u8('bump'),
u8('redeemableBump'),
u8('redeemableMintDecimals'),
])

const args = dataLayout.decode(Buffer.from(data)) as any
console.log('args', args)
return (
<>
<p>{args}</p>
</>
)
},
},
2: {
name: 'UXD - Set Redeemable Global Supply Cap',
accounts: ['authority', 'controller'],
getDataUI: (
_connection: Connection,
data: Uint8Array,
_accounts: AccountMetaData[]
) => {
const dataLayout = struct([u48('redeemable_global_supply_cap')])

const args = dataLayout.decode(Buffer.from(data)) as any
console.log('args', args)
return (
<>
<p>{args}</p>
</>
)
},
},
3: {
name: 'UXD - Set Mango Depositories Redeemable Supply Soft Cap',
accounts: ['authority', 'controller'],
getDataUI: (
_connection: Connection,
data: Uint8Array,
_accounts: AccountMetaData[]
) => {
const dataLayout = struct([u48('redeemable_global_supply_cap')])

const args = dataLayout.decode(Buffer.from(data)) as any
console.log('args', args)
return (
<>
<p>{args}</p>
</>
)
},
},
4: {
name: 'UXD - Register Mango Depository',
accounts: [
'authority',
'payer',
'controller',
'depository',
'collateralMint', // BTC/ WSOL.....
'insuranceMint', // USDC
'depositoryCollateralPassthroughAccount',
'depositoryInsurancePassthroughAccount',
'depositoryMangoAccount',
'mangoGroup',
'rent',
'systemProgram',
'tokenProgram',
'mangoProgram',
],
getDataUI: (
_connection: Connection,
data: Uint8Array,
_accounts: AccountMetaData[]
) => {
const dataLayout = struct([u48('redeemable_global_supply_cap')])

const args = dataLayout.decode(Buffer.from(data)) as any
console.log('args', args)
return (
<>
<p>{args}</p>
</>
)
},
},
5: {
name: 'UXD - Deposit Insurance To Mango Depository',
accounts: [
'authority',
'controller',
'depository',
'insuranceMint',
'authorityInsurance',
'depositoryInsurancePassthroughAccount',
'depositoryMangoAccount',
// mango accounts for CPI
'mangoGroup',
'mangoCache',
'mangoRootBank',
'mangoNodeBank',
'mangoVault',
//
'tokenProgram',
'mangoProgram',
],
getDataUI: (
_connection: Connection,
data: Uint8Array,
_accounts: AccountMetaData[]
) => {
const dataLayout = struct([u48('redeemable_global_supply_cap')])

const args = dataLayout.decode(Buffer.from(data)) as any
console.log('args', args)
return (
<>
<p>{args}</p>
</>
)
},
},
6: {
name: 'UXD - Withdraw Insurance From Mango Depository',
accounts: [
'authority',
'controller',
'depository',
'insuranceMint',
'authorityInsurance',
'depositoryInsurancePassthroughAccount',
'depositoryMangoAccount',
// mango accounts for CPI
'mangoGroup',
'mangoCache',
'mangoSigner',
'mangoRootBank',
'mangoNodeBank',
'mangoVault',
//
'tokenProgram',
'mangoProgram',
],
getDataUI: (
_connection: Connection,
data: Uint8Array,
_accounts: AccountMetaData[]
) => {
const dataLayout = struct([u48('redeemable_global_supply_cap')])

const args = dataLayout.decode(Buffer.from(data)) as any
console.log('args', args)
return (
<>
<p>{args}</p>
</>
)
},
},
},
CBSkoqgGtB4772H7FqeE6wz56rLbsxxbVjxEG6JmHzwG: {
1: {
name: 'UXD - Initialize Controller',
accounts: [
'authority',
'payer',
'controller',
'redeemableMint',
'systemProgram',
'tokenProgram',
'rent',
],
getDataUI: (
_connection: Connection,
data: Uint8Array,
_accounts: AccountMetaData[]
) => {
const dataLayout = struct([
u8('bump'),
u8('redeemableBump'),
u8('redeemableMintDecimals'),
])

const args = dataLayout.decode(Buffer.from(data)) as any
console.log('args', args)
return (
<>
<p>{args}</p>
</>
)
},
},
2: {
name: 'UXD - Set Redeemable Global Supply Cap',
accounts: ['authority', 'controller'],
getDataUI: (
_connection: Connection,
data: Uint8Array,
_accounts: AccountMetaData[]
) => {
const dataLayout = struct([u48('redeemable_global_supply_cap')])

const args = dataLayout.decode(Buffer.from(data)) as any
console.log('args', args)
return (
<>
<p>{args}</p>
</>
)
},
},
3: {
name: 'UXD - Set Mango Depositories Redeemable Supply Soft Cap',
accounts: ['authority', 'controller'],
getDataUI: (
_connection: Connection,
data: Uint8Array,
_accounts: AccountMetaData[]
) => {
const dataLayout = struct([u48('redeemable_global_supply_cap')])

const args = dataLayout.decode(Buffer.from(data)) as any
console.log('args', args)
return (
<>
<p>{args}</p>
</>
)
},
},
4: {
name: 'UXD - Register Mango Depository',
accounts: [
'authority',
'payer',
'controller',
'depository',
'collateralMint', // BTC/ WSOL.....
'insuranceMint', // USDC
'depositoryCollateralPassthroughAccount',
'depositoryInsurancePassthroughAccount',
'depositoryMangoAccount',
'mangoGroup',
'rent',
'systemProgram',
'tokenProgram',
'mangoProgram',
],
getDataUI: (
_connection: Connection,
data: Uint8Array,
_accounts: AccountMetaData[]
) => {
const dataLayout = struct([u48('redeemable_global_supply_cap')])

const args = dataLayout.decode(Buffer.from(data)) as any
console.log('args', args)
return (
<>
<p>{args}</p>
</>
)
},
},
5: {
name: 'UXD - Deposit Insurance To Mango Depository',
accounts: [
'authority',
'controller',
'depository',
'insuranceMint',
'authorityInsurance',
'depositoryInsurancePassthroughAccount',
'depositoryMangoAccount',
// mango accounts for CPI
'mangoGroup',
'mangoCache',
'mangoSigner',
'mangoRootBank',
'mangoNodeBank',
'mangoVault',
//
'tokenProgram',
'mangoProgram',
],
getDataUI: (
_connection: Connection,
data: Uint8Array,
_accounts: AccountMetaData[]
) => {
const dataLayout = struct([u48('redeemable_global_supply_cap')])

const args = dataLayout.decode(Buffer.from(data)) as any
console.log('args', args)
return (
<>
<p>{args}</p>
</>
)
},
},
6: {
name: 'UXD - Withdraw Insurance From Mango Depository',
accounts: [
'authority',
'controller',
'depository',
'insuranceMint',
'authorityInsurance',
'depositoryInsurancePassthroughAccount',
'depositoryMangoAccount',
// mango accounts for CPI
'mangoGroup',
'mangoCache',
'mangoRootBank',
'mangoNodeBank',
'mangoVault',
//
'tokenProgram',
'mangoProgram',
],
getDataUI: (
_connection: Connection,
data: Uint8Array,
_accounts: AccountMetaData[]
) => {
const dataLayout = struct([u48('redeemable_global_supply_cap')])

const args = dataLayout.decode(Buffer.from(data)) as any
console.log('args', args)
return (
<>
<p>{args}</p>
</>
)
},
},
},
}
Loading

2 comments on commit 7c3a9bc

@vercel
Copy link

@vercel vercel bot commented on 7c3a9bc Dec 12, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deployment failed with the following error:

The most recent charge for your active payment method has failed. Please update it here: https://vercel.com/teams/uxdprotocol-governance/settings/billing.

@vercel
Copy link

@vercel vercel bot commented on 7c3a9bc Dec 12, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.