parent
b253020db9
commit
6823e4df65
@ -1,3 +1,3 @@
|
|||||||
{
|
{
|
||||||
|
"Width": 120
|
||||||
}
|
}
|
||||||
|
@ -1,20 +1,19 @@
|
|||||||
|
|
||||||
const NetworkDefinition = {
|
const NetworkDefinition = {
|
||||||
rinkeby: {
|
rinkeby: {
|
||||||
url: "https://rinkeby.infura.io/v3/*******your-api-key*******",
|
url: "https://rinkeby.infura.io/v3/*******your-api-key*******",
|
||||||
accounts: {
|
accounts: {
|
||||||
mnemonic: "test test test test test test test test test test test junk"
|
mnemonic: "test test test test test test test test test test test junk",
|
||||||
}
|
},
|
||||||
|
},
|
||||||
|
polygon: {
|
||||||
|
url: "https://polygon.infura.io/v3/*******your-api-key*******",
|
||||||
|
accounts: {
|
||||||
|
mnemonic: "test test test test test test test test test test test junk",
|
||||||
},
|
},
|
||||||
polygon: {
|
},
|
||||||
url: "https://polygon.infura.io/v3/*******your-api-key*******",
|
};
|
||||||
accounts: {
|
|
||||||
mnemonic: "test test test test test test test test test test test junk"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
const EtherscanConfig = {
|
const EtherscanConfig = {
|
||||||
apiKey: "YOUR_ETHERSCAN_API_KEY"
|
apiKey: "YOUR_ETHERSCAN_API_KEY",
|
||||||
}
|
};
|
||||||
|
|
||||||
export { NetworkDefinition, EtherscanConfig }
|
export { NetworkDefinition, EtherscanConfig };
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -1,39 +1,41 @@
|
|||||||
import hre from 'hardhat'
|
import hre from "hardhat";
|
||||||
const { ethers } = hre;
|
const { ethers } = hre;
|
||||||
import fs from 'fs'
|
import fs from "fs";
|
||||||
|
|
||||||
async function main() {
|
async function main() {
|
||||||
const accounts = await ethers.getSigners();
|
const accounts = await ethers.getSigners();
|
||||||
console.log(accounts[0].address);
|
console.log(accounts[0].address);
|
||||||
|
|
||||||
const Git3 = await hre.ethers.getContractAt("Git3", "0xa709975Bc01e745432f8898499E7b9a60f420117")
|
const Git3 = await hre.ethers.getContractAt(
|
||||||
let storageManager = await Git3.storageManager()
|
"Git3",
|
||||||
console.log("storageManager", storageManager)
|
"0xa709975Bc01e745432f8898499E7b9a60f420117"
|
||||||
|
);
|
||||||
const flat = await hre.ethers.getContractAt("FlatDirectory", storageManager)
|
let storageManager = await Git3.storageManager();
|
||||||
let owner = await flat.owner()
|
console.log("storageManager", storageManager);
|
||||||
console.log("owner", owner)
|
|
||||||
return
|
const flat = await hre.ethers.getContractAt("FlatDirectory", storageManager);
|
||||||
|
let owner = await flat.owner();
|
||||||
|
console.log("owner", owner);
|
||||||
let file = fs.readFileSync("test/git3.png")
|
return;
|
||||||
|
|
||||||
let buffer = Array.from(file).slice(0, 24576)
|
let file = fs.readFileSync("test/git3.png");
|
||||||
let fileSize = buffer.length
|
|
||||||
console.log("buffer", buffer.length)
|
let buffer = Array.from(file).slice(0, 24576);
|
||||||
|
let fileSize = buffer.length;
|
||||||
let cost = 0
|
console.log("buffer", buffer.length);
|
||||||
if (fileSize > 24 * 1024 - 326) {
|
|
||||||
cost = Math.floor((fileSize + 326) / 1024 / 24)
|
let cost = 0;
|
||||||
}
|
if (fileSize > 24 * 1024 - 326) {
|
||||||
let key = ethers.utils.toUtf8Bytes("aaa")
|
cost = Math.floor((fileSize + 326) / 1024 / 24);
|
||||||
let rept = await Git3.upload(key, buffer, { value: ethers.utils.parseEther(cost.toString()) })
|
}
|
||||||
console.log("rept", "https://explorer.galileo.web3q.io/tx/" + rept.hash)
|
let key = ethers.utils.toUtf8Bytes("aaa");
|
||||||
|
let rept = await Git3.upload(key, buffer, {
|
||||||
|
value: ethers.utils.parseEther(cost.toString()),
|
||||||
|
});
|
||||||
|
console.log("rept", "https://explorer.galileo.web3q.io/tx/" + rept.hash);
|
||||||
}
|
}
|
||||||
|
|
||||||
main().catch((error) => {
|
main().catch((error) => {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
});
|
});
|
Loading…
Reference in new issue