Grant permission to accounts to trade on behalf of your Vault
You may want to grant or revoke approval from a particular Ethereum address to make trades on behalf of your Vault. Below is the process for querying which addresses are currently and editing that list appropriately.
import { IntegrationManager } from'@enzymefinance/protocol';import { providers, Wallet } from'ethers';// an example providerconstprovider=providers.StaticJsonRpcProvider(ethNodeAddress, ethNetwork); // an example wallet (a subclass of Signer that can be called directly)constwallet=newWallet(investorsEthPrivateKey, provider)// the IntegrationManager contract address, available at contracts.enzyme.financeconstintegrationManagerAddress='0x23k20d...';// the Vault's comptroller address, available at the vault dashboard at app.enzyme.financeconstvaultComptrollerAddress='0x2d9es...';// an arbitrary address; we'll permission it if it's not already and// revoke permission if it is.constarbitraryAddress='0x94d0s...';// instantiate the Integration Manager contractconstintegrationManagerContract=newIntegrationManager( integrationManagerAddress, wallet,);// determine whether the arbitrary address is currently permissionedconstisCurrentlyPermissioned=awaitintegrationManagerContract.isAuthUserForFund( vaultComptrollerAddress, arbitraryAddress,);// conditionally instantiate the transactionconstauthUserTx=!isCurrentlyPermissioneded?integrationManagerContract.addAuthUserForFund.args( vaultComptrollerAddress, arbitraryAddress, ) :integrationManagerContract.removeAuthUserForFund.args( vaultComptrollerAddress, arbitraryAddress, );// send the transactionconstauthUserTxReceipt=awaitauthUserTx.send();console.log('Pending transaction:',authUserTxReceipt.hash);console.log('Transaction included in block number:',authUserTxReceipt.blockNumber);