logic->impl renaming fixes
This commit is contained in:
@@ -28,7 +28,7 @@ export async function queryHelperContract(helper, provider) {
|
|||||||
|
|
||||||
|
|
||||||
// do not supply extensions with name or file: e.g.
|
// do not supply extensions with name or file: e.g.
|
||||||
// use newContract(addr, 'IVaultLogic', provider, 'IVault') to get the ABI from IVault.sol/IVaultLogic.json
|
// use newContract(addr, 'IVaultImpl', provider, 'IVault') to get the ABI from IVault.sol/IVaultImpl.json
|
||||||
export async function newContract(addr, name, provider) {
|
export async function newContract(addr, name, provider) {
|
||||||
const abi = await abiCache.get(name)
|
const abi = await abiCache.get(name)
|
||||||
return new ethers.Contract(addr, abi, provider)
|
return new ethers.Contract(addr, abi, provider)
|
||||||
|
|||||||
@@ -493,14 +493,13 @@ export async function detectUpgrade() {
|
|||||||
newContract(info.factory, 'IVaultFactory', provider),
|
newContract(info.factory, 'IVaultFactory', provider),
|
||||||
newContract(s.vault, 'IVault', provider),
|
newContract(s.vault, 'IVault', provider),
|
||||||
])
|
])
|
||||||
const vaultLogic = await vault.logic()
|
const vaultImpl = await vault.impl()
|
||||||
const latestLogic = await factory.logic()
|
const latestImpl = await factory.impl()
|
||||||
// const [vaultLogic, latestLogic] = await Promise.all( vault.logic(), factory.logic() )
|
console.log('vaultImpl / latestImpl', vaultImpl, latestImpl)
|
||||||
console.log('vaultLogic / latestLogic', vaultLogic, latestLogic)
|
if ( vaultImpl !== latestImpl ) {
|
||||||
if ( vaultLogic !== latestLogic ) {
|
s.upgrade = latestImpl
|
||||||
s.upgrade = latestLogic
|
const impl = await newContract(latestImpl, 'IVault', provider)
|
||||||
const logic = await newContract(latestLogic, 'IVault', provider)
|
const version = await impl.version()
|
||||||
const version = await logic.version()
|
|
||||||
console.log(`found vault version ${version}`)
|
console.log(`found vault version ${version}`)
|
||||||
return version
|
return version
|
||||||
}
|
}
|
||||||
@@ -512,10 +511,10 @@ export async function detectUpgrade() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function upgradeSender(vault, logic) {
|
function upgradeSender(vault, impl) {
|
||||||
return async function (signer) {
|
return async function (signer) {
|
||||||
const v = await vaultContract(vault, signer)
|
const v = await vaultContract(vault, signer)
|
||||||
v.upgrade(logic)
|
v.upgrade(impl)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -524,7 +523,7 @@ function upgradeError(e) {
|
|||||||
console.error('error while upgrading vault', e)
|
console.error('error while upgrading vault', e)
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function upgradeVault(vault, logic) {
|
export async function upgradeVault(vault, impl) {
|
||||||
pendTransaction(upgradeSender(vault, logic), upgradeError)
|
pendTransaction(upgradeSender(vault, impl), upgradeError)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -595,6 +595,7 @@ export const DataFeed = {
|
|||||||
|
|
||||||
|
|
||||||
poolCallback(chainId, poolPeriod, ohlcs) {
|
poolCallback(chainId, poolPeriod, ohlcs) {
|
||||||
|
if (!ohlcs || ohlcs.length===0) return
|
||||||
const key = `${chainId}|${poolPeriod}`;
|
const key = `${chainId}|${poolPeriod}`;
|
||||||
const bars = []
|
const bars = []
|
||||||
for (const ohlc of ohlcs) {
|
for (const ohlc of ohlcs) {
|
||||||
|
|||||||
@@ -123,11 +123,10 @@ export class AbiURLCache extends AsyncURLCache {
|
|||||||
|
|
||||||
const files = {
|
const files = {
|
||||||
// If a contract is in a file different than its name, put the exception here
|
// If a contract is in a file different than its name, put the exception here
|
||||||
// 'IVaultLogic' : 'IVault', // for example
|
// 'IVaultImpl' : 'IVault', // for example
|
||||||
'IVaultLogic' : 'IVault', // for example
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export function abiPath(name) {
|
export function abiPath(name) {
|
||||||
const file = files[name]
|
const file = files[name]
|
||||||
return `${file?file:name}.sol/${name}.json`
|
return `${file??name}.sol/${name}.json`
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user