Manages multiple Ledger contracts, facilitating cross-ledger transactions.
Acts as the owner of all managed Ledger contracts.
State Variables
transactionId
uint256 public transactionId;
ledgers
mapping(address => mapping(address => LedgerInfo)) public ledgers;
Functions
constructor
createLedger
Deploy a new Ledger contract.
function createLedger(string memory name, Ledger.Category category) external returns (address ledgerAddress);
Parameters
The name of the ledger (e.g., "Assets Ledger").
The type of accounts this ledger manages (Asset, Liability, etc.).
Returns
The address of the newly deployed Ledger.
recordCrossLedgerDoubleEntry
Facilitates a double-entry transaction across ledgers if needed.
function recordCrossLedgerDoubleEntry(Ledger.Entry[] memory debits, Ledger.Entry[] memory credits) external;
Parameters
An array of debit entries.
An array of credit entries.
getLedgersCount
Get the number of deployed Ledgers.
function getLedgersCount() external view returns (uint256 count);
Returns
The total number of Ledgers managed.
Events
LedgerManagerCreated
event LedgerManagerCreated(address ledgerManagerAddress);
LedgerCreated
event LedgerCreated(address indexed id, address indexed owner, string name, Ledger.Category category);
DoubleEntryRecorded
event DoubleEntryRecorded(address author, Ledger.Entry[] debits, Ledger.Entry[] credits, uint256 transactionId);
Structs
LedgerInfo
struct LedgerInfo {
address id;
string name;
Ledger.Category category;
uint256 entryCount;
}