Skip to content

Commit

Permalink
fix(pox-4-tests): Update AllowContractCallerCommand to remove the wal…
Browse files Browse the repository at this point in the history
…let from ex-allowed's list
  • Loading branch information
BowTiedRadone authored and moodmosaic committed Apr 22, 2024
1 parent d2c1eb7 commit e33895f
Showing 1 changed file with 21 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,27 @@ export class AllowContractCallerCommand implements PoxCommand {

// Get the wallets involved from the model and update it with the new state.
const wallet = model.stackers.get(this.wallet.stxAddress)!;
const callerAllowedBefore = wallet.allowedContractCaller;

const callerAllowedBeforeState = model.stackers.get(callerAllowedBefore) ||
null;

if (callerAllowedBeforeState) {
// Remove the allower from the ex-allowed caller's allowance list.

const walletIndexInsideAllowedByList = callerAllowedBeforeState
.callerAllowedBy.indexOf(
this.wallet.stxAddress,
);

expect(walletIndexInsideAllowedByList).toBeGreaterThan(-1);

callerAllowedBeforeState.callerAllowedBy.splice(
walletIndexInsideAllowedByList,
1,
);
}

const callerToAllow = model.stackers.get(this.allowanceTo.stxAddress)!;
// Update model so that we know this wallet has authorized a contract-caller.

Expand Down

0 comments on commit e33895f

Please sign in to comment.