theblockstalk / upgradeable-proxy Goto Github PK
View Code? Open in Web Editor NEWThis repository tests the upgradeable proxy pattern.
License: MIT License
This repository tests the upgradeable proxy pattern.
License: MIT License
Hello, I am having trouble replicating your work, which overall is great.
I am using Truffle5 and Solc 0.4.23;
I am following along using a basic uint256 operations contract:
`
pragma solidity ^0.4.23;
import "../upgradeable/upgradeable.sol";
contract CalculatorV5 is Upgradeable {
uint256 internal _count;
constructor(uint256 count)public {
_count = count;
}
function increment(uint256 amount)
public
returns (bool)
{
require(amount > 0, "amount must be positive");
_count = _count + amount;
return true;
}
function getCount()
external
view
returns(uint256)
{
return _count;
}
}
For test using a .js type of tests (vs .sol):
const UpgradeableProxy = artifacts.require('./upgradeable.sol')
const CalculatorV5 = artifacts.require('./CalculatorV5.sol');
const CalculatorV6 = artifacts.require('./CalculatorV6.sol')
contract('Calculator', (accounts) => {
beforeEach(async () => {
calcV5 = await CalculatorV5.new(100);
uproxy = await UpgradeableProxy.new(calcV5.address);
calcV5Proxy = await CalculatorV5.at(uproxy.address);
await calcV5Proxy.initialize();
});
it('calc v5 should equal 100',async () => {
let value = await calcV5Proxy.getCount({from:accounts[1]});
// also tried let value = await calcV5Proxy.getCount();
// as well as let value = await calcV5Proxy.getCount.call();
assert.equal(value, 100);
});
When I run it the before each works perfectly, emits the event Initalized, but fails on the test with this vague response:
Contract: Calculator
calc v5 should equal 100:
Error: Returned error: VM Exception while processing transaction: revert
Please let me know if you need more information. Thanks!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.