Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix rpc #5

Open
wants to merge 125 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
125 commits
Select commit Hold shift + click to select a range
d63b9b4
checkpoint
Dec 22, 2021
3aae86f
working version
Dec 23, 2021
449f3ff
add deal activation with latest devnet program
Jan 3, 2022
9df223b
Merge pull request #1 from credix-finance/deal-activation
MaximPiessen Jan 3, 2022
93b73b0
add cname
Jan 3, 2022
d1096c4
Merge branch 'master' of github.com:credix-finance/multisig-ui
Jan 3, 2022
8d50987
Create main.yml
MaximPiessen Jan 3, 2022
1f7a334
refresh deploy
Jan 4, 2022
a367da5
Merge branch 'master' of github.com:credix-finance/multisig-ui
Jan 4, 2022
03f249c
Update main.yml
MaximPiessen Jan 4, 2022
de4c085
Update main.yml
MaximPiessen Jan 4, 2022
7db1d20
change multisig addresses
Jan 4, 2022
ef4854d
Merge branch 'master' of github.com:credix-finance/multisig-ui
Jan 4, 2022
e163172
change multisig program dev id
Jan 4, 2022
bbac197
show token mint, use associated token address
Jan 4, 2022
7eb1856
refactor multisig code
Jan 5, 2022
a752a42
change api.ts to latest
Jan 6, 2022
bc06c23
add freeze / thaw market
Jan 6, 2022
1eb93d3
add credix pass + credix logo
Jan 8, 2022
6450a39
Merge pull request #2 from credix-finance/refactoring-and-adding-more-tx
MaximPiessen Jan 8, 2022
2b1a2a8
Update main.yml
MaximPiessen Jan 8, 2022
6a55a6b
add non-executed transactions on top in list
Jan 12, 2022
040afc5
change program id
Jan 12, 2022
2359336
Merge pull request #3 from credix-finance/refactoring-and-adding-more-tx
MaximPiessen Jan 12, 2022
d6a8689
fixes
Jan 12, 2022
e508dbd
Merge pull request #4 from credix-finance/refactoring-and-adding-more-tx
MaximPiessen Jan 12, 2022
6a88a61
change program id for mainnet
Jan 12, 2022
f9543f0
Update main.yml
MaximPiessen Jan 12, 2022
4a2cfc4
Merge pull request #5 from credix-finance/refactoring-and-adding-more-tx
MaximPiessen Jan 12, 2022
4f4f172
Update main.yml
MaximPiessen Jan 12, 2022
a91b00d
change seed marketplace
Jan 12, 2022
05171f1
Merge pull request #6 from credix-finance/refactoring-and-adding-more-tx
MaximPiessen Jan 12, 2022
ea280f5
update addresses
Jan 13, 2022
35d942b
add market name to credix pass issuance
Jan 13, 2022
420afb6
Merge pull request #7 from credix-finance/add-market-to-query-parameters
MaximPiessen Jan 13, 2022
34bba37
fixes
Jan 14, 2022
a0af106
Merge pull request #8 from credix-finance/add-market-to-query-parameters
MaximPiessen Jan 14, 2022
2b0ce87
add filter list
Jan 14, 2022
8fd2899
market seed everywhere
Jan 14, 2022
83fec59
provision less space in transactions to bring down cost
Jan 18, 2022
f8791b7
Merge pull request #9 from credix-finance/reduce-size-of-transactions
MaximPiessen Jan 18, 2022
f66a95f
update idl
Jan 25, 2022
a634c08
update rpc endpoint
Jan 25, 2022
c159441
update rpc endpoint
Jan 26, 2022
a9be4c9
catch cluster time error
Jan 26, 2022
35be923
add release date to credix pass
Jan 31, 2022
2188733
add release date
Jan 31, 2022
a84430a
Merge pull request #10 from credix-finance/release-timestamp
MaximPiessen Jan 31, 2022
be4b9ea
set default to mainnet
Jan 31, 2022
ded28d6
change order of dropdown
Jan 31, 2022
ff3acc9
Merge pull request #11 from credix-finance/release-timestamp
MaximPiessen Jan 31, 2022
9e859b5
feat: extra info on credix pass transactions
Feb 3, 2022
b8525af
Merge pull request #12 from credix-finance/show-transaction-data
MaximPiessen Feb 3, 2022
0ca1dfc
Delete .github/workflows directory
MaximPiessen Feb 3, 2022
28cd8d8
remove issue credix pass that fails
Mar 10, 2022
5c85122
change provider
Mar 11, 2022
dbfb8db
change to serum mainnet provider
Mar 11, 2022
c2fd8e2
change to serum mainnet provider
Mar 11, 2022
6f2fa9a
add name change
Mar 15, 2022
adaa426
Merge pull request #13 from credix-finance/add-token-name
MaximPiessen Mar 15, 2022
f648120
remove transaction
Mar 16, 2022
bfbcc45
remove transaction
Mar 16, 2022
24d00ab
change activate deal
Mar 17, 2022
ce84127
delete transaction
Mar 20, 2022
eb7900e
hide transaction
Apr 4, 2022
e9ab2ff
hide transaction
Apr 8, 2022
9f9e5c2
hide transaction + show right borrower pk
Apr 10, 2022
9e78299
remove transactions
May 13, 2022
4cefa46
other mainnet endpoint
Jun 7, 2022
efdb325
feat: only show open transactions
Jun 21, 2022
96ddd86
save progress
Jun 29, 2022
bea21f9
save progress
Jul 2, 2022
a66c2ef
save progress
Jul 5, 2022
fb7cfd5
add checkboxes when market is found
Jul 5, 2022
6f99d05
remove transactions
Aug 3, 2022
f1dcc5b
Merge pull request #14 from credix-finance/add-new-transactions
MaximPiessen Aug 3, 2022
d03bf78
right tranche names
Aug 13, 2022
01e7de0
...
Aug 14, 2022
77aaf56
...
Aug 15, 2022
12585a9
filter tranhces for passes
Aug 19, 2022
cba5f5f
filter transactions
Aug 19, 2022
e332a71
..
Aug 22, 2022
f6ea88e
...
Aug 22, 2022
37891cd
fix: set isInvestor correct on credix pass
Aug 27, 2022
eb5ca63
remove transaction
Sep 28, 2022
2e3ae62
...
Oct 1, 2022
f1223e3
Merge pull request #15 from credix-finance/credix-managers
MaximPiessen Oct 1, 2022
546a71a
..
Oct 1, 2022
00e7223
..
Oct 18, 2022
8572ffb
remove transactions
Oct 28, 2022
bdec1ee
remove pending deals
Oct 31, 2022
0d6d5b3
add borrower again
Oct 31, 2022
69b7f91
add update deal instruction
Nov 1, 2022
bf4c2a5
...
Nov 1, 2022
afdf8e3
add update repaymenschd and credix pass
Dec 1, 2022
b20f08a
fix
Dec 1, 2022
4fb6907
Merge pull request #16 from credix-finance/adjust-repayment-schedule
MaximPiessen Dec 1, 2022
6b4de6e
...
Dec 4, 2022
e7bc2cb
wip activate migrated deal
BartDeCaluwe Dec 15, 2022
f1553c0
feat: add activation of migrated deal
Dec 17, 2022
bd65348
add description for transaction
Dec 17, 2022
8eccc21
...
Dec 19, 2022
00c05a1
Merge pull request #17 from credix-finance/activate-migrated-deal
MaximPiessen Dec 19, 2022
034369e
update activate and open deal
Dec 21, 2022
3002bdc
update disablewithdrawalfee
Dec 28, 2022
5e2c541
..
Jan 13, 2023
d6403ad
temp commit
Mar 20, 2023
4899afc
fixed
Mar 20, 2023
ce126fe
token transfer fixed
Mar 21, 2023
6129ac0
token transfer fixed
Mar 21, 2023
26ee2d4
final fix
Mar 22, 2023
a27e205
Merge pull request #18 from credix-finance/signer-fix
MaximPiessen Mar 22, 2023
0d748ed
fix
Mar 22, 2023
94058a9
error handling
Apr 3, 2023
a238db9
add right message to update deal config
Apr 4, 2023
48c78d3
add opened at change
Apr 5, 2023
d4c7a0f
add opened at change
Apr 5, 2023
1200a66
feat: add update multisig instruction on program state
Apr 6, 2023
b134af0
..
Apr 18, 2023
7112a48
add build folder
Apr 26, 2023
3667443
remove map files
Apr 26, 2023
45dda24
remove transaction
Apr 26, 2023
e85680f
remove transactions
Apr 27, 2023
34d9327
remove transactions
May 10, 2023
1c4d0a9
...
Jun 9, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
change api.ts to latest
Maxim Piessen authored and Maxim Piessen committed Jan 6, 2022
commit a752a420ef97d50023932108eddddae8c6ef43c0
308 changes: 154 additions & 154 deletions src/components/Multisig.tsx
Original file line number Diff line number Diff line change
@@ -66,6 +66,160 @@ import { MultisigSetOwnersListItem } from "./transactions/SetOwners";
import { ActivateDealListItem } from "./transactions/ActivateDeal";
import { TransferTokenListItem } from "./transactions/TransferToken";

