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.
|
||||
// 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) {
|
||||
const abi = await abiCache.get(name)
|
||||
return new ethers.Contract(addr, abi, provider)
|
||||
|
||||
@@ -493,14 +493,13 @@ export async function detectUpgrade() {
|
||||
newContract(info.factory, 'IVaultFactory', provider),
|
||||
newContract(s.vault, 'IVault', provider),
|
||||
])
|
||||
const vaultLogic = await vault.logic()
|
||||
const latestLogic = await factory.logic()
|
||||
// const [vaultLogic, latestLogic] = await Promise.all( vault.logic(), factory.logic() )
|
||||
console.log('vaultLogic / latestLogic', vaultLogic, latestLogic)
|
||||
if ( vaultLogic !== latestLogic ) {
|
||||
s.upgrade = latestLogic
|
||||
const logic = await newContract(latestLogic, 'IVault', provider)
|
||||
const version = await logic.version()
|
||||
const vaultImpl = await vault.impl()
|
||||
const latestImpl = await factory.impl()
|
||||
console.log('vaultImpl / latestImpl', vaultImpl, latestImpl)
|
||||
if ( vaultImpl !== latestImpl ) {
|
||||
s.upgrade = latestImpl
|
||||
const impl = await newContract(latestImpl, 'IVault', provider)
|
||||
const version = await impl.version()
|
||||
console.log(`found vault version ${version}`)
|
||||
return version
|
||||
}
|
||||
@@ -512,10 +511,10 @@ export async function detectUpgrade() {
|
||||
}
|
||||
|
||||
|
||||
function upgradeSender(vault, logic) {
|
||||
function upgradeSender(vault, impl) {
|
||||
return async function (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)
|
||||
}
|
||||
|
||||
export async function upgradeVault(vault, logic) {
|
||||
pendTransaction(upgradeSender(vault, logic), upgradeError)
|
||||
export async function upgradeVault(vault, impl) {
|
||||
pendTransaction(upgradeSender(vault, impl), upgradeError)
|
||||
}
|
||||
|
||||
|
||||
@@ -595,6 +595,7 @@ export const DataFeed = {
|
||||
|
||||
|
||||
poolCallback(chainId, poolPeriod, ohlcs) {
|
||||
if (!ohlcs || ohlcs.length===0) return
|
||||
const key = `${chainId}|${poolPeriod}`;
|
||||
const bars = []
|
||||
for (const ohlc of ohlcs) {
|
||||
|
||||
@@ -123,11 +123,10 @@ export class AbiURLCache extends AsyncURLCache {
|
||||
|
||||
const files = {
|
||||
// If a contract is in a file different than its name, put the exception here
|
||||
// 'IVaultLogic' : 'IVault', // for example
|
||||
'IVaultLogic' : 'IVault', // for example
|
||||
// 'IVaultImpl' : 'IVault', // for example
|
||||
}
|
||||
|
||||
export function abiPath(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