MoonSHRD / UniversalNFTMarketplace

Universal NFT Marketplace
Other
9 stars 0 forks source link

[feature-request] Smart Version Control (SVC) #68

Closed JackBekket closed 2 years ago

JackBekket commented 3 years ago

[draft]

Upgradable svn for smart-contracts, which support smart-contract version control (May be considered as simple "proxy pattern" implementation)

synopsis -- contract which map version control number (string) to array of addresses

Contract variables

string version //-- version in string format like "v0.0.3"
uint version_count //-- version counter, use as index
// 'v0.0.3'=> 1
mapping (string=>uint ) Versions_index

// 'name_contract' = address
// 'MSNFT' = 0x...
mapping (string => address) ContractAddresses

// index version to ContractAddresses
// '1' => MSNFT=0x.., MasterFactory = 0x.. 
mapping (uint => ContractAddresses)

Functions

NewMigration Should increace version_counter and create new record in Version Index

SetNewContractAddress Should accept IN arguments: version string, contract name, contract address This function should: a. get version index which tethered to this version string b. check if contract with that name already has been setted to this version string c. if there are no entries for that contract name in current version, then set ContractAddresses[ContractName] = 0x...