Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
286 commits
Select commit Hold shift + click to select a range
eea667a
Agrippa/fix-vsr-govpower-loading (#2078)
asktree Jan 24, 2024
40bd6e2
show members tab if council exists (#2076)
asktree Jan 24, 2024
d8c0afb
paginate DAS queries
asktree Jan 24, 2024
41aaf73
Merge pull request #2080 from solana-labs:agrippa/bonkedao-issue
asktree Jan 24, 2024
a0421b6
chai price fix (#2083)
abrzezinski94 Jan 25, 2024
596ea98
fix chai price v2 (#2086)
abrzezinski94 Jan 25, 2024
3c894bd
add tier matching mango (#2087)
abrzezinski94 Jan 27, 2024
b410a31
remove deposit limit from compare of tier (#2088)
abrzezinski94 Jan 28, 2024
7611ef7
use react query caching, silence 403s (#2085)
ndrabins Jan 28, 2024
ab40bee
filter out unwanted realms (#2089)
abrzezinski94 Jan 29, 2024
099cf72
governance notifier upgrade shorter msgs (#2095)
abrzezinski94 Jan 30, 2024
5774d91
add moutai dao+fund (#2094)
adidogCEO Jan 30, 2024
82e67eb
Revert "governance notifier upgrade shorter msgs (#2095)" (#2096)
abrzezinski94 Jan 30, 2024
14f8c82
fallback for edit token decoding (#2097)
abrzezinski94 Jan 31, 2024
7cd094d
[Pyth] Display voting power properly (#2098)
guibescos Feb 2, 2024
a73bb61
fix vsr + clawback (#2100)
abrzezinski94 Feb 2, 2024
dfed814
fallback for broken group.pis mango edit token (#2108)
abrzezinski94 Feb 4, 2024
e74924b
pin node 18 (#2109)
asktree Feb 5, 2024
e3cd3a9
[pyth] Bump wallet connect adapter (#2106)
guibescos Feb 5, 2024
2d49a04
add spill account field in the upgrade form (#2107)
0xShuk Feb 5, 2024
9084d79
fix decoing of editing token mango v4 (#2111)
abrzezinski94 Feb 6, 2024
49ea179
remove explicit withAddSignatory when creating proposal (#2112)
asktree Feb 6, 2024
c2c35dd
fix label token edit (#2115)
abrzezinski94 Feb 7, 2024
42693a7
Filter delegators query (#2116)
asktree Feb 7, 2024
19c8935
Dual lockup option update to config v2 (#2119)
brittcyr Feb 8, 2024
c7a35f2
add apache license (#2121)
abrzezinski94 Feb 8, 2024
7205c48
Use BN for Staking Option Ix (#2120)
DonDuala Feb 9, 2024
3f53acb
update dual finance gso version (#2122)
brittcyr Feb 9, 2024
5630d70
Change the name of Our DAO from GRLA DAO to GARBAGE DAO (#2118)
B33pin Feb 9, 2024
5482cc5
Feature/fix repropopose button (#2123)
abrzezinski94 Feb 10, 2024
c780b56
deanslistDAO treasury naming (#2124)
vunax Feb 12, 2024
19f13c3
remove token jup ref account creation (#2126)
abrzezinski94 Feb 12, 2024
7dea43f
Feature: improve mango modal (#2117)
Redfox Feb 12, 2024
0e5988c
Revert "remove explicit withAddSignatory when creating proposal" (#2127)
abrzezinski94 Feb 12, 2024
ed8a796
fixed with the correct addresses. (#2128)
vunax Feb 13, 2024
f196cfa
withdraw all fees button (#2131)
abrzezinski94 Feb 14, 2024
ac8f476
change prefix for dist mango (#2132)
abrzezinski94 Feb 14, 2024
5044d22
fix display of the nota option (#2135)
0xShuk Feb 15, 2024
2718e30
Fix query invalidation (#2137)
ndrabins Feb 15, 2024
8d22a5f
upgrade settings lib (#2140)
abrzezinski94 Feb 16, 2024
c6a20df
Feature/decode fix mango (#2147)
abrzezinski94 Feb 19, 2024
5f8416f
fix error on domains load (#2148)
abrzezinski94 Feb 20, 2024
cc99fba
decode for boost (#2150)
abrzezinski94 Feb 21, 2024
3985d91
mango v23 test integration (#2154)
abrzezinski94 Feb 22, 2024
d4ad771
build fix (#2155)
abrzezinski94 Feb 22, 2024
d3a2199
fix mango edit borrows decode (#2156)
abrzezinski94 Feb 22, 2024
cf2271f
fix v23 token regsiter fallback (#2158)
abrzezinski94 Feb 24, 2024
472c479
usdc deposit to boost (#2161)
abrzezinski94 Feb 24, 2024
8f8427e
fix withdraw bug (#2163)
abrzezinski94 Feb 25, 2024
06ff1ea
[pyth] add mesh instructions (#2164)
guibescos Mar 1, 2024
a9fa661
mango v22 (#2167)
abrzezinski94 Mar 4, 2024
26a2848
add fabs to realms dao (#2125)
ZeroTimeDrift Mar 4, 2024
d835525
feat: add withdraw tab to Mango Modal (#2168)
Redfox Mar 6, 2024
ef1fc86
fix vanilla gov power fetch
0xShuk Mar 7, 2024
b415f6a
add undefined type
0xShuk Mar 7, 2024
1261856
Merge pull request #2171 from solana-labs/0xShuk-patch-1
0xShuk Mar 8, 2024
5754a84
add proposal warning for mismatch buffer authority
0xShuk Mar 10, 2024
a54a549
fix lint error
0xShuk Mar 10, 2024
cc0aa2a
merge v22 - v23 mango (#2176)
abrzezinski94 Mar 10, 2024
20318d3
fix fee estimamte (#2177)
abrzezinski94 Mar 11, 2024
9570654
Agrippa/hide-old-drift (#2178)
asktree Mar 11, 2024
842b018
reduce some imgs size (#2179)
abrzezinski94 Mar 11, 2024
fc33ab5
update mango prefix (#2180)
abrzezinski94 Mar 11, 2024
6e3562f
Merge pull request #2175 from solana-labs/0xshuk-buffer-auth-warning
0xShuk Mar 12, 2024
7bcecb7
Update code to use ENV vars for Jupiter swap api #77 (#2169)
zer0cache Mar 12, 2024
4e08b52
fix fee for retry (#2182)
abrzezinski94 Mar 13, 2024
7661304
fix fee multipler (#2184)
abrzezinski94 Mar 14, 2024
2f939f0
upgrade mango lib (#2186)
abrzezinski94 Mar 14, 2024
b6846b8
fix (#2187)
abrzezinski94 Mar 16, 2024
59c6c95
fix typos
xiaoxianBoy Mar 17, 2024
f982c02
boost council labels (#2190)
abrzezinski94 Mar 17, 2024
7cf172e
filter empty transactions
0xShuk Mar 19, 2024
71c5d59
Merge pull request #2191 from solana-labs/0xshuk-fix-new-dao-wizard
0xShuk Mar 19, 2024
c58bb11
Merge pull request #2189 from xiaoxianBoy/fixdevelop
0xShuk Mar 19, 2024
f99e138
deposit limit format fix edit token mango (#2193)
abrzezinski94 Mar 20, 2024
3727bbe
Feature/qv milestone 2 (#2151)
dankelleher Mar 21, 2024
c098254
Revert "Feature/qv milestone 2 (#2151)" (#2198)
SebastianBor Mar 21, 2024
3cbc32b
fix chunking for big multi signature wallet creation + openbook v2 na…
abrzezinski94 Mar 21, 2024
befdaf7
Remove default visibility for Squads ixs (#2206)
0xShuk Mar 24, 2024
8d556ad
add metadata for Pawngo DAO (#2207)
ilovespectra Mar 24, 2024
e8239be
update mango dist prefix (#2208)
abrzezinski94 Mar 25, 2024
28072a0
update token record preference (#2209)
0xShuk Mar 26, 2024
4e3a9fc
add recover account functionality (#2211)
keyvankhademi Mar 28, 2024
e86ff72
Show mango deposits in treasury and add those values to total treasur…
Redfox Mar 31, 2024
a30c55b
add collaterial fee field to mango edit (#2218)
abrzezinski94 Apr 2, 2024
8530972
Update TensorDAO (#2219)
ilmoi Apr 2, 2024
d147cc0
fix treasury total refresh (#2221)
abrzezinski94 Apr 3, 2024
dc516b2
feat: upgrade library to add metamask solflare support. (#2220)
dawnseeker8 Apr 4, 2024
a234b78
Feature/qv milestone 3 (#2204)
dankelleher Apr 4, 2024
111da5a
add Jito DAO (#2222)
0xShuk Apr 4, 2024
52fc063
Add sinDAO (#2173)
sindaodev Apr 4, 2024
aa42f7f
fix max duration constraint for token unlock (#2223)
0xShuk Apr 4, 2024
6b73b87
add burn instruction (#2224)
0xShuk Apr 5, 2024
fae5a9f
Fix issue with reproposing not matching correctly to the community mi…
dankelleher Apr 7, 2024
cd3c741
use backup rpc (#2229)
abrzezinski94 Apr 7, 2024
12ab2a3
fix: vsr vote authority key (#2230)
0xShuk Apr 8, 2024
3e810fb
replace parseInt check from deposit (#2231)
0xShuk Apr 9, 2024
9ae2b47
use new send function for deposit ix (#2233)
0xShuk Apr 9, 2024
7d882a0
fix stats page and registar vsr seed (#2235)
abrzezinski94 Apr 10, 2024
a29b38c
fix withdraw button logic (#2234)
0xShuk Apr 12, 2024
eab013f
min token check in council TOR (#2242)
0xShuk Apr 12, 2024
36d89ac
Update airdrop for new version (#2241)
brittcyr Apr 12, 2024
c96409a
add realm name check (#2243)
0xShuk Apr 13, 2024
0c70df8
fix collateral fee format (#2244)
abrzezinski94 Apr 13, 2024
427bd59
fix token stats (#2246)
abrzezinski94 Apr 13, 2024
0f27c59
fix protobufjs version (#2245)
abrzezinski94 Apr 13, 2024
7d4215d
zero util rate mango decode (#2247)
abrzezinski94 Apr 14, 2024
5cde538
fix buffer check (#2248)
abrzezinski94 Apr 15, 2024
03badbd
upgrade mango settings lib (#2250)
abrzezinski94 Apr 15, 2024
632eac0
optimize unreleased nft claim function (#2251)
0xShuk Apr 16, 2024
1c4b958
fix mango client init (#2252)
abrzezinski94 Apr 17, 2024
f36f7bb
fix overflow in burn ix (#2253)
0xShuk Apr 17, 2024
f2a99d2
max rate label fix mango (#2255)
abrzezinski94 Apr 19, 2024
91b7c74
fix ix chunk size in edit config form (#2258)
0xShuk Apr 22, 2024
0f2c746
api mango parsed proposal (#2259)
abrzezinski94 Apr 22, 2024
01410f9
Delegate vote fix (#2254)
dankelleher Apr 22, 2024
5f1fe91
Add FinanceIsMagic DAO (#2262)
machinemonk Apr 23, 2024
3608e40
fix: restore target in create proposal (#2263)
guibescos Apr 24, 2024
b3a0a50
Bugfix: Fixing delegate vote when delegate has no power (#2261)
chriteixeira Apr 24, 2024
e43e78a
feat: improve program upgrade select (#2264)
guibescos Apr 25, 2024
200556e
Feature/add to calendar (#2267)
abrzezinski94 Apr 25, 2024
74c0730
Bugfix: Acting as delegator vote (#2268)
chriteixeira Apr 26, 2024
242f992
[plugin] add drift voter plugin (#2269)
asktree Apr 26, 2024
85b15bb
fix col fee decimals (#2270)
abrzezinski94 Apr 27, 2024
399dbbd
feat: upgrade dialect (#2265)
zhelezkov Apr 27, 2024
b754a62
[WIP] fix: VWR not being created on token deposit (#2273)
chriteixeira Apr 30, 2024
88603ee
fix switchboard link and repropose chunking (#2281)
abrzezinski94 May 2, 2024
e8d55a8
Add Mewfasa DAO (#2278)
fnjorge May 3, 2024
0a04bd4
[plugin] add token-haver plugin (#2283)
asktree May 4, 2024
74d6dcb
fix withdraw/deposit to mango proposal title (#2285)
abrzezinski94 May 4, 2024
026431c
Add POLL pfp & banner (#2287)
DimiMili May 8, 2024
be8fe78
remove realms explorer (#2290)
0xShuk May 9, 2024
b8503ec
fix mango edit decode (#2291)
abrzezinski94 May 9, 2024
9f5fa0d
adjust token amount by mint decimals in params view (#2297)
asktree May 10, 2024
b107d81
add some mango aux accounts (#2298)
abrzezinski94 May 13, 2024
0ecb1c4
fix jupiter url (#2301)
abrzezinski94 May 14, 2024
2914a8b
Fix for missing custom config in editrealmsconfig (#2280)
dankelleher May 14, 2024
3031dd1
remove triton token
asktree May 14, 2024
769406e
Merge pull request #2302 from solana-labs:agrippa/remove-tokens-oops
asktree May 14, 2024
00f5b2c
Agrippa/drift-metadata (#2303)
asktree May 14, 2024
4fd6185
Fix for missing instructions in qv coefficient proposal (#2300)
dankelleher May 14, 2024
210fc8f
fix uncached drift plugin queries (#2304)
asktree May 14, 2024
b1e1273
fix drift access b4 initialization.. oops (#2305)
asktree May 14, 2024
a11c5fd
Feature/remove lockup inst (#2309)
abrzezinski94 May 15, 2024
a95aa63
Fix: Delegator with no power can create proposal and batch vote (#2307)
chriteixeira May 15, 2024
20b5b9a
fix loan fee rate mango (#2311)
abrzezinski94 May 16, 2024
f9f567c
Chore: Change gateway button style (#2310)
chriteixeira May 17, 2024
364ca73
mango vsr endpoint (#2312)
abrzezinski94 May 17, 2024
c84962f
fix mango acc reload + upgrade mango libs (#2313)
abrzezinski94 May 17, 2024
234496c
fix gate ix (#2314)
abrzezinski94 May 18, 2024
5f5fdba
custom voting card for token-haver
asktree May 19, 2024
e96421d
Merge pull request #2316 from solana-labs:agrippa/peepoo
asktree May 19, 2024
a267756
re-shift token haver power (#2318)
asktree May 19, 2024
39688d1
fix unique keys warning (#2317)
asktree May 19, 2024
fd26487
change token-haver program id (#2315)
asktree May 19, 2024
bb20519
add "join" btn to token-haver (#2319)
asktree May 19, 2024
4b880f7
Vote Plugin no longer returns TOR as the default VWR if no plugins ar…
dankelleher May 20, 2024
deec94f
Update The $GREED Experiment (#2322)
SolVoshy May 21, 2024
057b55a
[WIP] Factor in max voter weight config when calculating max weight (…
dankelleher May 21, 2024
faabe1b
Fix: VoterWeightPks are not retrieved after wallet is connected (#2323)
chriteixeira May 22, 2024
34fa56f
Add metadata for The $GREED Experiment (#2324)
SolVoshy May 22, 2024
b829c44
removing the wrong banner from GREED DAO (#2325)
SolVoshy May 22, 2024
c13ab30
Add banner and replace logo url for GREED (#2333)
SolVoshy May 27, 2024
a215210
add stake account decode and proposed by filed to proposal title (#2334)
abrzezinski94 May 28, 2024
c474a97
deploy test (#2335)
abrzezinski94 May 28, 2024
473697e
deployment test (#2336)
abrzezinski94 May 28, 2024
582cf2d
chore: Update comment (#2337)
SebastianBor May 28, 2024
6055836
allow council to comment in the DAOs using plugin (#2342)
0xShuk May 30, 2024
574b38e
chore: Deploy (#2343)
SebastianBor May 30, 2024
678d4a2
withdraw on stake decode fix (#2346)
abrzezinski94 Jun 1, 2024
b24febc
Advocat Dao (#2345)
WildThingCrypto Jun 4, 2024
e183547
Add Guacamole (#2338)
Guacgg Jun 5, 2024
a3a2582
update proposal warnings (#2356)
0xShuk Jun 5, 2024
1d9dc88
fix mango accounts api (#2359)
abrzezinski94 Jun 6, 2024
a4131c0
show voters count in Explore page (#2360)
0xShuk Jun 10, 2024
23e0749
legal dao (#2361)
abrzezinski94 Jun 11, 2024
bbda991
fix lite rpc url (#2364)
abrzezinski94 Jun 12, 2024
a199326
fix lite rpc url (#2365)
abrzezinski94 Jun 13, 2024
8cfde71
Add actions.json (Dialect) (#2363)
tsmbl Jun 14, 2024
37d6c39
sanctum deposit to stake inst checkpoint (#2362)
abrzezinski94 Jun 16, 2024
b043b58
fix lite rpc url (#2366)
abrzezinski94 Jun 17, 2024
6f282aa
optimize TOR fetch for council-only display (#2367)
0xShuk Jun 19, 2024
a1604c4
show variable suggested lockup durations in UI (#2372)
0xShuk Jun 23, 2024
0ee78e7
fix mango edit token parse (#2373)
abrzezinski94 Jun 24, 2024
d2a25fd
sanctum withdraw from stake (#2374)
abrzezinski94 Jun 26, 2024
78323af
Feature/fix token edit mango (#2375)
abrzezinski94 Jun 27, 2024
ef673cf
fetch individual TOR on the proposal page (#2377)
0xShuk Jun 29, 2024
88461ee
add: batch token transfer (#2371)
0xShuk Jul 6, 2024
c1c4d87
fix dist number (#2378)
abrzezinski94 Jul 8, 2024
5be5e09
add the members display for VSR DAOs (#2379)
0xShuk Jul 9, 2024
50a3316
replace: 'council' with 'members' in header (#2380)
0xShuk Jul 11, 2024
ae46ea5
add aux account to mango (#2381)
abrzezinski94 Jul 14, 2024
660d6b4
fix mango edit inst (#2382)
abrzezinski94 Jul 16, 2024
aca2814
fix: Leave DAO form error (#2383)
0xShuk Jul 16, 2024
607aa86
Update actions.json (dialect) (#2384)
0xShuk Jul 17, 2024
523dbfb
replace lite url (#2386)
abrzezinski94 Jul 19, 2024
2f20757
fix chunk of mango modal (#2387)
abrzezinski94 Jul 20, 2024
c4449d6
Parcl staking (#2385)
DMJ16 Jul 20, 2024
c04bfb7
fix deposit limits (#2388)
abrzezinski94 Jul 23, 2024
8e540e9
fix undefined plugin issue (#2389)
0xShuk Jul 23, 2024
bd87c06
upgrade mango client (#2393)
abrzezinski94 Jul 29, 2024
3ae8855
fix deposit limit parsing mango (#2394)
abrzezinski94 Jul 29, 2024
74a5f8e
fix dist number 135 (#2395)
abrzezinski94 Jul 30, 2024
494b3f6
fix staging url (#2396)
abrzezinski94 Jul 31, 2024
123c4bb
remove deprecated bonfida dao (#2397)
dr497 Aug 2, 2024
6239af1
Typo: Update WithdrawStake.tsx (#2398)
jnwng Aug 7, 2024
d2021d8
Add Epicentral Labs DAO (fixes made) (#2401)
TheLazySol Aug 9, 2024
fd56777
change dist number mango (#2402)
abrzezinski94 Aug 12, 2024
13bd508
fix allow scripts (#2406)
abrzezinski94 Aug 13, 2024
e8165df
Add old bonfida DAO to hidden Realms (#2404)
dr497 Aug 14, 2024
b67bc0d
upgrade ts and linting libs (#2408)
abrzezinski94 Aug 16, 2024
1071757
Logo & Description of FOXTAG (#2409)
vunax Aug 17, 2024
44108f8
minor fix (#2410)
0xShuk Aug 18, 2024
23233f1
remove balance validation from stake account fetch (#2412)
0xShuk Aug 20, 2024
9e7ce45
increase suggested lock period array length (#2416)
0xShuk Aug 22, 2024
9e569c6
fix loading of mango wallet (#2417)
abrzezinski94 Aug 24, 2024
c94cd73
Update Drift IDL (#2422)
0xShuk Aug 26, 2024
30e7873
add new governance package (#2423)
0xShuk Aug 26, 2024
d1982c3
fix schema error (#2424)
0xShuk Aug 27, 2024
4e9f770
Add error handling on very large comment during voting. (#2413)
PanoSui Aug 27, 2024
ef5e017
Change "Epicentral Labs DAO" to "EpicentralDAO" (#2425)
TheLazySol Aug 27, 2024
4271031
fix assertion error in deposit card (#2426)
0xShuk Aug 28, 2024
51d9c39
bump: pyth vsr package (#2428)
guibescos Aug 29, 2024
133d4a7
Update plugins.ts (#2421)
T3chie-404 Aug 29, 2024
4372c36
XANDC update (#2419)
T3chie-404 Aug 29, 2024
2a5d38c
Symmetry x Realms Integration (#2418)
0xbridges Aug 29, 2024
06f2aed
change date format in deposit card (#2429)
0xShuk Aug 29, 2024
1179372
upgrade client (#2430)
abrzezinski94 Aug 29, 2024
f409a65
Add CoalitionDAO (#2432)
Findiglay Sep 2, 2024
e44944d
fix veto vote release (#2435)
0xShuk Sep 2, 2024
cb05a85
feat: add pyth update pool authority instruction (#2436)
guibescos Sep 4, 2024
ad733a3
Add DAO account selector for edit,deposit,withdraw on Symmetry integr…
0xbridges Sep 4, 2024
30b55a0
JetSki DAO Logo & Banner (#2438)
vunax Sep 5, 2024
30e8545
fix spl-governance sdk package error (#2439)
0xShuk Sep 5, 2024
b539996
change ownership details (#2443)
0xShuk Sep 19, 2024
ceea061
Updated jup token fetch to directly load unverified tokens (#2403)
ritrafa Sep 24, 2024
9290275
feat(pyth): use the new pyth sdk (#2445)
keyvankhademi Sep 25, 2024
54c980e
add accept terms popup (#2449)
0xShuk Sep 28, 2024
3d04b53
update the ownership details (#2450)
0xShuk Sep 30, 2024
df283b5
fix mango edit token instruction tier (#2451)
abrzezinski94 Oct 2, 2024
5807061
Add UI elements for Pumpkin's Pool DAO (#2452)
bartenbach Oct 4, 2024
28afc52
Add Mergey Metadata to Realms UI (#2446)
pindaroso Oct 4, 2024
ffd1448
Add IKB (#2442)
ikb-token Oct 4, 2024
f2ba02c
CreateNewProposalWithInsufficientPower (#2440)
PanoSui Oct 4, 2024
274e5f2
Revised PibbleDAO info (#2448)
PibbleDevxyz Oct 6, 2024
a55b94f
Revert "Updated jup token fetch to directly load unverified tokens (#…
0xShuk Oct 6, 2024
289c36a
Revert "CreateNewProposalWithInsufficientPower (#2440)" (#2454)
0xShuk Oct 7, 2024
23aecf9
upgrade mangolana lib (#2455)
abrzezinski94 Oct 9, 2024
b3d2df6
fix env in api (#2456)
abrzezinski94 Oct 10, 2024
888913a
Update README.md (#2480)
SebastianBor Feb 9, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 1 addition & 0 deletions .env.sample
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ DEVNET_RPC=https://mango.devnet.rpcpool.com

DEFAULT_GOVERNANCE_PROGRAM_ID=GTesTBiEWE32WHXXE2S4XbZvA5CrEc4xs6ZgRe895dP

NEXT_PUBLIC_JUPTER_SWAP_API_ENDPOINT=https://quote-api.jup.ag/v6
NEXT_PUBLIC_API_ENDPOINT=https://api.realms.today/graphql
NEXT_PUBLIC_DISCORD_APPLICATION_CLIENT_ID=1042836142560645130
NEXT_PUBLIC_DISCORD_MATCHDAY_CLIENT_ID=1044361939322683442
Expand Down
46 changes: 23 additions & 23 deletions .github/workflows/ci-main-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:

- name: Run CodeQL
uses: github/codeql-action/analyze@v2

sca:
name: Dependency Scan
runs-on: ubuntu-latest
Expand Down Expand Up @@ -54,41 +54,41 @@ jobs:
format: 'table'
severity: 'CRITICAL'
exit-code: '1'

- name: Upload scan results
uses: github/codeql-action/upload-sarif@v2
uses: github/codeql-action/upload-sarif@v3
if: always()
with:
sarif_file: 'trivy-results.sarif'

test:
name: Run Tests
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
name: Run Tests
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 18
cache: yarn
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20
cache: yarn

- name: Cache dependencies
uses: actions/cache@v3
with:
path: '**/node_modules'
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
- name: Cache dependencies
uses: actions/cache@v3
with:
path: '**/node_modules'
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}

- name: Install dependencies
run: yarn ci
- name: Install dependencies
run: yarn ci

- name: Run tests
run: yarn test-all
- name: Run tests
run: yarn test-all

pass:
name: All tests pass
needs: ['sast', 'sca', 'test']
runs-on: ubuntu-latest
steps:
- run: echo ok
- run: echo ok
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
lts/gallium
lts/iron
1 change: 1 addition & 0 deletions .vscode/deploy.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Please deploy
1 change: 0 additions & 1 deletion .yarnrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
--frozen-lockfile true
--add.exact true
ignore-scripts true
2 changes: 2 additions & 0 deletions @types/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@ export interface EndpointInfo {
name: EndpointTypes
url: string
}

export type GovernanceRole = 'council' | 'community';
259 changes: 259 additions & 0 deletions DriftStakeVoterPlugin/DriftVoterClient.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,259 @@
import { BN, Program, Provider } from '@coral-xyz/anchor'
import { Client } from '@solana/governance-program-library'
import {
getTokenOwnerRecordAddress,
SYSTEM_PROGRAM_ID,
} from '@solana/spl-governance'
import { PublicKey, TransactionInstruction } from '@solana/web3.js'
import { DriftStakeVoter, IDL } from './idl/driftStakeVoter'
import { IDL as DriftIDL } from './idl/drift'
import {
getInsuranceFundStakeAccountPublicKey,
getInsuranceFundVaultPublicKey,
getSpotMarketPublicKey,
unstakeSharesToAmountWithOpenRequest,
} from './driftSdk'
import { fetchTokenAccountByPubkey } from '@hooks/queries/tokenAccount'
import { DRIFT_STAKE_VOTER_PLUGIN } from './constants'
import { fetchRealmByPubkey } from '@hooks/queries/realm'
import queryClient from '@hooks/queries/queryClient'

export class DriftVoterClient extends Client<DriftStakeVoter> {
readonly requiresInputVoterWeight = true

async _fetchRegistrar(realm: PublicKey, mint: PublicKey) {
const { registrar: registrarPk } = this.getRegistrarPDA(realm, mint)
const registrar = await queryClient.fetchQuery(
['Drift', 'Plugin Registrar', registrarPk],
() => this.program.account.registrar.fetch(registrarPk)
)
return registrar
}

constructor(
public program: Program<DriftStakeVoter>,
public devnet: boolean
) {
super(program, devnet)
}

async calculateMaxVoterWeight(
_realm: PublicKey,
_mint: PublicKey
): Promise<BN | null> {
console.log(
'drift voter client was just asked to calculate max voter weight'
)
const { result: realm } = await fetchRealmByPubkey(
this.program.provider.connection,
_realm
)
console.log('drift voter client realm', realm)
return realm?.account.config?.communityMintMaxVoteWeightSource.value ?? null // TODO this code should not actually be called because this is not a max voter weight plugin
}

async calculateVoterWeight(
voter: PublicKey,
realm: PublicKey,
mint: PublicKey,
inputVoterWeight: BN
): Promise<BN | null> {
const registrar = await this._fetchRegistrar(realm, mint)
const spotMarketIndex = registrar.spotMarketIndex // could just hardcode spotmarket pk
const driftProgramId = registrar.driftProgramId // likewise
const drift = new Program(DriftIDL, driftProgramId, this.program.provider)
const spotMarketPk = await getSpotMarketPublicKey(
driftProgramId,
spotMarketIndex
)
const insuranceFundVaultPk = await getInsuranceFundVaultPublicKey(
driftProgramId,
spotMarketIndex
)
const insuranceFundStakePk = await getInsuranceFundStakeAccountPublicKey(
driftProgramId,
voter,
spotMarketIndex
)

const insuranceFundStake = await queryClient.fetchQuery({
queryKey: ['Insurance Fund Stake', insuranceFundStakePk.toString()],
queryFn: async () =>
drift.account.insuranceFundStake.fetchNullable(insuranceFundStakePk),
})

if (insuranceFundStake === null) {
console.log('drift voter client', 'no insurance fund stake account found')
return inputVoterWeight
}

const spotMarket = await queryClient.fetchQuery({
queryKey: ['Drift Spot Market', spotMarketPk.toString()],
queryFn: async () => drift.account.spotMarket.fetchNullable(spotMarketPk),
})

if (spotMarket === null) {
console.log('Drift spot market not found: ' + spotMarketPk.toString())
return inputVoterWeight
}

const insuranceFundVault = await fetchTokenAccountByPubkey(
this.program.provider.connection,
insuranceFundVaultPk
)
if (insuranceFundVault.result === undefined) {
console.log(
'Insurance fund vault not found: ' + insuranceFundVaultPk.toString()
)
return inputVoterWeight
}

const nShares = insuranceFundStake.ifShares
const withdrawRequestShares = insuranceFundStake.lastWithdrawRequestShares
const withdrawRequestAmount = insuranceFundStake.lastWithdrawRequestValue
const totalIfShares = spotMarket.insuranceFund.totalShares
const insuranceFundVaultBalance = insuranceFundVault.result?.amount

const amount = unstakeSharesToAmountWithOpenRequest(
nShares,
withdrawRequestShares,
withdrawRequestAmount,
totalIfShares,
insuranceFundVaultBalance
)

return amount.add(inputVoterWeight)
}

async updateVoterWeightRecord(
voter: PublicKey,
realm: PublicKey,
mint: PublicKey
//action?: VoterWeightAction | undefined,
//inputRecordCallback?: (() => Promise<PublicKey>) | undefined
): Promise<{
pre: TransactionInstruction[]
post?: TransactionInstruction[] | undefined
}> {
const connection = this.program.provider.connection
const { result: realmAccount } = await fetchRealmByPubkey(connection, realm)
if (!realmAccount) throw new Error('Realm not found')
const tokenOwnerRecordPk = await getTokenOwnerRecordAddress(
realmAccount?.owner,
realm,
mint,
voter
)
const { voterWeightPk } = await this.getVoterWeightRecordPDA(
realm,
mint,
voter
)
const { registrar: registrarPk } = this.getRegistrarPDA(realm, mint)
const registrar = await this._fetchRegistrar(realm, mint)
const spotMarketIndex = registrar.spotMarketIndex // could just hardcode spotmarket pk
const driftProgramId = registrar.driftProgramId // likewise
const drift = new Program(DriftIDL, driftProgramId, this.program.provider)

//const drift = new Program(DriftIDL, driftProgramId, this.program.provider)
const spotMarketPk = await getSpotMarketPublicKey(
driftProgramId,
spotMarketIndex
)
const insuranceFundVaultPk = await getInsuranceFundVaultPublicKey(
driftProgramId,
spotMarketIndex
)
const insuranceFundStakePk = await getInsuranceFundStakeAccountPublicKey(
driftProgramId,
voter,
spotMarketIndex
)

const spotMarket = await queryClient.fetchQuery({
queryKey: ['Drift Spot Market', spotMarketPk.toString()],
queryFn: async () => drift.account.spotMarket.fetchNullable(spotMarketPk),
})
const spotMarketPkOrNull = spotMarket === null ? null : spotMarketPk

const insuranceFundVault = await fetchTokenAccountByPubkey(
this.program.provider.connection,
insuranceFundVaultPk
)
const insuranceFundVaultPkOrNull =
insuranceFundVault.found === false ? null : insuranceFundVaultPk

let insuranceFundStake:
| Awaited<ReturnType<typeof drift.account.insuranceFundStake.fetch>>
| undefined
try {
insuranceFundStake = await drift.account.insuranceFundStake.fetch(
insuranceFundStakePk
)
} catch (e) {
console.log('drift voter client', 'no insurance fund stake account found')
insuranceFundStake = undefined
}
const stakePkOrNull =
insuranceFundStake === undefined ? null : insuranceFundStakePk

const ix = await this.program.methods
.updateVoterWeightRecord()
.accountsStrict({
voterWeightRecord: voterWeightPk,
registrar: registrarPk,
driftProgram: driftProgramId,
spotMarket: spotMarketPkOrNull,
insuranceFundStake: stakePkOrNull,
insuranceFundVault: insuranceFundVaultPkOrNull,
tokenOwnerRecord: tokenOwnerRecordPk,
})
.instruction()

return { pre: [ix] }
}

// NO-OP
async createMaxVoterWeightRecord(): Promise<TransactionInstruction | null> {
return null
}

// NO-OP
async updateMaxVoterWeightRecord(): Promise<TransactionInstruction | null> {
return null
}

static async connect(
provider: Provider,
programId = new PublicKey(DRIFT_STAKE_VOTER_PLUGIN),
devnet = false
): Promise<DriftVoterClient> {
return new DriftVoterClient(
new Program<DriftStakeVoter>(IDL, programId, provider),
devnet
)
}

async createVoterWeightRecord(
voter: PublicKey,
realm: PublicKey,
mint: PublicKey
): Promise<TransactionInstruction | null> {
const { voterWeightPk } = await this.getVoterWeightRecordPDA(
realm,
mint,
voter
)
const { registrar } = this.getRegistrarPDA(realm, mint)

return this.program.methods
.createVoterWeightRecord(voter)
.accounts({
voterWeightRecord: voterWeightPk,
registrar,
payer: voter,
systemProgram: SYSTEM_PROGRAM_ID,
})
.instruction()
}
}
Loading