The restricted pim factory deployment is almost the same process as the default factory. The only difference being that the user has to pass factoryType: 'restricted-pim'
approve their collateral tokens for the pim-factory and pass the extra parameters required by the factory.
Copy import { Inverter , type RequestedModules , type GetUserArgs } from '@inverter-network/sdk'
const sdk = Inverter .getInstance ({ publicClient , walletClient })
const requestedModules = {
fundingManager : 'FM_BC_Restricted_Bancor_Redeeming_VirtualSupply_v1' ,
authorizer : 'AUT_Roles_v1' ,
paymentProcessor : 'PP_Simple_v1' ,
} as const satisfies RequestedModules < 'restricted-pim' >
const { run } = await sdk .getDeploy ({
factoryType : 'restricted-pim' ,
requestedModules
})
Copy const FORMATTED_MAX_UINT = '115792089237316195423570985008687907853269984665640564039457.584007913129639935' as const // Human Readable MAX_UINT
const curveShape = {
Basic : {
reserveRatioForBuying : 333_333 ,
reserveRatioForSelling : 333_333 ,
initialIssuanceSupply : '200002.999999999999998676' ,
initialCollateralSupply : '296.306333665498798599' ,
} ,
} as const
const args = {
authorizer : {
initialAdmin : < admin_address > ,
} ,
fundingManager : {
bondingCurveParams : {
formula : < bancor_formula > ,
buyFee : < PPM_Amount > ,
sellFee : < PPM_Amount > ,
buyIsOpen : true ,
sellIsOpen : true ,
... curveShape .Basic ,
} ,
collateralToken : < collateral_token_address > ,
} ,
issuanceToken : {
name : < name_of_the_token > ,
symbol : < symbol_of_the_token > ,
decimals : < decimals_of_the_token > ,
maxSupply : FORMATTED_MAX_UINT
} ,
beneficiary : < beneficiary_address >
} as const satisfies GetUserArgs < typeof requestedModules , 'restricted-pim' >
Copy const {
orchestratorAddress ,
transactionHash
} = await run (args , {
confirmations : 1 ,
onHash : (hash) => { console .log (hash)} ,
onConfirmation : (receipt) => { console .log (receipt)} ,
onApprove : (receipts) => { console .log (receipts)}
})