Skip to content

Commit

Permalink
safeMasterCopyAddress - safeMasterCopyAddress
Browse files Browse the repository at this point in the history
safeMasterCopyAbi - safeMasterCopyAbi
MASTER_COPY_ADDRESS - SINGLETON_ADDRESS
MASTER_COPY_ABI - SINGLETON_ABI
  • Loading branch information
yagopv committed Sep 12, 2023
1 parent ac4a098 commit e2df557
Show file tree
Hide file tree
Showing 13 changed files with 34 additions and 34 deletions.
4 changes: 2 additions & 2 deletions guides/integrating-the-safe-core-sdk.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,15 +82,15 @@ import { ContractNetworksConfig } from '@safe-global/protocol-kit'
const chainId = await ethAdapter.getChainId()
const contractNetworks: ContractNetworksConfig = {
[chainId]: {
safeMasterCopyAddress: '<MASTER_COPY_ADDRESS>',
safeSingletonAddress: '<SINGLETON_ADDRESS>',
safeProxyFactoryAddress: '<PROXY_FACTORY_ADDRESS>',
multiSendAddress: '<MULTI_SEND_ADDRESS>',
multiSendCallOnlyAddress: '<MULTI_SEND_CALL_ONLY_ADDRESS>',
fallbackHandlerAddress: '<FALLBACK_HANDLER_ADDRESS>',
signMessageLibAddress: '<SIGN_MESSAGE_LIB_ADDRESS>',
createCallAddress: '<CREATE_CALL_ADDRESS>',
simulateTxAccessorAddress: '<SIMULATE_TX_ACCESSOR_ADDRESS>',
safeMasterCopyAbi: '<MASTER_COPY_ABI>', // Optional. Only needed with web3.js
safeSingletonAbi: '<SINGLETON_ABI>', // Optional. Only needed with web3.js
safeProxyFactoryAbi: '<PROXY_FACTORY_ABI>', // Optional. Only needed with web3.js
multiSendAbi: '<MULTI_SEND_ABI>', // Optional. Only needed with web3.js
multiSendCallOnlyAbi: '<MULTI_SEND_CALL_ONLY_ABI>', // Optional. Only needed with web3.js
Expand Down
12 changes: 6 additions & 6 deletions packages/protocol-kit/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -183,15 +183,15 @@ const safeFactory = await SafeFactory.create({ ethAdapter })
const chainId = await ethAdapter.getChainId()
const contractNetworks: ContractNetworksConfig = {
[chainId]: {
safeMasterCopyAddress: '<MASTER_COPY_ADDRESS>',
safeSingletonAddress: '<SINGLETON_ADDRESS>',
safeProxyFactoryAddress: '<PROXY_FACTORY_ADDRESS>',
multiSendAddress: '<MULTI_SEND_ADDRESS>',
multiSendCallOnlyAddress: '<MULTI_SEND_CALL_ONLY_ADDRESS>',
fallbackHandlerAddress: '<FALLBACK_HANDLER_ADDRESS>',
signMessageLibAddress: '<SIGN_MESSAGE_LIB_ADDRESS>',
createCallAddress: '<CREATE_CALL_ADDRESS>',
simulateTxAccessorAddress: '<SIMULATE_TX_ACCESSOR_ADDRESS>',
safeMasterCopyAbi: '<MASTER_COPY_ABI>', // Optional. Only needed with web3.js
safeSingletonAbi: '<SINGLETON_ABI>', // Optional. Only needed with web3.js
safeProxyFactoryAbi: '<PROXY_FACTORY_ABI>', // Optional. Only needed with web3.js
multiSendAbi: '<MULTI_SEND_ABI>', // Optional. Only needed with web3.js
multiSendCallOnlyAbi: '<MULTI_SEND_CALL_ONLY_ABI>', // Optional. Only needed with web3.js
Expand Down Expand Up @@ -337,15 +337,15 @@ const safeSdk = await Safe.create({ ethAdapter, predictedSafe })
const chainId = await ethAdapter.getChainId()
const contractNetworks: ContractNetworksConfig = {
[chainId]: {
safeMasterCopyAddress: '<MASTER_COPY_ADDRESS>',
safeSingletonAddress: '<SINGLETON_ADDRESS>',
safeProxyFactoryAddress: '<PROXY_FACTORY_ADDRESS>',
multiSendAddress: '<MULTI_SEND_ADDRESS>',
multiSendCallOnlyAddress: '<MULTI_SEND_CALL_ONLY_ADDRESS>',
fallbackHandlerAddress: '<FALLBACK_HANDLER_ADDRESS>',
signMessageLibAddress: '<SIGN_MESSAGE_LIB_ADDRESS>',
createCallAddress: '<CREATE_CALL_ADDRESS>',
simulateTxAccessorAddress: '<SIMULATE_TX_ACCESSOR_ADDRESS>',
safeMasterCopyAbi: '<MASTER_COPY_ABI>', // Optional. Only needed with web3.js
safeSingletonAbi: '<SINGLETON_ABI>', // Optional. Only needed with web3.js
safeProxyFactoryAbi: '<PROXY_FACTORY_ABI>', // Optional. Only needed with web3.js
multiSendAbi: '<MULTI_SEND_ABI>', // Optional. Only needed with web3.js
multiSendCallOnlyAbi: '<MULTI_SEND_CALL_ONLY_ABI>', // Optional. Only needed with web3.js
Expand Down Expand Up @@ -402,15 +402,15 @@ const safeSdk = await safeSdk.connect({ ethAdapter, predictedSafe })
const chainId = await ethAdapter.getChainId()
const contractNetworks: ContractNetworksConfig = {
[chainId]: {
safeMasterCopyAddress: '<MASTER_COPY_ADDRESS>',
safeSingletonAddress: '<SINGLETON_ADDRESS>',
safeProxyFactoryAddress: '<PROXY_FACTORY_ADDRESS>',
multiSendAddress: '<MULTI_SEND_ADDRESS>',
multiSendCallOnlyAddress: '<MULTI_SEND_CALL_ONLY_ADDRESS>',
fallbackHandlerAddress: '<FALLBACK_HANDLER_ADDRESS>',
signMessageLibAddress: '<SIGN_MESSAGE_LIB_ADDRESS>',
createCallAddress: '<CREATE_CALL_ADDRESS>',
simulateTxAccessorAddress: '<SIMULATE_TX_ACCESSOR_ADDRESS>',
safeMasterCopyAbi: '<MASTER_COPY_ABI>', // Optional. Only needed with web3.js
safeSingletonAbi: '<SINGLETON_ABI>', // Optional. Only needed with web3.js
safeProxyFactoryAbi: '<PROXY_FACTORY_ABI>', // Optional. Only needed with web3.js
multiSendAbi: '<MULTI_SEND_ABI>', // Optional. Only needed with web3.js
multiSendCallOnlyAbi: '<MULTI_SEND_CALL_ONLY_ABI>', // Optional. Only needed with web3.js
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { Safe_proxy_factory as SafeProxyFactory_V1_4_1 } from '@safe-global/prot
import { SafeProxyFactoryContract } from '@safe-global/safe-core-sdk-types'

export interface CreateProxyProps {
safeMasterCopyAddress: string
safeSingletonAddress: string
initializer: string
saltNonce: string
options?: EthersTransactionOptions
Expand All @@ -33,7 +33,7 @@ class SafeProxyFactoryEthersContract implements SafeProxyFactoryContract {
}

async createProxy({
safeMasterCopyAddress,
safeSingletonAddress,
initializer,
saltNonce,
options,
Expand All @@ -44,14 +44,14 @@ class SafeProxyFactoryEthersContract implements SafeProxyFactoryContract {
if (options && !options.gasLimit) {
options.gasLimit = await this.estimateGas(
'createProxyWithNonce',
[safeMasterCopyAddress, initializer, saltNonce],
[safeSingletonAddress, initializer, saltNonce],
{
...options
}
)
}
const proxyAddress = this.contract
.createProxyWithNonce(safeMasterCopyAddress, initializer, saltNonce, options)
.createProxyWithNonce(safeSingletonAddress, initializer, saltNonce, options)
.then(async (txResponse) => {
if (callback) {
callback(txResponse.hash)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { SafeProxyFactoryContract } from '@safe-global/safe-core-sdk-types'
import { TransactionReceipt } from 'web3-core/types'

export interface CreateProxyProps {
safeMasterCopyAddress: string
safeSingletonAddress: string
initializer: string
saltNonce: string
options?: Web3TransactionOptions
Expand All @@ -34,7 +34,7 @@ class SafeProxyFactoryWeb3Contract implements SafeProxyFactoryContract {
}

async createProxy({
safeMasterCopyAddress,
safeSingletonAddress,
initializer,
saltNonce,
options,
Expand All @@ -45,14 +45,14 @@ class SafeProxyFactoryWeb3Contract implements SafeProxyFactoryContract {
if (options && !options.gas) {
options.gas = await this.estimateGas(
'createProxyWithNonce',
[safeMasterCopyAddress, initializer, saltNonce],
[safeSingletonAddress, initializer, saltNonce],
{
...options
}
)
}
const txResponse = this.contract.methods
.createProxyWithNonce(safeMasterCopyAddress, initializer, saltNonce)
.createProxyWithNonce(safeSingletonAddress, initializer, saltNonce)
.send(options)

if (callback) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,8 @@ export async function getSafeContract({
const safeContract = await ethAdapter.getSafeContract({
safeVersion,
singletonDeployment,
customContractAddress: customSafeAddress ?? customContracts?.safeMasterCopyAddress,
customContractAbi: customContracts?.safeMasterCopyAbi
customContractAddress: customSafeAddress ?? customContracts?.safeSingletonAddress,
customContractAbi: customContracts?.safeSingletonAbi
})
const isContractDeployed = await ethAdapter.isContractDeployed(safeContract.getAddress())
if (!isContractDeployed) {
Expand Down
2 changes: 1 addition & 1 deletion packages/protocol-kit/src/safeFactory/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ class SafeFactory {
throw new Error('Cannot specify gas and gasLimit together in transaction options')
}
const safeAddress = await this.#safeProxyFactoryContract.createProxy({
safeMasterCopyAddress: this.#safeContract.getAddress(),
safeSingletonAddress: this.#safeContract.getAddress(),
initializer,
saltNonce,
options: {
Expand Down
8 changes: 4 additions & 4 deletions packages/protocol-kit/src/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ export interface PredictedSafeProps {
}

export interface ContractNetworkConfig {
/** safeMasterCopyAddress - Address of the Safe Master Copy contract deployed on a specific network */
safeMasterCopyAddress: string
/** safeMasterCopyAbi - Abi of the Safe Master Copy contract deployed on a specific network */
safeMasterCopyAbi?: AbiItem | AbiItem[]
/** safeSingletonAddress - Address of the Safe Master Copy contract deployed on a specific network */
safeSingletonAddress: string
/** safeSingletonAbi - Abi of the Safe Master Copy contract deployed on a specific network */
safeSingletonAbi?: AbiItem | AbiItem[]
/** safeProxyFactoryAddress - Address of the SafeProxyFactory contract deployed on a specific network */
safeProxyFactoryAddress: string
/** safeProxyFactoryAbi - Abi of the SafeProxyFactory contract deployed on a specific network */
Expand Down
4 changes: 2 additions & 2 deletions packages/protocol-kit/tests/e2e/contractManager.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@ describe('Safe contracts manager', () => {
const { safe, accounts, chainId } = await setupTests()
const customContractNetworks: ContractNetworksConfig = {
[chainId]: {
safeMasterCopyAddress: ZERO_ADDRESS,
safeMasterCopyAbi: (await getSafeSingleton()).abi,
safeSingletonAddress: ZERO_ADDRESS,
safeSingletonAbi: (await getSafeSingleton()).abi,
safeProxyFactoryAddress: ZERO_ADDRESS,
safeProxyFactoryAbi: (await getFactory()).abi,
multiSendAddress: ZERO_ADDRESS,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,8 @@ describe('createSafeDeploymentTransaction', () => {
const customContract = contractNetworks[chainId]
const safeContract = await ethAdapter.getSafeContract({
safeVersion: safeVersionDeployed,
customContractAddress: customContract?.safeMasterCopyAddress,
customContractAbi: customContract?.safeMasterCopyAbi
customContractAddress: customContract?.safeSingletonAddress,
customContractAbi: customContract?.safeSingletonAbi
})

// this is the call to the setup method that sets the threshold & owners of the new Safe
Expand Down
4 changes: 2 additions & 2 deletions packages/protocol-kit/tests/e2e/ethAdapters.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ describe('Safe contracts', () => {
const customContract = contractNetworks[chainId]
const safeContract = await ethAdapter.getSafeContract({
safeVersion,
customContractAddress: customContract?.safeMasterCopyAddress,
customContractAbi: customContract?.safeMasterCopyAbi
customContractAddress: customContract?.safeSingletonAddress,
customContractAbi: customContract?.safeSingletonAbi
})
chai
.expect(await safeContract.getAddress())
Expand Down
4 changes: 2 additions & 2 deletions packages/protocol-kit/tests/e2e/safeFactory.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ describe('SafeProxyFactory', () => {
const ethAdapter = await getEthAdapter(account1.signer)
const contractNetworks: ContractNetworksConfig = {
[chainId]: {
safeMasterCopyAddress: ZERO_ADDRESS,
safeMasterCopyAbi: (await getSafeSingleton()).abi,
safeSingletonAddress: ZERO_ADDRESS,
safeSingletonAbi: (await getSafeSingleton()).abi,
safeProxyFactoryAddress: ZERO_ADDRESS,
safeProxyFactoryAbi: (await getFactory()).abi,
multiSendAddress: ZERO_ADDRESS,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import {
export async function getContractNetworks(chainId: number): Promise<ContractNetworksConfig> {
return {
[chainId]: {
safeMasterCopyAddress: (await getSafeSingleton()).contract.address,
safeMasterCopyAbi: (await getSafeSingleton()).abi,
safeSingletonAddress: (await getSafeSingleton()).contract.address,
safeSingletonAbi: (await getSafeSingleton()).abi,
safeProxyFactoryAddress: (await getFactory()).contract.address,
safeProxyFactoryAbi: (await getFactory()).abi,
multiSendAddress: (await getMultiSend()).contract.address,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { TransactionOptions } from '@safe-global/safe-core-sdk-types/types'

export interface CreateProxyProps {
safeMasterCopyAddress: string
safeSingletonAddress: string
initializer: string
saltNonce: string
options?: TransactionOptions
Expand Down

0 comments on commit e2df557

Please sign in to comment.