Security News
Input Validation Vulnerabilities Dominate MITRE's 2024 CWE Top 25 List
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
@defi-wonderland/lopt
Advanced tools
lopt
is a utility package that can generate mock Solidity contracts in the form of fakes
and mocks
.
lopt
is based in @eth-optimism/smock, sinon and sinon-chai.
Some benefits of using lopt
:
sinon-chai
expect
and should
syntaxtypechain
(highly recommended)fakes
mock
and start asserting calls or changing behaviourDocumentation is available here.
You can easily install lopt
via npm:
npm install --save-dev @defi-wonderland/lopt
Or via yarn:
yarn add --dev @defi-wonderland/lopt
...
import { FakeContract, lopt } from '@defi-wonderland/lopt';
chai.should(); // if you like should syntax
chai.use(lopt.matchers);
describe('MyContract', () => {
let myContractFake: FakeContract<MyContract>;
beforeEach(async () => {
...
myContractFake = await lopt.fake<MyContract>('MyContract');
});
it('some test', () => {
...
myContractFake.bark.atCall(0).should.be.calledWith('Hello World');
});
});
lopt
?Loki's alternative name is Lopt, and Loki was obviously taken.
Loki is the God of Mischief, a trickster, and the purpose of mocking libraries is basically to trick the tests.
FAQs
Mocking framework for Solidity contracts
The npm package @defi-wonderland/lopt receives a total of 0 weekly downloads. As such, @defi-wonderland/lopt popularity was classified as not popular.
We found that @defi-wonderland/lopt demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.