## Error Message
```
Can handle NewSubmitProposalEvent
🛠Mapping aborted at ~lib/array.ts, line 106, column 42, with message: Index out of range
wasm backtrace:
0: 0x2a5b - <unknown>!~lib/array/Array<~lib/@graphprotocol/graph-ts/chain/ethereum/ethereum.EventParam>#__get
1: 0x328d - <unknown>!src/mappings/handleSubmitProposal
2: 0x35d0 - <unknown>!start:tests/submitproposal.test~anonymous|1~anonymous|1
```
## Info of my test
#### sumbitproposal.test.ts file
```typescript=
test("Should throw an error", () => {
throw new Error()
}, true)
export function createNewSubmitProposalEvent(
applicant: string,
sharesRequested: i32,
lootRequested: i32,
tributeOffered: i32,
tributeToken: string,
paymentRequested: i32,
paymentToken: i32,
details: string,
flags: boolean,
proposalId: i32,
): SubmitProposal {
let NewSubmitProposalEvent = changetype<SubmitProposal>(newMockEvent())
NewSubmitProposalEvent.parameters = new Array();
let applicantParam = new ethereum.EventParam("applicant", ethereum.Value.fromAddress(Address.fromString(applicant)));
let sharesRequestedParam = new ethereum.EventParam("sharesRequested", ethereum.Value.fromI32(sharesRequested));
let lootRequestedParam = new ethereum.EventParam("lootRequested", ethereum.Value.fromI32(lootRequested));
let tributeOfferedParam = new ethereum.EventParam("tributeOffered", ethereum.Value.fromI32((tributeOffered)));
let tributeTokenParam = new ethereum.EventParam("tributeToken", ethereum.Value.fromAddress(Address.fromString(tributeToken)));
let paymentRequestedParam = new ethereum.EventParam("paymentRequested", ethereum.Value.fromI32(paymentRequested));
let paymentTokenParam = new ethereum.EventParam("paymentToken", ethereum.Value.fromI32(paymentToken));
let detailsParam = new ethereum.EventParam("details", ethereum.Value.fromAddress(Address.fromString(details)));
let flagsParam = new ethereum.EventParam("flags", ethereum.Value.fromBoolean(flags));
let proposalIdParam = new ethereum.EventParam("proposalId", ethereum.Value.fromI32(proposalId));
NewSubmitProposalEvent.parameters.push(applicantParam);
NewSubmitProposalEvent.parameters.push(sharesRequestedParam);
NewSubmitProposalEvent.parameters.push(lootRequestedParam);
NewSubmitProposalEvent.parameters.push(tributeOfferedParam);
NewSubmitProposalEvent.parameters.push(tributeTokenParam);
NewSubmitProposalEvent.parameters.push(paymentRequestedParam);
NewSubmitProposalEvent.parameters.push(paymentTokenParam);
NewSubmitProposalEvent.parameters.push(detailsParam);
NewSubmitProposalEvent.parameters.push(flagsParam);
NewSubmitProposalEvent.parameters.push(proposalIdParam);
return NewSubmitProposalEvent;
}
describe("Mocked Events", () => {
afterEach(() => {
clearStore();
})
test("Can handle NewSubmitProposalEvent", () => {
// Call mappings
let NewSubmitProposalEvent = createNewSubmitProposalEvent(
"0x00c9894ec45e1e0c547da44c007b1fa7ead36222",
1,
1,
1,
"0x00c9894ec45e1e0c547da44c007b1fa7ead36222",
1,
1,
"0x00c9894ec45e1e0c547da44c007b1fa7ead36222",
true,
1,
)
handleSubmitProposal(NewSubmitProposalEvent)
//assert.entityCount("Moloch", 1)
logStore();
// assert.fieldEquals("Moloch", "0x00c9894ec45e1e0c547da44c007b1fa7ead36228","summoner", "0x00c9894ec45e1e0c547da44c007b1fa7ead36221")
// assert.fieldEquals("Moloch", "displayName", "Gravatar 0xdead", "https://example.com/image0xdead.png")
// assert.fieldEquals("0xbeef", "displayName", "Gravatar 0xbeef")
})
})
```
#### Event Signature
```yaml
eventHandlers:
- event: SubmitProposal(indexed address,uint256,uint256,uint256,address,uint256,address,string,bool[6],uint256,indexed address,indexed address)
handler: handleSubmitProposal
```
#### mappings.ts file
```typescript
export function handleSubmitProposal(event: SubmitProposal):void {
let molochId = event.address.toHexString();
let newProposalId = molochId.concat("-proposal-").concat(event.params.proposalId.toString());
let memberId = molochId.concat("-member-").concat(event.params.memberAddress.toHex());
let proposal = new Proposal(newProposalId);
proposal.proposalId = event.params.proposalId;
proposal.moloch = molochId;
proposal.member = memberId;
proposal.memberAddress = event.params.memberAddress;
proposal.delegateKey = event.params.delegateKey;
proposal.yesVotes = BigInt.fromI32(0);
proposal.noVotes = BigInt.fromI32(0);
proposal.yesShares = BigInt.fromI32(0);
proposal.noShares = BigInt.fromI32(0);
proposal.maxTotalSharesAndLootAtYesVote = BigInt.fromI32(0);
proposal.save();
}
```