MultipayV2 is a blockchain-based payroll management system implemented as a smart contract that enables organizations to efficiently handle payments to multiple employees using both native cryptocurrency and ERC20 tokens. The contract is designed to be deployed through a factory pattern, allowing each organization to have its own instance of the payment system.
- Automated Payments: Organizations can set up automated recurring payments with customizable intervals
- Flexibility: Supports both native cryptocurrency and ERC20 token payments
- Scalability: Can handle multiple employees (up to 20 per contract)
- Transparency: All payment transactions are recorded on the blockchain
- Employee Management: Easy addition and removal of employees
- Payment Tracking: Maintains detailed payment history for each employee
- Manual Payment Overhead: Eliminates the need for manual processing of multiple individual transactions
- Payment Delays: Automated scheduling ensures timely payments
- Record Keeping: Automatic tracking of payment history and employee details
- Payment Verification: Transparent verification of payments through blockchain
- Multi-Currency Support: Flexibility to pay in different tokens without multiple systems
- Automated payment scheduling
- Support for both native cryptocurrency and ERC20 tokens
- Employee management system
- Batch payment processing
- Detailed payment tracking and history
- Role-based access control
- Event logging for payments
-
OrganizationDetails
- Organization name and address
- Token address for payments
- List of employees and payment amounts
- Payment interval and timing settings
-
EmployeeDetails
- Employee address
- Payment amount
- Payment history tracking
- Next payment date
- Deploy contract with organization name
constructor(string memory _organizationName)- Configure payment method
function setupPaymentMethod(
address _tokenAddress,
uint256 _paymentInterval,
uint256 _startTime
)- Add single employee
function addEmployee(address _employee, uint256 _amount)- Add multiple employees
function addMultipleEmployees(
address[] memory _employees,
uint256[] memory _amounts
)- Remove employee
function removeEmployee(address _employee)- Regular employee payments
function sendToEmployee()- Batch payments (for one-time transactions)
function batchSend(
address[] calldata _recipients,
uint256[] calldata _amounts,
address _tokenAddress
)- Deploy the contract with organization name
- Set up payment method by specifying:
- Token address (use
0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeEfor native currency) - Payment interval (in seconds)
- Start time (unix timestamp)
- Token address (use
- Add employees individually or in batches
- For each employee, specify:
- Wallet address
- Payment amount
- Ensure sufficient balance in contract
- For ERC20 tokens, approve contract for token spending
- Execute payments through
sendToEmployee()function - Monitor events for payment confirmation
- Only owner can modify employee details
- Maximum limit of 20 employees per contract
- Input validation for addresses and amounts
- Checks for duplicate employee entries
- Protection against zero-address entries
ERC20Transfer: Logs token transfer detailsNativeTransfer: Logs native currency transfer details
The contract includes custom errors for common scenarios:
Unauthorized: Access control violationInvalidAmount: Zero or invalid payment amountInvalidLength: Array length mismatchInsufficientBalance: Inadequate fundsEmployeeNotFound: Invalid employee addressEmployeeAlreadyExist: Duplicate employeeInvalidAddress: Zero address entryExceedsLimit: Employee limit exceeded
- Maximum 20 employees per contract instance
- Requires manual triggering of payments (can be automated with Chainlink)
- Integration with Chainlink for automated payments
- Dynamic employee limits
- Multi-signature support for payment approval
- Payment amount modification functionality
- Support for multiple tokens per organization
- Enhanced reporting and analytics features
- Batch operations for multiple employees
- Efficient storage usage with mappings
- Minimal state changes
- Optimized loops and array operations