Comments (3)
There is a couple of ways of achieving that:
You can use delegatecall
available in solidity that will call a method in another smart contract together with changeable variable currentVersionAddress
we can call 'current' version of the contract from our 'proxy'.
example from https://github.com/shaunazzopardi/smart-contract-versioning called 'Proxy/Interface method'
address currentVersion = <someAddress>;
<type> <varName>;
function <methodName>() public returns(<type>){
if(currentVersion.delegatecall(msg.data)){
returns <varName>;
}
else{
revert();
}
}
Only Owner of the contract can modify the currentVersionAddress.
In more details it concept is explained on https://ethereum.stackexchange.com/questions/2404/upgradeable-smart-contracts
One of the limits of that approach is that you can have only variables available in the original contract, meaning you would have to either know a priori what will you require or provide a magic map
of anything.
Sources:
- https://github.com/shaunazzopardi/smart-contract-versioning
- https://ethereum.stackexchange.com/questions/2404/upgradeable-smart-contracts
- https://forum.ethereum.org/discussion/4595/versioning-of-smart-contracts
from motoro.
Versioning best practices
https://blog.zeppelin.solutions/proxy-libraries-in-solidity-79fbe4b970fd
https://medium.com/rocket-pool/upgradable-solidity-contract-design-54789205276d
from motoro.
Consider moving to Zeppelin OS https://docs.zeppelinos.org/docs/start.html
from motoro.
Related Issues (20)
- token pre-sale strategy / financial model HOT 1
- Unit test coverage HOT 2
- Apply style corrections from #23
- Add linting with eslint for Airbnb style guide HOT 4
- Refactor repository structure
- Update README
- update package-lock.json and README
- Compare KYC and AML systems available on the market and choose the most suitable to integrate with our system HOT 2
- Design the process of Ownership Aproval
- Prepare a Motorcycle rental flowchart HOT 2
- Setup a CI system
- Cleanup repository from build artifacts
- Jest has incorrect test search path
- UIKit doesn't render spinners in React HOT 1
- Create UI for renting machines HOT 1
- Add required node version HOT 1
- State is undefined
- Vulnerability warning
- Dockerize + handle docker image
- Error when getting the container up HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from motoro.