Skip to content

CONTRACT: MultiSig Wallet Contract #27

@PoulavBhowmick03

Description

@PoulavBhowmick03

Title: Admin Treasury Management
Description
Create 3/5 multisig wallet for platform funds.

Acceptance Criteria:

  • Requires 3/5 signatures for:
    • Contract upgrades
    • Prize pool adjustments
    • Emergency pauses
  • Tracks pending transactions
  • Allows signer rotation

Technical Details:

#[starknet::contract]
mod MultiSig {
    #[storage]
    struct Storage {
        signers: Array<felt252>,
        threshold: u8,
        nonce: u64
    }

    #[external(v0)]
    fn submit_tx(
        ref self: ContractState,
        destination: felt252,
        value: u64,
        data: Array<u64>
    ) -> felt252 {
        let tx_hash = pedersen_hash(data);
        // Store pending transaction
        self.pending_txs.write(tx_hash, (destination, value, data));
        tx_hash
    }

    #[external(v0)]
    fn confirm_tx(ref self: ContractState, tx_hash: felt252) {
        let sig = get_caller_address();
        assert(self.signers.contains(sig), 'Not signer');
        
        self.confirmations.write((tx_hash, sig), true);
        if self.get_confirm_count(tx_hash) >= self.threshold.read() {
            self.execute_tx(tx_hash);
        }
    }
}

Notes:

  • Implement replay attack protection
  • Add transaction expiration
  • Test threshold scenarios

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions