diff --git a/components/modals/DashboardSuggestedValuesModal.tsx b/components/modals/DashboardSuggestedValuesModal.tsx
index fd27eeaa..60a03e6d 100644
--- a/components/modals/DashboardSuggestedValuesModal.tsx
+++ b/components/modals/DashboardSuggestedValuesModal.tsx
@@ -79,6 +79,172 @@ const DashboardSuggestedValues = ({
setForcePythOracle(bank?.oracleProvider === OracleProvider.Pyth)
}, [bank.oracleProvider])
+ const proposeChanges = async () => {
+ const toRetier = [
+ { name: 'RLB', tier: 'D' },
+ { name: 'stSOL', tier: 'D' },
+ { name: 'LDO', tier: 'D' },
+ { name: 'EURC', tier: 'D' },
+ { name: 'NEON', tier: 'D' },
+ { name: 'RAY', tier: 'AA' },
+ { name: 'W', tier: 'AA' },
+ { name: 'PYTH', tier: 'AA' },
+ { name: 'MEW', tier: 'AA' },
+ { name: 'BONK', tier: 'AAA' },
+ { name: 'ETH (Portal)', tier: 'AAA' },
+ { name: 'WIF', tier: 'AAA' },
+ { name: 'wBTC (Portal)', tier: 'AAA' },
+ { name: 'TBTC', tier: 'AAA' },
+ { name: 'BLZE', tier: 'C' },
+ { name: 'GOFX', tier: 'C' },
+ { name: 'SOL', tier: 'S' },
+ { name: 'JitoSOL', tier: 'S' },
+ { name: 'USDT', tier: 'S' },
+ { name: 'MSOL', tier: 'S' },
+ { name: 'USDC', tier: 'S' },
+ { name: 'JLP', tier: 'S' },
+ { name: 'bSOL', tier: 'S' },
+ { name: 'INF', tier: 'S' },
+ { name: 'ZEUS', tier: 'A' },
+ { name: 'JSOL', tier: 'A' },
+ { name: 'POPCAT', tier: 'A' },
+ { name: 'DAI', tier: 'A' },
+ { name: 'DRIFT', tier: 'AA' },
+ { name: 'MOTHER', tier: 'AA' },
+ { name: 'USDY', tier: 'AA' },
+ { name: 'hubSOL', tier: 'AAA' },
+ { name: 'dualSOL', tier: 'AAA' },
+ { name: 'digitSOL', tier: 'AAA' },
+ { name: 'mangoSOL', tier: 'AAA' },
+ { name: 'compassSOL', tier: 'AAA' },
+ { name: 'stepSOL', tier: 'AAA' },
+ { name: 'Moutai', tier: 'C' },
+ { name: 'DUAL', tier: 'C' },
+ { name: 'META', tier: 'C' },
+ { name: 'GUAC', tier: 'C' },
+ { name: 'CORN', tier: 'C' },
+ { name: 'USDH', tier: 'C' },
+ { name: 'SLCL', tier: 'C' },
+ { name: 'MNGO', tier: 'C' },
+ { name: 'GECKO', tier: 'C' },
+ { name: 'ELON', tier: 'C' },
+ { name: 'GME', tier: 'C' },
+ { name: 'BILLY', tier: 'C' },
+ { name: 'DEAN', tier: 'C' },
+ { name: 'LNGCAT', tier: 'C' },
+ { name: 'OPOS', tier: 'D' },
+ { name: 'CROWN', tier: 'D' },
+ { name: 'ALL-OLD', tier: 'D' },
+ { name: 'KIN', tier: 'D' },
+ { name: 'CHAI', tier: 'S' },
+ ]
+ console.log(toRetier.length)
+ const proposalTx = []
+ for (const token of toRetier) {
+ const bank = group!.banksMapByName.get(token.name)
+ if (!bank) {
+ console.log('no token')
+ throw 'noo token'
+ }
+ const mintInfo = group!.mintInfosMapByMint.get(bank[0].mint.toBase58())!
+ if (!mintInfo) {
+ console.log('no mint info')
+ throw 'no mintinfo'
+ }
+
+ const ix = await client!.program.methods
+ .tokenEdit(
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ false,
+ false,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ //do not edit of interest curve scaling
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ false,
+ false,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ token.tier,
+ )
+ .accounts({
+ group: group!.publicKey,
+ fallbackOracle: PublicKey.default,
+ oracle: bank[0]!.oracle!,
+ admin: MANGO_DAO_WALLET,
+ mintInfo: mintInfo.publicKey,
+ })
+ .remainingAccounts([
+ {
+ pubkey: bank[0].publicKey!,
+ isWritable: true,
+ isSigner: false,
+ } as AccountMeta,
+ ])
+ .instruction()
+ proposalTx.push(ix)
+ }
+ try {
+ const walletSigner = wallet as never
+
+ const index = proposals ? Object.values(proposals).length : 0
+ const proposalAddress = await createProposal(
+ connection,
+ client,
+ walletSigner,
+ MANGO_DAO_WALLET_GOVERNANCE,
+ voter.tokenOwnerRecord!,
+ `Edit tokens tier params`,
+ '',
+ index,
+ proposalTx,
+ vsrClient!,
+ fee,
+ )
+ window.open(
+ `https://dao.mango.markets/dao/MNGO/proposal/${proposalAddress.toBase58()}`,
+ '_blank',
+ )
+ } catch (e) {
+ notify({
+ title: 'Error during proposal creation',
+ description: `${e}`,
+ type: 'error',
+ })
+ }
+ }
+
const proposeNewSuggestedValues = useCallback(
async (
bank: Bank,
@@ -679,6 +845,7 @@ const DashboardSuggestedValues = ({
>
{proposing ? : 'Propose new suggested values'}
+
)}
diff --git a/utils/governance/instructions/createProposal.ts b/utils/governance/instructions/createProposal.ts
index 26f21cc2..8601dfe7 100644
--- a/utils/governance/instructions/createProposal.ts
+++ b/utils/governance/instructions/createProposal.ts
@@ -28,6 +28,14 @@ import {
MangoClient,
} from '@blockworks-foundation/mango-v4'
import { sendTxAndConfirm } from '../tools'
+import {
+ SequenceType,
+ TransactionInstructionWithSigners,
+} from '@blockworks-foundation/mangolana/lib/globalTypes'
+import {
+ sendSignAndConfirmTransactions,
+ TransactionInstructionWithType,
+} from '@blockworks-foundation/mangolana/lib/transactions'
export const createProposal = async (
connection: Connection,
@@ -139,20 +147,35 @@ export const createProposal = async (
undefined,
)
- const txChunks = chunk([...instructions, ...insertInstructions], 2)
-
const transactions: Transaction[] = []
const latestBlockhash = await connection.getLatestBlockhash('processed')
- for (const chunk of txChunks) {
- const tx = new Transaction()
- tx.add(createComputeBudgetIx(fee))
- tx.add(...chunk)
- tx.lastValidBlockHeight = latestBlockhash.lastValidBlockHeight
- tx.recentBlockhash = latestBlockhash.blockhash
- tx.feePayer = payer
- transactions.push(tx)
- }
+ const transactionInstructions: TransactionInstructionWithType[] = []
+ chunk([...instructions, ...insertInstructions], 2).map((chunkInstructions) =>
+ transactionInstructions.push({
+ instructionsSet: [
+ new TransactionInstructionWithSigners(createComputeBudgetIx(80000)),
+ ...chunkInstructions.map(
+ (inst) => new TransactionInstructionWithSigners(inst),
+ ),
+ ],
+ sequenceType: SequenceType.Sequential,
+ }),
+ )
+
+ await sendSignAndConfirmTransactions({
+ connection,
+ wallet: wallet,
+ backupConnections: [],
+ transactionInstructions: transactionInstructions,
+ config: {
+ maxTxesInBatch: 10,
+ maxRetries: 3,
+ autoRetry: true,
+ logFlowInfo: true,
+ useVersionedTransactions: true,
+ },
+ })
const signedTransactions = await wallet.signAllTransactions(transactions)
for (const tx of signedTransactions) {
await sendTxAndConfirm(
diff --git a/yarn.lock b/yarn.lock
index b7fdc80b..e94812eb 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -10826,14 +10826,14 @@ node-addon-api@^7.0.0:
resolved "https://registry.yarnpkg.com/node-addon-api/-/node-addon-api-7.1.0.tgz#71f609369379c08e251c558527a107107b5e0fdb"
integrity sha512-mNcltoe1R8o7STTegSOHdnJNN7s5EUvhoS7ShnTHDyOSd+8H+UdWODq6qSv67PjC8Zc5JRT8+oLAMCr0SIXw7g==
-node-fetch@3.3.2, "node-fetch@npm:@blockworks-foundation/node-fetch@2.6.11":
+node-fetch@3.3.2, node-fetch@^2.6.12, node-fetch@^2.7.0, "node-fetch@npm:@blockworks-foundation/node-fetch@2.6.11":
version "2.6.11"
resolved "https://registry.yarnpkg.com/@blockworks-foundation/node-fetch/-/node-fetch-2.6.11.tgz#fb536ef0e6a960e7b7993f3c1d3b3bba9bdfbc56"
integrity sha512-HeDTxpIypSR4qCoqgUXGr8YL4OG1z7BbV4VhQ9iQs+pt2wV3MtqO+sQk2vXK3WDKu5C6BsbGmWE22BmIrcuOOw==
dependencies:
whatwg-url "^5.0.0"
-node-fetch@^2.6.1, node-fetch@^2.6.12, node-fetch@^2.6.7, node-fetch@^2.7.0:
+node-fetch@^2.6.1, node-fetch@^2.6.7:
version "2.7.0"
resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.7.0.tgz#d0f0fa6e3e2dc1d27efcd8ad99d550bda94d187d"
integrity sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==
@@ -12764,6 +12764,7 @@ string-length@^4.0.1:
strip-ansi "^6.0.0"
"string-width-cjs@npm:string-width@^4.2.0", "string-width@^1.0.2 || 2 || 3 || 4", string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3:
+ name string-width-cjs
version "4.2.3"
resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010"
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
@@ -12884,6 +12885,7 @@ stringify-entities@^4.0.0:
character-entities-legacy "^3.0.0"
"strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@^6.0.0, strip-ansi@^6.0.1:
+ name strip-ansi-cjs
version "6.0.1"
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9"
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
@@ -14340,6 +14342,7 @@ word-wrap@^1.2.5:
integrity sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA==
"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0", wrap-ansi@^7.0.0:
+ name wrap-ansi-cjs
version "7.0.0"
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43"
integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==