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

feat: Manage Nervos DAO with multisig address #3298

Open
wants to merge 8 commits into
base: develop
Choose a base branch
from
Open

Conversation

devchenyan
Copy link
Collaborator

@devchenyan devchenyan commented Jan 14, 2025

Magickbase/neuron-public-issues#425

Screen-2025-01-16-050516.mp4

@devchenyan devchenyan marked this pull request as ready for review January 15, 2025 21:05
@Danie0918 Danie0918 requested review from yanguoyu, homura and Keith-CY and removed request for homura January 20, 2025 01:34
@Danie0918
Copy link
Collaborator

@homura @yanguoyu Please have a review.

generateMultisigDaoClaimTx({
withdrawingOutPoint: record.outPoint,
depositOutPoint: record.depositOutPoint,
feeRate: `${MEDIUM_FEE_RATE}`,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is there no sugested fee rate here?

Comment on lines +569 to +582
feeRate: string = '0',
lockClass = {
lockArgs: [''],
codeHash: SystemScriptInfo.SECP_CODE_HASH,
hashType: ScriptHashType.Type,
},
multisigConfig?: MultisigConfigModel
): Promise<Transaction> => {
const secpCellDep = await SystemScriptInfo.getInstance().getSecpCellDep()
let cellDep: CellDep
if (lockClass.codeHash === SystemScriptInfo.MULTI_SIGN_CODE_HASH) {
cellDep = await SystemScriptInfo.getInstance().getMultiSignCellDep()
} else {
cellDep = await SystemScriptInfo.getInstance().getSecpCellDep()
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

The lockClass is unnecessary here because multisigConfig includes a blake160s property, which serves the same purpose as lockArgs in lockClass

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The lockClass is still needed in subsequent processing

Comment on lines 28 to 36
export const useOnWithdrawDialogSubmit = ({
activeRecord,
setActiveRecord,
clearGeneratedTx,
walletID,
dispatch,
suggestFeeRate,
multisigConfig,
}: {
Copy link
Collaborator

Choose a reason for hiding this comment

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

It is recommended to rename useOnWithdrawDialogSubmit to useGenerateDaoWithdrawTx and rename clearGeneratedTx to onGenerateFailed for clearer

@yanguoyu
Copy link
Collaborator

I guess it will be better to back to the multisig address table after the send success dialog opens and closes
image

multisigConfig.n
)

const multiSignBlake160 = script.args.slice(0, 42)
Copy link
Collaborator

Choose a reason for hiding this comment

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


const multiSignBlake160 = script.args.slice(0, 42)

logger.info('getMultisigDaoCells---multiSignBlake160----', multiSignBlake160)
Copy link
Collaborator

Choose a reason for hiding this comment

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

If this is a debug log, remove it. Or print it in a better format.

@@ -285,6 +286,75 @@ export default class CellsService {
return cells
}

public static async getMultisigDaoCells(multisigConfig: MultisigConfigModel): Promise<Cell[]> {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could we refactor this function https://github.com/nervosnetwork/neuron/blob/develop/packages/neuron-wallet/src/services/cells.ts#L226 to get the DaoCells with lock args?

@@ -815,6 +894,121 @@ export default class TransactionSender {
return tx
}

public withdrawFromMultisigDao = async (
Copy link
Collaborator

Choose a reason for hiding this comment

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

Comment on lines 508 to 510
? Script.fromSDK(
Multisig.getMultisigScript(multisigConfig.blake160s, multisigConfig.r, multisigConfig.m, multisigConfig.n)
)
Copy link
Collaborator

Choose a reason for hiding this comment

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

What is the difference between Multisig.getMultisigScript's return type and Script.fromSDK's return type?

type: AppActions.RequestPassword,
payload: {
walletID: wallet.id,
actionType: multisigConfig.m === 1 ? 'send-from-multisig-need-one' : 'send-from-multisig',
Copy link
Collaborator

Choose a reason for hiding this comment

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

This can be verified using the getMultisigSignStatus result named canBroadcastAfterSign.

@Danie0918 Danie0918 requested review from yanguoyu and homura January 26, 2025 01:22
@Danie0918
Copy link
Collaborator

@homura @yanguoyu Please have a review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants