DummyImplementation.sol 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. // SPDX-License-Identifier: MIT
  2. pragma solidity ^0.8.0;
  3. abstract contract Impl {
  4. function version() public pure virtual returns (string memory);
  5. }
  6. contract DummyImplementation {
  7. uint256 public value;
  8. string public text;
  9. uint256[] public values;
  10. function initializeNonPayable() public {
  11. value = 10;
  12. }
  13. function initializePayable() public payable {
  14. value = 100;
  15. }
  16. function initializeNonPayableWithValue(uint256 _value) public {
  17. value = _value;
  18. }
  19. function initializePayableWithValue(uint256 _value) public payable {
  20. value = _value;
  21. }
  22. function initialize(
  23. uint256 _value,
  24. string memory _text,
  25. uint256[] memory _values
  26. ) public {
  27. value = _value;
  28. text = _text;
  29. values = _values;
  30. }
  31. function get() public pure returns (bool) {
  32. return true;
  33. }
  34. function version() public pure virtual returns (string memory) {
  35. return "V1";
  36. }
  37. function reverts() public pure {
  38. require(false, "DummyImplementation reverted");
  39. }
  40. }
  41. contract DummyImplementationV2 is DummyImplementation {
  42. function migrate(uint256 newVal) public payable {
  43. value = newVal;
  44. }
  45. function version() public pure override returns (string memory) {
  46. return "V2";
  47. }
  48. }