mirror of
https://github.com/logos-storage/codex-factory.git
synced 2026-01-02 13:03:07 +00:00
chore: update 1.10 contracts (#232)
This commit is contained in:
parent
fa4533d2cc
commit
276f04265d
1
generator/contracts/PostagePriceOracle.bytecode
Normal file
1
generator/contracts/PostagePriceOracle.bytecode
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -29,8 +29,16 @@ function getPostageStampBin(tokenAddress) {
|
||||
return bin + tokenAddress
|
||||
}
|
||||
|
||||
function getPriceOracleBin(price, chequeValueDeduction) {
|
||||
const binPath = Path.join(__dirname, '..', 'contracts', 'PriceOracle.bytecode')
|
||||
function getPostagePriceOracleBin(tokenAddress) {
|
||||
const binPath = Path.join(__dirname, '..', 'contracts', 'PostagePriceOracle.bytecode')
|
||||
const bin = FS.readFileSync(binPath, 'utf8').toString().trim()
|
||||
tokenAddress = prefixedAddressParamToByteCode(tokenAddress)
|
||||
//add tokenaddress for param to the end of the bytecode
|
||||
return bin + tokenAddress
|
||||
}
|
||||
|
||||
function getSwapPriceOracleBin(price, chequeValueDeduction) {
|
||||
const binPath = Path.join(__dirname, '..', 'contracts', 'SwapPriceOracle.bytecode')
|
||||
const bin = FS.readFileSync(binPath, 'utf8').toString().trim()
|
||||
const priceAbi = intToByteCode(price)
|
||||
const chequeValueAbi = intToByteCode(chequeValueDeduction)
|
||||
@ -47,13 +55,14 @@ function getStakeRegistryBin(tokenAddress) {
|
||||
return bin + tokenAddress + networkIdAbi
|
||||
}
|
||||
|
||||
function getRedistributionBin(stakingAddress, postageContractAddress) {
|
||||
function getRedistributionBin(stakingAddress, postageContractAddress, oracleContractAddress) {
|
||||
const binPath = Path.join(__dirname, '..', 'contracts', 'Redistribution.bytecode')
|
||||
const bin = FS.readFileSync(binPath, 'utf8').toString().trim()
|
||||
stakingAddress = prefixedAddressParamToByteCode(stakingAddress)
|
||||
postageContractAddress = prefixedAddressParamToByteCode(postageContractAddress)
|
||||
//add staking address and postage address for param to the end of the bytecode
|
||||
return bin + stakingAddress + postageContractAddress
|
||||
oracleContractAddress = prefixedAddressParamToByteCode(oracleContractAddress)
|
||||
//add staking address, postage address and oracle contract address for param to the end of the bytecode
|
||||
return bin + stakingAddress + postageContractAddress + oracleContractAddress
|
||||
}
|
||||
|
||||
/** Returns back contract hash */
|
||||
@ -74,7 +83,10 @@ async function createContract(contractName, data, creatorAccount, configName) {
|
||||
`\tTransaction ID: ${transaction.transactionHash}\n` +
|
||||
`\tContract ID: ${transaction.contractAddress}`,
|
||||
)
|
||||
console.log(`::CONTRACT:${configName}:${transaction.contractAddress}\n`)
|
||||
|
||||
if (configName) {
|
||||
console.log(`::CONTRACT:${configName}:${transaction.contractAddress}\n`)
|
||||
}
|
||||
|
||||
return transaction.contractAddress
|
||||
}
|
||||
@ -83,7 +95,7 @@ module.exports = function (deployer, network, accounts) {
|
||||
const creatorAccount = accounts[0]
|
||||
|
||||
deployer.deploy(ERC20PresetMinterPauser, 'Swarm Token', 'BZZ').then(async () => {
|
||||
await createContract('PriceOracle', getPriceOracleBin(100000, 100), creatorAccount, 'price-oracle-address')
|
||||
await createContract('SwapPriceOracle', getSwapPriceOracleBin(100000, 100), creatorAccount, 'price-oracle-address')
|
||||
await createContract(
|
||||
'SimpleSwapFactory',
|
||||
getSimpleSwapFactoryBin(ERC20PresetMinterPauser.address),
|
||||
@ -98,16 +110,22 @@ module.exports = function (deployer, network, accounts) {
|
||||
'postage-stamp-address',
|
||||
)
|
||||
|
||||
const postagePriceOracleAddress = await createContract(
|
||||
'PostagePriceOracle',
|
||||
getPostagePriceOracleBin(ERC20PresetMinterPauser.address),
|
||||
creatorAccount,
|
||||
)
|
||||
|
||||
const stakeRegistryAddress = await createContract(
|
||||
'StakeRegistry',
|
||||
getStakeRegistryBin(ERC20PresetMinterPauser.address, accounts[0]),
|
||||
getStakeRegistryBin(ERC20PresetMinterPauser.address),
|
||||
creatorAccount,
|
||||
'staking-address',
|
||||
)
|
||||
|
||||
await createContract(
|
||||
'Redistribution',
|
||||
getRedistributionBin(stakeRegistryAddress, postageStampAddress),
|
||||
getRedistributionBin(stakeRegistryAddress, postageStampAddress, postagePriceOracleAddress),
|
||||
creatorAccount,
|
||||
'redistribution-address',
|
||||
)
|
||||
|
||||
20
generator/package-lock.json
generated
20
generator/package-lock.json
generated
@ -9,7 +9,7 @@
|
||||
"version": "0.0.1",
|
||||
"license": "BSD-3-Clause",
|
||||
"dependencies": {
|
||||
"@ethersphere/bee-js": "^5.0.0",
|
||||
"@ethersphere/bee-js": "^5.1.0",
|
||||
"@ethersphere/swarm-cli": "^1.12.0",
|
||||
"@openzeppelin/contracts": "^3.1.0",
|
||||
"truffle": "^5.6.3"
|
||||
@ -207,9 +207,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@ethersphere/bee-js": {
|
||||
"version": "5.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@ethersphere/bee-js/-/bee-js-5.0.0.tgz",
|
||||
"integrity": "sha512-Dr5Xon0UZvi37fvbyGj46kw3/0D8fydwfDtVtFHKi2p7mNEizG0uok2mXvwLZrMvUMOS8uXkFhbQjTFBjB+pWA==",
|
||||
"version": "5.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@ethersphere/bee-js/-/bee-js-5.1.0.tgz",
|
||||
"integrity": "sha512-DJERG2F0Qjxsu3gZ9e7w2yc83/EdvN+gRIKczkNW0arpXn6IBphK21esGURqkhasmrbgPPZ1pA178BIAIb6/hg==",
|
||||
"dependencies": {
|
||||
"@ethersphere/swarm-cid": "^0.1.0",
|
||||
"@types/readable-stream": "^2.3.13",
|
||||
@ -227,9 +227,9 @@
|
||||
"ws": "^8.7.0"
|
||||
},
|
||||
"engines": {
|
||||
"bee": "1.7.0-bbf13011",
|
||||
"beeApiVersion": "3.0.2",
|
||||
"beeDebugApiVersion": "3.0.2",
|
||||
"bee": "1.9.0-13a47043",
|
||||
"beeApiVersion": "3.2.0",
|
||||
"beeDebugApiVersion": "3.2.0",
|
||||
"node": ">=14.0.0",
|
||||
"npm": ">=6.0.0"
|
||||
}
|
||||
@ -9556,9 +9556,9 @@
|
||||
}
|
||||
},
|
||||
"@ethersphere/bee-js": {
|
||||
"version": "5.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@ethersphere/bee-js/-/bee-js-5.0.0.tgz",
|
||||
"integrity": "sha512-Dr5Xon0UZvi37fvbyGj46kw3/0D8fydwfDtVtFHKi2p7mNEizG0uok2mXvwLZrMvUMOS8uXkFhbQjTFBjB+pWA==",
|
||||
"version": "5.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@ethersphere/bee-js/-/bee-js-5.1.0.tgz",
|
||||
"integrity": "sha512-DJERG2F0Qjxsu3gZ9e7w2yc83/EdvN+gRIKczkNW0arpXn6IBphK21esGURqkhasmrbgPPZ1pA178BIAIb6/hg==",
|
||||
"requires": {
|
||||
"@ethersphere/swarm-cid": "^0.1.0",
|
||||
"@types/readable-stream": "^2.3.13",
|
||||
|
||||
@ -13,7 +13,7 @@
|
||||
"gen:traffic": "node ./scripts/gen-traffic.js"
|
||||
},
|
||||
"dependencies": {
|
||||
"@ethersphere/bee-js": "^5.0.0",
|
||||
"@ethersphere/bee-js": "^5.1.0",
|
||||
"@ethersphere/swarm-cli": "^1.12.0",
|
||||
"@openzeppelin/contracts": "^3.1.0",
|
||||
"truffle": "^5.6.3"
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
BEE_VERSION="1.9.0"
|
||||
BLOCKCHAIN_VERSION="1.3.0"
|
||||
BEE_VERSION="1.10.0-rc16"
|
||||
BLOCKCHAIN_VERSION="1.3.1"
|
||||
BEE_ENV_PREFIX="bee-factory"
|
||||
BEE_IMAGE_PREFIX="ethersphere"
|
||||
COMMIT_VERSION_TAG="false"
|
||||
|
||||
@ -90,6 +90,8 @@ async function genTrafficLoop(hosts, minCheques) {
|
||||
const uploaderBee = new Bee(uploaderBeeUrl)
|
||||
const uploaderBeeDebug = new BeeDebug(uploaderBeeDebugUrl)
|
||||
|
||||
console.log(`Depositing 10 BZZ to Chequebook on ${uploaderBeeDebugUrl}...`)
|
||||
await uploaderBeeDebug.depositTokens('1000000000000000000')
|
||||
console.log(`Creating postage stamp on ${uploaderBeeDebugUrl}...`)
|
||||
const postageBatchId = await uploaderBeeDebug.createPostageBatch(POSTAGE_STAMPS_AMOUNT, POSTAGE_STAMPS_DEPTH, {
|
||||
waitForUsable: true,
|
||||
|
||||
@ -1,29 +1,28 @@
|
||||
module.exports = {
|
||||
|
||||
networks: {
|
||||
development: {
|
||||
host: "127.0.0.1",
|
||||
host: '127.0.0.1',
|
||||
port: 9545,
|
||||
network_id: "4020",
|
||||
gasPrice: "10000000000", //10 gwei
|
||||
}
|
||||
network_id: '4020',
|
||||
gasPrice: '10000000000', //10 gwei
|
||||
},
|
||||
},
|
||||
|
||||
compilers: {
|
||||
solc: {
|
||||
version: "0.6.12", // Fetch exact version from solc-bin (default: truffle's version)
|
||||
version: '0.6.12', // Fetch exact version from solc-bin (default: truffle's version)
|
||||
docker: true,
|
||||
settings: {
|
||||
optimizer: {
|
||||
enabled: true,
|
||||
runs: 200 // Optimize for how many times you intend to run the code
|
||||
runs: 200, // Optimize for how many times you intend to run the code
|
||||
},
|
||||
evmVersion: "istanbul"
|
||||
}
|
||||
}
|
||||
evmVersion: 'istanbul',
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
db: {
|
||||
enabled: true
|
||||
}
|
||||
};
|
||||
enabled: true,
|
||||
},
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user