Skip to content

Commit

Permalink
Create SecureSpeed
Browse files Browse the repository at this point in the history
This smart contract creates a multi-sig wallet that requires multiple signatures to authorize a transaction. The execute function can be called by any of the owners to initiate a transaction, but it requires confirmation from other owners before it can be executed.
  • Loading branch information
CTG-TOKEN committed Jan 21, 2023
1 parent 9553658 commit 116b4b5
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions SecureSpeed
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
pragma solidity ^0.8.0;

contract MultiSigWallet {
address[] public owners;
mapping(address => bool) public isOwner;
address public owner;
address public spender;
address public recipient;
uint public value;

constructor(address[] memory _owners) public {
owners = _owners;
for (uint i = 0; i < owners.length; i++) {
isOwner[owners[i]] = true;
}
}

function execute(address _spender, address _recipient, uint _value) public {
require(isOwner[msg.sender], "Sender is not an owner of the contract");
require(isOwner[spender], "Spender is not an owner of the contract");
spender = _spender;
recipient = _recipient;
value = _value;
}

function confirm(address _spender, address _recipient, uint _value) public {
require(spender == _spender, "Spender does not match the transaction");
require(recipient == _recipient, "Recipient does not match the transaction");
require(value == _value, "Value does not match the transaction");
require(isOwner[msg.sender], "Sender is not an owner of the contract");
spender.transfer(_value);
}
}

0 comments on commit 116b4b5

Please sign in to comment.