forked from cerc-io/laconicd-deprecated
tests: add solidity test suites (#487)
* tests: add solidity test suite * tests: remove require strings * Update tests-solidity/init-test-node.sh * Update tests-solidity/init-test-node.sh Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com>
This commit is contained in:
co-authored by
Federico Kunze
parent
4344dc10c7
commit
c9639c3860
@@ -0,0 +1,24 @@
|
||||
pragma solidity ^0.5.11;
|
||||
|
||||
contract Counter {
|
||||
uint256 counter = 0;
|
||||
string internal constant ERROR_TOO_LOW = "COUNTER_TOO_LOW";
|
||||
event Changed(uint256 counter);
|
||||
event Added(uint256 counter);
|
||||
|
||||
function add() public {
|
||||
counter++;
|
||||
emit Added(counter);
|
||||
emit Changed(counter);
|
||||
}
|
||||
|
||||
function subtract() public {
|
||||
require(counter > 0, ERROR_TOO_LOW);
|
||||
counter--;
|
||||
emit Changed(counter);
|
||||
}
|
||||
|
||||
function getCounter() public view returns (uint256) {
|
||||
return counter;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
pragma solidity >=0.4.22 <0.8.0;
|
||||
|
||||
contract Migrations {
|
||||
address public owner = msg.sender;
|
||||
uint public last_completed_migration;
|
||||
|
||||
modifier restricted() {
|
||||
require(
|
||||
msg.sender == owner,
|
||||
"This function is restricted to the contract's owner"
|
||||
);
|
||||
_;
|
||||
}
|
||||
|
||||
function setCompleted(uint completed) public restricted {
|
||||
last_completed_migration = completed;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user