- The account that deployes the contract is the
token contract owner
; Multisig Wallet Contract
has all the tokens at the begining;- Multisig Wallet can have up to 50 owners;
- Multisig Wallet contract needs to set owner addresses and requiredConfirmation when deployed;
- Transfer funds between accounts needs adequate confirmations from wallet owners;
- Token contract owner can freeze any account to prevent tranferring funds out from these accounts;
- Token owner can unfreeze or whitelist accounts to enable transfer;
- Token owner can return a list of all accounts that received tokens;
Currently support node.js v8.11.1
$ npm intall
$ truffle test
The result is similar to following:
deploy the contracts to ropsten network as:
$ truffle migrate <account1,account2,...,accountN> <requiredConfirmations> --network ropsten
For example:
$ truffle migrate 0x57db0db20dd46b83fa2acbf800c145b6df1b9052,0x6e3373b09901fc55497cd2583b164da366771d7e 2 --network ropsten
// generate encoded bytes of transfer transaction
const transferEncoded = tokenInstance.contract.transfer.getData(accounts[1], 1000000*scale)
// submit transaction
let transferReceipt = await multisigInstance.submitTransaction(tokenInstance.address, 0, transferEncoded, {from: accounts[0]})
// get transaction Id
let transactionId = transferReceipt.logs[0].args.transactionId.toNumber()
// should fail to execute transfer due to inadequate confirmations
await multisigInstance.executeTransaction(transactionId, {from: accounts[0]})
assert.equal(false, await multisigInstance.isExecuted(transactionId, {from: accounts[0]}))
// second owner confirm the tx
await multisigInstance.confirmTransaction(transactionId, {from: accounts[1]})
// confirm the tx is confimed
assert.equal(true, await multisigInstance.isConfirmed(transactionId, {from: accounts[1]}))
// transfer transaction should be successful
await multisigInstance.executeTransaction(transactionId, {from: accounts[1]})
assert.equal(true, await multisigInstance.isExecuted(transactionId, {from: accounts[1]}))