// NEW TRANSACTION
function AddTransactionDialog({
multisig,
open,
onClose,
didAddTransaction,
}: {
multisig: PublicKey;
open: boolean;
onClose: () => void;
didAddTransaction: (tx: PublicKey) => void;
}) {
return (
<Dialog open={open} fullWidth onClose={onClose} maxWidth="md">
<DialogTitle>
<Typography variant="h4" component="h2">
New Transaction
</Typography>
</DialogTitle>
<DialogContent style={{ paddingBottom: "16px" }}>
<DialogContentText>
Create a new transaction to be signed by the multisig. This
transaction will not execute until enough owners have signed the
transaction.
</DialogContentText>
<List disablePadding>
<ProgramUpdateListItem
didAddTransaction={didAddTransaction}
multisig={multisig}
onClose={onClose}
/>
<IdlUpgradeListItem
didAddTransaction={didAddTransaction}
multisig={multisig}
onClose={onClose}
/>
<MultisigSetOwnersListItem
didAddTransaction={didAddTransaction}
multisig={multisig}
onClose={onClose}
/>
<ChangeThresholdListItem
didAddTransaction={didAddTransaction}
multisig={multisig}
onClose={onClose}
/>
<TransferTokenListItem
didAddTransaction={didAddTransaction}
multisig={multisig}
onClose={onClose}
/>
<ActivateDealListItem
didAddTransaction={didAddTransaction}
multisig={multisig}
onClose={onClose}
/>
</List>
</DialogContent>
</Dialog>
);
}

// LABELS FOR TRANSACTIONS
function ixLabel(tx: any, multisigClient: any) {
if (tx.account.programId.equals(BPF_LOADER_UPGRADEABLE_PID)) {
// Upgrade instruction.
if (tx.account.data.equals(Buffer.from([3, 0, 0, 0]))) {
return (
<ListItemText
primary="Program upgrade"
secondary={tx.publicKey.toString()}
/>
);
}
}
if (tx.account.programId.equals(multisigClient.programId)) {
const setThresholdSighash = multisigClient.coder.sighash(
"global",
"change_threshold"
);
if (setThresholdSighash.equals(tx.account.data.slice(0, 8))) {
return (
<ListItemText
primary="Set threshold"
secondary={tx.publicKey.toString()}
/>
);
}
const setOwnersSighash = multisigClient.coder.sighash(
"global",
"set_owners"
);
if (setOwnersSighash.equals(tx.account.data.slice(0, 8))) {
return (
<ListItemText
primary="Set owners"
secondary={tx.publicKey.toString()}
/>
);
}
}
if (tx.account.programId.equals(TOKEN_PROGRAM_ID)) {
const tag = tx.account.data.slice(0, 1);
const amountBuf = tx.account.data.slice(1, 9) as Buffer;
const amountParsed = u64.fromBuffer(amountBuf).toNumber() / 1000000;
if (Buffer.from([3]).equals(tag)) {
return (
<ListItemText
primary={`Transfer ${amountParsed.toString()} Token`}
secondary={tx.publicKey.toString()}
/>
);
}

if (Buffer.from([4]).equals(tag)) {
return (
<ListItemText
primary="Approve Token"
secondary={tx.publicKey.toString()}
/>
);
}

if (Buffer.from([7]).equals(tag)) {
return (
<ListItemText
primary="Mint Token To"
secondary={tx.publicKey.toString()}
/>
);
}
return (
<ListItemText
primary="Token Instructions"
secondary={tx.publicKey.toString()}
/>
);
}
if (tx.account.programId.equals(config.clusterConfig.programId)) {
const borrowerPk = tx.account.accounts[6].pubkey.toString();
return (
<ListItemText
primary={`Activate deal for borrower ${borrowerPk.slice(0,5)}...${borrowerPk.slice(-5,)}`}
secondary={tx.publicKey.toString()}
/>
);
}
if (idl.IDL_TAG.equals(tx.account.data.slice(0, 8))) {
return (
<ListItemText primary="Upgrade IDL" secondary={tx.publicKey.toString()} />
);
}
return <ListItemText primary={tx.publicKey.toString()} />;
}

export default function Multisig({ multisig }: { multisig?: PublicKey }) {
return (
@@ -608,99 +762,7 @@ function TxListItem({
);
}

// LABELS FOR TRANSACTIONS
function ixLabel(tx: any, multisigClient: any) {
if (tx.account.programId.equals(BPF_LOADER_UPGRADEABLE_PID)) {
// Upgrade instruction.
if (tx.account.data.equals(Buffer.from([3, 0, 0, 0]))) {
return (
<ListItemText
primary="Program upgrade"
secondary={tx.publicKey.toString()}
/>
);
}
}
if (tx.account.programId.equals(multisigClient.programId)) {
const setThresholdSighash = multisigClient.coder.sighash(
"global",
"change_threshold"
);
if (setThresholdSighash.equals(tx.account.data.slice(0, 8))) {
return (
<ListItemText
primary="Set threshold"
secondary={tx.publicKey.toString()}
/>
);
}
const setOwnersSighash = multisigClient.coder.sighash(
"global",
"set_owners"
);
if (setOwnersSighash.equals(tx.account.data.slice(0, 8))) {
return (
<ListItemText
primary="Set owners"
secondary={tx.publicKey.toString()}
/>
);
}
}
if (tx.account.programId.equals(TOKEN_PROGRAM_ID)) {
const tag = tx.account.data.slice(0, 1);
const amountBuf = tx.account.data.slice(1, 9) as Buffer;
const amountParsed = u64.fromBuffer(amountBuf).toNumber() / 1000000;
if (Buffer.from([3]).equals(tag)) {
return (
<ListItemText
primary={`Transfer ${amountParsed.toString()} Token`}
secondary={tx.publicKey.toString()}
/>
);
}

if (Buffer.from([4]).equals(tag)) {
return (
<ListItemText
primary="Approve Token"
secondary={tx.publicKey.toString()}
/>
);
}

if (Buffer.from([7]).equals(tag)) {
return (
<ListItemText
primary="Mint Token To"
secondary={tx.publicKey.toString()}
/>
);
}
return (
<ListItemText
primary="Token Instructions"
secondary={tx.publicKey.toString()}
/>
);
}
if (tx.account.programId.equals(config.clusterConfig.programId)) {
const borrowerPk = tx.account.accounts[5].pubkey.toString();
const dealPk = tx.account.accounts[3].pubkey;
return (
<ListItemText
primary={`Activate deal for borrower ${borrowerPk.slice(0,5)}...${borrowerPk.slice(-5,)}`}
secondary={tx.publicKey.toString()}
/>
);
}
if (idl.IDL_TAG.equals(tx.account.data.slice(0, 8))) {
return (
<ListItemText primary="Upgrade IDL" secondary={tx.publicKey.toString()} />
);
}
return <ListItemText primary={tx.publicKey.toString()} />;
}

function AccountsList({ accounts }: { accounts: any }) {
return (
@@ -778,68 +840,6 @@ function SignerDialog({
);
}

// NEW TRANSACTION
function AddTransactionDialog({
multisig,
open,
onClose,
didAddTransaction,
}: {
multisig: PublicKey;
open: boolean;
onClose: () => void;
didAddTransaction: (tx: PublicKey) => void;
}) {
return (
<Dialog open={open} fullWidth onClose={onClose} maxWidth="md">
<DialogTitle>
<Typography variant="h4" component="h2">
New Transaction
</Typography>
</DialogTitle>
<DialogContent style={{ paddingBottom: "16px" }}>
<DialogContentText>
Create a new transaction to be signed by the multisig. This
transaction will not execute until enough owners have signed the
transaction.
</DialogContentText>
<List disablePadding>
<ProgramUpdateListItem
didAddTransaction={didAddTransaction}
multisig={multisig}
onClose={onClose}
/>
<IdlUpgradeListItem
didAddTransaction={didAddTransaction}
multisig={multisig}
onClose={onClose}
/>
<MultisigSetOwnersListItem
didAddTransaction={didAddTransaction}
multisig={multisig}
onClose={onClose}
/>
<ChangeThresholdListItem
didAddTransaction={didAddTransaction}
multisig={multisig}
onClose={onClose}
/>
<TransferTokenListItem
didAddTransaction={didAddTransaction}
multisig={multisig}
onClose={onClose}
/>
<ActivateDealListItem
didAddTransaction={didAddTransaction}
multisig={multisig}
onClose={onClose}
/>
</List>
</DialogContent>
</Dialog>
);
}

// @ts-ignore
function icon(tx, multisigClient) {
if (tx.account.programId.equals(BPF_LOADER_UPGRADEABLE_PID)) {
1 change: 1 addition & 0 deletions src/components/transactions/ActivateDeal.tsx
Original file line number Diff line number Diff line change
@@ -67,6 +67,7 @@ export function ActivateDealListItem({
const fetchDeals = async () => {
const pendingDeals = await findPendingDeals(multisigClient.provider);
setDeals(pendingDeals);
console.log(deals);
}

const createTransactionAccount = async (dealPk: PublicKey, borrowerPk: PublicKey) => {
1 change: 1 addition & 0 deletions src/components/transactions/ChangeThreshold.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { useSnackbar } from "notistack";
import { Button, Collapse, ListItem, ListItemIcon, ListItemText, TextField } from "@material-ui/core";
import { ExpandLess, ExpandMore } from "@material-ui/icons";
import { useState } from "react";
13 changes: 9 additions & 4 deletions src/credix/api.ts
Original file line number Diff line number Diff line change
@@ -146,14 +146,19 @@ const getGatewayToken = multiAsync(
}
);

const findCredixPassPDA = multiAsync(async (publicKey: PublicKey) => {
const credixPassSeeds = encodeSeedString("credix-pass");
const address = publicKey.toBuffer();
const seeds: PdaSeeds = [address, credixPassSeeds];
export const findCredixPassPDA = multiAsync(async (publicKey: PublicKey) => {
const globalMarketStatePDA = await findGlobalMarketStatePDA();
const credixPassSeeds = encodeSeedString(SEEDS.CREDIX_PASS);
const seeds: PdaSeeds = [
globalMarketStatePDA[0].toBuffer(),
publicKey.toBuffer(),
credixPassSeeds,
];

return findPDA(seeds);
});


export const activateDeal = multiAsync(
async (dealPk: PublicKey, borrowerPk: PublicKey, multisigPk: PublicKey, provider) => {
const program = constructProgram(provider);
7 changes: 4 additions & 3 deletions src/credix/consts.ts
Original file line number Diff line number Diff line change
@@ -4,9 +4,10 @@ export const SESSION_STORAGE = {

// TODO: turn into enum
export const SEEDS = {
GLOBAL_MARKET_STATE_PDA: "global-market-state",
MARKET_USDC_TOKEN_ACCOUNT: "market-liquidity-pool",
DEAL_INFO: "deal-info"
GLOBAL_MARKET_STATE_PDA: "credix-marketplace",
DEAL_INFO: "deal-info",
CREDIX_PASS: "credix-pass",
BORROWER_INFO: "borrower-info",
};

export const FEES = {
Loading