-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
116 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
smart-contracts/deploy/3_delegate_protocol.migration copy.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import { Deployer } from '@solarity/hardhat-migrate'; | ||
|
||
import { parseConfig } from './helpers/config-parser'; | ||
|
||
import { | ||
DelegatorFactory__factory, | ||
ERC1967Proxy__factory, | ||
ProvidersDelegator__factory, | ||
} from '@/generated-types/ethers'; | ||
import { wei } from '@/scripts/utils/utils'; | ||
|
||
module.exports = async function (deployer: Deployer) { | ||
const config = parseConfig(); | ||
|
||
const providersDelegatorImpl = await deployer.deploy(ProvidersDelegator__factory); | ||
const delegatorFactoryImpl = await deployer.deploy(DelegatorFactory__factory); | ||
const proxy = await deployer.deploy(ERC1967Proxy__factory, [await delegatorFactoryImpl.getAddress(), '0x']); | ||
|
||
const delegatorFactory = await deployer.deployed(DelegatorFactory__factory, await proxy.getAddress()); | ||
|
||
await delegatorFactory.DelegatorFactory_init(config.lumerinProtocol, providersDelegatorImpl); | ||
|
||
await delegatorFactory.deployProxy( | ||
'0x19ec1E4b714990620edf41fE28e9a1552953a7F4', | ||
wei(0.2, 25), | ||
'First Subnet', | ||
'Custom endpoint', | ||
60 * 60 * 1, | ||
60 * 30, | ||
); | ||
}; | ||
|
||
// npx hardhat migrate --only 3 | ||
|
||
// npx hardhat migrate --network arbitrum_sepolia --only 3 --verify | ||
// npx hardhat migrate --network arbitrum_sepolia --only 3 --verify --continue | ||
|
||
// npx hardhat migrate --network arbitrum --only 3 --verify | ||
// npx hardhat migrate --network arbitrum --only 3 --verify --continue |
65 changes: 65 additions & 0 deletions
65
smart-contracts/deploy/4_update_session_facet.migration.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
import { Deployer } from '@solarity/hardhat-migrate'; | ||
import { Fragment } from 'ethers'; | ||
import { ethers } from 'hardhat'; | ||
|
||
import { parseConfig } from './helpers/config-parser'; | ||
|
||
import { | ||
ISessionRouter__factory, | ||
IStatsStorage__factory, | ||
LinearDistributionIntervalDecrease__factory, | ||
LumerinDiamond__factory, | ||
SessionRouter__factory, | ||
} from '@/generated-types/ethers'; | ||
import { FacetAction } from '@/test/helpers/deployers'; | ||
|
||
module.exports = async function (deployer: Deployer) { | ||
const config = parseConfig(); | ||
|
||
const ldid = await deployer.deploy(LinearDistributionIntervalDecrease__factory); | ||
const newSessionRouterFacet = await deployer.deploy(SessionRouter__factory, { | ||
libraries: { | ||
LinearDistributionIntervalDecrease: ldid, | ||
}, | ||
}); | ||
|
||
const lumerinDiamond = await deployer.deployed(LumerinDiamond__factory, config.lumerinProtocol); | ||
|
||
// ONLY FOR TESTS | ||
// const testSigner = await ethers.getImpersonatedSigner(await lumerinDiamond.owner()); | ||
// END | ||
|
||
const oldSessionRouterFacet = '0xCc48cB2DbA21A5D36C16f6f64e5B5E138EA1ba13'; | ||
const oldSelectors = await lumerinDiamond.facetFunctionSelectors(oldSessionRouterFacet); | ||
|
||
// ONLY FOR TESTS - remove or add `.connect(testSigner)` | ||
await lumerinDiamond['diamondCut((address,uint8,bytes4[])[])']([ | ||
{ | ||
facetAddress: oldSessionRouterFacet, | ||
action: FacetAction.Remove, | ||
functionSelectors: [...oldSelectors], | ||
}, | ||
{ | ||
facetAddress: newSessionRouterFacet, | ||
action: FacetAction.Add, | ||
functionSelectors: ISessionRouter__factory.createInterface() | ||
.fragments.filter(Fragment.isFunction) | ||
.map((f) => f.selector), | ||
}, | ||
{ | ||
facetAddress: newSessionRouterFacet, | ||
action: FacetAction.Add, | ||
functionSelectors: IStatsStorage__factory.createInterface() | ||
.fragments.filter(Fragment.isFunction) | ||
.map((f) => f.selector), | ||
}, | ||
]); | ||
}; | ||
|
||
// npx hardhat migrate --only 4 | ||
|
||
// npx hardhat migrate --network arbitrum_sepolia --only 4 --verify | ||
// npx hardhat migrate --network arbitrum_sepolia --only 4 --verify --continue | ||
|
||
// npx hardhat migrate --network arbitrum --only 4 --verify | ||
// npx hardhat migrate --network arbitrum --only 4 --verify --continue |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters