In the example below, we'll query the settings for a vault's implementation of the investor whitelist policy, then update it. Note that most policies cannot be changed once a Vault has been configured and deployed; only the investor whitelist and the investment limits.
import { InvestorWhitelist, PolicyManager, investorWhitelistArgs } from'@enzymefinance/protocol';import { providers, BigNumber, Wallet, constants } from'ethers';constprovider=providers.StaticJsonRpcProvider(ethNodeAddress, ethNetwork); constsigner=newWallet(investorsEthPrivateKey, provider);// the address of the investor whitelist policy, available at contracts.enzyme.financeconstwhitelistPolicyAddress='0xsow9o...';// the address of the policy manager contract, avalable at contracts.enzyme.financeconstpolicyManagerAddress='0xw923...';// the comptroller address of the vault in question, available at the // vault's overview page at app.enzyme.financeconstvaultComptrollerAddress='0xwdfn289s...'; constwhitelistContract=newInvestorWhitelist( whitelistPolicyAddress, provider,);// an arbitrary address to add or remove to the whitelist// if the address does not exist in the list, we'll update it// if the address does exist in the list, we'll remove itconstarbitraryAddress='0x2iws...';constaddressIsInList=awaitwhitelistContract.isInList(arbitraryAddress);constinvestorsToAdd= addressIsInList ?undefined: [arbitraryAddress];constinvestorsToRemove= addressIsInList ? [arbitraryAddress] :undefined;constupdatedPolicySettings=investorWhitelistArgs({ investorsToAdd, investorsToRemove,});constpolicyManagerContract=newPolicyManager( policyManagerAddress, signer);constpolicyUpdateTx=policyManagerContract.updatePolicySettingsForFund.args( vaultComptrollerAddress, whitelistPolicyAddress, updatedPolicySettings,);constpolicyUpdateTxReceipt=awaitpolicyUpdateTransaction.send();console.log('Pending transaction:',policyUpdateTxReceipt.hash);console.log('Transaction included in block number:',policyUpdateTxReceipt.blockNumber);