Skip to content

Commit 5d10ae8

Browse files
Minor updates for reliability (#30)
* Use automated gas limit when not supplied * Use etherscan v2 api for source download * FIXME Comment out operator verification not working * Construct seq wallet deploy with txParam as relayer doesn't use in inner tx * FIXME Comment out laos-sigma as not mining new blocks * FIXME Cooment out homeverse testnet. Verse not found
1 parent 21a80e5 commit 5d10ae8

File tree

6 files changed

+84
-63
lines changed

6 files changed

+84
-63
lines changed

.github/workflows/deploy.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,16 +80,16 @@ jobs:
8080
chain: immutable-zkevm-testnet
8181
- name: APE Chain Testnet
8282
chain: apechain-testnet
83-
- name: Oasys Homeverse Testnet
84-
chain: homeverse-testnet
83+
# - name: Oasys Homeverse Testnet
84+
# chain: homeverse-testnet
8585
- name: Avalanche Testnet
8686
chain: avalanche-testnet
8787
- name: Somnia Testnet
8888
chain: somnia-testnet
8989
- name: Incentiv Testnet
9090
chain: incentiv-testnet
91-
- name: LAOS Sigma Testnet
92-
chain: laos-sigma-testnet
91+
# - name: LAOS Sigma Testnet
92+
# chain: laos-sigma-testnet
9393
- name: Polygon Amoy
9494
chain: amoy
9595
- name: Base Sepolia

scripts/deploy-contracts.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,8 @@ export const deployContracts = async (config: Config): Promise<string | null> =>
7474
const txParams = {
7575
gasPrice: config.gasPrice ? BigNumber.from(config.gasPrice) : undefined, // Automated gas price
7676
// gasPrice: (await provider.getGasPrice()).mul(3).div(2), // 1.5x gas price
77-
gasLimit: config.gasLimit
78-
? BigNumber.from(config.gasLimit)
79-
: await provider.getBlock('latest').then(b => b.gasLimit.mul(4).div(10))
80-
// gasPrice: BigNumber.from(10).pow(8).mul(16)
77+
gasLimit: config.gasLimit ? BigNumber.from(config.gasLimit) : undefined // Automated gas limit
78+
// gasLimit: await provider.getBlock('latest').then(b => b.gasLimit.mul(4).div(10)),
8179
}
8280

8381
prompt.info(`Network Name: ${config.networkName}`)

scripts/download-source-code.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ async function downloadJsonFromApi(
1010
action: ApiAction,
1111
outputFile: string
1212
): Promise<void> {
13-
const apiUrl = `${apiUrlBase}?module=contract&action=${action}&apikey=${apiKey}&address=${contractAddr}`
13+
const apiUrl = `${apiUrlBase}&module=contract&action=${action}&apikey=${apiKey}&address=${contractAddr}`
1414
try {
1515
const response = await axios.get(apiUrl)
1616
if (response.status !== 200) {
@@ -36,9 +36,10 @@ async function downloadJsonFromApi(
3636
}
3737

3838
//FIXME Change these values to match your contract
39-
const etherscanApiUrl = 'https://api-sepolia.arbiscan.io/api'
39+
const etherscanApiUrl = 'https://api.etherscan.io/v2/api?chainid='
40+
const chainId = 421614 // Arbitrum sepolia
4041
const etherscanApiKey = 'XXX'
4142
const addr = '0x4240E4605cA550ea682E5ef4d1A13A132bc7fB4D'
4243

43-
downloadJsonFromApi(etherscanApiUrl, etherscanApiKey, addr, 'getsourcecode', 'source_output.json')
44-
downloadJsonFromApi(etherscanApiUrl, etherscanApiKey, addr, 'getabi', 'source_abi.json')
44+
downloadJsonFromApi(etherscanApiUrl + chainId, etherscanApiKey, addr, 'getsourcecode', 'source_output.json')
45+
downloadJsonFromApi(etherscanApiUrl + chainId, etherscanApiKey, addr, 'getabi', 'source_abi.json')

scripts/verify-contracts.ts

Lines changed: 49 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,14 @@ import { ERC721SoulboundFactory, ERC721SOULBOUNDFACTORY_VERIFICATION } from './f
2727
import { PaymentCombiner, PAYMENTCOMBINER_VERIFICATION } from './factories/token_library/PaymentCombiner'
2828
import { PAYMENTS_FACTORY_VERIFICATION, PaymentsFactory } from './factories/token_library/PaymentsFactory'
2929
import { UpgradeableBeacon, UPGRADEABLEBEACON_VERIFICATION } from './factories/token_library/UpgradeableBeacon'
30-
import {
31-
ERC1155OperatorEnforcedFactory,
32-
ERC1155OPERATORENFORCEDFACTORY_VERIFICATION
33-
} from './factories/token_library/immutable/ERC1155OperatorEnforcedFactory'
34-
import {
35-
ERC721OperatorEnforcedFactory,
36-
ERC721OPERATORENFORCEDFACTORY_VERIFICATION
37-
} from './factories/token_library/immutable/ERC721OperatorEnforcedFactory'
30+
// import {
31+
// ERC1155OperatorEnforcedFactory,
32+
// ERC1155OPERATORENFORCEDFACTORY_VERIFICATION
33+
// } from './factories/token_library/immutable/ERC1155OperatorEnforcedFactory'
34+
// import {
35+
// ERC721OperatorEnforcedFactory,
36+
// ERC721OPERATORENFORCEDFACTORY_VERIFICATION
37+
// } from './factories/token_library/immutable/ERC721OperatorEnforcedFactory'
3838
import { FACTORY_V1_VERIFICATION } from './factories/v1/FactoryV1'
3939
import { GUEST_MODULE_V1_VERIFICATION } from './factories/v1/GuestModuleV1'
4040
import { MAIN_MODULE_UPGRADABLE_V1_VERIFICATION } from './factories/v1/MainModuleUpgradableV1'
@@ -303,16 +303,16 @@ export const verifyContracts = async (config: Config, walletContextAddrs: Contra
303303
waitForSuccess,
304304
constructorArgs: defaultAbiCoder.encode(['address'], [walletContextAddrs.DeveloperMultisig])
305305
})
306-
await verifyContract(walletContextAddrs.ERC721OperatorEnforcedFactory, {
307-
...ERC721OPERATORENFORCEDFACTORY_VERIFICATION,
308-
waitForSuccess,
309-
constructorArgs: defaultAbiCoder.encode(['address'], [walletContextAddrs.DeveloperMultisig])
310-
})
311-
await verifyContract(walletContextAddrs.ERC1155OperatorEnforcedFactory, {
312-
...ERC1155OPERATORENFORCEDFACTORY_VERIFICATION,
313-
waitForSuccess,
314-
constructorArgs: defaultAbiCoder.encode(['address'], [walletContextAddrs.DeveloperMultisig])
315-
})
306+
// await verifyContract(walletContextAddrs.ERC721OperatorEnforcedFactory, {
307+
// ...ERC721OPERATORENFORCEDFACTORY_VERIFICATION,
308+
// waitForSuccess,
309+
// constructorArgs: defaultAbiCoder.encode(['address'], [walletContextAddrs.DeveloperMultisig])
310+
// })
311+
// await verifyContract(walletContextAddrs.ERC1155OperatorEnforcedFactory, {
312+
// ...ERC1155OPERATORENFORCEDFACTORY_VERIFICATION,
313+
// waitForSuccess,
314+
// constructorArgs: defaultAbiCoder.encode(['address'], [walletContextAddrs.DeveloperMultisig])
315+
// })
316316
await verifyContract(walletContextAddrs.ERC1155PackFactory, {
317317
...ERC1155PACKFACTORY_VERIFICATION,
318318
waitForSuccess,
@@ -420,37 +420,37 @@ export const verifyContracts = async (config: Config, walletContextAddrs: Contra
420420
waitForSuccess
421421
})
422422
}
423-
if (provider && walletContextAddrs.ERC721OperatorEnforcedFactory) {
424-
const erc721OperatorEnforcedFactory = new ERC721OperatorEnforcedFactory()
425-
.attach(walletContextAddrs.ERC721OperatorEnforcedFactory)
426-
.connect(provider)
427-
const erc721OperatorEnforcedBeacon = await erc721OperatorEnforcedFactory.beacon()
428-
const erc721OperatorEnforcedImplementation = await beacon
429-
.attach(erc721OperatorEnforcedBeacon)
430-
.connect(provider)
431-
.implementation()
432-
console.log('erc721OperatorEnforcedImplementation', erc721OperatorEnforcedImplementation)
433-
await verifyContract(erc721OperatorEnforcedImplementation, {
434-
...ERC721OPERATORENFORCEDFACTORY_VERIFICATION,
435-
contractToVerify: 'src/tokens/ERC721/presets/operator-enforced/ERC721OperatorEnforced.sol:ERC721OperatorEnforced',
436-
waitForSuccess
437-
})
438-
}
439-
if (provider && walletContextAddrs.ERC1155OperatorEnforcedFactory) {
440-
const erc1155OperatorEnforcedFactory = new ERC1155OperatorEnforcedFactory()
441-
.attach(walletContextAddrs.ERC1155OperatorEnforcedFactory)
442-
.connect(provider)
443-
const erc1155OperatorEnforcedBeacon = await erc1155OperatorEnforcedFactory.beacon()
444-
const erc1155OperatorEnforcedImplementation = await beacon
445-
.attach(erc1155OperatorEnforcedBeacon)
446-
.connect(provider)
447-
.implementation()
448-
await verifyContract(erc1155OperatorEnforcedImplementation, {
449-
...ERC1155OPERATORENFORCEDFACTORY_VERIFICATION,
450-
contractToVerify: 'src/tokens/ERC1155/presets/operator-enforced/ERC1155OperatorEnforced.sol:ERC1155OperatorEnforced',
451-
waitForSuccess
452-
})
453-
}
423+
// if (provider && walletContextAddrs.ERC721OperatorEnforcedFactory) {
424+
// const erc721OperatorEnforcedFactory = new ERC721OperatorEnforcedFactory()
425+
// .attach(walletContextAddrs.ERC721OperatorEnforcedFactory)
426+
// .connect(provider)
427+
// const erc721OperatorEnforcedBeacon = await erc721OperatorEnforcedFactory.beacon()
428+
// const erc721OperatorEnforcedImplementation = await beacon
429+
// .attach(erc721OperatorEnforcedBeacon)
430+
// .connect(provider)
431+
// .implementation()
432+
// console.log('erc721OperatorEnforcedImplementation', erc721OperatorEnforcedImplementation)
433+
// await verifyContract(erc721OperatorEnforcedImplementation, {
434+
// ...ERC721OPERATORENFORCEDFACTORY_VERIFICATION,
435+
// contractToVerify: 'src/tokens/ERC721/presets/operator-enforced/ERC721OperatorEnforced.sol:ERC721OperatorEnforced',
436+
// waitForSuccess
437+
// })
438+
// }
439+
// if (provider && walletContextAddrs.ERC1155OperatorEnforcedFactory) {
440+
// const erc1155OperatorEnforcedFactory = new ERC1155OperatorEnforcedFactory()
441+
// .attach(walletContextAddrs.ERC1155OperatorEnforcedFactory)
442+
// .connect(provider)
443+
// const erc1155OperatorEnforcedBeacon = await erc1155OperatorEnforcedFactory.beacon()
444+
// const erc1155OperatorEnforcedImplementation = await beacon
445+
// .attach(erc1155OperatorEnforcedBeacon)
446+
// .connect(provider)
447+
// .implementation()
448+
// await verifyContract(erc1155OperatorEnforcedImplementation, {
449+
// ...ERC1155OPERATORENFORCEDFACTORY_VERIFICATION,
450+
// contractToVerify: 'src/tokens/ERC1155/presets/operator-enforced/ERC1155OperatorEnforced.sol:ERC1155OperatorEnforced',
451+
// waitForSuccess
452+
// })
453+
// }
454454
// Clawback
455455
if (walletContextAddrs.ClawbackMetadata) {
456456
await verifyContract(walletContextAddrs.Clawback, {

scripts/wallets/DeveloperMultisig.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,18 @@ export const deployDeveloperMultisig = async (
108108
if (await wallet.reader().isDeployed(wallet.address)) {
109109
o.warn(`Already deployed developer multisig wallet at ${wallet.address}`)
110110
} else {
111-
const tx = await wallet.deploy()
111+
const deployTx = await wallet.buildDeployTransaction()
112+
if (!deployTx) {
113+
throw new Error(`Unable to build deploy transaction for developer multisig wallet at ${wallet.address}`)
114+
}
115+
const txContent = deployTx.transactions[0]
116+
const tx = await signer.sendTransaction({
117+
to: txContent.to,
118+
data: txContent.data,
119+
gasLimit: txParams?.gasLimit,
120+
gasPrice: txParams?.gasPrice
121+
})
122+
// const tx = await wallet.deploy()
112123
if (!tx) {
113124
throw new Error(`Unable to deploy developer multisig wallet at ${wallet.address}`)
114125
}

scripts/wallets/SequencePaymentsSigner.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,18 @@ export const deployPaymentsSigner = async (
9292
if (await wallet.reader().isDeployed(wallet.address)) {
9393
o.warn(`Already deployed ${signerEnv} payments signer wallet at ${wallet.address}`)
9494
} else {
95-
const tx = await wallet.deploy()
95+
const deployTx = await wallet.buildDeployTransaction()
96+
if (!deployTx) {
97+
throw new Error(`Unable to build deploy transaction for developer multisig wallet at ${wallet.address}`)
98+
}
99+
const txContent = deployTx.transactions[0]
100+
const tx = await relayer.sendTransaction({
101+
to: txContent.to,
102+
data: txContent.data,
103+
gasLimit: txParams?.gasLimit,
104+
gasPrice: txParams?.gasPrice
105+
})
106+
// const tx = await wallet.deploy()
96107
if (!tx) {
97108
throw new Error(`Unable to deploy ${signerEnv} payments signer wallet at ${wallet.address}`)
98109
}

0 commit comments

Comments
 (0)