Contract Overview
Latest 9 from a total of 9 transactions
Contract Name:
LocalMultiSig
Compiler Version
v0.8.4+commit.c7e474f2
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; // This is multisig to accept tokens in local currnecy contract LocalMultiSig{ // Defining events // Fired when tokens are deposited to this multisig wallet event Deposit(address indexed sender, uint amount); // Fired when a transaction is submitted, waiting for other owners to approve event Submit(uint indexed txnId); // Fired when an owner approves event Approve(address indexed owner, uint indexed txnId); // Fired when an owner revokes his approval event Revoke(address indexed owner, uint indexed txnId); // Fired when there are sufficient approvals for the contract to get executed event Execute(uint indexed txnId); // Transaction Description struct Transaction { // Address where the transaction is executed address to; // Amount of tokens sent tot he 'to' address uint value; // Set to true when transaction is executed bool executed; } // Owners of multisig address[] public owners; mapping(address => bool) public isOwner; // Minimum approvals for transaction get executed uint public required; // List of all transactions submitted Transaction[] public transactions; // Mapping of vote/approval of each owner for each transaction mapping(uint => mapping(address => bool)) public approved; // Defining modifier to allow only owners to execute certain functions modifier onlyOwner(){ require(isOwner[msg.sender], "not owner"); _; } // Modifier to check if the transaction exists modifier txExists(uint _txId){ require(_txId<transactions.length, "tx does not exist"); _; } // Modifier to check if the transaction is not already approved by msg.sender modifier notApproved(uint _txId){ require(!approved[_txId][msg.sender], "tx already approved"); _; } // Modifier to check if the transaction is not executed modifier notExecuted(uint _txId){ require(!transactions[_txId].executed, "tx already executed"); _; } constructor(address[] memory _owners, uint _required){ require(_owners.length > 0, "Owners required"); require(_required > 0 && _required < _owners.length, "invalid required numer of owners"); for(uint i = 0; i < _owners.length; i++){ address owner = _owners[i]; require(owner != address(0), "invalid owner"); require(!isOwner[owner], "owner not unique"); isOwner[owner] = true; owners.push(owner); } required = _required; } // Fallback function to received sent ether receive() external payable{ // Emit Deposit event emit Deposit(msg.sender, msg.value); } // Function to submit transactions to be reviewed function submit(address _to, uint _value) external onlyOwner { transactions.push(Transaction(_to, _value, false)); emit Submit(transactions.length - 1); } // Function to approve submitted transaction function approve(uint _txId) external onlyOwner txExists(_txId) notApproved(_txId) notExecuted(_txId) { approved[_txId][msg.sender] = true; emit Approve(msg.sender, _txId); } // Function to get total approvals for a submitted transaction function _getApprovalCount(uint _txId) private view returns (uint) { uint count = 0; for(uint i = 0; i < owners.length; i++){ if(approved[_txId][owners[i]]){ count+=1; } } return count; } // Function to execute submitted transaction function execute(uint _txId) external onlyOwner txExists(_txId) notExecuted(_txId) { require(_getApprovalCount(_txId) >= required, "Approvals less than required"); Transaction storage transaction = transactions[_txId]; transaction.executed = true; (bool success,) = payable(transaction.to).call{value: transaction.value}(""); require(success, "tx failed"); emit Execute(_txId); } // Function to revoke approval for a submitted transaction function revoke(uint _txId) external onlyOwner txExists(_txId) notExecuted(_txId) { require(approved[_txId][msg.sender], "tx not Approved"); approved[_txId][msg.sender] = false; emit Revoke(msg.sender, _txId); } // View function to return number of transaction based on transaction id function num_transactions() external view returns(uint num_tx) { num_tx = transactions.length; } }
[{"inputs":[{"internalType":"address[]","name":"_owners","type":"address[]"},{"internalType":"uint256","name":"_required","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"uint256","name":"txnId","type":"uint256"}],"name":"Approve","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Deposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"txnId","type":"uint256"}],"name":"Execute","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"uint256","name":"txnId","type":"uint256"}],"name":"Revoke","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"txnId","type":"uint256"}],"name":"Submit","type":"event"},{"inputs":[{"internalType":"uint256","name":"_txId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"address","name":"","type":"address"}],"name":"approved","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_txId","type":"uint256"}],"name":"execute","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"isOwner","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"num_transactions","outputs":[{"internalType":"uint256","name":"num_tx","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"owners","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"required","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_txId","type":"uint256"}],"name":"revoke","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_value","type":"uint256"}],"name":"submit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"transactions","outputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"bool","name":"executed","type":"bool"}],"stateMutability":"view","type":"function"},{"stateMutability":"payable","type":"receive"}]
Contract Creation Code
6080604052600436106100955760003560e01c80638253951a116100595780638253951a146101e65780639ace38c214610223578063b759f95414610262578063dc8452cd1461028b578063fe0d94c1146102b6576100ea565b8063025e7c27146100ef5780630d07fc921461012c578063203dd6661461015757806320c5429b146101805780632f54bf6e146101a9576100ea565b366100ea573373ffffffffffffffffffffffffffffffffffffffff167fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c346040516100e091906112d5565b60405180910390a2005b600080fd5b3480156100fb57600080fd5b5061011660048036038101906101119190610fc9565b6102df565b6040516101239190611188565b60405180910390f35b34801561013857600080fd5b5061014161031e565b60405161014e91906112d5565b60405180910390f35b34801561016357600080fd5b5061017e60048036038101906101799190610f8d565b61032b565b005b34801561018c57600080fd5b506101a760048036038101906101a29190610fc9565b6104cb565b005b3480156101b557600080fd5b506101d060048036038101906101cb9190610f64565b610788565b6040516101dd91906111da565b60405180910390f35b3480156101f257600080fd5b5061020d60048036038101906102089190610ff2565b6107a8565b60405161021a91906111da565b60405180910390f35b34801561022f57600080fd5b5061024a60048036038101906102459190610fc9565b6107d7565b604051610259939291906111a3565b60405180910390f35b34801561026e57600080fd5b5061028960048036038101906102849190610fc9565b61083e565b005b34801561029757600080fd5b506102a0610afe565b6040516102ad91906112d5565b60405180910390f35b3480156102c257600080fd5b506102dd60048036038101906102d89190610fc9565b610b04565b005b600081815481106102ef57600080fd5b906000526020600020016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600380549050905090565b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff166103b7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103ae90611295565b60405180910390fd5b600360405180606001604052808473ffffffffffffffffffffffffffffffffffffffff16815260200183815260200160001515815250908060018154018082558091505060019003906000526020600020906003020160009091909190915060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506020820151816001015560408201518160020160006101000a81548160ff0219169083151502179055505050600160038054905061049b9190611362565b7f08324b3d745b914e3abd4ffbfead91e3b78391a98c173202129215ab933adfbe60405160405180910390a25050565b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16610557576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161054e90611295565b60405180910390fd5b80600380549050811061059f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161059690611215565b60405180910390fd5b81600381815481106105da577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b906000526020600020906003020160020160009054906101000a900460ff1615610639576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161063090611275565b60405180910390fd5b6004600084815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff166106d6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106cd906112b5565b60405180910390fd5b60006004600085815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550823373ffffffffffffffffffffffffffffffffffffffff167fec9ab91322523c899ede7830ec9bfc992b5981cdcc27b91162fb23de5791117b60405160405180910390a3505050565b60016020528060005260406000206000915054906101000a900460ff1681565b60046020528160005260406000206020528060005260406000206000915091509054906101000a900460ff1681565b600381815481106107e757600080fd5b90600052602060002090600302016000915090508060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16908060010154908060020160009054906101000a900460ff16905083565b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff166108ca576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108c190611295565b60405180910390fd5b806003805490508110610912576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161090990611215565b60405180910390fd5b816004600082815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16156109b1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109a890611235565b60405180910390fd5b82600381815481106109ec577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b906000526020600020906003020160020160009054906101000a900460ff1615610a4b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a4290611275565b60405180910390fd5b60016004600086815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550833373ffffffffffffffffffffffffffffffffffffffff167f90ec57f18fa7b15c6b8d5e4d1deb90796c74b2ff23d4d0cecad0cb42a96b312860405160405180910390a350505050565b60025481565b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16610b90576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b8790611295565b60405180910390fd5b806003805490508110610bd8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610bcf90611215565b60405180910390fd5b8160038181548110610c13577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b906000526020600020906003020160020160009054906101000a900460ff1615610c72576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c6990611275565b60405180910390fd5b600254610c7e84610e30565b1015610cbf576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610cb690611255565b60405180910390fd5b600060038481548110610cfb577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000209060030201905060018160020160006101000a81548160ff02191690831515021790555060008160000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168260010154604051610d7690611173565b60006040518083038185875af1925050503d8060008114610db3576040519150601f19603f3d011682016040523d82523d6000602084013e610db8565b606091505b5050905080610dfc576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610df3906111f5565b60405180910390fd5b847fddb556f1d2c1ec821e910b019d3685b229db152a0ecd517ca7e24b8bd713928960405160405180910390a25050505050565b6000806000905060005b600080549050811015610f3057600460008581526020019081526020016000206000808381548110610e95577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615610f1d57600182610f1a919061130c565b91505b8080610f28906113de565b915050610e3a565b5080915050919050565b600081359050610f4981611578565b92915050565b600081359050610f5e8161158f565b92915050565b600060208284031215610f7657600080fd5b6000610f8484828501610f3a565b91505092915050565b60008060408385031215610fa057600080fd5b6000610fae85828601610f3a565b9250506020610fbf85828601610f4f565b9150509250929050565b600060208284031215610fdb57600080fd5b6000610fe984828501610f4f565b91505092915050565b6000806040838503121561100557600080fd5b600061101385828601610f4f565b925050602061102485828601610f3a565b9150509250929050565b61103781611396565b82525050565b611046816113a8565b82525050565b60006110596009836112fb565b915061106482611456565b602082019050919050565b600061107c6011836112fb565b91506110878261147f565b602082019050919050565b600061109f6013836112fb565b91506110aa826114a8565b602082019050919050565b60006110c2601c836112fb565b91506110cd826114d1565b602082019050919050565b60006110e56000836112f0565b91506110f0826114fa565b600082019050919050565b60006111086013836112fb565b9150611113826114fd565b602082019050919050565b600061112b6009836112fb565b915061113682611526565b602082019050919050565b600061114e600f836112fb565b91506111598261154f565b602082019050919050565b61116d816113d4565b82525050565b600061117e826110d8565b9150819050919050565b600060208201905061119d600083018461102e565b92915050565b60006060820190506111b8600083018661102e565b6111c56020830185611164565b6111d2604083018461103d565b949350505050565b60006020820190506111ef600083018461103d565b92915050565b6000602082019050818103600083015261120e8161104c565b9050919050565b6000602082019050818103600083015261122e8161106f565b9050919050565b6000602082019050818103600083015261124e81611092565b9050919050565b6000602082019050818103600083015261126e816110b5565b9050919050565b6000602082019050818103600083015261128e816110fb565b9050919050565b600060208201905081810360008301526112ae8161111e565b9050919050565b600060208201905081810360008301526112ce81611141565b9050919050565b60006020820190506112ea6000830184611164565b92915050565b600081905092915050565b600082825260208201905092915050565b6000611317826113d4565b9150611322836113d4565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561135757611356611427565b5b828201905092915050565b600061136d826113d4565b9150611378836113d4565b92508282101561138b5761138a611427565b5b828203905092915050565b60006113a1826113b4565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b60006113e9826113d4565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561141c5761141b611427565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f7478206661696c65640000000000000000000000000000000000000000000000600082015250565b7f747820646f6573206e6f74206578697374000000000000000000000000000000600082015250565b7f747820616c726561647920617070726f76656400000000000000000000000000600082015250565b7f417070726f76616c73206c657373207468616e20726571756972656400000000600082015250565b50565b7f747820616c726561647920657865637574656400000000000000000000000000600082015250565b7f6e6f74206f776e65720000000000000000000000000000000000000000000000600082015250565b7f7478206e6f7420417070726f7665640000000000000000000000000000000000600082015250565b61158181611396565b811461158c57600080fd5b50565b611598816113d4565b81146115a357600080fd5b5056fea2646970667358221220573e0eaaa4dc43ad7fca5fd80ae475a16114706e8e8d6480ea957349031bbd0a64736f6c63430008040033
Age | Block | Fee Address | BC Fee Address | Voting Power | Jailed | Incoming |
---|
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for
interesting conversations.