forked from circlefin/stablecoin-evm
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add deploy script for MockERC1271 wallet
* Create script to deploy MockERC1271Wallet * Modify config.js * Update documentation for testing sample ERC1271 wallet * Update v2.2 doc
- Loading branch information
1 parent
e70c672
commit f2cdf23
Showing
7 changed files
with
148 additions
and
18 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
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
File renamed without changes.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
const fs = require("fs"); | ||
const path = require("path"); | ||
const some = require("lodash/some"); | ||
|
||
const MockERC1271Wallet = artifacts.require("MockERC1271Wallet"); | ||
|
||
let mockERC1271WalletOwnerAddress = ""; | ||
|
||
// Read config file if it exists | ||
if (fs.existsSync(path.join(__dirname, "..", "config.js"))) { | ||
({ | ||
MOCK_ERC1271_WALLET_OWNER_ADDRESS: mockERC1271WalletOwnerAddress, | ||
} = require("../config.js")); | ||
} | ||
|
||
module.exports = async (deployer, network, accounts) => { | ||
const isTestEnvironment = some(["development", "coverage"], (v) => | ||
network.includes(v) | ||
); | ||
|
||
if (isTestEnvironment) { | ||
mockERC1271WalletOwnerAddress = accounts[0]; | ||
} | ||
|
||
if (!mockERC1271WalletOwnerAddress) { | ||
throw new Error( | ||
"MOCK_ERC1271_WALLET_OWNER_ADDRESS must be provided in config.js" | ||
); | ||
} | ||
|
||
console.log("Deploying MockERC1271Wallet contract..."); | ||
|
||
await deployer.deploy(MockERC1271Wallet, mockERC1271WalletOwnerAddress); | ||
const walletAddress = (await MockERC1271Wallet.deployed()).address; | ||
|
||
console.log(`>>>>>>> Deployed MockERC1271Wallet at ${walletAddress} <<<<<<<`); | ||
}; |