mirror of git3://git3.w3q/git3-contract
commit
ae64ab5551
@ -0,0 +1,23 @@
|
||||
//SPDX-License-Identifier: Unlicense
|
||||
pragma solidity ^0.8.0;
|
||||
|
||||
contract Git3HubStorage {
|
||||
struct refInfo {
|
||||
bytes20 hash;
|
||||
uint96 index;
|
||||
}
|
||||
|
||||
struct refData {
|
||||
bytes20 hash;
|
||||
bytes name;
|
||||
}
|
||||
// LargeStorageManagerV2 Storage Layout
|
||||
mapping(bytes32 => mapping(uint256 => bytes32)) internal keyToMetadata;
|
||||
mapping(bytes32 => mapping(uint256 => mapping(uint256 => bytes32)))
|
||||
internal keyToSlots;
|
||||
|
||||
// Git3Hub Storage Layout
|
||||
mapping(bytes => address) public repoNameToOwner;
|
||||
mapping(bytes => refInfo) public nameToRefInfo; // dev => {hash: 0x1234..., index: 1 }
|
||||
mapping(bytes => bytes[]) public repoNameToRefs; // [main, dev, test, staging]
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,24 @@
|
||||
import { ethers } from "hardhat";
|
||||
|
||||
async function main(proxyAddr:string) {
|
||||
|
||||
const Git3 = await ethers.getContractFactory("Git3Hub");
|
||||
const git3 = await Git3.deploy();
|
||||
let logicReceipt = await git3.deployed()
|
||||
|
||||
let proxyInstance = await ethers.getContractAt("UpgradeableProxy",proxyAddr);
|
||||
// Proxy don't need to init Git3 contract because the constructor is empty.
|
||||
let initSelector = "0x";
|
||||
let [operator,] = await ethers.getSigners();
|
||||
let receipt = await proxyInstance
|
||||
.connect(operator)
|
||||
.upgradeToAndCall(git3.address, initSelector);
|
||||
await receipt.wait();
|
||||
|
||||
console.log("upgradeTxHash:",receipt.hash);
|
||||
}
|
||||
|
||||
main(process.argv0).catch((error) => {
|
||||
console.error(error);
|
||||
process.exitCode = 1;
|
||||
});
|
Loading…
Reference in new issue