Skip to content

Instantly share code, notes, and snippets.

@andreolf
Created December 23, 2022 10:55
Show Gist options
  • Save andreolf/42a457ba43bfa96118af39db14eef3be to your computer and use it in GitHub Desktop.
Save andreolf/42a457ba43bfa96118af39db14eef3be to your computer and use it in GitHub Desktop.
Pass constructor arguments to a contract in an Echidna test
pragma solidity ^0.6.0;
contract MyContract {
uint public value;
constructor(uint _value) public {
value = _value;
}
}
// Echidna test code
import "echidna/echidna.sol";
contract TestMyContract {
using Echidna for *;
MyContract myContract;
function beforeEach() public {
myContract = new MyContract(123);
}
@test
function testConstructor() public {
assert(myContract.value() == 123);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment