diff --git a/test/contracts/bounties/SlotOverwrite.sol b/test/contracts/bounties/SlotOverwrite.sol new file mode 100644 index 0000000..fe61500 --- /dev/null +++ b/test/contracts/bounties/SlotOverwrite.sol @@ -0,0 +1,13 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.4; + +contract SlotOverwrite { + address public storedAddress; + bool public isWritten; + + constructor(address _storedAddress) { + storedAddress = _storedAddress; + } + + +} diff --git a/test/unit/bounties/slot-overwrite-bug.spec.ts b/test/unit/bounties/slot-overwrite-bug.spec.ts new file mode 100644 index 0000000..94a8f50 --- /dev/null +++ b/test/unit/bounties/slot-overwrite-bug.spec.ts @@ -0,0 +1,38 @@ +import { MockContract, MockContractFactory, smock } from '@src'; +import { ADDRESS_EXAMPLE } from '@test-utils'; +import { SlotOverwrite, SlotOverwrite__factory } from '@typechained'; +import { expect } from 'chai'; + +describe.only('Mock: Editable storage logic', () => { + let slotOverwriteFactory: MockContractFactory; + let mock: MockContract; + + before(async () => { + slotOverwriteFactory = await smock.mock('SlotOverwrite'); + }); + + beforeEach(async () => { + mock = await slotOverwriteFactory.deploy(ADDRESS_EXAMPLE); + }); + + describe('slot overwrite bug', ()=>{ + context('on normal conditions', ()=>{ + it('should return the data on the queried slot', async()=>{ + expect(await mock.storedAddress()).to.eq(ADDRESS_EXAMPLE) + }) + }) + + context('when a bool is set next to the slot', ()=>{ + beforeEach(async()=>{ + await mock.setVariable('isWritten',true) + }) + it('should return the data on the queried slot', async()=>{ + expect(await mock.storedAddress()).to.eq(ADDRESS_EXAMPLE) + }) + }) + + it('should describe other data types reached by bug') + it('should present correspondant tests') + }) + +});