` | Checks if address is registered as a child contract of this AutoApproveFactory on a specific network |
+| [nameBookReference](./autoapprove.md#nameBookReference-property-static) | `string` | Name reference to find the address of the contract in the book address.
*Overrides [RainContract.nameBookReference](./raincontract.md#nameBookReference-property-static)* |
+| [Opcodes](./autoapprove.md#Opcodes-property-static) | [AutoApproveOps](../types/autoapproveops.md) | All the opcodes avaialbles in the AutoApprove contract. |
+
+## Properties
+
+| Property | Type | Description |
+| --- | --- | --- |
+| [address](./raincontract.md#address-property) | `string` | The contract address of the instance.
*Inherited from [RainContract.address](./raincontract.md#address-property)* |
+| [afterAdd](./autoapprove.md#afterAdd-property) | (arg0: string, evidences_: EvidenceConfig[], overrides?: TxOverrides & {
from?: string \| Promise;
}) => Promise | |
+| [afterApprove](./autoapprove.md#afterApprove-property) | (approver_: string, evidences_: EvidenceConfig[], overrides?: TxOverrides & {
from?: string \| Promise;
}) => Promise | |
+| [afterBan](./autoapprove.md#afterBan-property) | (banner_: string, evidences_: EvidenceConfig[], overrides?: TxOverrides & {
from?: string \| Promise;
}) => Promise | |
+| [afterRemove](./autoapprove.md#afterRemove-property) | (remover_: string, evidences_: EvidenceConfig[], overrides?: TxOverrides & {
from?: string \| Promise;
}) => Promise | |
+| [connect](./autoapprove.md#connect-property) | `(signer: Signer) => AutoApprove` | Connect to this AutoApprove instance with a new signer
*Overrides [RainContract.connect](./raincontract.md#connect-property)* |
+| [owner](./autoapprove.md#owner-property) | `(overrides?: ReadTxOverrides) => Promise` | |
+| [packedFunctionPointers](./autoapprove.md#packedFunctionPointers-property) | `(overrides?: ReadTxOverrides) => Promise` | Pointers to opcode functions, necessary for being able to read the packedBytes |
+| [renounceOwnership](./autoapprove.md#renounceOwnership-property) | (overrides?: TxOverrides & {
from?: string \| Promise;
}) => Promise | |
+| [signer](./raincontract.md#signer-property) | `Signer` | The ethers signer that is connected to the instance.
*Inherited from [RainContract.signer](./raincontract.md#signer-property)* |
+| [storageOpcodesRange](./autoapprove.md#storageOpcodesRange-property) | `(overrides?: ReadTxOverrides) => Promise` | Returns the pointer and length for AutoApprove's storage opcodes |
+| [transferOwnership](./autoapprove.md#transferOwnership-property) | (newOwner: string, overrides?: TxOverrides & {
from?: string \| Promise;
}) => Promise | |
+
+## Static Methods
+
+| Method | Description |
+| --- | --- |
+| [\_isChild(signer, maybeChild)](./factorycontract.md#_isChild-method-static-1) | Checks if address is registered as a child contract of the factory in the chain.
*Inherited from [FactoryContract.\_isChild()](./factorycontract.md#_isChild-method-static-1)* |
+| [getBookAddress(chainId)](./raincontract.md#getBookAddress-method-static-1) | Get the address stored in the book for a determined chain if it is available.
*Inherited from [RainContract.getBookAddress()](./raincontract.md#getBookAddress-method-static-1)* |
+| [getNewChildFromReceipt(receipt, parentContract)](./factorycontract.md#getNewChildFromReceipt-method-static-1) | Get the child from a receipt obtain from a Factory transaction
*Inherited from [FactoryContract.getNewChildFromReceipt()](./factorycontract.md#getNewChildFromReceipt-method-static-1)* |
+
+## Methods
+
+| Method | Description |
+| --- | --- |
+| [checkAddress(address, message)](./raincontract.md#checkAddress-method-1) | Check if an address is correctly formatted and throw an error if it is not an valid address
*Inherited from [RainContract.checkAddress()](./raincontract.md#checkAddress-method-1)* |
+
+## Static Property Details
+
+
+
+### deploy
+
+Deploys a new AutoApprove.
+
+Signature:
+
+```typescript
+static deploy: (signer: Signer, autoApproveConfig: StateConfig, overrides?: TxOverrides) => Promise;
+```
+
+
+
+### isChild
+
+Checks if address is registered as a child contract of this AutoApproveFactory on a specific network
+
+Signature:
+
+```typescript
+static isChild: (signer: Signer, maybeChild: string) => Promise;
+```
+
+
+
+### nameBookReference
+
+Name reference to find the address of the contract in the book address.
+
+*Overrides [RainContract.nameBookReference](./raincontract.md#nameBookReference-property-static)*
+
+Should be implemented in each class to find the factory or main address in the book.
+
+Signature:
+
+```typescript
+protected static readonly nameBookReference: string;
+```
+
+
+
+### Opcodes
+
+All the opcodes avaialbles in the AutoApprove contract.
+
+This expose all the standard opcodes along with the specific local AutoApprove opcodes.
+
+Signature:
+
+```typescript
+static Opcodes: AutoApproveOps;
+```
+
+## Property Details
+
+
+
+### afterAdd
+
+
+Signature:
+
+```typescript
+readonly afterAdd: (arg0: string, evidences_: EvidenceConfig[], overrides?: TxOverrides & {
+ from?: string | Promise;
+ }) => Promise;
+```
+
+
+
+### afterApprove
+
+
+Signature:
+
+```typescript
+readonly afterApprove: (approver_: string, evidences_: EvidenceConfig[], overrides?: TxOverrides & {
+ from?: string | Promise;
+ }) => Promise;
+```
+
+
+
+### afterBan
+
+
+Signature:
+
+```typescript
+readonly afterBan: (banner_: string, evidences_: EvidenceConfig[], overrides?: TxOverrides & {
+ from?: string | Promise;
+ }) => Promise;
+```
+
+
+
+### afterRemove
+
+
+Signature:
+
+```typescript
+readonly afterRemove: (remover_: string, evidences_: EvidenceConfig[], overrides?: TxOverrides & {
+ from?: string | Promise;
+ }) => Promise;
+```
+
+
+
+### connect
+
+Connect to this AutoApprove instance with a new signer
+
+*Overrides [RainContract.connect](./raincontract.md#connect-property)*
+
+Signature:
+
+```typescript
+readonly connect: (signer: Signer) => AutoApprove;
+```
+
+
+
+### owner
+
+
+Signature:
+
+```typescript
+readonly owner: (overrides?: ReadTxOverrides) => Promise;
+```
+
+
+
+### packedFunctionPointers
+
+Pointers to opcode functions, necessary for being able to read the packedBytes
+
+Signature:
+
+```typescript
+readonly packedFunctionPointers: (overrides?: ReadTxOverrides) => Promise;
+```
+
+
+
+### renounceOwnership
+
+
+Signature:
+
+```typescript
+readonly renounceOwnership: (overrides?: TxOverrides & {
+ from?: string | Promise;
+ }) => Promise;
+```
+
+
+
+### storageOpcodesRange
+
+Returns the pointer and length for AutoApprove's storage opcodes
+
+Signature:
+
+```typescript
+readonly storageOpcodesRange: (overrides?: ReadTxOverrides) => Promise;
+```
+
+
+
+### transferOwnership
+
+
+Signature:
+
+```typescript
+readonly transferOwnership: (newOwner: string, overrides?: TxOverrides & {
+ from?: string | Promise;
+ }) => Promise;
+```
diff --git a/docs/classes/betweenblocks.md b/docs/classes/betweenblocks.md
new file mode 100644
index 0000000..c3d1191
--- /dev/null
+++ b/docs/classes/betweenblocks.md
@@ -0,0 +1,137 @@
+
+# Class BetweenBlocks
+
+- A class used for creating a VM state for Sale's canLive StateConfig based on block number.
+
+- Like all the method calls, order of calling methods in this class is important in order to produce the desired result, although calling in any order will produce a reliable result, that depends on what the intention is. Methods afterMinimumRaise and applyExtratime should not be used together as they are opposite of eachother and will cancel eachother out.
+
+Signature:
+
+```typescript
+class BetweenBlocks
+```
+
+## Example
+
+
+```typescript
+//For generating a canLive StateConfig for the sale pass in the required arguments to the constructor.
+const saleDuration = new SaleDuration(startBlockNumber, endBlockNumber)
+
+```
+
+## Properties
+
+| Property | Type | Description |
+| --- | --- | --- |
+| [constants](./betweenblocks.md#constants-property) | `BigNumberish[]` | |
+| [endBlockNumber](./betweenblocks.md#endBlockNumber-property) | `number` | |
+| [sources](./betweenblocks.md#sources-property) | `BytesLike[]` | |
+| [startBlockNumber](./betweenblocks.md#startBlockNumber-property) | `number` | |
+
+## Methods
+
+| Method | Description |
+| --- | --- |
+| [afterMinimumRaise(minimumRaise, reserveTokenDecimals)](./betweenblocks.md#afterMinimumRaise-method-1) | A method for the sale to be able to end once the sale hits minimumRaise i.e. the minimum amount that needs to be raiseed so the raises status becomes "success" after raise ends. |
+| [applyExtraTime(extraTimeBlocks, extraTimeAmount, reserveTokenDecimals)](./betweenblocks.md#applyExtraTime-method-1) | Method to apply extra time to the sale duration. if the extra time criteria which is raising more than 'extraTimeAmount' has been met the sale continue for longer (for 'extraTimeBlocks' more blocks). |
+
+## Property Details
+
+
+
+### constants
+
+Signature:
+
+```typescript
+constants: BigNumberish[];
+```
+
+
+
+### endBlockNumber
+
+Signature:
+
+```typescript
+readonly endBlockNumber: number;
+```
+
+
+
+### sources
+
+Signature:
+
+```typescript
+sources: BytesLike[];
+```
+
+
+
+### startBlockNumber
+
+Signature:
+
+```typescript
+readonly startBlockNumber: number;
+```
+
+## Method Details
+
+
+
+### afterMinimumRaise(minimumRaise, reserveTokenDecimals)
+
+A method for the sale to be able to end once the sale hits minimumRaise i.e. the minimum amount that needs to be raiseed so the raises status becomes "success" after raise ends.
+
+please note that this method should not be used with applyExtraTime as they are opossit of eachother and also the order of using this method along with other methods of this class is important
+
+Signature:
+
+```typescript
+afterMinimumRaise(minimumRaise: number, reserveTokenDecimals?: number): BetweenBlocks;
+```
+
+#### Parameters
+
+| Parameter | Type | Description |
+| --- | --- | --- |
+| minimumRaise | `number` | the minimumRaise parameter of the raise which is passed at the time of sale's deployment as part of the SaleConfig |
+| reserveTokenDecimals | `number` | |
+
+Returns:
+
+`BetweenBlocks`
+
+BetweenBlocks
+
+
+
+### applyExtraTime(extraTimeBlocks, extraTimeAmount, reserveTokenDecimals)
+
+Method to apply extra time to the sale duration. if the extra time criteria which is raising more than 'extraTimeAmount' has been met the sale continue for longer (for 'extraTimeBlocks' more blocks).
+
+- This method is designed for sale's canEndStateConfig and should 'not' be used for canStart
+
+Signature:
+
+```typescript
+applyExtraTime(extraTimeBlocks: number, extraTimeAmount: number, reserveTokenDecimals?: number): BetweenBlocks;
+```
+
+#### Parameters
+
+| Parameter | Type | Description |
+| --- | --- | --- |
+| extraTimeBlocks | `number` | The amount of time (in blocks) that sale can continue for, if the extra time criteria has been met. |
+| extraTimeAmount | `number` | The criteria for extra time, if the raised amount exceeds this amount then the raise can continue into extra time. |
+| reserveTokenDecimals | `number` | |
+
+Returns:
+
+`BetweenBlocks`
+
+BetweenBlocks
+
diff --git a/docs/classes/betweentimestamps.md b/docs/classes/betweentimestamps.md
new file mode 100644
index 0000000..ff543e8
--- /dev/null
+++ b/docs/classes/betweentimestamps.md
@@ -0,0 +1,137 @@
+
+# Class BetweenTimestamps
+
+- A class used for creating a VM state for Sale's canLive StateConfig based on timestamp.
+
+- Like all the method calls, order of calling methods in this class is important in order to produce the desired result, although calling in any order will produce a reliable result, that depends on what the intention is. Methods afterMinimumRaise and applyExtratime should not be used together as they are opposite of eachother and will cancel eachother out.
+
+Signature:
+
+```typescript
+class BetweenTimestamps
+```
+
+## Example
+
+
+```typescript
+//For generating a canLive StateConfig for the sale pass in the required arguments to the constructor.
+const saleDuration = new SaleDuration(startTimestamp, endTimestamp)
+
+```
+
+## Properties
+
+| Property | Type | Description |
+| --- | --- | --- |
+| [constants](./betweentimestamps.md#constants-property) | `BigNumberish[]` | |
+| [endTimestamp](./betweentimestamps.md#endTimestamp-property) | `number` | |
+| [sources](./betweentimestamps.md#sources-property) | `BytesLike[]` | |
+| [startTimestamp](./betweentimestamps.md#startTimestamp-property) | `number` | |
+
+## Methods
+
+| Method | Description |
+| --- | --- |
+| [afterMinimumRaise(minimumRaise, reserveTokenDecimals)](./betweentimestamps.md#afterMinimumRaise-method-1) | A method for the sale to be able to end once the sale hits minimumRaise i.e. the minimum amount that needs to be raiseed so the raises status becomes "success" after raise ends. |
+| [applyExtraTime(extraTime, extraTimeAmount, reserveTokenDecimals)](./betweentimestamps.md#applyExtraTime-method-1) | Method to apply extra time to the sale duration. if the extra time criteria which is raising more than 'extraTimeAmount' has been met the sale continue for longer (for 'extraTime' more minutes). |
+
+## Property Details
+
+
+
+### constants
+
+Signature:
+
+```typescript
+constants: BigNumberish[];
+```
+
+
+
+### endTimestamp
+
+Signature:
+
+```typescript
+readonly endTimestamp: number;
+```
+
+
+
+### sources
+
+Signature:
+
+```typescript
+sources: BytesLike[];
+```
+
+
+
+### startTimestamp
+
+Signature:
+
+```typescript
+readonly startTimestamp: number;
+```
+
+## Method Details
+
+
+
+### afterMinimumRaise(minimumRaise, reserveTokenDecimals)
+
+A method for the sale to be able to end once the sale hits minimumRaise i.e. the minimum amount that needs to be raiseed so the raises status becomes "success" after raise ends.
+
+please note that this method should not be used with applyExtraTime as they are opossit of eachother and also the order of using this method along with other methods of this class is important
+
+Signature:
+
+```typescript
+afterMinimumRaise(minimumRaise: number, reserveTokenDecimals?: number): BetweenTimestamps;
+```
+
+#### Parameters
+
+| Parameter | Type | Description |
+| --- | --- | --- |
+| minimumRaise | `number` | the minimumRaise parameter of the raise which is passed at the time of sale's deployment as part of the SaleConfig |
+| reserveTokenDecimals | `number` | |
+
+Returns:
+
+`BetweenTimestamps`
+
+BetweenTimestamps
+
+
+
+### applyExtraTime(extraTime, extraTimeAmount, reserveTokenDecimals)
+
+Method to apply extra time to the sale duration. if the extra time criteria which is raising more than 'extraTimeAmount' has been met the sale continue for longer (for 'extraTime' more minutes).
+
+- If the sale has extra time discount, it is important that this method to be applied for canEndStateConfig of the sale.
+
+Signature:
+
+```typescript
+applyExtraTime(extraTime: number, extraTimeAmount: number, reserveTokenDecimals?: number): BetweenTimestamps;
+```
+
+#### Parameters
+
+| Parameter | Type | Description |
+| --- | --- | --- |
+| extraTime | `number` | The amount of time (in minutes) that sale can continue for, if the extra time criteria has been met. |
+| extraTimeAmount | `number` | The criteria for extra time, if the raised amount exceeds this amount then the raise can continue into extra time. |
+| reserveTokenDecimals | `number` | |
+
+Returns:
+
+`BetweenTimestamps`
+
+BetweenTimestamps
+
diff --git a/docs/classes/buildreport.md b/docs/classes/buildreport.md
index 36f9c54..2c4fff2 100644
--- a/docs/classes/buildreport.md
+++ b/docs/classes/buildreport.md
@@ -13,17 +13,15 @@ class BuildReport extends CombineTierGenerator
| Property | Type | Description |
| --- | --- | --- |
-| [argumentsLength](./combinetiergenerator.md#argumentsLength-property) | `BigNumberish` | *Inherited from [CombineTierGenerator.argumentsLength](./combinetiergenerator.md#argumentsLength-property)* |
| [constants](./combinetiergenerator.md#constants-property) | `BigNumberish[]` | *Inherited from [CombineTierGenerator.constants](./combinetiergenerator.md#constants-property)* |
| [sources](./combinetiergenerator.md#sources-property) | `BytesLike[]` | *Inherited from [CombineTierGenerator.sources](./combinetiergenerator.md#sources-property)* |
-| [stackLength](./combinetiergenerator.md#stackLength-property) | `BigNumberish` | *Inherited from [CombineTierGenerator.stackLength](./combinetiergenerator.md#stackLength-property)* |
## Methods
| Method | Description |
| --- | --- |
-| [combine(reportVar, logic, mode, number)](./combinetiergenerator.md#combine-method-1) | Combines 2 tier report with selectLte with its logic and mode, and can be chained for multiple reports each with their own logic and mode
*Inherited from [CombineTierGenerator.combine()](./combinetiergenerator.md#combine-method-1)* |
-| [holdingTimeTransferTier(reportVar, numberOfBlocks)](./combinetiergenerator.md#holdingTimeTransferTier-method-1) | Creats a holding time ALWAYS/NEVER tier script for a CombineTier contract out of a TransferTier.
*Inherited from [CombineTierGenerator.holdingTimeTransferTier()](./combinetiergenerator.md#holdingTimeTransferTier-method-1)* |
-| [satDiff(reportVar)](./combinetiergenerator.md#satDiff-method-1) | Saturating difference between 2 reports
*Inherited from [CombineTierGenerator.satDiff()](./combinetiergenerator.md#satDiff-method-1)* |
-| [updateReportAtTierRange(startTier, endTier, number)](./combinetiergenerator.md#updateReportAtTierRange-method-1) | Method to update a report at given tier range (can be any range between 0 to 8)
*Inherited from [CombineTierGenerator.updateReportAtTierRange()](./combinetiergenerator.md#updateReportAtTierRange-method-1)* |
+| [combineWith(reporter, logic, mode, hasReportForSingleTier, delegatedReport, number)](./combinetiergenerator.md#combineWith-method-1) | Combines 2 tier report with selectLte with its logic and mode, and can be chained for multiple reports each with their own logic and mode
*Inherited from [CombineTierGenerator.combineWith()](./combinetiergenerator.md#combineWith-method-1)* |
+| [differenceFrom(reporter, delegatedReport)](./combinetiergenerator.md#differenceFrom-method-1) | Saturating difference between 2 reports
*Inherited from [CombineTierGenerator.differenceFrom()](./combinetiergenerator.md#differenceFrom-method-1)* |
+| [isTierHeldFor(duration)](./combinetiergenerator.md#isTierHeldFor-method-1) | Creats a holding time ALWAYS/NEVER tier script for a Combinetier contract out of a Stake contract.
*Inherited from [CombineTierGenerator.isTierHeldFor()](./combinetiergenerator.md#isTierHeldFor-method-1)* |
+| [updateReport(startTier, endTier, number)](./combinetiergenerator.md#updateReport-method-1) | Method to update a report at given tier range (can be any range between 0 to 8)
*Inherited from [CombineTierGenerator.updateReport()](./combinetiergenerator.md#updateReport-method-1)* |
diff --git a/docs/classes/buyamount.md b/docs/classes/buyamount.md
new file mode 100644
index 0000000..a93b654
--- /dev/null
+++ b/docs/classes/buyamount.md
@@ -0,0 +1,91 @@
+
+# Class BuyAmount
+
+The fisrt piece of script in a sale's amount/price pair script which determines the amoount or cap that can be bought.
+
+Signature:
+
+```typescript
+class BuyAmount
+```
+
+## Properties
+
+| Property | Type | Description |
+| --- | --- | --- |
+| [buyCapConfig](./buyamount.md#buyCapConfig-property) | `StateConfig \| undefined` | |
+| [constants](./buyamount.md#constants-property) | `BigNumberish[]` | |
+| [sources](./buyamount.md#sources-property) | `BytesLike[]` | |
+
+## Methods
+
+| Method | Description |
+| --- | --- |
+| [applyWalletCap(mode, options)](./buyamount.md#applyWalletCap-method-1) | Method to apply cap per wallet to the sale. addresses can only buy that certain amount of rTKNs. With the option of applying multiplier for max cap per wallet. |
+
+## Property Details
+
+
+
+### buyCapConfig
+
+Signature:
+
+```typescript
+readonly buyCapConfig?: StateConfig | undefined;
+```
+
+
+
+### constants
+
+Signature:
+
+```typescript
+constants: BigNumberish[];
+```
+
+
+
+### sources
+
+Signature:
+
+```typescript
+sources: BytesLike[];
+```
+
+## Method Details
+
+
+
+### applyWalletCap(mode, options)
+
+Method to apply cap per wallet to the sale. addresses can only buy that certain amount of rTKNs. With the option of applying multiplier for max cap per wallet.
+
+Signature:
+
+```typescript
+applyWalletCap(mode: BuyCapMode, options?: {
+ minWalletCap?: number;
+ maxWalletCap?: number;
+ tierAddress?: string;
+ tierMultiplier?: number[];
+ tierActivation?: (number | string)[];
+ tierContext?: BigNumber[];
+ }): BuyAmount;
+```
+
+#### Parameters
+
+| Parameter | Type | Description |
+| --- | --- | --- |
+| mode | [BuyCapMode](../enums/buycapmode.md) | The mode that determines if there is max or min cap per wallet or both. |
+| options | {
minWalletCap?: number;
maxWalletCap?: number;
tierAddress?: string;
tierMultiplier?: number[];
tierActivation?: (number \| string)[];
tierContext?: BigNumber[];
} | (optional) Additional arguments to configure the cap per wallet behaviour: - (param) minWalletCap - The number for min cap per wallet, addresses cannot buy less number of rTKNs than this amount. - (param) maxWalletCap - The number for max cap per wallet, addresses cannot buy more number of rTKNs than this amount. - (param) tierAddress - The Tier contract address for tiers' max cap per wallet multiplier. - (param) tierMultiplier - An array of each tiers' Multiplier value. - (param) tierActivation - An array of number of timestamps for each tier that will be the required period of time for that tiered address to hold the tier's in order to be eligible for that tier's multiplier. - (param) tierContext - an array of 8 items represtenting stake contract thresholds |
+
+Returns:
+
+`BuyAmount`
+
+BuyAmount
+
diff --git a/docs/classes/combinetier.md b/docs/classes/combinetier.md
index 4470463..d085dfe 100644
--- a/docs/classes/combinetier.md
+++ b/docs/classes/combinetier.md
@@ -10,7 +10,7 @@ The combine tiers implements the `ReadOnlyTier` over RainVM. Allows combining th
Signature:
```typescript
-class CombineTier extends TierContract
+class CombineTier extends ITierV2
```
## Example
@@ -41,24 +41,27 @@ const alwaysTier = await CombineTier.getAlwaysTier(signer);
| Property | Type | Description |
| --- | --- | --- |
| [deploy](./combinetier.md#deploy-property-static) | `(signer: Signer, args: CombineTierDeployArgs, overrides?: TxOverrides) => Promise` | Deploy a new CombineTier contract from the factory. |
+| [deployBalanceTier](./combinetier.md#deployBalanceTier-property-static) | `(address: string, type: "erc20" \| "erc721" \| "erc1155", levels: (number \| string)[], signer: Signer, erc20Decimals?: number, tokenId?: BigNumber) => Promise` | Method to deploy similar to Rain v1 BalanceTier contracts using CombineTier and CombineTier script generator for either of ERC20, ERC721, or ERC1155 tokens |
| [getAddressesForChainId](./addressbook.md#getAddressesForChainId-property-static) | `(chainId: number) => Addresses` | Obtain all the addresses deployed in a specific network with a chain ID.
*Inherited from [AddressBook.getAddressesForChainId](./addressbook.md#getAddressesForChainId-property-static)* |
| [getAlwaysTier](./combinetier.md#getAlwaysTier-property-static) | `(signer: Signer) => Promise` | Get an instance of a CombineTier contract that represent an AlwaysTier contract. |
| [getChainId](./raincontract.md#getChainId-property-static) | `(signerOrProvider: Signer \| Provider) => Promise` | Get the chain ID from a valid ethers provider.
Request to the provider stored in the signer which is the chain ID.
*Inherited from [RainContract.getChainId](./raincontract.md#getChainId-property-static)* |
| [getSubgraphEndpoint](./addressbook.md#getSubgraphEndpoint-property-static) | `(chainId: number) => string` | Obtain the latest subgraph endpoint related to the version that use the SDK.
*Inherited from [AddressBook.getSubgraphEndpoint](./addressbook.md#getSubgraphEndpoint-property-static)* |
| [isChild](./combinetier.md#isChild-property-static) | `(signer: Signer, maybeChild: string) => Promise` | Checks if address is registered as a child contract of this contract in a specific network. |
| [nameBookReference](./combinetier.md#nameBookReference-property-static) | `string` | Name reference to find the address of the contract in the book address.
*Overrides [RainContract.nameBookReference](./raincontract.md#nameBookReference-property-static)* |
-| [Opcodes](./combinetier.md#Opcodes-property-static) | [CombineTierOpcodes](../types/combinetieropcodes.md) | All the opcodes avaialbles in the CombineTier contract. |
## Properties
| Property | Type | Description |
| --- | --- | --- |
| [address](./raincontract.md#address-property) | `string` | The contract address of the instance.
*Inherited from [RainContract.address](./raincontract.md#address-property)* |
-| [connect](./combinetier.md#connect-property) | `(signer: Signer) => CombineTier` | Connect the current contract instance to a new ethers signer.
*Overrides [RainContract.connect](./raincontract.md#connect-property)* |
-| [levels](./tiercontract.md#levels-property) | `typeof Tier` | All the contract tier levels availables in all ITier contracts.
*Inherited from [TierContract.levels](./tiercontract.md#levels-property)* |
-| [report](./tiercontract.md#report-property) | `(account: string, overrides?: ReadTxOverrides) => Promise` | A tier report is a `uint256` that contains each of the block numbers each tier has been held continously since as a `uint32`.
*Inherited from [TierContract.report](./tiercontract.md#report-property)* |
-| [setTier](./combinetier.md#setTier-property) | `(account: string, endTier: BigNumberish, data: BytesLike, overrides?: TxOverrides \| undefined) => Promise` | It is NOT implemented in CombineTiers. Always will throw an error
*Overrides [TierContract.setTier](./tiercontract.md#setTier-property)* |
+| [connect](./combinetier.md#connect-property) | `(signer: Signer) => CombineTier` | Conncect to this CombineTier contract with another signer
*Overrides [ITierV2.connect](./itierv2.md#connect-property)* |
+| [levels](./itierv2.md#levels-property) | `typeof Tier` | All the contract tier levels availables in all ITier contracts.
*Inherited from [ITierV2.levels](./itierv2.md#levels-property)* |
+| [packedFunctionPointers](./combinetier.md#packedFunctionPointers-property) | `(overrides?: ReadTxOverrides) => Promise` | Pointers to opcode functions, necessary for being able to read the packedBytes |
+| [report](./itierv2.md#report-property) | `(account: string, context: BigNumberish[], overrides?: ReadTxOverrides) => Promise` | A tier report is a `uint256` that contains each of the block numbers each tier has been held continously since as a `uint32`.
*Inherited from [ITierV2.report](./itierv2.md#report-property)* |
+| [reportTimeForTier](./itierv2.md#reportTimeForTier-property) | `(account: string, tier: BigNumberish, context: BigNumberish[], overrides?: ReadTxOverrides) => Promise` | Same as report but only returns the time for a single tier. Often the implementing contract can calculate a single tier more efficiently than all 8 tiers. If the consumer only needs one or a few tiers it MAY be much cheaper to request only those tiers individually.
*Inherited from [ITierV2.reportTimeForTier](./itierv2.md#reportTimeForTier-property)* |
| [signer](./raincontract.md#signer-property) | `Signer` | The ethers signer that is connected to the instance.
*Inherited from [RainContract.signer](./raincontract.md#signer-property)* |
+| [storageOpcodesRange](./combinetier.md#storageOpcodesRange-property) | `(overrides?: ReadTxOverrides) => Promise` | Returns the pointer and length for combineTier's storage opcodes |
+| [supportsInterface](./combinetier.md#supportsInterface-property) | `(interfaceId_: BytesLike, overrides?: ReadTxOverrides) => Promise` | |
## Static Methods
@@ -73,7 +76,7 @@ const alwaysTier = await CombineTier.getAlwaysTier(signer);
| Method | Description |
| --- | --- |
| [checkAddress(address, message)](./raincontract.md#checkAddress-method-1) | Check if an address is correctly formatted and throw an error if it is not an valid address
*Inherited from [RainContract.checkAddress()](./raincontract.md#checkAddress-method-1)* |
-| [currentTier(account, block)](./tiercontract.md#currentTier-method-1) | Get the current tier of an `account` in the Tier as an expression between `[0 - 8]`. Tier 0 is that a address has never interact with the Tier Contract.
*Inherited from [TierContract.currentTier()](./tiercontract.md#currentTier-method-1)* |
+| [currentTier(account, timestamp)](./itierv2.md#currentTier-method-1) | Get the current tier of an `account` in the Tier as an expression between `[0 - 8]`. Tier 0 is that a address has never interact with the Tier Contract.
*Inherited from [ITierV2.currentTier()](./itierv2.md#currentTier-method-1)* |
## Static Property Details
@@ -91,6 +94,29 @@ Use the factory stored in the book addresses and use the provided signer as depl
static deploy: (signer: Signer, args: CombineTierDeployArgs, overrides?: TxOverrides) => Promise;
```
+
+
+### deployBalanceTier
+
+Method to deploy similar to Rain v1 BalanceTier contracts using CombineTier and CombineTier script generator for either of ERC20, ERC721, or ERC1155 tokens
+
+A BalanceTier checks a wallet address balance of the token and reports the results as an ALWAYS/NEVER tier.
+
+Signature:
+
+```typescript
+static deployBalanceTier: (address: string, type: "erc20" | "erc721" | "erc1155", levels: (number | string)[], signer: Signer, erc20Decimals?: number, tokenId?: BigNumber) => Promise;
+```
+
+#### Example
+
+
+```typescript
+Deploy a new BalanceTier contract using CombineTier class and script generators
+const newBalanceTier = CombineTier.deployBalanceTier(address, type, levels, signer)
+
+```
+
### getAlwaysTier
@@ -135,48 +161,53 @@ Should be implemented in each class to find the factory or main address in the b
protected static readonly nameBookReference: string;
```
-
+## Property Details
+
+
-### Opcodes
+### connect
-All the opcodes avaialbles in the CombineTier contract.
+Conncect to this CombineTier contract with another signer
-This expose all the standard opcodes along with the specific opcodes of the CombineTier.
+*Overrides [ITierV2.connect](./itierv2.md#connect-property)*
Signature:
```typescript
-static Opcodes: CombineTierOpcodes;
+readonly connect: (signer: Signer) => CombineTier;
```
-## Property Details
-
-
-
-### connect
+
-Connect the current contract instance to a new ethers signer.
+### packedFunctionPointers
-*Overrides [RainContract.connect](./raincontract.md#connect-property)*
+Pointers to opcode functions, necessary for being able to read the packedBytes
Signature:
```typescript
-readonly connect: (signer: Signer) => CombineTier;
+readonly packedFunctionPointers: (overrides?: ReadTxOverrides) => Promise;
```
-
+
+
+### storageOpcodesRange
+
+Returns the pointer and length for combineTier's storage opcodes
-### setTier
+Signature:
+
+```typescript
+readonly storageOpcodesRange: (overrides?: ReadTxOverrides) => Promise;
+```
-It is NOT implemented in CombineTiers. Always will throw an error
+
-*Overrides [TierContract.setTier](./tiercontract.md#setTier-property)*
+### supportsInterface
-Users can set their own tier by calling `setTier` if is this option available on the Tier contract. ITier like BalanceTier does not allow this.
Signature:
```typescript
-readonly setTier: (account: string, endTier: BigNumberish, data: BytesLike, overrides?: TxOverrides | undefined) => Promise;
+readonly supportsInterface: (interfaceId_: BytesLike, overrides?: ReadTxOverrides) => Promise;
```
diff --git a/docs/classes/combinetiergenerator.md b/docs/classes/combinetiergenerator.md
index 52fa80d..eeed73a 100644
--- a/docs/classes/combinetiergenerator.md
+++ b/docs/classes/combinetiergenerator.md
@@ -17,32 +17,20 @@ new CombineTier(a tierAddress or a StateConfig)
| Property | Type | Description |
| --- | --- | --- |
-| [argumentsLength](./combinetiergenerator.md#argumentsLength-property) | `BigNumberish` | |
| [constants](./combinetiergenerator.md#constants-property) | `BigNumberish[]` | |
| [sources](./combinetiergenerator.md#sources-property) | `BytesLike[]` | |
-| [stackLength](./combinetiergenerator.md#stackLength-property) | `BigNumberish` | |
## Methods
| Method | Description |
| --- | --- |
-| [combine(reportVar, logic, mode, number)](./combinetiergenerator.md#combine-method-1) | Combines 2 tier report with selectLte with its logic and mode, and can be chained for multiple reports each with their own logic and mode |
-| [holdingTimeTransferTier(reportVar, numberOfBlocks)](./combinetiergenerator.md#holdingTimeTransferTier-method-1) | Creats a holding time ALWAYS/NEVER tier script for a CombineTier contract out of a TransferTier. |
-| [satDiff(reportVar)](./combinetiergenerator.md#satDiff-method-1) | Saturating difference between 2 reports |
-| [updateReportAtTierRange(startTier, endTier, number)](./combinetiergenerator.md#updateReportAtTierRange-method-1) | Method to update a report at given tier range (can be any range between 0 to 8) |
+| [combineWith(reporter, logic, mode, hasReportForSingleTier, delegatedReport, number)](./combinetiergenerator.md#combineWith-method-1) | Combines 2 tier report with selectLte with its logic and mode, and can be chained for multiple reports each with their own logic and mode |
+| [differenceFrom(reporter, delegatedReport)](./combinetiergenerator.md#differenceFrom-method-1) | Saturating difference between 2 reports |
+| [isTierHeldFor(duration)](./combinetiergenerator.md#isTierHeldFor-method-1) | Creats a holding time ALWAYS/NEVER tier script for a Combinetier contract out of a Stake contract. |
+| [updateReport(startTier, endTier, number)](./combinetiergenerator.md#updateReport-method-1) | Method to update a report at given tier range (can be any range between 0 to 8) |
## Property Details
-
-
-### argumentsLength
-
-Signature:
-
-```typescript
-argumentsLength: BigNumberish;
-```
-
### constants
@@ -63,104 +51,96 @@ constants: BigNumberish[];
sources: BytesLike[];
```
-
-
-### stackLength
-
-Signature:
-
-```typescript
-stackLength: BigNumberish;
-```
-
## Method Details
-
+
-### combine(reportVar, logic, mode, number)
+### combineWith(reporter, logic, mode, hasReportForSingleTier, delegatedReport, number)
Combines 2 tier report with selectLte with its logic and mode, and can be chained for multiple reports each with their own logic and mode
Signature:
```typescript
-combine(reportVar: string | StateConfig, logic: selectLteLogic, mode: selectLteMode, number?: number): this;
+combineWith(reporter: string | StateConfig, logic: selectLteLogic, mode: selectLteMode, hasReportForSingleTier?: boolean, delegatedReport?: boolean, number?: number): CombineTierGenerator;
```
#### Parameters
| Parameter | Type | Description |
| --- | --- | --- |
-| reportVar | `string \| StateConfig` | either a tier contract address or a StateConfig of REPROT script (or any other form of StateConfig desired) |
+| reporter | `string \| StateConfig` | either a tier contract address or a StateConfig of REPROT script (or any other form of StateConfig desired) |
| logic | `selectLteLogic` | selectLte logic |
| mode | `selectLteMode` | selectLte mode |
-| number | `number` | (optional) if passed it would be the number to compare reports against, if not passed reports will be compared against BLOCK\_NUMBER |
+| hasReportForSingleTier | `boolean` | (optional) Used to determine if this script needs to have a second script used for getting the ITIERV2\_TIME\_FOR\_TIER for a combineTier contract reportTimeForTier, default is false |
+| delegatedReport | `boolean` | (optional) Used to determine if this script is being used for combinetier contract or standalone then it will produce the result for SENDER(false) or ACCOUNT(true) i.e CONTEXT\[0\] |
+| number | `number` | (optional) if passed it would be the number to compare reports against, if not passed reports will be compared against BLOCK\_TIMESTAMP |
Returns:
-`this`
+`CombineTierGenerator`
-this
+CombineTierGenerator
-
+
-### holdingTimeTransferTier(reportVar, numberOfBlocks)
+### differenceFrom(reporter, delegatedReport)
-Creats a holding time ALWAYS/NEVER tier script for a CombineTier contract out of a TransferTier.
+Saturating difference between 2 reports
Signature:
```typescript
-holdingTimeTransferTier(reportVar: string | StateConfig, numberOfBlocks: number | number[]): this;
+differenceFrom(reporter: string | StateConfig, delegatedReport?: boolean): this;
```
#### Parameters
| Parameter | Type | Description |
| --- | --- | --- |
-| reportVar | `string \| StateConfig` | either a TransferTier contract address or a StateConfig of TransferTier REPORT script (or can be any other form of StateConfig desired) |
-| numberOfBlocks | `number \| number[]` | A number or an array of numbers represting the number of blocks a given tier must be held to get ALWAYS report or else it gets NEVER report. |
+| reporter | `string \| StateConfig` | either a tier contract address or a StateConfig of REPROT script (or any other form of StateConfig desired) |
+| delegatedReport | `boolean` | (optional) Used to determine if this script is being used for combinetier contract or standalone then it will produce the result for SENDER(false) or ACCOUNT(true) i.e CONTEXT\[0\] |
Returns:
`this`
-this
+CombineTierGenerator
-
+
-### satDiff(reportVar)
+### isTierHeldFor(duration)
-Saturating difference between 2 reports
+Creats a holding time ALWAYS/NEVER tier script for a Combinetier contract out of a Stake contract.
Signature:
```typescript
-satDiff(reportVar: string | StateConfig): this;
+isTierHeldFor(duration: number[]): CombineTierGenerator;
```
#### Parameters
| Parameter | Type | Description |
| --- | --- | --- |
-| reportVar | `string \| StateConfig` | either a tier contract address or a StateConfig of REPROT script (or any other form of StateConfig desired) |
+| duration | `number[]` | An array of numbers represting the duration in timestamp a given tier must be held to get ALWAYS report or else it gets NEVER report. |
Returns:
-`this`
+`CombineTierGenerator`
-this
+CombineTierGenerator
-
+
-### updateReportAtTierRange(startTier, endTier, number)
+### updateReport(startTier, endTier, number)
Method to update a report at given tier range (can be any range between 0 to 8)
Signature:
```typescript
-updateReportAtTierRange(startTier: Tier, endTier: Tier, number?: number): this;
+updateReport(startTier: Tier, endTier: Tier, number?: number): CombineTierGenerator;
```
#### Parameters
@@ -169,11 +149,11 @@ updateReportAtTierRange(startTier: Tier, endTier: Tier, number?: number): this;
| --- | --- | --- |
| startTier | [Tier](../enums/tier.md) | start of the report updating range (exclusive) |
| endTier | [Tier](../enums/tier.md) | end of the report updating range (inclusive) |
-| number | `number` | (optional) if passed it would be the number to compare reports against, if not passed reports will be compared against BLOCK\_NUMBER |
+| number | `number` | (optional) if passed it would be the number to compare reports against, if not passed reports will be compared against BLOCK\_TIMESTAMP |
Returns:
-`this`
+`CombineTierGenerator`
-this
+CombineTierGenerator
diff --git a/docs/classes/combinetierjs.md b/docs/classes/combinetierjs.md
deleted file mode 100644
index da4da7e..0000000
--- a/docs/classes/combinetierjs.md
+++ /dev/null
@@ -1,64 +0,0 @@
-
-# Class CombineTierJS
-
-- The javascript version of CombineTierVM which inherits RainJS with local CombineTier opcodes.
-
-Signature:
-
-```typescript
-class CombineTierJS extends RainJS
-```
-
-## Static Properties
-
-| Property | Type | Description |
-| --- | --- | --- |
-| [Opcodes](./combinetierjs.md#Opcodes-property-static) | `import("../contracts/tiers/combineTier").CombineTierOpcodes` | Local CombineTier Opcodes + AllstandardOps
*Overrides [RainJS.Opcodes](./rainjs.md#Opcodes-property-static)* |
-
-## Properties
-
-| Property | Type | Description |
-| --- | --- | --- |
-| [\_OPCODE\_](./combinetierjs.md#_OPCODE_-property) | [ApplyOpFn](../interfaces/applyopfn.md) | key/value pair of opcodes and their functions for all standard opcodes + EmissionsERC20 local opcodes
*Overrides [RainJS.\_OPCODE\_](./rainjs.md#_OPCODE_-property)* |
-| [contract](./rainjs.md#contract-property) | `Contract` | An ethers Contract
*Inherited from [RainJS.contract](./rainjs.md#contract-property)* |
-| [lastState](./rainjs.md#lastState-property) | `BigNumber[]` | The result state of the executed Rainjs.
*Inherited from [RainJS.lastState](./rainjs.md#lastState-property)* |
-| [provider](./rainjs.md#provider-property) | `Provider` | An ethers provider.
*Inherited from [RainJS.provider](./rainjs.md#provider-property)* |
-| [signer](./rainjs.md#signer-property) | `Signer` | An ethers Signer.
*Inherited from [RainJS.signer](./rainjs.md#signer-property)* |
-
-## Methods
-
-| Method | Description |
-| --- | --- |
-| [run(data)](./rainjs.md#run-method-1) | Method to execute the RainJS.
*Inherited from [RainJS.run()](./rainjs.md#run-method-1)* |
-
-## Static Property Details
-
-
-
-### Opcodes
-
-Local CombineTier Opcodes + AllstandardOps
-
-*Overrides [RainJS.Opcodes](./rainjs.md#Opcodes-property-static)*
-
-Signature:
-
-```typescript
-static Opcodes: import("../contracts/tiers/combineTier").CombineTierOpcodes;
-```
-
-## Property Details
-
-
-
-### \_OPCODE\_
-
-key/value pair of opcodes and their functions for all standard opcodes + EmissionsERC20 local opcodes
-
-*Overrides [RainJS.\_OPCODE\_](./rainjs.md#_OPCODE_-property)*
-
-Signature:
-
-```typescript
-protected readonly _OPCODE_: ApplyOpFn;
-```
diff --git a/docs/classes/combinetierjsvm.md b/docs/classes/combinetierjsvm.md
new file mode 100644
index 0000000..1c46775
--- /dev/null
+++ b/docs/classes/combinetierjsvm.md
@@ -0,0 +1,66 @@
+
+# Class CombineTierJSVM
+
+- The javascript version of CombineTierVM which inherits RainJSVM with local CombineTier opcodes.
+
+Signature:
+
+```typescript
+class CombineTierJSVM extends RainJSVM
+```
+
+## Properties
+
+| Property | Type | Description |
+| --- | --- | --- |
+| [applyOpFn](./rainjsvm.md#applyOpFn-property) | [FnPtrsJSVM](../interfaces/fnptrsjsvm.md) | It is a property for overriding the opcodes. Need to be passed at the time of construction because the RainJSVM opcode functions should be immutable after an instance has be created.
*Inherited from [RainJSVM.applyOpFn](./rainjsvm.md#applyOpFn-property)* |
+| [constant](./rainjsvm.md#constant-property) | `(operand: number, data?: any) => void` |
*Inherited from [RainJSVM.constant](./rainjsvm.md#constant-property)* |
+| [context](./rainjsvm.md#context-property) | `(operand: number, data?: any) => void` |
*Inherited from [RainJSVM.context](./rainjsvm.md#context-property)* |
+| [ContextLength](./combinetierjsvm.md#ContextLength-property) | `number` | CombineTierJSVM can have any length for context |
+| [ContextRange](./rainjsvm.md#ContextRange-property) | `number` | Length of the valid context argument accessible by eval
*Inherited from [RainJSVM.ContextRange](./rainjsvm.md#ContextRange-property)* |
+| [debug](./rainjsvm.md#debug-property) | `(operand: number, data?: any) => void` | *Inherited from [RainJSVM.debug](./rainjsvm.md#debug-property)* |
+| [fnPtrs](./rainjsvm.md#fnPtrs-property) | [FnPtrsJSVM](../interfaces/fnptrsjsvm.md) | key/value pair of opcodes and their functions for all standard opcodes
*Inherited from [RainJSVM.fnPtrs](./rainjsvm.md#fnPtrs-property)* |
+| [lastState](./rainjsvm.md#lastState-property) | `BigNumber[]` | The result state of the executed Rainjs.
*Inherited from [RainJSVM.lastState](./rainjsvm.md#lastState-property)* |
+| [self](./rainjsvm.md#self-property) | `string` | The contract address of the instance of this class used for THIS\_ADDRESS opcode
*Inherited from [RainJSVM.self](./rainjsvm.md#self-property)* |
+| [signer](./rainjsvm.md#signer-property) | `Signer` | An ethers Signer.
*Inherited from [RainJSVM.signer](./rainjsvm.md#signer-property)* |
+| [stack](./rainjsvm.md#stack-property) | `(operand: number, data?: any) => void` |
*Inherited from [RainJSVM.stack](./rainjsvm.md#stack-property)* |
+| [storage](./rainjsvm.md#storage-property) | `(operand: number, data?: any) => Promise` |
*Inherited from [RainJSVM.storage](./rainjsvm.md#storage-property)* |
+| [StorageOps](./rainjsvm.md#StorageOps-property) | [FnPtrsJSVM](../interfaces/fnptrsjsvm.md) | Object that contains the STORAGE opcode functions (i.e. local opcodes)
*Inherited from [RainJSVM.StorageOps](./rainjsvm.md#StorageOps-property)* |
+| [StorageRange](./combinetierjsvm.md#StorageRange-property) | `` | CombineTierJSVM valid storage range
*Overrides [RainJSVM.StorageRange](./rainjsvm.md#StorageRange-property)* |
+| [zipmap](./rainjsvm.md#zipmap-property) | `(operand: number, data?: any) => Promise` | *Inherited from [RainJSVM.zipmap](./rainjsvm.md#zipmap-property)* |
+
+## Methods
+
+| Method | Description |
+| --- | --- |
+| [connect(signer)](./rainjsvm.md#connect-method-1) |
*Inherited from [RainJSVM.connect()](./rainjsvm.md#connect-method-1)* |
+| [run(data, entrypoint)](./rainjsvm.md#run-method-1) | Method to execute the RainJSVM.
*Inherited from [RainJSVM.run()](./rainjsvm.md#run-method-1)* |
+| [setContract(contract)](./rainjsvm.md#setContract-method-1) |
*Inherited from [RainJSVM.setContract()](./rainjsvm.md#setContract-method-1)* |
+
+## Property Details
+
+
+
+### ContextLength
+
+CombineTierJSVM can have any length for context
+
+Signature:
+
+```typescript
+protected readonly ContextLength: number;
+```
+
+
+
+### StorageRange
+
+CombineTierJSVM valid storage range
+
+*Overrides [RainJSVM.StorageRange](./rainjsvm.md#StorageRange-property)*
+
+Signature:
+
+```typescript
+protected readonly StorageRange = CombineTierStorage.length;
+```
diff --git a/docs/classes/combinetiersimulation.md b/docs/classes/combinetiersimulation.md
new file mode 100644
index 0000000..bed10da
--- /dev/null
+++ b/docs/classes/combinetiersimulation.md
@@ -0,0 +1,97 @@
+
+# Class CombinetierSimulation
+
+A class for creating a simulation environment for simulating a CombineTier contract off-chain using JSVM.
+
+this class is compatible with
+
+Signature:
+
+```typescript
+class CombinetierSimulation extends vmSimulation
+```
+
+## Properties
+
+| Property | Type | Description |
+| --- | --- | --- |
+| [address](./combinetiersimulation.md#address-property) | `string` | The CombineTier address of this class that the simulation is done for. this is needed for THIS\_ADDRESS opcode and updating storage types after method calls, and needs to be a string number or hex string.
*Overrides [vmSimulation.address](./vmsimulation.md#address-property)* |
+| [blockNumber](./vmsimulation.md#blockNumber-property) | `number` | A property for producing block number for the class which will be used in BLOCK\_NUMBER opcode but BLOCK\_NUMBER opcode can also be passed at runtime
*Inherited from [vmSimulation.blockNumber](./vmsimulation.md#blockNumber-property)* |
+| [erc1155s](./vmsimulation.md#erc1155s-property) | [sERC1155s](../interfaces/serc1155s.md) | A property of type erc1155s that act like a storage for simulation and stores the erc1155 token data. this is needed for IERC1155 related opcodes
*Inherited from [vmSimulation.erc1155s](./vmsimulation.md#erc1155s-property)* |
+| [erc20s](./vmsimulation.md#erc20s-property) | [sERC20s](../interfaces/serc20s.md) | A property of type erc20s that act like a storage for simulation and stores the erc20 token data. this is needed for IERC20 related opcodes
*Inherited from [vmSimulation.erc20s](./vmsimulation.md#erc20s-property)* |
+| [erc721s](./vmsimulation.md#erc721s-property) | [sERC721s](../interfaces/serc721s.md) | A property of type erc721s that act like a storage for simulation and stores the erc721 token data. this is needed for IERC721 related opcodes
*Inherited from [vmSimulation.erc721s](./vmsimulation.md#erc721s-property)* |
+| [iTiers](./vmsimulation.md#iTiers-property) | [sITiers](../interfaces/sitiers.md) | A property of type itiers that act like a storage for simulation of Rain tier contracts. this is needed for ITIERV2\_REPORT and ITIERV2\_REPORT\_TIME\_FOR\_TIER opcodes.
*Inherited from [vmSimulation.iTiers](./vmsimulation.md#iTiers-property)* |
+| [OpFns](./vmsimulation.md#OpFns-property) | [FnPtrsJSVM](../interfaces/fnptrsjsvm.md) | Opcodes functions body for simulation that use the class properties/types.
*Inherited from [vmSimulation.OpFns](./vmsimulation.md#OpFns-property)* |
+| [report](./combinetiersimulation.md#report-property) | [sStore](../interfaces/sstore.md) | The report of each account which is compatible and can be stored in |
+| [script](./vmsimulation.md#script-property) | [StateConfig](../interfaces/stateconfig.md) | The script to simulate
*Inherited from [vmSimulation.script](./vmsimulation.md#script-property)* |
+| [sender](./vmsimulation.md#sender-property) | `string` | A sender that performs the simulation transactions. this is needed for SENDER opcode simulation, and updating storage types after method calls and needs to be a string number or hex string.
*Inherited from [vmSimulation.sender](./vmsimulation.md#sender-property)* |
+| [timestamp](./vmsimulation.md#timestamp-property) | `number` | A property for producing timestamp for the class which will be used in BLOCK\_TIMESTAMP opcode but BLOCK\_TIMESTAMP opcode can also be passed at runtime
*Inherited from [vmSimulation.timestamp](./vmsimulation.md#timestamp-property)* |
+
+## Methods
+
+| Method | Description |
+| --- | --- |
+| [addAssets(erc20s, erc721s, erc1155s)](./vmsimulation.md#addAssets-method-1) | Method to add assets i.e erc20/721/1155 types objects
*Inherited from [vmSimulation.addAssets()](./vmsimulation.md#addAssets-method-1)* |
+| [addITiers(iTiers)](./vmsimulation.md#addITiers-method-1) | Method to add tier contract types objects to the class (iTiers)
*Inherited from [vmSimulation.addITiers()](./vmsimulation.md#addITiers-method-1)* |
+| [runScript(data, index)](./vmsimulation.md#runScript-method-1) | Method to run the script using JSVM
*Inherited from [vmSimulation.runScript()](./vmsimulation.md#runScript-method-1)* |
+| [setContractAddress(contractAddress)](./vmsimulation.md#setContractAddress-method-1) | Method to set the class address property
*Inherited from [vmSimulation.setContractAddress()](./vmsimulation.md#setContractAddress-method-1)* |
+| [setReport(account, timestamp, blockNumber)](./combinetiersimulation.md#setReport-method-1) | Method to get the report for an account which then will be stored in the class's report property and can be accessed later on, each time this method is called it runs the JSVM for the scripts and updates the report of the account it is been called for |
+| [setScript(script)](./vmsimulation.md#setScript-method-1) | Method to set the class script
*Inherited from [vmSimulation.setScript()](./vmsimulation.md#setScript-method-1)* |
+| [setSender(senderAddress)](./vmsimulation.md#setSender-method-1) | Method to set the class sender property
*Inherited from [vmSimulation.setSender()](./vmsimulation.md#setSender-method-1)* |
+
+## Property Details
+
+
+
+### address
+
+The CombineTier address of this class that the simulation is done for. this is needed for THIS\_ADDRESS opcode and updating storage types after method calls, and needs to be a string number or hex string.
+
+*Overrides [vmSimulation.address](./vmsimulation.md#address-property)*
+
+Signature:
+
+```typescript
+address: string;
+```
+
+
+
+### report
+
+The report of each account which is compatible and can be stored in
+
+Signature:
+
+```typescript
+report: sStore;
+```
+
+## Method Details
+
+
+
+### setReport(account, timestamp, blockNumber)
+
+Method to get the report for an account which then will be stored in the class's report property and can be accessed later on, each time this method is called it runs the JSVM for the scripts and updates the report of the account it is been called for
+
+Signature:
+
+```typescript
+setReport(account: string, timestamp?: number, blockNumber?: number): Promise;
+```
+
+#### Parameters
+
+| Parameter | Type | Description |
+| --- | --- | --- |
+| account | `string` | the account to get and update the report for which needs to be string number or hex string |
+| timestamp | `number` | (optional) custom timestamp to be used when running the script |
+| blockNumber | `number` | (optional) custom block number to be used when running the script |
+
+Returns:
+
+`Promise`
+
+the report of the account in a 64 char length hex string
+
diff --git a/docs/classes/createerc20.md b/docs/classes/createerc20.md
new file mode 100644
index 0000000..f4b3564
--- /dev/null
+++ b/docs/classes/createerc20.md
@@ -0,0 +1,39 @@
+
+# Class CreateERC20
+
+A class to creat a an ERC20 token with ability to be a faucet. owner can mint extar token if i=the token is not fixed supply. It can be claimed x number of tokens once every number of blocks passed which is defined by the faucet at the time of deployment.
+
+Signature:
+
+```typescript
+class CreateERC20
+```
+
+## Properties
+
+| Property | Type | Description |
+| --- | --- | --- |
+| [constants](./createerc20.md#constants-property) | `BigNumberish[]` | |
+| [sources](./createerc20.md#sources-property) | `BytesLike[]` | |
+
+## Property Details
+
+
+
+### constants
+
+Signature:
+
+```typescript
+constants: BigNumberish[];
+```
+
+
+
+### sources
+
+Signature:
+
+```typescript
+sources: BytesLike[];
+```
diff --git a/docs/classes/emissionserc20.md b/docs/classes/emissionserc20.md
index 5eb8e9f..0bef0fa 100644
--- a/docs/classes/emissionserc20.md
+++ b/docs/classes/emissionserc20.md
@@ -8,7 +8,7 @@ This class provides an easy way to deploy and interact with EmissionsERC20's.
Signature:
```typescript
-class EmissionsERC20 extends TierContract
+class EmissionsERC20 extends ITierV2
```
## Example
@@ -35,7 +35,6 @@ await EmissionsERC20.isChild(signer, newEmission.address);
| [getSubgraphEndpoint](./addressbook.md#getSubgraphEndpoint-property-static) | `(chainId: number) => string` | Obtain the latest subgraph endpoint related to the version that use the SDK.
*Inherited from [AddressBook.getSubgraphEndpoint](./addressbook.md#getSubgraphEndpoint-property-static)* |
| [isChild](./emissionserc20.md#isChild-property-static) | `(signer: Signer, maybeChild: string) => Promise` | Checks if address is registered as a child contract of this RedeemableERC20Factory on a specific network |
| [nameBookReference](./emissionserc20.md#nameBookReference-property-static) | `string` | Name reference to find the address of the contract in the book address.
*Overrides [RainContract.nameBookReference](./raincontract.md#nameBookReference-property-static)* |
-| [Opcodes](./emissionserc20.md#Opcodes-property-static) | [EmissionsERC20Opcodes](../types/emissionserc20opcodes.md) | All the opcodes avaialbles in the EmissionsERC20 contract. |
## Properties
@@ -44,23 +43,25 @@ await EmissionsERC20.isChild(signer, newEmission.address);
| [address](./raincontract.md#address-property) | `string` | The contract address of the instance.
*Inherited from [RainContract.address](./raincontract.md#address-property)* |
| [allowance](./emissionserc20.md#allowance-property) | `(owner: string, spender: string, overrides?: ReadTxOverrides) => Promise` | Returns the remaining number of tokens that `spender` will be allowed to spend on behalf of `owner` through `transferFrom()`. This is zero by default.
This value changes when `approve()` or `transferFrom()` are called. |
| [allowDelegatedClaims](./emissionserc20.md#allowDelegatedClaims-property) | `(overrides?: ReadTxOverrides) => Promise` | Whether the claimant must be the caller of `claim`. If `false` then accounts other than claimant can claim. This may or may not be desirable depending on the emissions schedule. For example, a linear schedule will produce the same end result for the claimant regardless of who calls `claim` or when but an exponential schedule is more profitable if the claimant waits longer between claims. In the non-linear case delegated claims would be inappropriate as third party accounts could grief claimants by claiming "early", thus forcing opportunity cost on claimants who would have preferred to wait. |
-| [approve](./emissionserc20.md#approve-property) | `(spender: string, amount: BigNumberish, overrides?: TxOverrides) => Promise` | Sets `amount` as the allowance of `spender` over the caller's tokens. |
+| [approve](./emissionserc20.md#approve-property) | `(spender: string, amount: BigNumberish, overrides?: TxOverrides) => Promise` | Approve spend limit `amount` as the allowance for a `spender` over this tokens. |
| [balanceOf](./emissionserc20.md#balanceOf-property) | `(account: string, overrides?: ReadTxOverrides) => Promise` | Returns the amount of tokens owned by `account`. |
| [calculateClaim](./emissionserc20.md#calculateClaim-property) | `(claimant: string, overrides?: ReadTxOverrides) => Promise` | Calculates the claim without processing it. Read only method that may be useful downstream both onchain and offchain if a claimant wants to check the claim amount before deciding whether to process it. As this is read only there are no checks against delegated claims. It is possible to return a value from `calculateClaim` and to not be able to process the claim with `claim` if `msg.sender` is not the `claimant`. |
| [claim](./emissionserc20.md#claim-property) | `(claimant: string, data: BytesLike, overrides?: TxOverrides) => Promise` | Processes the claim for `claimant_`. - Enforces `allowDelegatedClaims` if it is `true` so that `msg.sender` must also be `claimant_`. - Takes the return from `calculateClaim` and mints for `claimant_`. - Records the current block as the claim-tier for this contract. - emits a `Claim` event as per `IClaim`. |
-| [connect](./emissionserc20.md#connect-property) | `(signer: Signer) => EmissionsERC20` | Connect the current contract instance to a new ethers signer.
*Overrides [RainContract.connect](./raincontract.md#connect-property)* |
-| [decimals](./emissionserc20.md#decimals-property) | `(overrides?: ReadTxOverrides) => Promise` | Returns the number of decimals used to get its user representation. |
-| [decreaseAllowance](./emissionserc20.md#decreaseAllowance-property) | `(spender: string, subtractedValue: BigNumberish, overrides?: TxOverrides) => Promise` | Atomically decreases the allowance granted to `spender` by the caller.
This is an alternative to `approve()` that can be used as a mitigation for problems described in https://github.com/ethereum/EIPs/issues/20\#issuecomment-263524729. |
-| [increaseAllowance](./emissionserc20.md#increaseAllowance-property) | `(spender: string, addedValue: BigNumberish, overrides?: TxOverrides) => Promise` | Atomically increases the allowance granted to `spender` by the caller.
This is an alternative to `approve()` that can be used as a mitigation for problems described in https://github.com/ethereum/EIPs/issues/20\#issuecomment-263524729. |
-| [levels](./tiercontract.md#levels-property) | `typeof Tier` | All the contract tier levels availables in all ITier contracts.
*Inherited from [TierContract.levels](./tiercontract.md#levels-property)* |
+| [connect](./emissionserc20.md#connect-property) | `(signer: Signer) => EmissionsERC20` | Conncect to this EmissionsERC20 contract with another signer
*Overrides [ITierV2.connect](./itierv2.md#connect-property)* |
+| [decimals](./emissionserc20.md#decimals-property) | `(overrides?: ReadTxOverrides) => Promise` | Returns the number of decimals used to get its user representation. (It is always 18 for this contract type) |
+| [decreaseAllowance](./emissionserc20.md#decreaseAllowance-property) | `(spender: string, subtractedValue: BigNumberish, overrides?: TxOverrides) => Promise` | Automatically decreases the allowance granted to `spender` for this token.
This is an alternative to `approve()` that can be used as a mitigation for problems described in https://github.com/ethereum/EIPs/issues/20\#issuecomment-263524729. |
+| [increaseAllowance](./emissionserc20.md#increaseAllowance-property) | `(spender: string, addedValue: BigNumberish, overrides?: TxOverrides) => Promise` | Automically increases the allowance granted to `spender` for this token.
This is an alternative to `approve()` that can be used as a mitigation for problems described in https://github.com/ethereum/EIPs/issues/20\#issuecomment-263524729. |
+| [levels](./itierv2.md#levels-property) | `typeof Tier` | All the contract tier levels availables in all ITier contracts.
*Inherited from [ITierV2.levels](./itierv2.md#levels-property)* |
| [name](./emissionserc20.md#name-property) | `(overrides?: ReadTxOverrides) => Promise` | Returns the name of the token. |
-| [report](./tiercontract.md#report-property) | `(account: string, overrides?: ReadTxOverrides) => Promise` | A tier report is a `uint256` that contains each of the block numbers each tier has been held continously since as a `uint32`.
*Inherited from [TierContract.report](./tiercontract.md#report-property)* |
-| [setTier](./emissionserc20.md#setTier-property) | `(account: string, endTier: BigNumberish, data: BytesLike, overrides?: TxOverrides \| undefined) => Promise` | It is NOT implemented in Emissions. Always will throw an error
*Overrides [TierContract.setTier](./tiercontract.md#setTier-property)* |
+| [packedFunctionPointers](./emissionserc20.md#packedFunctionPointers-property) | `(overrides?: ReadTxOverrides) => Promise` | Pointers to opcode functions, necessary for being able to read the packedBytes |
+| [report](./itierv2.md#report-property) | `(account: string, context: BigNumberish[], overrides?: ReadTxOverrides) => Promise` | A tier report is a `uint256` that contains each of the block numbers each tier has been held continously since as a `uint32`.
*Inherited from [ITierV2.report](./itierv2.md#report-property)* |
+| [reportTimeForTier](./itierv2.md#reportTimeForTier-property) | `(account: string, tier: BigNumberish, context: BigNumberish[], overrides?: ReadTxOverrides) => Promise` | Same as report but only returns the time for a single tier. Often the implementing contract can calculate a single tier more efficiently than all 8 tiers. If the consumer only needs one or a few tiers it MAY be much cheaper to request only those tiers individually.
*Inherited from [ITierV2.reportTimeForTier](./itierv2.md#reportTimeForTier-property)* |
| [signer](./raincontract.md#signer-property) | `Signer` | The ethers signer that is connected to the instance.
*Inherited from [RainContract.signer](./raincontract.md#signer-property)* |
+| [storageOpcodesRange](./emissionserc20.md#storageOpcodesRange-property) | `(overrides?: ReadTxOverrides) => Promise` | Returns the pointer and length for emissionERC20's storage opcodes |
| [symbol](./emissionserc20.md#symbol-property) | `(overrides?: ReadTxOverrides) => Promise` | Returns the symbol of the token, usually a shorter version of the name. |
| [totalSupply](./emissionserc20.md#totalSupply-property) | `(overrides?: ReadTxOverrides) => Promise` | Returns the amount of tokens in existence. |
-| [transfer](./emissionserc20.md#transfer-property) | `(to: string, amount: BigNumberish, overrides?: TxOverrides) => Promise` | Moves `amount` tokens from the caller's account to `to`.
Requirements:
- `to` cannot be the zero address. - the caller must have a balance of at least `amount`. |
-| [transferFrom](./emissionserc20.md#transferFrom-property) | `(from: string, to: string, amount: BigNumberish, overrides?: TxOverrides) => Promise` | Moves `amount` tokens from `from` to `to` using the allowance mechanism. `amount` is then deducted from the caller's allowance.
NOTE: Does not update the allowance if the current allowance is the maximum `uint256`.
Requirements:
- `from` and `to` cannot be the zero address. - `from` must have a balance of at least `amount`. - the caller must have allowance for `from`'s tokens of at least `amount`. |
+| [transfer](./emissionserc20.md#transfer-property) | `(to: string, amount: BigNumberish, overrides?: TxOverrides) => Promise` | Moves `amount` of tokens from the caller's account to `to`.
Requirements:
- `to` cannot be the zero address. - the caller must have a balance of at least `amount`. |
+| [transferFrom](./emissionserc20.md#transferFrom-property) | `(from: string, to: string, amount: BigNumberish, overrides?: TxOverrides) => Promise` | Moves `amount` of tokens from `from` to `to` using the allowance mechanism. `amount` is then deducted from the caller's allowance.
NOTE: Does not update the allowance if the current allowance is the maximum `uint256`.
Requirements:
- `from` and `to` cannot be the zero address. - `from` must have a balance of at least `amount`. - the caller must have allowance for `from`'s tokens of at least `amount`. |
## Static Methods
@@ -75,7 +76,7 @@ await EmissionsERC20.isChild(signer, newEmission.address);
| Method | Description |
| --- | --- |
| [checkAddress(address, message)](./raincontract.md#checkAddress-method-1) | Check if an address is correctly formatted and throw an error if it is not an valid address
*Inherited from [RainContract.checkAddress()](./raincontract.md#checkAddress-method-1)* |
-| [currentTier(account, block)](./tiercontract.md#currentTier-method-1) | Get the current tier of an `account` in the Tier as an expression between `[0 - 8]`. Tier 0 is that a address has never interact with the Tier Contract.
*Inherited from [TierContract.currentTier()](./tiercontract.md#currentTier-method-1)* |
+| [currentTier(account, timestamp)](./itierv2.md#currentTier-method-1) | Get the current tier of an `account` in the Tier as an expression between `[0 - 8]`. Tier 0 is that a address has never interact with the Tier Contract.
*Inherited from [ITierV2.currentTier()](./itierv2.md#currentTier-method-1)* |
## Static Property Details
@@ -119,20 +120,6 @@ Should be implemented in each class to find the factory or main address in the b
protected static readonly nameBookReference: string;
```
-
-
-### Opcodes
-
-All the opcodes avaialbles in the EmissionsERC20 contract.
-
-This expose all the standard opcodes along with the specific opcodes of the EmissionsERC20.
-
-Signature:
-
-```typescript
-static Opcodes: EmissionsERC20Opcodes;
-```
-
## Property Details
@@ -165,7 +152,7 @@ readonly allowDelegatedClaims: (overrides?: ReadTxOverrides) => Promise
### approve
-Sets `amount` as the allowance of `spender` over the caller's tokens.
+Approve spend limit `amount` as the allowance for a `spender` over this tokens.
Signature:
@@ -213,9 +200,9 @@ readonly claim: (claimant: string, data: BytesLike, overrides?: TxOverrides) =>
### connect
-Connect the current contract instance to a new ethers signer.
+Conncect to this EmissionsERC20 contract with another signer
-*Overrides [RainContract.connect](./raincontract.md#connect-property)*
+*Overrides [ITierV2.connect](./itierv2.md#connect-property)*
Signature:
@@ -227,7 +214,7 @@ readonly connect: (signer: Signer) => EmissionsERC20;
### decimals
-Returns the number of decimals used to get its user representation.
+Returns the number of decimals used to get its user representation. (It is always 18 for this contract type)
Signature:
@@ -239,7 +226,7 @@ readonly decimals: (overrides?: ReadTxOverrides) => Promise;
### decreaseAllowance
-Atomically decreases the allowance granted to `spender` by the caller.
+Automatically decreases the allowance granted to `spender` for this token.
This is an alternative to `approve()` that can be used as a mitigation for problems described in https://github.com/ethereum/EIPs/issues/20\#issuecomment-263524729.
@@ -253,7 +240,7 @@ readonly decreaseAllowance: (spender: string, subtractedValue: BigNumberish, ove
### increaseAllowance
-Atomically increases the allowance granted to `spender` by the caller.
+Automically increases the allowance granted to `spender` for this token.
This is an alternative to `approve()` that can be used as a mitigation for problems described in https://github.com/ethereum/EIPs/issues/20\#issuecomment-263524729.
@@ -275,20 +262,28 @@ Returns the name of the token.
readonly name: (overrides?: ReadTxOverrides) => Promise;
```
-
+
+
+### packedFunctionPointers
-### setTier
+Pointers to opcode functions, necessary for being able to read the packedBytes
+
+Signature:
+
+```typescript
+readonly packedFunctionPointers: (overrides?: ReadTxOverrides) => Promise;
+```
-It is NOT implemented in Emissions. Always will throw an error
+
-*Overrides [TierContract.setTier](./tiercontract.md#setTier-property)*
+### storageOpcodesRange
-Users can set their own tier by calling `setTier` if is this option available on the Tier contract. ITier like BalanceTier does not allow this.
+Returns the pointer and length for emissionERC20's storage opcodes
Signature:
```typescript
-readonly setTier: (account: string, endTier: BigNumberish, data: BytesLike, overrides?: TxOverrides | undefined) => Promise;
+readonly storageOpcodesRange: (overrides?: ReadTxOverrides) => Promise;
```
@@ -319,7 +314,7 @@ readonly totalSupply: (overrides?: ReadTxOverrides) => Promise;
### transfer
-Moves `amount` tokens from the caller's account to `to`.
+Moves `amount` of tokens from the caller's account to `to`.
Requirements:
@@ -335,7 +330,7 @@ readonly transfer: (to: string, amount: BigNumberish, overrides?: TxOverrides) =
### transferFrom
-Moves `amount` tokens from `from` to `to` using the allowance mechanism. `amount` is then deducted from the caller's allowance.
+Moves `amount` of tokens from `from` to `to` using the allowance mechanism. `amount` is then deducted from the caller's allowance.
NOTE: Does not update the allowance if the current allowance is the maximum `uint256`.
diff --git a/docs/classes/emissionserc20js.md b/docs/classes/emissionserc20js.md
deleted file mode 100644
index cd34479..0000000
--- a/docs/classes/emissionserc20js.md
+++ /dev/null
@@ -1,64 +0,0 @@
-
-# Class EmissionsERC20JS
-
-- The javascript version of EmissionsERC20JS which inherits RainJS with local EmissionsERC20JS opcodes.
-
-Signature:
-
-```typescript
-class EmissionsERC20JS extends RainJS
-```
-
-## Static Properties
-
-| Property | Type | Description |
-| --- | --- | --- |
-| [Opcodes](./emissionserc20js.md#Opcodes-property-static) | `import("../contracts/emissionsERC20").EmissionsERC20Opcodes` | Local EmissionsERC20 Opcodes + AllstandardOps
*Overrides [RainJS.Opcodes](./rainjs.md#Opcodes-property-static)* |
-
-## Properties
-
-| Property | Type | Description |
-| --- | --- | --- |
-| [\_OPCODE\_](./emissionserc20js.md#_OPCODE_-property) | [ApplyOpFn](../interfaces/applyopfn.md) | key/value pair of opcodes and their functions for all standard opcodes + EmissionsERC20 local opcodes
*Overrides [RainJS.\_OPCODE\_](./rainjs.md#_OPCODE_-property)* |
-| [contract](./rainjs.md#contract-property) | `Contract` | An ethers Contract
*Inherited from [RainJS.contract](./rainjs.md#contract-property)* |
-| [lastState](./rainjs.md#lastState-property) | `BigNumber[]` | The result state of the executed Rainjs.
*Inherited from [RainJS.lastState](./rainjs.md#lastState-property)* |
-| [provider](./rainjs.md#provider-property) | `Provider` | An ethers provider.
*Inherited from [RainJS.provider](./rainjs.md#provider-property)* |
-| [signer](./rainjs.md#signer-property) | `Signer` | An ethers Signer.
*Inherited from [RainJS.signer](./rainjs.md#signer-property)* |
-
-## Methods
-
-| Method | Description |
-| --- | --- |
-| [run(data)](./rainjs.md#run-method-1) | Method to execute the RainJS.
*Inherited from [RainJS.run()](./rainjs.md#run-method-1)* |
-
-## Static Property Details
-
-
-
-### Opcodes
-
-Local EmissionsERC20 Opcodes + AllstandardOps
-
-*Overrides [RainJS.Opcodes](./rainjs.md#Opcodes-property-static)*
-
-Signature:
-
-```typescript
-static Opcodes: import("../contracts/emissionsERC20").EmissionsERC20Opcodes;
-```
-
-## Property Details
-
-
-
-### \_OPCODE\_
-
-key/value pair of opcodes and their functions for all standard opcodes + EmissionsERC20 local opcodes
-
-*Overrides [RainJS.\_OPCODE\_](./rainjs.md#_OPCODE_-property)*
-
-Signature:
-
-```typescript
-protected readonly _OPCODE_: ApplyOpFn;
-```
diff --git a/docs/classes/emissionserc20jsvm.md b/docs/classes/emissionserc20jsvm.md
new file mode 100644
index 0000000..731d656
--- /dev/null
+++ b/docs/classes/emissionserc20jsvm.md
@@ -0,0 +1,66 @@
+
+# Class EmissionsERC20JSVM
+
+- The javascript version of EmissionsERC20JSVM which inherits RainJSVM with local EmissionsERC20JSVM opcodes.
+
+Signature:
+
+```typescript
+class EmissionsERC20JSVM extends RainJSVM
+```
+
+## Properties
+
+| Property | Type | Description |
+| --- | --- | --- |
+| [applyOpFn](./rainjsvm.md#applyOpFn-property) | [FnPtrsJSVM](../interfaces/fnptrsjsvm.md) | It is a property for overriding the opcodes. Need to be passed at the time of construction because the RainJSVM opcode functions should be immutable after an instance has be created.
*Inherited from [RainJSVM.applyOpFn](./rainjsvm.md#applyOpFn-property)* |
+| [constant](./rainjsvm.md#constant-property) | `(operand: number, data?: any) => void` |
*Inherited from [RainJSVM.constant](./rainjsvm.md#constant-property)* |
+| [context](./rainjsvm.md#context-property) | `(operand: number, data?: any) => void` |
*Inherited from [RainJSVM.context](./rainjsvm.md#context-property)* |
+| [ContextLength](./emissionserc20jsvm.md#ContextLength-property) | `` | EmissionsERC20JSVM valid context length |
+| [ContextRange](./rainjsvm.md#ContextRange-property) | `number` | Length of the valid context argument accessible by eval
*Inherited from [RainJSVM.ContextRange](./rainjsvm.md#ContextRange-property)* |
+| [debug](./rainjsvm.md#debug-property) | `(operand: number, data?: any) => void` | *Inherited from [RainJSVM.debug](./rainjsvm.md#debug-property)* |
+| [fnPtrs](./rainjsvm.md#fnPtrs-property) | [FnPtrsJSVM](../interfaces/fnptrsjsvm.md) | key/value pair of opcodes and their functions for all standard opcodes
*Inherited from [RainJSVM.fnPtrs](./rainjsvm.md#fnPtrs-property)* |
+| [lastState](./rainjsvm.md#lastState-property) | `BigNumber[]` | The result state of the executed Rainjs.
*Inherited from [RainJSVM.lastState](./rainjsvm.md#lastState-property)* |
+| [self](./rainjsvm.md#self-property) | `string` | The contract address of the instance of this class used for THIS\_ADDRESS opcode
*Inherited from [RainJSVM.self](./rainjsvm.md#self-property)* |
+| [signer](./rainjsvm.md#signer-property) | `Signer` | An ethers Signer.
*Inherited from [RainJSVM.signer](./rainjsvm.md#signer-property)* |
+| [stack](./rainjsvm.md#stack-property) | `(operand: number, data?: any) => void` |
*Inherited from [RainJSVM.stack](./rainjsvm.md#stack-property)* |
+| [storage](./rainjsvm.md#storage-property) | `(operand: number, data?: any) => Promise` |
*Inherited from [RainJSVM.storage](./rainjsvm.md#storage-property)* |
+| [StorageOps](./rainjsvm.md#StorageOps-property) | [FnPtrsJSVM](../interfaces/fnptrsjsvm.md) | Object that contains the STORAGE opcode functions (i.e. local opcodes)
*Inherited from [RainJSVM.StorageOps](./rainjsvm.md#StorageOps-property)* |
+| [StorageRange](./emissionserc20jsvm.md#StorageRange-property) | `` | EmissionsERC20JSVM valid storage range
*Overrides [RainJSVM.StorageRange](./rainjsvm.md#StorageRange-property)* |
+| [zipmap](./rainjsvm.md#zipmap-property) | `(operand: number, data?: any) => Promise` | *Inherited from [RainJSVM.zipmap](./rainjsvm.md#zipmap-property)* |
+
+## Methods
+
+| Method | Description |
+| --- | --- |
+| [connect(signer)](./rainjsvm.md#connect-method-1) |
*Inherited from [RainJSVM.connect()](./rainjsvm.md#connect-method-1)* |
+| [run(data, entrypoint)](./rainjsvm.md#run-method-1) | Method to execute the RainJSVM.
*Inherited from [RainJSVM.run()](./rainjsvm.md#run-method-1)* |
+| [setContract(contract)](./rainjsvm.md#setContract-method-1) |
*Inherited from [RainJSVM.setContract()](./rainjsvm.md#setContract-method-1)* |
+
+## Property Details
+
+
+
+### ContextLength
+
+EmissionsERC20JSVM valid context length
+
+Signature:
+
+```typescript
+protected readonly ContextLength = EmissionsERC20Context.length;
+```
+
+
+
+### StorageRange
+
+EmissionsERC20JSVM valid storage range
+
+*Overrides [RainJSVM.StorageRange](./rainjsvm.md#StorageRange-property)*
+
+Signature:
+
+```typescript
+protected readonly StorageRange = EmissionsERC20Storage.length;
+```
diff --git a/docs/classes/emissionsmiulation.md b/docs/classes/emissionsmiulation.md
new file mode 100644
index 0000000..e1fd8bd
--- /dev/null
+++ b/docs/classes/emissionsmiulation.md
@@ -0,0 +1,177 @@
+
+# Class EmissionSmiulation
+
+A class for creating a simulation environment for simulating a EmissionsERC20 contract off-chain using JSVM.
+
+this class is compatible with
+
+Signature:
+
+```typescript
+class EmissionSmiulation extends vmSimulation
+```
+
+## Properties
+
+| Property | Type | Description |
+| --- | --- | --- |
+| [address](./emissionsmiulation.md#address-property) | `string` | The EmissionsERC20 address of this class that the simulation is done for. this is needed for THIS\_ADDRESS opcode and updating storage types after method calls, and needs to be a string number or hex string.
*Overrides [vmSimulation.address](./vmsimulation.md#address-property)* |
+| [balanceOf](./emissionsmiulation.md#balanceOf-property) | [sStore](../interfaces/sstore.md) | The balance of emission token holders which is compatible with |
+| [blockNumber](./vmsimulation.md#blockNumber-property) | `number` | A property for producing block number for the class which will be used in BLOCK\_NUMBER opcode but BLOCK\_NUMBER opcode can also be passed at runtime
*Inherited from [vmSimulation.blockNumber](./vmsimulation.md#blockNumber-property)* |
+| [decimals](./emissionsmiulation.md#decimals-property) | `number` | The decimals value of the emissions token which is 18 |
+| [erc1155s](./vmsimulation.md#erc1155s-property) | [sERC1155s](../interfaces/serc1155s.md) | A property of type erc1155s that act like a storage for simulation and stores the erc1155 token data. this is needed for IERC1155 related opcodes
*Inherited from [vmSimulation.erc1155s](./vmsimulation.md#erc1155s-property)* |
+| [erc20s](./vmsimulation.md#erc20s-property) | [sERC20s](../interfaces/serc20s.md) | A property of type erc20s that act like a storage for simulation and stores the erc20 token data. this is needed for IERC20 related opcodes
*Inherited from [vmSimulation.erc20s](./vmsimulation.md#erc20s-property)* |
+| [erc721s](./vmsimulation.md#erc721s-property) | [sERC721s](../interfaces/serc721s.md) | A property of type erc721s that act like a storage for simulation and stores the erc721 token data. this is needed for IERC721 related opcodes
*Inherited from [vmSimulation.erc721s](./vmsimulation.md#erc721s-property)* |
+| [iTiers](./vmsimulation.md#iTiers-property) | [sITiers](../interfaces/sitiers.md) | A property of type itiers that act like a storage for simulation of Rain tier contracts. this is needed for ITIERV2\_REPORT and ITIERV2\_REPORT\_TIME\_FOR\_TIER opcodes.
*Inherited from [vmSimulation.iTiers](./vmsimulation.md#iTiers-property)* |
+| [OpFns](./vmsimulation.md#OpFns-property) | [FnPtrsJSVM](../interfaces/fnptrsjsvm.md) | Opcodes functions body for simulation that use the class properties/types.
*Inherited from [vmSimulation.OpFns](./vmsimulation.md#OpFns-property)* |
+| [report](./emissionsmiulation.md#report-property) | [sStore](../interfaces/sstore.md) | The report of each claimant which is compatible and can be stored in |
+| [script](./vmsimulation.md#script-property) | [StateConfig](../interfaces/stateconfig.md) | The script to simulate
*Inherited from [vmSimulation.script](./vmsimulation.md#script-property)* |
+| [sender](./emissionsmiulation.md#sender-property) | `string` | A sender that performs the simulation transactions. this is needed for SENDER opcode simulation, and updating storage types after method calls and needs to be a string number or hex string.
*Overrides [vmSimulation.sender](./vmsimulation.md#sender-property)* |
+| [timestamp](./vmsimulation.md#timestamp-property) | `number` | A property for producing timestamp for the class which will be used in BLOCK\_TIMESTAMP opcode but BLOCK\_TIMESTAMP opcode can also be passed at runtime
*Inherited from [vmSimulation.timestamp](./vmsimulation.md#timestamp-property)* |
+| [totalSupply](./emissionsmiulation.md#totalSupply-property) | `BigNumber` | The current totalSupply of the emissions token which can increase everytime a successful mint happens |
+
+## Methods
+
+| Method | Description |
+| --- | --- |
+| [addAssets(erc20s, erc721s, erc1155s)](./vmsimulation.md#addAssets-method-1) | Method to add assets i.e erc20/721/1155 types objects
*Inherited from [vmSimulation.addAssets()](./vmsimulation.md#addAssets-method-1)* |
+| [addITiers(iTiers)](./vmsimulation.md#addITiers-method-1) | Method to add tier contract types objects to the class (iTiers)
*Inherited from [vmSimulation.addITiers()](./vmsimulation.md#addITiers-method-1)* |
+| [calculateClaim(claimantAccount, timestamp, blockNumber)](./emissionsmiulation.md#calculateClaim-method-1) | Method to calculate the cliamable amount for the claimant by running the script by JSVM |
+| [claim(claimantAccount, timestamp, blockNumber)](./emissionsmiulation.md#claim-method-1) | The method to perform the claim (claculate and mint) for the claimant account by rruning by JSVM |
+| [runScript(data, index)](./vmsimulation.md#runScript-method-1) | Method to run the script using JSVM
*Inherited from [vmSimulation.runScript()](./vmsimulation.md#runScript-method-1)* |
+| [setContractAddress(contractAddress)](./vmsimulation.md#setContractAddress-method-1) | Method to set the class address property
*Inherited from [vmSimulation.setContractAddress()](./vmsimulation.md#setContractAddress-method-1)* |
+| [setScript(script)](./vmsimulation.md#setScript-method-1) | Method to set the class script
*Inherited from [vmSimulation.setScript()](./vmsimulation.md#setScript-method-1)* |
+| [setSender(senderAddress)](./vmsimulation.md#setSender-method-1) | Method to set the class sender property
*Inherited from [vmSimulation.setSender()](./vmsimulation.md#setSender-method-1)* |
+
+## Property Details
+
+
+
+### address
+
+The EmissionsERC20 address of this class that the simulation is done for. this is needed for THIS\_ADDRESS opcode and updating storage types after method calls, and needs to be a string number or hex string.
+
+*Overrides [vmSimulation.address](./vmsimulation.md#address-property)*
+
+Signature:
+
+```typescript
+address: string;
+```
+
+
+
+### balanceOf
+
+The balance of emission token holders which is compatible with
+
+Signature:
+
+```typescript
+balanceOf: sStore;
+```
+
+
+
+### decimals
+
+The decimals value of the emissions token which is 18
+
+Signature:
+
+```typescript
+readonly decimals: number;
+```
+
+
+
+### report
+
+The report of each claimant which is compatible and can be stored in
+
+Signature:
+
+```typescript
+report: sStore;
+```
+
+
+
+### sender
+
+A sender that performs the simulation transactions. this is needed for SENDER opcode simulation, and updating storage types after method calls and needs to be a string number or hex string.
+
+*Overrides [vmSimulation.sender](./vmsimulation.md#sender-property)*
+
+Signature:
+
+```typescript
+sender: string;
+```
+
+
+
+### totalSupply
+
+The current totalSupply of the emissions token which can increase everytime a successful mint happens
+
+Signature:
+
+```typescript
+totalSupply: BigNumber;
+```
+
+## Method Details
+
+
+
+### calculateClaim(claimantAccount, timestamp, blockNumber)
+
+Method to calculate the cliamable amount for the claimant by running the script by JSVM
+
+Signature:
+
+```typescript
+calculateClaim(claimantAccount: string, timestamp?: number, blockNumber?: number): Promise;
+```
+
+#### Parameters
+
+| Parameter | Type | Description |
+| --- | --- | --- |
+| claimantAccount | `string` | the account to calculate the claimable amount which needs to be string number or hex string |
+| timestamp | `number` | (optional) custom timestamp to be used when running the script |
+| blockNumber | `number` | (optional) custom block number to be used when running the script |
+
+Returns:
+
+`Promise`
+
+A BigNumber that represents the claimable amount
+
+
+
+### claim(claimantAccount, timestamp, blockNumber)
+
+The method to perform the claim (claculate and mint) for the claimant account by rruning by JSVM
+
+Signature:
+
+```typescript
+claim(claimantAccount: string, timestamp?: number, blockNumber?: number): Promise;
+```
+
+#### Parameters
+
+| Parameter | Type | Description |
+| --- | --- | --- |
+| claimantAccount | `string` | the account to calculate the claimable amount which needs to be string number or hex string |
+| timestamp | `number` | (optional) custom timestamp to be used when running the script |
+| blockNumber | `number` | (optional) custom block number to be used when running the script |
+
+Returns:
+
+`Promise`
+
+the minted amount in a BigNumber format
+
diff --git a/docs/classes/erc1155.md b/docs/classes/erc1155.md
index b01672d..62ca97c 100644
--- a/docs/classes/erc1155.md
+++ b/docs/classes/erc1155.md
@@ -27,7 +27,7 @@ class ERC1155
| [balanceOfBatch](./erc1155.md#balanceOfBatch-property) | `(accounts: string[], ids: BigNumberish[], overrides?: ReadTxOverrides) => Promise` | Return a batch of the balances
Requirements:
- `accounts` and `ids` must have the same length. |
| [burn](./erc1155.md#burn-property) | `(account: string, id: BigNumberish, value: BigNumberish, overrides?: TxOverrides) => Promise` | Burn the tokens of type `id` from `account ` |
| [burnBatch](./erc1155.md#burnBatch-property) | `(account: string, ids: BigNumberish[], values: BigNumberish[], overrides?: TxOverrides) => Promise` | Burn the tokens of type `id` from `account as a batch` |
-| [connect](./erc1155.md#connect-property) | `(signer: Signer) => ERC1155` | Connect the current instance to a new signer |
+| [connect](./erc1155.md#connect-property) | `(signer: Signer) => ERC1155` | Connect the current instance of ERC1155 to a new signer |
| [isApprovedForAll](./erc1155.md#isApprovedForAll-property) | `(account: string, operator: string, overrides?: ReadTxOverrides) => Promise` | Returns true if `operator` is approved to transfer `account`'s tokens. |
| [safeBatchTransferFrom](./erc1155.md#safeBatchTransferFrom-property) | `(from: string, to: string, ids: BigNumberish[], amounts: BigNumberish[], data: BytesLike, overrides?: TxOverrides) => Promise` | Transfers each `amounts` tokens of token type `ids` from `from` to `to`.
Requirements:
- `to` cannot be the zero address. - If the caller is not `from`, it must be have been approved to spend `from`'s tokens via `setApprovalForAll()`. - `from` must have a balance of tokens of type `id` of at least `amount`. |
| [safeTransferFrom](./erc1155.md#safeTransferFrom-property) | `(from: string, to: string, id: BigNumberish, amount: BigNumberish, data: BytesLike, overrides?: TxOverrides) => Promise` | Transfers `amount` tokens of token type `id` from `from` to `to`.
Requirements:
- `to` cannot be the zero address. - If the caller is not `from`, it must be have been approved to spend `from`'s tokens via `setApprovalForAll()`. - `from` must have a balance of tokens of type `id` of at least `amount`. |
@@ -136,7 +136,7 @@ readonly burnBatch: (account: string, ids: BigNumberish[], values: BigNumberish[
### connect
-Connect the current instance to a new signer
+Connect the current instance of ERC1155 to a new signer
Signature:
diff --git a/docs/classes/erc1155balancetier.md b/docs/classes/erc1155balancetier.md
new file mode 100644
index 0000000..6b720e7
--- /dev/null
+++ b/docs/classes/erc1155balancetier.md
@@ -0,0 +1,61 @@
+
+# Class ERC1155BalanceTier
+
+class to create a the vmStateConfig for CombineTier as BalanceTier. this will perform similar to ERC1155BalancTier witha certain toke ID
+
+Signature:
+
+```typescript
+class ERC1155BalanceTier extends CombineTierGenerator
+```
+
+## Properties
+
+| Property | Type | Description |
+| --- | --- | --- |
+| [constants](./combinetiergenerator.md#constants-property) | `BigNumberish[]` | *Inherited from [CombineTierGenerator.constants](./combinetiergenerator.md#constants-property)* |
+| [sources](./combinetiergenerator.md#sources-property) | `BytesLike[]` | *Inherited from [CombineTierGenerator.sources](./combinetiergenerator.md#sources-property)* |
+| [tierValues](./erc1155balancetier.md#tierValues-property) | `(number \| string)[]` | |
+| [tokenAddress](./erc1155balancetier.md#tokenAddress-property) | `string` | |
+| [tokenId](./erc1155balancetier.md#tokenId-property) | `BigNumber` | |
+
+## Methods
+
+| Method | Description |
+| --- | --- |
+| [combineWith(reporter, logic, mode, hasReportForSingleTier, delegatedReport, number)](./combinetiergenerator.md#combineWith-method-1) | Combines 2 tier report with selectLte with its logic and mode, and can be chained for multiple reports each with their own logic and mode
*Inherited from [CombineTierGenerator.combineWith()](./combinetiergenerator.md#combineWith-method-1)* |
+| [differenceFrom(reporter, delegatedReport)](./combinetiergenerator.md#differenceFrom-method-1) | Saturating difference between 2 reports
*Inherited from [CombineTierGenerator.differenceFrom()](./combinetiergenerator.md#differenceFrom-method-1)* |
+| [isTierHeldFor(duration)](./combinetiergenerator.md#isTierHeldFor-method-1) | Creats a holding time ALWAYS/NEVER tier script for a Combinetier contract out of a Stake contract.
*Inherited from [CombineTierGenerator.isTierHeldFor()](./combinetiergenerator.md#isTierHeldFor-method-1)* |
+| [updateReport(startTier, endTier, number)](./combinetiergenerator.md#updateReport-method-1) | Method to update a report at given tier range (can be any range between 0 to 8)
*Inherited from [CombineTierGenerator.updateReport()](./combinetiergenerator.md#updateReport-method-1)* |
+
+## Property Details
+
+
+
+### tierValues
+
+Signature:
+
+```typescript
+readonly tierValues: (number | string)[];
+```
+
+
+
+### tokenAddress
+
+Signature:
+
+```typescript
+readonly tokenAddress: string;
+```
+
+
+
+### tokenId
+
+Signature:
+
+```typescript
+readonly tokenId: BigNumber;
+```
diff --git a/docs/classes/erc20.md b/docs/classes/erc20.md
index 01fe034..0724982 100644
--- a/docs/classes/erc20.md
+++ b/docs/classes/erc20.md
@@ -3,7 +3,7 @@
A generic ERC20 interface to get connected to any ERC20 address and make transactions.
-The interface only have and provide generic and common methods calls. Remember that any specific method implemented in the contract will NOT be available in this interface.
+The interface only have and provide generic and common methods calls. Remember that any specific method implemented in the contract will NOT be available in this interface. Can get connected to ERC20Snapshot as well.
Signature:
@@ -23,21 +23,23 @@ class ERC20
| --- | --- | --- |
| [address](./erc20.md#address-property) | `string` | |
| [allowance](./erc20.md#allowance-property) | `(owner: string, spender: string, overrides?: ReadTxOverrides) => Promise` | Returns the remaining number of tokens that `spender` will be allowed to spend on behalf of `owner` through `transferFrom()`. This is zero by default.
This value changes when `approve()` or `transferFrom()` are called. |
-| [approve](./erc20.md#approve-property) | `(spender: string, amount: BigNumberish, overrides?: TxOverrides) => Promise` | Sets `amount` as the allowance of `spender` over the caller's tokens. |
+| [approve](./erc20.md#approve-property) | `(spender: string, amount: BigNumberish, overrides?: TxOverrides) => Promise` | Approve spend limit `amount` as the allowance for a `spender` over this tokens. |
| [attach](./erc20.md#attach-property) | `(address: string) => ERC20` | Create new instance with same signer but different contract address |
| [balanceOf](./erc20.md#balanceOf-property) | `(account: string, overrides?: ReadTxOverrides) => Promise` | Returns the amount of tokens owned by `account`. |
+| [balanceOfAt](./erc20.md#balanceOfAt-property) | `(account: string, snapshotId: BigNumberish, overrides?: TxOverrides) => Promise` | Get the balanceOf the account at the snapshotId |
| [burn](./erc20.md#burn-property) | `(amount: BigNumberish, overrides?: TxOverrides) => Promise` | Destroys `amount` tokens from the caller. |
| [burnFrom](./erc20.md#burnFrom-property) | `(account: string, amount: BigNumberish, overrides?: TxOverrides) => Promise` | Destroys `amount` tokens from `account`, deducting from the caller's allowance. Requirements:
- the caller must have allowance for `accounts`'s tokens of at least `amount`. |
-| [connect](./erc20.md#connect-property) | `(signer: Signer) => ERC20` | Connect the current instance to a new signer |
+| [connect](./erc20.md#connect-property) | `(signer: Signer) => ERC20` | Connect the current instance of the ERC20 to a new signer |
| [decimals](./erc20.md#decimals-property) | `(overrides?: ReadTxOverrides) => Promise` | Returns the number of decimals used to get its user representation. |
-| [decreaseAllowance](./erc20.md#decreaseAllowance-property) | `(spender: string, subtractedValue: BigNumberish, overrides?: TxOverrides) => Promise` | Atomically decreases the allowance granted to `spender` by the caller.
This is an alternative to `approve()` that can be used as a mitigation for problems described in https://github.com/ethereum/EIPs/issues/20\#issuecomment-263524729. |
-| [increaseAllowance](./erc20.md#increaseAllowance-property) | `(spender: string, addedValue: BigNumberish, overrides?: TxOverrides) => Promise` | Atomically increases the allowance granted to `spender` by the caller.
This is an alternative to `approve()` that can be used as a mitigation for problems described in https://github.com/ethereum/EIPs/issues/20\#issuecomment-263524729. |
+| [decreaseAllowance](./erc20.md#decreaseAllowance-property) | `(spender: string, subtractedValue: BigNumberish, overrides?: TxOverrides) => Promise` | Automatically decreases the allowance granted to `spender` for this token.
This is an alternative to `approve()` that can be used as a mitigation for problems described in https://github.com/ethereum/EIPs/issues/20\#issuecomment-263524729. |
+| [increaseAllowance](./erc20.md#increaseAllowance-property) | `(spender: string, addedValue: BigNumberish, overrides?: TxOverrides) => Promise` | Automically increases the allowance granted to `spender` for this token.
This is an alternative to `approve()` that can be used as a mitigation for problems described in https://github.com/ethereum/EIPs/issues/20\#issuecomment-263524729. |
| [name](./erc20.md#name-property) | `(overrides?: ReadTxOverrides) => Promise` | Returns the name of the token. |
| [signer](./erc20.md#signer-property) | `Signer` | |
| [symbol](./erc20.md#symbol-property) | `(overrides?: ReadTxOverrides) => Promise` | Returns the symbol of the token, usually a shorter version of the name. |
| [totalSupply](./erc20.md#totalSupply-property) | `(overrides?: ReadTxOverrides) => Promise` | Returns the amount of tokens in existence. |
-| [transfer](./erc20.md#transfer-property) | `(to: string, amount: BigNumberish, overrides?: TxOverrides) => Promise` | Moves `amount` tokens from the caller's account to `to`.
Requirements:
- `to` cannot be the zero address. - the caller must have a balance of at least `amount`. |
-| [transferFrom](./erc20.md#transferFrom-property) | `(from: string, to: string, amount: BigNumberish, overrides?: TxOverrides) => Promise` | Moves `amount` tokens from `from` to `to` using the allowance mechanism. `amount` is then deducted from the caller's allowance.
NOTE: Does not update the allowance if the current allowance is the maximum `uint256`.
Requirements:
- `from` and `to` cannot be the zero address. - `from` must have a balance of at least `amount`. - the caller must have allowance for `from`'s tokens of at least `amount`. |
+| [totalSupplyAt](./erc20.md#totalSupplyAt-property) | `(snapshotId: BigNumberish, overrides?: TxOverrides) => Promise` | Get the totalSupply at the snapshotId |
+| [transfer](./erc20.md#transfer-property) | `(to: string, amount: BigNumberish, overrides?: TxOverrides) => Promise` | Moves `amount` of tokens from the caller's account to `to`.
Requirements:
- `to` cannot be the zero address. - the caller must have a balance of at least `amount`. |
+| [transferFrom](./erc20.md#transferFrom-property) | `(from: string, to: string, amount: BigNumberish, overrides?: TxOverrides) => Promise` | Moves `amount` of tokens from `from` to `to` using the allowance mechanism. `amount` is then deducted from the caller's allowance.
NOTE: Does not update the allowance if the current allowance is the maximum `uint256`.
Requirements:
- `from` and `to` cannot be the zero address. - `from` must have a balance of at least `amount`. - the caller must have allowance for `from`'s tokens of at least `amount`. |
## Static Property Details
@@ -85,7 +87,7 @@ readonly allowance: (owner: string, spender: string, overrides?: ReadTxOverrides
### approve
-Sets `amount` as the allowance of `spender` over the caller's tokens.
+Approve spend limit `amount` as the allowance for a `spender` over this tokens.
Signature:
@@ -117,6 +119,18 @@ Returns the amount of tokens owned by `account`.
readonly balanceOf: (account: string, overrides?: ReadTxOverrides) => Promise;
```
+
+
+### balanceOfAt
+
+Get the balanceOf the account at the snapshotId
+
+Signature:
+
+```typescript
+readonly balanceOfAt?: (account: string, snapshotId: BigNumberish, overrides?: TxOverrides) => Promise;
+```
+
### burn
@@ -126,7 +140,7 @@ Destroys `amount` tokens from the caller.
Signature:
```typescript
-readonly burn: (amount: BigNumberish, overrides?: TxOverrides) => Promise;
+readonly burn?: (amount: BigNumberish, overrides?: TxOverrides) => Promise;
```
@@ -140,14 +154,14 @@ Destroys `amount` tokens from `account`, deducting from the caller's all
Signature:
```typescript
-readonly burnFrom: (account: string, amount: BigNumberish, overrides?: TxOverrides) => Promise;
+readonly burnFrom?: (account: string, amount: BigNumberish, overrides?: TxOverrides) => Promise;
```
### connect
-Connect the current instance to a new signer
+Connect the current instance of the ERC20 to a new signer
Signature:
@@ -171,7 +185,7 @@ readonly decimals: (overrides?: ReadTxOverrides) => Promise;
### decreaseAllowance
-Atomically decreases the allowance granted to `spender` by the caller.
+Automatically decreases the allowance granted to `spender` for this token.
This is an alternative to `approve()` that can be used as a mitigation for problems described in https://github.com/ethereum/EIPs/issues/20\#issuecomment-263524729.
@@ -185,7 +199,7 @@ readonly decreaseAllowance: (spender: string, subtractedValue: BigNumberish, ove
### increaseAllowance
-Atomically increases the allowance granted to `spender` by the caller.
+Automically increases the allowance granted to `spender` for this token.
This is an alternative to `approve()` that can be used as a mitigation for problems described in https://github.com/ethereum/EIPs/issues/20\#issuecomment-263524729.
@@ -241,11 +255,23 @@ Returns the amount of tokens in existence.
readonly totalSupply: (overrides?: ReadTxOverrides) => Promise;
```
+
+
+### totalSupplyAt
+
+Get the totalSupply at the snapshotId
+
+Signature:
+
+```typescript
+readonly totalSupplyAt?: (snapshotId: BigNumberish, overrides?: TxOverrides) => Promise;
+```
+
### transfer
-Moves `amount` tokens from the caller's account to `to`.
+Moves `amount` of tokens from the caller's account to `to`.
Requirements:
@@ -261,7 +287,7 @@ readonly transfer: (to: string, amount: BigNumberish, overrides?: TxOverrides) =
### transferFrom
-Moves `amount` tokens from `from` to `to` using the allowance mechanism. `amount` is then deducted from the caller's allowance.
+Moves `amount` of tokens from `from` to `to` using the allowance mechanism. `amount` is then deducted from the caller's allowance.
NOTE: Does not update the allowance if the current allowance is the maximum `uint256`.
diff --git a/docs/classes/erc20balancetier.md b/docs/classes/erc20balancetier.md
index da4a317..61be611 100644
--- a/docs/classes/erc20balancetier.md
+++ b/docs/classes/erc20balancetier.md
@@ -1,216 +1,61 @@
# Class ERC20BalanceTier
-A class for deploying and calling methods on a ERC20BalanceTier.
-
-This class provides an easy way to deploy ERC20BalanceTiers using Rain's canonical factories, and methods for interacting with an already deployed ERC20BalanceTier.
-
-The `ERC20BalanceTier` simply checks the current balance of an erc20 against tier values. As the current balance is always read from the erc20 contract directly there is no historical block data.
+class to create a the vmStateConfig for CombineTier as BalanceTier. this will perform similar to ERC20BalanceTier in RainVM version 1.0
Signature:
```typescript
-class ERC20BalanceTier extends TierContract
-```
-
-## Example
-
-
-```typescript
-import { ERC20BalanceTier } from 'rain-sdk'
-
-// To deploy a new ERC20BalanceTier, pass an ethers.js Signer and the config for the ERC20BalanceTier.
-const newTier = await ERC20BalanceTier.deploy(signer, ERC20BalanceTierArgs);
-
-// To connect to an existing ERC20BalanceTier just pass the tier address, token address and an ethers.js Signer.
-const existingTier = new ERC20BalanceTier(address, signer[, tokenAddress]);
-
-// Once you have a ERC20BalanceTier, you can call the smart contract methods:
-const tierValues = await existingTier.tierValues();
-
+class ERC20BalanceTier
```
-## Static Properties
-
-| Property | Type | Description |
-| --- | --- | --- |
-| [deploy](./erc20balancetier.md#deploy-property-static) | `(signer: Signer, args: ERC20BalanceTierDeployArgs, overrides?: TxOverrides) => Promise` | Deploys a new ERC20BalanceTier. |
-| [getAddressesForChainId](./addressbook.md#getAddressesForChainId-property-static) | `(chainId: number) => Addresses` | Obtain all the addresses deployed in a specific network with a chain ID.
*Inherited from [AddressBook.getAddressesForChainId](./addressbook.md#getAddressesForChainId-property-static)* |
-| [getChainId](./raincontract.md#getChainId-property-static) | `(signerOrProvider: Signer \| Provider) => Promise` | Get the chain ID from a valid ethers provider.
Request to the provider stored in the signer which is the chain ID.
*Inherited from [RainContract.getChainId](./raincontract.md#getChainId-property-static)* |
-| [getSubgraphEndpoint](./addressbook.md#getSubgraphEndpoint-property-static) | `(chainId: number) => string` | Obtain the latest subgraph endpoint related to the version that use the SDK.
*Inherited from [AddressBook.getSubgraphEndpoint](./addressbook.md#getSubgraphEndpoint-property-static)* |
-| [isChild](./erc20balancetier.md#isChild-property-static) | `(signer: Signer, maybeChild: string) => Promise` | Checks if address is registered as a child contract of this contract in a specific network. |
-| [nameBookReference](./erc20balancetier.md#nameBookReference-property-static) | `string` | Name reference to find the address of the contract in the book address.
*Overrides [RainContract.nameBookReference](./raincontract.md#nameBookReference-property-static)* |
-
## Properties
| Property | Type | Description |
| --- | --- | --- |
-| [address](./raincontract.md#address-property) | `string` | The contract address of the instance.
*Inherited from [RainContract.address](./raincontract.md#address-property)* |
-| [addTokenAddress](./erc20balancetier.md#addTokenAddress-property) | `(tokenAddress: string) => ERC20BalanceTier` | Get a new instance with the token address provided.
This method must be used if the token address is not provided in construction moment. The class use this address to make calculations related with the Tier. The token address provided should be the same that the Tier is using to work correctly. |
-| [connect](./erc20balancetier.md#connect-property) | `(signer: Signer) => ERC20BalanceTier` | Connect the current contract instance to a new ethers signer.
*Overrides [RainContract.connect](./raincontract.md#connect-property)* |
-| [levels](./tiercontract.md#levels-property) | `typeof Tier` | All the contract tier levels availables in all ITier contracts.
*Inherited from [TierContract.levels](./tiercontract.md#levels-property)* |
-| [report](./tiercontract.md#report-property) | `(account: string, overrides?: ReadTxOverrides) => Promise` | A tier report is a `uint256` that contains each of the block numbers each tier has been held continously since as a `uint32`.
*Inherited from [TierContract.report](./tiercontract.md#report-property)* |
-| [setTier](./erc20balancetier.md#setTier-property) | `(account: string, endTier: BigNumberish, data: BytesLike, overrides?: TxOverrides \| undefined) => Promise` | It is NOT implemented in BalanceTiers. Always will throw an error
*Overrides [TierContract.setTier](./tiercontract.md#setTier-property)* |
-| [signer](./raincontract.md#signer-property) | `Signer` | The ethers signer that is connected to the instance.
*Inherited from [RainContract.signer](./raincontract.md#signer-property)* |
-| [tierValues](./erc20balancetier.md#tierValues-property) | `(overrides?: ReadTxOverrides) => Promise` | Complements the default solidity accessor for `tierValues`. Returns all the values in a listrather than requiring an index be specified. |
-| [token](./erc20balancetier.md#token-property) | `string` | ERC20 Token address that track the Tier |
-
-## Static Methods
-
-| Method | Description |
-| --- | --- |
-| [\_isChild(signer, maybeChild)](./factorycontract.md#_isChild-method-static-1) | Checks if address is registered as a child contract of the factory in the chain.
*Inherited from [FactoryContract.\_isChild()](./factorycontract.md#_isChild-method-static-1)* |
-| [getBookAddress(chainId)](./raincontract.md#getBookAddress-method-static-1) | Get the address stored in the book for a determined chain if it is available.
*Inherited from [RainContract.getBookAddress()](./raincontract.md#getBookAddress-method-static-1)* |
-| [getNewChildFromReceipt(receipt, parentContract)](./factorycontract.md#getNewChildFromReceipt-method-static-1) | Get the child from a receipt obtain from a Factory transaction
*Inherited from [FactoryContract.getNewChildFromReceipt()](./factorycontract.md#getNewChildFromReceipt-method-static-1)* |
-
-## Methods
-
-| Method | Description |
-| --- | --- |
-| [amountToTier(account, desiredLevel)](./erc20balancetier.md#amountToTier-method-1) | Calculate how much amount of the token needed transfer to or transfer out of the account to reach a `desiredLevel`.
Take in mind: - If the `desired level` is higher than the current level, the amount returned will be the amount needed to obtain or transfer to the `account`. - If the `desired level` is lower than the current level, the amount returned will be the amount needed to remove or transfer out of the `account`. - If already have the `desired` tier, will return 0 |
-| [checkAddress(address, message)](./raincontract.md#checkAddress-method-1) | Check if an address is correctly formatted and throw an error if it is not an valid address
*Inherited from [RainContract.checkAddress()](./raincontract.md#checkAddress-method-1)* |
-| [currentTier(account, block)](./tiercontract.md#currentTier-method-1) | Get the current tier of an `account` in the Tier as an expression between `[0 - 8]`. Tier 0 is that a address has never interact with the Tier Contract.
*Inherited from [TierContract.currentTier()](./tiercontract.md#currentTier-method-1)* |
-
-## Static Property Details
-
-
-
-### deploy
-
-Deploys a new ERC20BalanceTier.
-
-Signature:
-
-```typescript
-static deploy: (signer: Signer, args: ERC20BalanceTierDeployArgs, overrides?: TxOverrides) => Promise;
-```
-
-
-
-### isChild
-
-Checks if address is registered as a child contract of this contract in a specific network.
-
-The methods require a signer that will be used to call to the Factory Contract and ask if the address provided is a child. Also it is necessary to get the current Chain ID using the provider in the signer.
-
-Signature:
-
-```typescript
-static isChild: (signer: Signer, maybeChild: string) => Promise;
-```
-
-
-
-### nameBookReference
-
-Name reference to find the address of the contract in the book address.
-
-*Overrides [RainContract.nameBookReference](./raincontract.md#nameBookReference-property-static)*
-
-Should be implemented in each class to find the factory or main address in the book.
-
-Signature:
-
-```typescript
-protected static readonly nameBookReference: string;
-```
+| [constants](./erc20balancetier.md#constants-property) | `BigNumberish[]` | |
+| [sources](./erc20balancetier.md#sources-property) | `BytesLike[]` | |
+| [tierValues](./erc20balancetier.md#tierValues-property) | `(number \| string)[]` | |
+| [tokenAddress](./erc20balancetier.md#tokenAddress-property) | `string` | |
## Property Details
-
-
-### addTokenAddress
-
-Get a new instance with the token address provided.
-
-This method must be used if the token address is not provided in construction moment. The class use this address to make calculations related with the Tier. The token address provided should be the same that the Tier is using to work correctly.
+
-Signature:
-
-```typescript
-readonly addTokenAddress: (tokenAddress: string) => ERC20BalanceTier;
-```
-
-
-
-### connect
-
-Connect the current contract instance to a new ethers signer.
-
-*Overrides [RainContract.connect](./raincontract.md#connect-property)*
+### constants
Signature:
```typescript
-readonly connect: (signer: Signer) => ERC20BalanceTier;
+constants: BigNumberish[];
```
-
-
-### setTier
-
-It is NOT implemented in BalanceTiers. Always will throw an error
+
-*Overrides [TierContract.setTier](./tiercontract.md#setTier-property)*
-
-Users can set their own tier by calling `setTier` if is this option available on the Tier contract. ITier like BalanceTier does not allow this.
+### sources
Signature:
```typescript
-readonly setTier: (account: string, endTier: BigNumberish, data: BytesLike, overrides?: TxOverrides | undefined) => Promise;
+sources: BytesLike[];
```
### tierValues
-Complements the default solidity accessor for `tierValues`. Returns all the values in a listrather than requiring an index be specified.
-
-Signature:
-
-```typescript
-readonly tierValues: (overrides?: ReadTxOverrides) => Promise;
-```
-
-
-
-### token
-
-ERC20 Token address that track the Tier
-
Signature:
```typescript
-readonly token: string;
+readonly tierValues: (number | string)[];
```
-## Method Details
+
-
-
-### amountToTier(account, desiredLevel)
-
-Calculate how much amount of the token needed transfer to or transfer out of the account to reach a `desiredLevel`.
-
-Take in mind: - If the `desired level` is higher than the current level, the amount returned will be the amount needed to obtain or transfer to the `account`. - If the `desired level` is lower than the current level, the amount returned will be the amount needed to remove or transfer out of the `account`. - If already have the `desired` tier, will return 0
+### tokenAddress
Signature:
```typescript
-amountToTier(account: string, desiredLevel: number): Promise;
+readonly tokenAddress: string;
```
-
-#### Parameters
-
-| Parameter | Type | Description |
-| --- | --- | --- |
-| account | `string` | (optional) the account address to calculate. If not provided will use the signer of the instance |
-| desiredLevel | `number` | the tier level desired to get |
-
-Returns:
-
-`Promise`
-
-The amount t
-
diff --git a/docs/classes/erc20transfertier.md b/docs/classes/erc20transfertier.md
deleted file mode 100644
index 9345aee..0000000
--- a/docs/classes/erc20transfertier.md
+++ /dev/null
@@ -1,260 +0,0 @@
-
-# Class ERC20TransferTier
-
-A class for deploying and calling methods on a ERC20TransferTier.
-
-This class provides an easy way to deploy ERC20TransferTiers using Rain's canonical factories, and methods for interacting with an already deployed ERC20TransferTier.
-
-The `ERC20TransferTier` takes ownership of an erc20 balance by transferring erc20 token to itself. The `msg.sender` must pay the difference on upgrade; the tiered address receives refunds on downgrade. This allows users to "gift" tiers to each other. As the transfer is a state changing event we can track historical block times.
-
-As the tiered address moves up/down tiers it sends/receives the value difference between its current tier only.The user is required to preapprove enough erc20 to cover the tier change or they will fail and lose gas.
-
-In addition to the standard accounting it requires that users transfer erc20 tokens to achieve a tier. Data is ignored, the only requirement is that the user has approved sufficient balance to gain the next tier. The 8 values for gainable tiers and erc20 contract must be set upon construction and are immutable.
-
-`⚠️ WARNING:` If a user sends erc20 tokens directly to the contract without calling `setTier` the FUNDS ARE LOST. ⚠️
-
-Signature:
-
-```typescript
-class ERC20TransferTier extends TierContract
-```
-
-## Example
-
-
-```typescript
-import { ERC20TransferTier } from 'rain-sdk'
-
-// To deploy a new ERC20TransferTier, pass an ethers.js Signer and the config for the ERC20TransferTier.
-const newTier = await ERC20TransferTier.deploy(signer, ERC20TransferTierConfigArgs);
-
-// To connect to an existing ERC20TransferTier just pass the tier address, token address and an ethers.js Signer.
-const existingTier = new ERC20TransferTier(address, tokenAddress, signer);
-
-// Once you have a ERC20TransferTier, you can call the smart contract methods:
-const tierValues = await existingTier.tierValues();
-
-```
-
-## Static Properties
-
-| Property | Type | Description |
-| --- | --- | --- |
-| [getAddressesForChainId](./addressbook.md#getAddressesForChainId-property-static) | `(chainId: number) => Addresses` | Obtain all the addresses deployed in a specific network with a chain ID.
*Inherited from [AddressBook.getAddressesForChainId](./addressbook.md#getAddressesForChainId-property-static)* |
-| [getChainId](./raincontract.md#getChainId-property-static) | `(signerOrProvider: Signer \| Provider) => Promise` | Get the chain ID from a valid ethers provider.
Request to the provider stored in the signer which is the chain ID.
*Inherited from [RainContract.getChainId](./raincontract.md#getChainId-property-static)* |
-| [getSubgraphEndpoint](./addressbook.md#getSubgraphEndpoint-property-static) | `(chainId: number) => string` | Obtain the latest subgraph endpoint related to the version that use the SDK.
*Inherited from [AddressBook.getSubgraphEndpoint](./addressbook.md#getSubgraphEndpoint-property-static)* |
-| [isChild](./erc20transfertier.md#isChild-property-static) | `(signer: Signer, maybeChild: string) => Promise` | Checks if address is registered as a child contract of this ERC20TransferTierFactory on a specific network |
-| [nameBookReference](./erc20transfertier.md#nameBookReference-property-static) | `string` | Name reference to find the address of the contract in the book address.
*Overrides [RainContract.nameBookReference](./raincontract.md#nameBookReference-property-static)* |
-
-## Properties
-
-| Property | Type | Description |
-| --- | --- | --- |
-| [address](./raincontract.md#address-property) | `string` | The contract address of the instance.
*Inherited from [RainContract.address](./raincontract.md#address-property)* |
-| [addTokenAddress](./erc20transfertier.md#addTokenAddress-property) | `(tokenAddress: string) => ERC20TransferTier` | Get a new instance with the token address provided.
This method must be used if the token address is not provided in construction moment. The class use this address to make calculations related with the Tier. The token address provided should be the same that the Tier is using to work correctly. |
-| [connect](./erc20transfertier.md#connect-property) | `(signer: Signer) => ERC20TransferTier` | Connect the current contract instance to a new ethers signer.
*Overrides [RainContract.connect](./raincontract.md#connect-property)* |
-| [levels](./tiercontract.md#levels-property) | `typeof Tier` | All the contract tier levels availables in all ITier contracts.
*Inherited from [TierContract.levels](./tiercontract.md#levels-property)* |
-| [report](./tiercontract.md#report-property) | `(account: string, overrides?: ReadTxOverrides) => Promise` | A tier report is a `uint256` that contains each of the block numbers each tier has been held continously since as a `uint32`.
*Inherited from [TierContract.report](./tiercontract.md#report-property)* |
-| [setTier](./erc20transfertier.md#setTier-property) | `(account: string, endTier: BigNumberish, data: BytesLike, overrides?: TxOverrides) => Promise` | Updates the tier of an account tansfering balances of erc20 from/to the tiered account according to the difference in values.
*Overrides [TierContract.setTier](./tiercontract.md#setTier-property)* |
-| [signer](./raincontract.md#signer-property) | `Signer` | The ethers signer that is connected to the instance.
*Inherited from [RainContract.signer](./raincontract.md#signer-property)* |
-| [tierValues](./erc20transfertier.md#tierValues-property) | `(overrides?: ReadTxOverrides) => Promise` | Complements the default solidity accessor for `tierValues`. Returns all the values in a listrather than requiring an index be specified. |
-| [token](./erc20transfertier.md#token-property) | `string` | The ERC20 Token address that holds the Tier. |
-
-## Static Methods
-
-| Method | Description |
-| --- | --- |
-| [\_isChild(signer, maybeChild)](./factorycontract.md#_isChild-method-static-1) | Checks if address is registered as a child contract of the factory in the chain.
*Inherited from [FactoryContract.\_isChild()](./factorycontract.md#_isChild-method-static-1)* |
-| [deploy(signer, args, overrides)](./erc20transfertier.md#deploy-method-static-1) | Deploys a new ERC20TransferTier. |
-| [getBookAddress(chainId)](./raincontract.md#getBookAddress-method-static-1) | Get the address stored in the book for a determined chain if it is available.
*Inherited from [RainContract.getBookAddress()](./raincontract.md#getBookAddress-method-static-1)* |
-| [getNewChildFromReceipt(receipt, parentContract)](./factorycontract.md#getNewChildFromReceipt-method-static-1) | Get the child from a receipt obtain from a Factory transaction
*Inherited from [FactoryContract.getNewChildFromReceipt()](./factorycontract.md#getNewChildFromReceipt-method-static-1)* |
-
-## Methods
-
-| Method | Description |
-| --- | --- |
-| [amountToTier(account, desiredLevel)](./erc20transfertier.md#amountToTier-method-1) | Calculate how much amount of the token needed transfer to the tier contract or how much tokens the `account` will get back to reach the `desiredLevel`. |
-| [approveTokenForTier(amount, overrides)](./erc20transfertier.md#approveTokenForTier-method-1) | |
-| [checkAddress(address, message)](./raincontract.md#checkAddress-method-1) | Check if an address is correctly formatted and throw an error if it is not an valid address
*Inherited from [RainContract.checkAddress()](./raincontract.md#checkAddress-method-1)* |
-| [currentTier(account, block)](./tiercontract.md#currentTier-method-1) | Get the current tier of an `account` in the Tier as an expression between `[0 - 8]`. Tier 0 is that a address has never interact with the Tier Contract.
*Inherited from [TierContract.currentTier()](./tiercontract.md#currentTier-method-1)* |
-
-## Static Property Details
-
-
-
-### isChild
-
-Checks if address is registered as a child contract of this ERC20TransferTierFactory on a specific network
-
-Signature:
-
-```typescript
-static isChild: (signer: Signer, maybeChild: string) => Promise;
-```
-
-
-
-### nameBookReference
-
-Name reference to find the address of the contract in the book address.
-
-*Overrides [RainContract.nameBookReference](./raincontract.md#nameBookReference-property-static)*
-
-Should be implemented in each class to find the factory or main address in the book.
-
-Signature:
-
-```typescript
-protected static readonly nameBookReference: string;
-```
-
-## Property Details
-
-
-
-### addTokenAddress
-
-Get a new instance with the token address provided.
-
-This method must be used if the token address is not provided in construction moment. The class use this address to make calculations related with the Tier. The token address provided should be the same that the Tier is using to work correctly.
-
-Signature:
-
-```typescript
-readonly addTokenAddress: (tokenAddress: string) => ERC20TransferTier;
-```
-
-
-
-### connect
-
-Connect the current contract instance to a new ethers signer.
-
-*Overrides [RainContract.connect](./raincontract.md#connect-property)*
-
-Signature:
-
-```typescript
-readonly connect: (signer: Signer) => ERC20TransferTier;
-```
-
-
-
-### setTier
-
-Updates the tier of an account tansfering balances of erc20 from/to the tiered account according to the difference in values.
-
-*Overrides [TierContract.setTier](./tiercontract.md#setTier-property)*
-
-Users can set their own tier by calling `setTier`.
-
-Any failure to transfer in/out will rollback the tier change. The tiered account must ensure sufficient approvals before attempting to set a new tier. This throw an error if the user attempts to return to the ZERO tier.
-
-Signature:
-
-```typescript
-readonly setTier: (account: string, endTier: BigNumberish, data: BytesLike, overrides?: TxOverrides) => Promise;
-```
-
-
-
-### tierValues
-
-Complements the default solidity accessor for `tierValues`. Returns all the values in a listrather than requiring an index be specified.
-
-Signature:
-
-```typescript
-readonly tierValues: (overrides?: ReadTxOverrides) => Promise;
-```
-
-
-
-### token
-
-The ERC20 Token address that holds the Tier.
-
-Signature:
-
-```typescript
-readonly token: string;
-```
-
-## Static Method Details
-
-
-
-### deploy(signer, args, overrides)
-
-Deploys a new ERC20TransferTier.
-
-Signature:
-
-```typescript
-static deploy(signer: Signer, args: ERC20TransferTierDeployArgs, overrides?: TxOverrides): Promise;
-```
-
-#### Parameters
-
-| Parameter | Type | Description |
-| --- | --- | --- |
-| signer | `Signer` | An ethers.js Signer |
-| args | [ERC20TransferTierDeployArgs](../interfaces/erc20transfertierdeployargs.md) | Arguments for deploying a ERC20TransferTier |
-| overrides | [TxOverrides](../interfaces/txoverrides.md) | |
-
-Returns:
-
-`Promise`
-
-A new ERC20TransferTier instance
-
-## Method Details
-
-
-
-### amountToTier(account, desiredLevel)
-
-Calculate how much amount of the token needed transfer to the tier contract or how much tokens the `account` will get back to reach the `desiredLevel`.
-
-Take in mind: - If the `account` directly send tokens to the ERC20TransferTier contract, those tokens are lost. All the calcualtions are make it with the tokens transfered by the account with setTier method. - If the `desired level` is higher than the current level, the amount returned will be the amount needed to obtain tier. - If the `desired level` is lower than the current level, the amount returned will be the amount that will get back. - If already have the `desired` tier, will return 0.
-
-Signature:
-
-```typescript
-amountToTier(account: string, desiredLevel: number): Promise;
-```
-
-#### Parameters
-
-| Parameter | Type | Description |
-| --- | --- | --- |
-| account | `string` | (optional) the account address to calculate. If not provided will use the signer of the instance |
-| desiredLevel | `number` | the tier level desired to get |
-
-Returns:
-
-`Promise`
-
-The amount t
-
-
-
-### approveTokenForTier(amount, overrides)
-
-Signature:
-
-```typescript
-approveTokenForTier(amount: BigNumberish, overrides?: ReadTxOverrides): Promise;
-```
-
-#### Parameters
-
-| Parameter | Type | Description |
-| --- | --- | --- |
-| amount | `BigNumberish` | |
-| overrides | [ReadTxOverrides](../interfaces/readtxoverrides.md) | |
-
-Returns:
-
-`Promise`
-
diff --git a/docs/classes/erc721.md b/docs/classes/erc721.md
index 2797e26..aa9c70e 100644
--- a/docs/classes/erc721.md
+++ b/docs/classes/erc721.md
@@ -26,7 +26,7 @@ class ERC721
| [attach](./erc721.md#attach-property) | `(address: string) => ERC721` | Create new instance with same signer but different contract address |
| [balanceOf](./erc721.md#balanceOf-property) | `(account: string, overrides?: ReadTxOverrides) => Promise` | Returns the number of tokens in `owner`'s account. |
| [burn](./erc721.md#burn-property) | `(tokenId: BigNumberish, overrides?: TxOverrides) => Promise` | Burns `tokenId`.
Requirements:
- The caller must own `tokenId` or be an approved operator. |
-| [connect](./erc721.md#connect-property) | `(signer: Signer) => ERC721` | Connect the current instance to a new signer |
+| [connect](./erc721.md#connect-property) | `(signer: Signer) => ERC721` | Connect the current instance of ERC721 to a new signer |
| [getApproved](./erc721.md#getApproved-property) | `(tokenId: BigNumberish, overrides?: ReadTxOverrides) => Promise` | Returns the account approved for `tokenId` token.
Requirements:
- `tokenId` must exist. |
| [isApprovedForAll](./erc721.md#isApprovedForAll-property) | `(owner: string, operator: string, overrides?: ReadTxOverrides) => Promise` | Returns if the `operator` is allowed to manage all of the assets of `owner`. |
| [name](./erc721.md#name-property) | `(overrides?: ReadTxOverrides) => Promise` | Returns the name of the token. |
@@ -130,7 +130,7 @@ readonly burn: (tokenId: BigNumberish, overrides?: TxOverrides) => PromiseSignature:
diff --git a/docs/classes/erc721balancetier.md b/docs/classes/erc721balancetier.md
index 4d0c6d2..9d40dde 100644
--- a/docs/classes/erc721balancetier.md
+++ b/docs/classes/erc721balancetier.md
@@ -1,212 +1,50 @@
# Class ERC721BalanceTier
-A class for deploying and calling methods on a ERC721BalanceTier. The `ERC721BalanceTier` simply checks the current balance of an erc721 against tier values. As the current balance is always read from the erc721contract directly there is no historical block data.
-
-This class provides an easy way to deploy ERC721BalanceTiers using Rain's canonical factories, and methods for interacting with an already deployed ERC721BalanceTier.
+class to create a the vmStateConfig for CombineTier as BalanceTier. this will perform similar to ERC721BalancTier in RainVM version 1.0
Signature:
```typescript
-class ERC721BalanceTier extends TierContract
-```
-
-## Example
-
-
-```typescript
-import { ERC721BalanceTier } from 'rain-sdk'
-
-// To deploy a new ERC721BalanceTier, pass an ethers.js Signer and the config for the ERC721BalanceTier.
-const newTier = await ERC721BalanceTier.deploy(signer, ERC721BalanceTierConfigArgs);
-
-// To connect to an existing ERC721BalanceTier just pass the address and an ethers.js Signer.
-const existingTier = new ERC721BalanceTier(address, signer);
-
-// Once you have a ERC721BalanceTier, you can call the smart contract methods:
-const tierValues = await existingTier.tierValues();
-
+class ERC721BalanceTier extends CombineTierGenerator
```
-## Static Properties
-
-| Property | Type | Description |
-| --- | --- | --- |
-| [deploy](./erc721balancetier.md#deploy-property-static) | `(signer: Signer, args: ERC721BalanceTierDeployArgs, overrides?: TxOverrides) => Promise` | Deploys a new ERC721BalanceTier. |
-| [getAddressesForChainId](./addressbook.md#getAddressesForChainId-property-static) | `(chainId: number) => Addresses` | Obtain all the addresses deployed in a specific network with a chain ID.
*Inherited from [AddressBook.getAddressesForChainId](./addressbook.md#getAddressesForChainId-property-static)* |
-| [getChainId](./raincontract.md#getChainId-property-static) | `(signerOrProvider: Signer \| Provider) => Promise` | Get the chain ID from a valid ethers provider.
Request to the provider stored in the signer which is the chain ID.
*Inherited from [RainContract.getChainId](./raincontract.md#getChainId-property-static)* |
-| [getSubgraphEndpoint](./addressbook.md#getSubgraphEndpoint-property-static) | `(chainId: number) => string` | Obtain the latest subgraph endpoint related to the version that use the SDK.
*Inherited from [AddressBook.getSubgraphEndpoint](./addressbook.md#getSubgraphEndpoint-property-static)* |
-| [isChild](./erc721balancetier.md#isChild-property-static) | `(signer: Signer, maybeChild: string) => Promise` | Checks if address is registered as a child contract of this ERC721BalanceTierFactory on a specific network |
-| [nameBookReference](./erc721balancetier.md#nameBookReference-property-static) | `string` | Name reference to find the address of the contract in the book address.
*Overrides [RainContract.nameBookReference](./raincontract.md#nameBookReference-property-static)* |
-
## Properties
| Property | Type | Description |
| --- | --- | --- |
-| [address](./raincontract.md#address-property) | `string` | The contract address of the instance.
*Inherited from [RainContract.address](./raincontract.md#address-property)* |
-| [addTokenAddress](./erc721balancetier.md#addTokenAddress-property) | `(tokenAddress: string) => ERC721BalanceTier` | Get a new instance with the token address provided.
This method must be used if the token address is not provided in construction moment. The class use this address to make calculations related with the Tier. The token address provided should be the same that the Tier is using to work correctly. |
-| [connect](./erc721balancetier.md#connect-property) | `(signer: Signer) => ERC721BalanceTier` | Connect the current contract instance to a new ethers signer.
*Overrides [RainContract.connect](./raincontract.md#connect-property)* |
-| [levels](./tiercontract.md#levels-property) | `typeof Tier` | All the contract tier levels availables in all ITier contracts.
*Inherited from [TierContract.levels](./tiercontract.md#levels-property)* |
-| [report](./tiercontract.md#report-property) | `(account: string, overrides?: ReadTxOverrides) => Promise` | A tier report is a `uint256` that contains each of the block numbers each tier has been held continously since as a `uint32`.
*Inherited from [TierContract.report](./tiercontract.md#report-property)* |
-| [setTier](./erc721balancetier.md#setTier-property) | `(account: string, endTier: BigNumberish, data: BytesLike, overrides?: TxOverrides \| undefined) => Promise` | It is NOT implemented in BalanceTiers. Always will throw an error
*Overrides [TierContract.setTier](./tiercontract.md#setTier-property)* |
-| [signer](./raincontract.md#signer-property) | `Signer` | The ethers signer that is connected to the instance.
*Inherited from [RainContract.signer](./raincontract.md#signer-property)* |
-| [tierValues](./erc721balancetier.md#tierValues-property) | `(overrides?: ReadTxOverrides) => Promise` | Complements the default solidity accessor for `tierValues`. Returns all the values in a listrather than requiring an index be specified. |
-| [token](./erc721balancetier.md#token-property) | `string` | ERC721 Token address that track the Tier |
-
-## Static Methods
-
-| Method | Description |
-| --- | --- |
-| [\_isChild(signer, maybeChild)](./factorycontract.md#_isChild-method-static-1) | Checks if address is registered as a child contract of the factory in the chain.
*Inherited from [FactoryContract.\_isChild()](./factorycontract.md#_isChild-method-static-1)* |
-| [getBookAddress(chainId)](./raincontract.md#getBookAddress-method-static-1) | Get the address stored in the book for a determined chain if it is available.
*Inherited from [RainContract.getBookAddress()](./raincontract.md#getBookAddress-method-static-1)* |
-| [getNewChildFromReceipt(receipt, parentContract)](./factorycontract.md#getNewChildFromReceipt-method-static-1) | Get the child from a receipt obtain from a Factory transaction
*Inherited from [FactoryContract.getNewChildFromReceipt()](./factorycontract.md#getNewChildFromReceipt-method-static-1)* |
+| [constants](./combinetiergenerator.md#constants-property) | `BigNumberish[]` | *Inherited from [CombineTierGenerator.constants](./combinetiergenerator.md#constants-property)* |
+| [sources](./combinetiergenerator.md#sources-property) | `BytesLike[]` | *Inherited from [CombineTierGenerator.sources](./combinetiergenerator.md#sources-property)* |
+| [tierValues](./erc721balancetier.md#tierValues-property) | `(number \| string)[]` | |
+| [tokenAddress](./erc721balancetier.md#tokenAddress-property) | `string` | |
## Methods
| Method | Description |
| --- | --- |
-| [amountToTier(account, desiredLevel)](./erc721balancetier.md#amountToTier-method-1) | Calculate how much amount of the token needed transfer to or transfer out of the account to reach a `desiredLevel`.
Take in mind: - If the `desired level` is higher than the current level, the amount returned will be the amount needed to obtain or transfer to the `account`. - If the `desired level` is lower than the current level, the amount returned will be the amount needed to remove or transfer out of the `account`. - If already have the `desired` tier, will return 0 |
-| [checkAddress(address, message)](./raincontract.md#checkAddress-method-1) | Check if an address is correctly formatted and throw an error if it is not an valid address
*Inherited from [RainContract.checkAddress()](./raincontract.md#checkAddress-method-1)* |
-| [currentTier(account, block)](./tiercontract.md#currentTier-method-1) | Get the current tier of an `account` in the Tier as an expression between `[0 - 8]`. Tier 0 is that a address has never interact with the Tier Contract.
*Inherited from [TierContract.currentTier()](./tiercontract.md#currentTier-method-1)* |
-
-## Static Property Details
-
-
-
-### deploy
-
-Deploys a new ERC721BalanceTier.
-
-Signature:
-
-```typescript
-static deploy: (signer: Signer, args: ERC721BalanceTierDeployArgs, overrides?: TxOverrides) => Promise;
-```
-
-
-
-### isChild
-
-Checks if address is registered as a child contract of this ERC721BalanceTierFactory on a specific network
-
-Signature:
-
-```typescript
-static isChild: (signer: Signer, maybeChild: string) => Promise;
-```
-
-
-
-### nameBookReference
-
-Name reference to find the address of the contract in the book address.
-
-*Overrides [RainContract.nameBookReference](./raincontract.md#nameBookReference-property-static)*
-
-Should be implemented in each class to find the factory or main address in the book.
-
-Signature:
-
-```typescript
-protected static readonly nameBookReference: string;
-```
+| [combineWith(reporter, logic, mode, hasReportForSingleTier, delegatedReport, number)](./combinetiergenerator.md#combineWith-method-1) | Combines 2 tier report with selectLte with its logic and mode, and can be chained for multiple reports each with their own logic and mode
*Inherited from [CombineTierGenerator.combineWith()](./combinetiergenerator.md#combineWith-method-1)* |
+| [differenceFrom(reporter, delegatedReport)](./combinetiergenerator.md#differenceFrom-method-1) | Saturating difference between 2 reports
*Inherited from [CombineTierGenerator.differenceFrom()](./combinetiergenerator.md#differenceFrom-method-1)* |
+| [isTierHeldFor(duration)](./combinetiergenerator.md#isTierHeldFor-method-1) | Creats a holding time ALWAYS/NEVER tier script for a Combinetier contract out of a Stake contract.
*Inherited from [CombineTierGenerator.isTierHeldFor()](./combinetiergenerator.md#isTierHeldFor-method-1)* |
+| [updateReport(startTier, endTier, number)](./combinetiergenerator.md#updateReport-method-1) | Method to update a report at given tier range (can be any range between 0 to 8)
*Inherited from [CombineTierGenerator.updateReport()](./combinetiergenerator.md#updateReport-method-1)* |
## Property Details
-
-
-### addTokenAddress
-
-Get a new instance with the token address provided.
-
-This method must be used if the token address is not provided in construction moment. The class use this address to make calculations related with the Tier. The token address provided should be the same that the Tier is using to work correctly.
-
-Signature:
-
-```typescript
-readonly addTokenAddress: (tokenAddress: string) => ERC721BalanceTier;
-```
-
-
-
-### connect
-
-Connect the current contract instance to a new ethers signer.
-
-*Overrides [RainContract.connect](./raincontract.md#connect-property)*
-
-Signature:
-
-```typescript
-readonly connect: (signer: Signer) => ERC721BalanceTier;
-```
-
-
-
-### setTier
-
-It is NOT implemented in BalanceTiers. Always will throw an error
-
-*Overrides [TierContract.setTier](./tiercontract.md#setTier-property)*
-
-Users can set their own tier by calling `setTier` if is this option available on the Tier contract. ITier like BalanceTier does not allow this.
-
-Signature:
-
-```typescript
-readonly setTier: (account: string, endTier: BigNumberish, data: BytesLike, overrides?: TxOverrides | undefined) => Promise;
-```
-
### tierValues
-Complements the default solidity accessor for `tierValues`. Returns all the values in a listrather than requiring an index be specified.
-
-Signature:
-
-```typescript
-readonly tierValues: (overrides?: ReadTxOverrides) => Promise;
-```
-
-
-
-### token
-
-ERC721 Token address that track the Tier
-
Signature:
```typescript
-readonly token: string;
+readonly tierValues: (number | string)[];
```
-## Method Details
-
-
-
-### amountToTier(account, desiredLevel)
+
-Calculate how much amount of the token needed transfer to or transfer out of the account to reach a `desiredLevel`.
-
-Take in mind: - If the `desired level` is higher than the current level, the amount returned will be the amount needed to obtain or transfer to the `account`. - If the `desired level` is lower than the current level, the amount returned will be the amount needed to remove or transfer out of the `account`. - If already have the `desired` tier, will return 0
+### tokenAddress
Signature:
```typescript
-amountToTier(account: string, desiredLevel: number): Promise;
+readonly tokenAddress: string;
```
-
-#### Parameters
-
-| Parameter | Type | Description |
-| --- | --- | --- |
-| account | `string` | (optional) the account address to calculate. If not provided will use the signer of the instance |
-| desiredLevel | `number` | the tier level desired to get |
-
-Returns:
-
-`Promise`
-
-The amount t
-
diff --git a/docs/classes/fixedprice.md b/docs/classes/fixedprice.md
index 8bba104..bfd81c8 100644
--- a/docs/classes/fixedprice.md
+++ b/docs/classes/fixedprice.md
@@ -18,37 +18,17 @@ const saleType = new FixedPrice(price)
```
-## Static Properties
-
-| Property | Type | Description |
-| --- | --- | --- |
-| [FIXED\_PRICE\_SOURCES](./fixedprice.md#FIXED_PRICE_SOURCES-property-static) | `() => Uint8Array` | |
-
## Properties
| Property | Type | Description |
| --- | --- | --- |
-| [argumentsLength](./pricecurve.md#argumentsLength-property) | `BigNumberish` | *Inherited from [PriceCurve.argumentsLength](./pricecurve.md#argumentsLength-property)* |
| [constants](./pricecurve.md#constants-property) | `BigNumberish[]` | *Inherited from [PriceCurve.constants](./pricecurve.md#constants-property)* |
| [sources](./pricecurve.md#sources-property) | `BytesLike[]` | *Inherited from [PriceCurve.sources](./pricecurve.md#sources-property)* |
-| [stackLength](./pricecurve.md#stackLength-property) | `BigNumberish` | *Inherited from [PriceCurve.stackLength](./pricecurve.md#stackLength-property)* |
## Methods
| Method | Description |
| --- | --- |
| [applyExtraTimeDiscount(endTimestamp, extraTimeDiscountThreshold, extraTimeDiscount)](./pricecurve.md#applyExtraTimeDiscount-method-1) | Method to apply extra time discount to the sale. if sale's continues into extra time then those addresses that have met the critera of extra time discount which is already purchased a certain amount of rTKN will get some discount on price for their next purchase.
*Inherited from [PriceCurve.applyExtraTimeDiscount()](./pricecurve.md#applyExtraTimeDiscount-method-1)* |
-| [applyTierDiscount(tierAddress, tierDiscount, tierActivation)](./pricecurve.md#applyTierDiscount-method-1) | Method to apply tiers' discounts to the sale. Tiered addresses will get discount based on the tier they hold.
*Inherited from [PriceCurve.applyTierDiscount()](./pricecurve.md#applyTierDiscount-method-1)* |
-| [applyWalletCap(mode, options)](./pricecurve.md#applyWalletCap-method-1) | Method to apply cap per wallet to the sale. addresses can only buy that certain amount of rTKNs. With the option of applying multiplier for max cap per wallet.
*Inherited from [PriceCurve.applyWalletCap()](./pricecurve.md#applyWalletCap-method-1)* |
-
-## Static Property Details
-
-
+| [applyTierDiscount(tierAddress, tierDiscount, options)](./pricecurve.md#applyTierDiscount-method-1) | Method to apply tiers' discounts to the sale. Tiered addresses will get discount based on the tier they hold.
*Inherited from [PriceCurve.applyTierDiscount()](./pricecurve.md#applyTierDiscount-method-1)* |
-### FIXED\_PRICE\_SOURCES
-
-Signature:
-
-```typescript
-static FIXED_PRICE_SOURCES: () => Uint8Array;
-```
diff --git a/docs/classes/formatter.md b/docs/classes/formatter.md
new file mode 100644
index 0000000..308fd72
--- /dev/null
+++ b/docs/classes/formatter.md
@@ -0,0 +1,98 @@
+
+# Class Formatter
+
+The generator of human friendly readable source.
+
+Parse an StateConfig/Script to a more human readable form, making easier to understand. This form allows users read exactly what the Script will do, like the conditions, values used, etc. Also, anyone can learn to write their own scripts if use the Human Form to see the output for each combination that they made.
+
+If you find an issue or you want to propose a better way to show a specific script or opcodes, please feel to do it on: https://github.com/beehive-innovation/rain-sdk/issues
+
+Signature:
+
+```typescript
+class Formatter
+```
+
+## Static Methods
+
+| Method | Description |
+| --- | --- |
+| [get(\_state, \_config)](./formatter.md#get-method-static-1) | Obtain the friendly output from an StateConfig/script. |
+| [prettify(\_text, \_config)](./formatter.md#prettify-method-static-1) | Make the output from the HumanFriendly Source more readable by adding indenting following the parenthesis |
+| [set(opmeta\_)](./formatter.md#set-method-static-1) | Method to set the opmeta with more than AllStandardOps opcodes or with other name/aliases for this instance of the Formatter |
+
+## Static Method Details
+
+
+
+### get(\_state, \_config)
+
+Obtain the friendly output from an StateConfig/script.
+
+Signature:
+
+```typescript
+static get(_state: StateConfig, _config?: Config): string;
+```
+
+#### Parameters
+
+| Parameter | Type | Description |
+| --- | --- | --- |
+| \_state | [StateConfig](../interfaces/stateconfig.md) | The StateConfig/script to generate the friendly version |
+| \_config | [Config](../types/config.md) | The configuration that will run the generator |
+
+Returns:
+
+`string`
+
+
+
+
+### prettify(\_text, \_config)
+
+Make the output from the HumanFriendly Source more readable by adding indenting following the parenthesis
+
+If the string is already indentend, the method will wrongly generate the string
+
+Signature:
+
+```typescript
+static prettify(_text: string, _config?: PrettifyConfig): string;
+```
+
+#### Parameters
+
+| Parameter | Type | Description |
+| --- | --- | --- |
+| \_text | `string` | The output from the HumanFriendlySource |
+| \_config | [PrettifyConfig](../types/prettifyconfig.md) | The configuration of the prettify method (experimental) |
+
+Returns:
+
+`string`
+
+A prettified output
+
+
+
+### set(opmeta\_)
+
+Method to set the opmeta with more than AllStandardOps opcodes or with other name/aliases for this instance of the Formatter
+
+Signature:
+
+```typescript
+static set(opmeta_: typeof OpMeta): Formatter;
+```
+
+#### Parameters
+
+| Parameter | Type | Description |
+| --- | --- | --- |
+| opmeta\_ | `typeof OpMeta` | The OpMeta map object |
+
+Returns:
+
+`Formatter`
+
diff --git a/docs/classes/gatednft.md b/docs/classes/gatednft.md
deleted file mode 100644
index 9e39e3a..0000000
--- a/docs/classes/gatednft.md
+++ /dev/null
@@ -1,410 +0,0 @@
-
-# Class GatedNFT
-
-//TODO: Add doc
-
-Signature:
-
-```typescript
-class GatedNFT extends FactoryContract
-```
-
-## Static Properties
-
-| Property | Type | Description |
-| --- | --- | --- |
-| [deploy](./gatednft.md#deploy-property-static) | `(signer: Signer, args: GatedNFTDeployArguments, overrides?: TxOverrides) => Promise` | Deploys a new GatedNFT. |
-| [getAddressesForChainId](./addressbook.md#getAddressesForChainId-property-static) | `(chainId: number) => Addresses` | Obtain all the addresses deployed in a specific network with a chain ID.
*Inherited from [AddressBook.getAddressesForChainId](./addressbook.md#getAddressesForChainId-property-static)* |
-| [getChainId](./raincontract.md#getChainId-property-static) | `(signerOrProvider: Signer \| Provider) => Promise` | Get the chain ID from a valid ethers provider.
Request to the provider stored in the signer which is the chain ID.
*Inherited from [RainContract.getChainId](./raincontract.md#getChainId-property-static)* |
-| [getSubgraphEndpoint](./addressbook.md#getSubgraphEndpoint-property-static) | `(chainId: number) => string` | Obtain the latest subgraph endpoint related to the version that use the SDK.
*Inherited from [AddressBook.getSubgraphEndpoint](./addressbook.md#getSubgraphEndpoint-property-static)* |
-| [isChild](./gatednft.md#isChild-property-static) | `(signer: Signer, maybeChild: string) => Promise` | Checks if address is registered as a child contract of this GatedNFTFactory on a specific network |
-| [nameBookReference](./gatednft.md#nameBookReference-property-static) | `string` | Name reference to find the address of the contract in the book address.
*Overrides [RainContract.nameBookReference](./raincontract.md#nameBookReference-property-static)* |
-
-## Properties
-
-| Property | Type | Description |
-| --- | --- | --- |
-| [address](./raincontract.md#address-property) | `string` | The contract address of the instance.
*Inherited from [RainContract.address](./raincontract.md#address-property)* |
-| [approve](./gatednft.md#approve-property) | `(to: string, tokenId: BigNumberish, overrides?: TxOverrides) => Promise` | Gives permission to `to` to transfer `tokenId` token to another account. The approval is cleared when the token is transferred.
Only a single account can be approved at a time, so approving the zero address clears previous approvals.
Requirements:
- The caller must own the token or be an approved operator. - `tokenId` must exist. |
-| [balanceOf](./gatednft.md#balanceOf-property) | `(owner: string, overrides?: ReadTxOverrides) => Promise` | Returns the number of tokens in `owner`'s account. |
-| [connect](./gatednft.md#connect-property) | `(signer: Signer) => GatedNFT` | Connect the current contract instance to a new ethers signer.
*Overrides [RainContract.connect](./raincontract.md#connect-property)* |
-| [getApproved](./gatednft.md#getApproved-property) | `(tokenId: BigNumberish, overrides?: ReadTxOverrides) => Promise` | Returns the account approved for `tokenId` token.
Requirements:
- `tokenId` must exist. |
-| [isApprovedForAll](./gatednft.md#isApprovedForAll-property) | `(owner: string, operator: string, overrides?: ReadTxOverrides) => Promise` | Returns if the `operator` is allowed to manage all of the assets of `owner`. |
-| [mint](./gatednft.md#mint-property) | `(to: string, overrides?: TxOverrides) => Promise` | Mint a token and transfers it to `to`.
Requirements: - `to` should have the required tier - `to` should not exhausted his allowance |
-| [name](./gatednft.md#name-property) | `(overrides?: ReadTxOverrides) => Promise` | Returns the token collection name. |
-| [owner](./gatednft.md#owner-property) | `(overrides?: ReadTxOverrides) => Promise` | Returns the address of the current owner. |
-| [ownerOf](./gatednft.md#ownerOf-property) | `(tokenId: BigNumberish, overrides?: ReadTxOverrides) => Promise` | Returns the owner of the `tokenId` token.
Requirements:
- `tokenId` must exist. |
-| [renounceOwnership](./gatednft.md#renounceOwnership-property) | `(overrides?: TxOverrides) => Promise` | Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner.
NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner. |
-| [royaltyInfo](./gatednft.md#royaltyInfo-property) | `(salePrice: BigNumberish, overrides?: ReadTxOverrides) => Promise` | Returns how much royalty is owed and to whom, based on a sale price that may be denominated in any unit of exchange. The royalty amount is denominated and should be payed in that same unit of exchange. |
-| [safeTransferFrom](./gatednft.md#safeTransferFrom-property) | `(from: string, to: string, tokenId: BigNumberish, overrides?: TxOverrides) => Promise` | Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients are aware of the ERC721 protocol to prevent tokens from being forever locked.
Requirements:
- `from` cannot be the zero address. - `to` cannot be the zero address. - `tokenId` token must exist and be owned by `from`. - If the caller is not `from`, it must be have been allowed to move this token by either approve() or setApprovalForAll(). - If `to` refers to a smart contract, it must implement `IERC721Receiver-onERC721Received`, which is called upon a safe transfer. |
-| [safeTransferFromWithData](./gatednft.md#safeTransferFromWithData-property) | `(from: string, to: string, tokenId: BigNumberish, data: BytesLike, overrides?: TxOverrides) => Promise` | Safely transfers `tokenId` token from `from` to `to`.
Requirements:
- `from` cannot be the zero address. - `to` cannot be the zero address. - `tokenId` token must exist and be owned by `from`. - If the caller is not `from`, it must be approved to move this token by either approve() or setApprovalForAll(). - If `to` refers to a smart contract, it must implement `IERC721Receiver-onERC721Received`, which is called upon a safe transfer. |
-| [setApprovalForAll](./gatednft.md#setApprovalForAll-property) | `(operator: string, approved: boolean, overrides?: TxOverrides) => Promise` | Approve or remove `operator` as an operator for the caller. Operators can call `transferFrom()` or `safeTransferFrom()` for any token owned by the caller.
Requirements:
- The `operator` cannot be the caller. |
-| [signer](./raincontract.md#signer-property) | `Signer` | The ethers signer that is connected to the instance.
*Inherited from [RainContract.signer](./raincontract.md#signer-property)* |
-| [supportsInterface](./gatednft.md#supportsInterface-property) | `(interfaceId: BytesLike, overrides?: ReadTxOverrides) => Promise` | Returns true if this contract implements the interface defined by `interfaceId`. See the corresponding https://eips.ethereum.org/EIPS/eip-165\#how-interfaces-are-identified\[EIP section\] to learn more about how these ids are created. |
-| [symbol](./gatednft.md#symbol-property) | `(overrides?: ReadTxOverrides) => Promise` | Returns the token collection symbol. |
-| [tier](./gatednft.md#tier-property) | `(overrides?: ReadTxOverrides) => Promise` | Tier contract to compare statuses against on transfer. |
-| [tokenURI](./gatednft.md#tokenURI-property) | `(tokenId: BigNumberish, overrides?: ReadTxOverrides) => Promise` | Returns the Uniform Resource Identifier (URI) for `tokenId` token. |
-| [totalSupply](./gatednft.md#totalSupply-property) | `(overrides?: ReadTxOverrides) => Promise` | Returns the total amount of tokens stored by the contract. |
-| [transferFrom](./gatednft.md#transferFrom-property) | `(from: string, to: string, tokenId: BigNumberish, overrides?: TxOverrides) => Promise` | Transfers `tokenId` token from `from` to `to`.
WARNING: Usage of this method is discouraged, use `safeTransferFrom()` whenever possible.
Requirements:
- `from` cannot be the zero address. - `to` cannot be the zero address. - `tokenId` token must be owned by `from`. - If the caller is not `from`, it must be approved to move this token by either `approve()` or `setApprovalForAll()`. |
-| [transferOwnership](./gatednft.md#transferOwnership-property) | `(newOwner: string, overrides?: TxOverrides) => Promise` | Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner. |
-| [updateRoyaltyRecipient](./gatednft.md#updateRoyaltyRecipient-property) | `(royaltyRecipient: string, overrides?: TxOverrides) => Promise` | Update the royalty recipient. Requires the caller to be the current recipient |
-
-## Static Methods
-
-| Method | Description |
-| --- | --- |
-| [\_isChild(signer, maybeChild)](./factorycontract.md#_isChild-method-static-1) | Checks if address is registered as a child contract of the factory in the chain.
*Inherited from [FactoryContract.\_isChild()](./factorycontract.md#_isChild-method-static-1)* |
-| [getBookAddress(chainId)](./raincontract.md#getBookAddress-method-static-1) | Get the address stored in the book for a determined chain if it is available.
*Inherited from [RainContract.getBookAddress()](./raincontract.md#getBookAddress-method-static-1)* |
-| [getNewChildFromReceipt(receipt, parentContract)](./factorycontract.md#getNewChildFromReceipt-method-static-1) | Get the child from a receipt obtain from a Factory transaction
*Inherited from [FactoryContract.getNewChildFromReceipt()](./factorycontract.md#getNewChildFromReceipt-method-static-1)* |
-
-## Methods
-
-| Method | Description |
-| --- | --- |
-| [checkAddress(address, message)](./raincontract.md#checkAddress-method-1) | Check if an address is correctly formatted and throw an error if it is not an valid address
*Inherited from [RainContract.checkAddress()](./raincontract.md#checkAddress-method-1)* |
-
-## Static Property Details
-
-
-
-### deploy
-
-Deploys a new GatedNFT.
-
-Signature:
-
-```typescript
-static deploy: (signer: Signer, args: GatedNFTDeployArguments, overrides?: TxOverrides) => Promise;
-```
-
-
-
-### isChild
-
-Checks if address is registered as a child contract of this GatedNFTFactory on a specific network
-
-Signature:
-
-```typescript
-static isChild: (signer: Signer, maybeChild: string) => Promise;
-```
-
-
-
-### nameBookReference
-
-Name reference to find the address of the contract in the book address.
-
-*Overrides [RainContract.nameBookReference](./raincontract.md#nameBookReference-property-static)*
-
-Should be implemented in each class to find the factory or main address in the book.
-
-Signature:
-
-```typescript
-protected static readonly nameBookReference: string;
-```
-
-## Property Details
-
-
-
-### approve
-
-Gives permission to `to` to transfer `tokenId` token to another account. The approval is cleared when the token is transferred.
-
-Only a single account can be approved at a time, so approving the zero address clears previous approvals.
-
-Requirements:
-
-- The caller must own the token or be an approved operator. - `tokenId` must exist.
-
-Signature:
-
-```typescript
-readonly approve: (to: string, tokenId: BigNumberish, overrides?: TxOverrides) => Promise;
-```
-
-
-
-### balanceOf
-
-Returns the number of tokens in `owner`'s account.
-
-Signature:
-
-```typescript
-readonly balanceOf: (owner: string, overrides?: ReadTxOverrides) => Promise;
-```
-
-
-
-### connect
-
-Connect the current contract instance to a new ethers signer.
-
-*Overrides [RainContract.connect](./raincontract.md#connect-property)*
-
-Signature:
-
-```typescript
-readonly connect: (signer: Signer) => GatedNFT;
-```
-
-
-
-### getApproved
-
-Returns the account approved for `tokenId` token.
-
-Requirements:
-
-- `tokenId` must exist.
-
-Signature:
-
-```typescript
-readonly getApproved: (tokenId: BigNumberish, overrides?: ReadTxOverrides) => Promise;
-```
-
-
-
-### isApprovedForAll
-
-Returns if the `operator` is allowed to manage all of the assets of `owner`.
-
-Signature:
-
-```typescript
-readonly isApprovedForAll: (owner: string, operator: string, overrides?: ReadTxOverrides) => Promise;
-```
-
-
-
-### mint
-
-Mint a token and transfers it to `to`.
-
-Requirements: - `to` should have the required tier - `to` should not exhausted his allowance
-
-Signature:
-
-```typescript
-readonly mint: (to: string, overrides?: TxOverrides) => Promise;
-```
-
-
-
-### name
-
-Returns the token collection name.
-
-Signature:
-
-```typescript
-readonly name: (overrides?: ReadTxOverrides) => Promise;
-```
-
-
-
-### owner
-
-Returns the address of the current owner.
-
-Signature:
-
-```typescript
-readonly owner: (overrides?: ReadTxOverrides) => Promise;
-```
-
-
-
-### ownerOf
-
-Returns the owner of the `tokenId` token.
-
-Requirements:
-
-- `tokenId` must exist.
-
-Signature:
-
-```typescript
-readonly ownerOf: (tokenId: BigNumberish, overrides?: ReadTxOverrides) => Promise;
-```
-
-
-
-### renounceOwnership
-
-Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner.
-
-NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner.
-
-Signature:
-
-```typescript
-readonly renounceOwnership: (overrides?: TxOverrides) => Promise;
-```
-
-
-
-### royaltyInfo
-
-Returns how much royalty is owed and to whom, based on a sale price that may be denominated in any unit of exchange. The royalty amount is denominated and should be payed in that same unit of exchange.
-
-Signature:
-
-```typescript
-readonly royaltyInfo: (salePrice: BigNumberish, overrides?: ReadTxOverrides) => Promise;
-```
-
-
-
-### safeTransferFrom
-
-Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients are aware of the ERC721 protocol to prevent tokens from being forever locked.
-
-Requirements:
-
-- `from` cannot be the zero address. - `to` cannot be the zero address. - `tokenId` token must exist and be owned by `from`. - If the caller is not `from`, it must be have been allowed to move this token by either approve() or setApprovalForAll(). - If `to` refers to a smart contract, it must implement `IERC721Receiver-onERC721Received`, which is called upon a safe transfer.
-
-Signature:
-
-```typescript
-readonly safeTransferFrom: (from: string, to: string, tokenId: BigNumberish, overrides?: TxOverrides) => Promise;
-```
-
-
-
-### safeTransferFromWithData
-
-Safely transfers `tokenId` token from `from` to `to`.
-
-Requirements:
-
-- `from` cannot be the zero address. - `to` cannot be the zero address. - `tokenId` token must exist and be owned by `from`. - If the caller is not `from`, it must be approved to move this token by either approve() or setApprovalForAll(). - If `to` refers to a smart contract, it must implement `IERC721Receiver-onERC721Received`, which is called upon a safe transfer.
-
-Signature:
-
-```typescript
-readonly safeTransferFromWithData: (from: string, to: string, tokenId: BigNumberish, data: BytesLike, overrides?: TxOverrides) => Promise;
-```
-
-
-
-### setApprovalForAll
-
-Approve or remove `operator` as an operator for the caller. Operators can call `transferFrom()` or `safeTransferFrom()` for any token owned by the caller.
-
-Requirements:
-
-- The `operator` cannot be the caller.
-
-Signature:
-
-```typescript
-readonly setApprovalForAll: (operator: string, approved: boolean, overrides?: TxOverrides) => Promise;
-```
-
-
-
-### supportsInterface
-
-Returns true if this contract implements the interface defined by `interfaceId`. See the corresponding https://eips.ethereum.org/EIPS/eip-165\#how-interfaces-are-identified\[EIP section\] to learn more about how these ids are created.
-
-Signature:
-
-```typescript
-readonly supportsInterface: (interfaceId: BytesLike, overrides?: ReadTxOverrides) => Promise;
-```
-
-
-
-### symbol
-
-Returns the token collection symbol.
-
-Signature:
-
-```typescript
-readonly symbol: (overrides?: ReadTxOverrides) => Promise;
-```
-
-
-
-### tier
-
-Tier contract to compare statuses against on transfer.
-
-Signature:
-
-```typescript
-readonly tier: (overrides?: ReadTxOverrides) => Promise;
-```
-
-
-
-### tokenURI
-
-Returns the Uniform Resource Identifier (URI) for `tokenId` token.
-
-Signature:
-
-```typescript
-readonly tokenURI: (tokenId: BigNumberish, overrides?: ReadTxOverrides) => Promise;
-```
-
-
-
-### totalSupply
-
-Returns the total amount of tokens stored by the contract.
-
-Signature:
-
-```typescript
-readonly totalSupply: (overrides?: ReadTxOverrides) => Promise;
-```
-
-
-
-### transferFrom
-
-Transfers `tokenId` token from `from` to `to`.
-
-WARNING: Usage of this method is discouraged, use `safeTransferFrom()` whenever possible.
-
-Requirements:
-
-- `from` cannot be the zero address. - `to` cannot be the zero address. - `tokenId` token must be owned by `from`. - If the caller is not `from`, it must be approved to move this token by either `approve()` or `setApprovalForAll()`.
-
-Signature:
-
-```typescript
-readonly transferFrom: (from: string, to: string, tokenId: BigNumberish, overrides?: TxOverrides) => Promise;
-```
-
-
-
-### transferOwnership
-
-Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner.
-
-Signature:
-
-```typescript
-readonly transferOwnership: (newOwner: string, overrides?: TxOverrides) => Promise;
-```
-
-
-
-### updateRoyaltyRecipient
-
-Update the royalty recipient. Requires the caller to be the current recipient
-
-Signature:
-
-```typescript
-readonly updateRoyaltyRecipient: (royaltyRecipient: string, overrides?: TxOverrides) => Promise;
-```
diff --git a/docs/classes/incdecprice.md b/docs/classes/incdecprice.md
new file mode 100644
index 0000000..a0f2921
--- /dev/null
+++ b/docs/classes/incdecprice.md
@@ -0,0 +1,53 @@
+
+# Class IncDecPrice
+
+- A sub-class of PriceCurve for creating an linear Increasing or Decreasing sale type.
+
+- Price starts at 'startPrice' and goes to 'endPrice' over the span of the sale's duration.
+
+Signature:
+
+```typescript
+class IncDecPrice extends PriceCurve
+```
+
+## Example
+
+
+```typescript
+//For generating a Increasing/Decreasing Price sale type pass in the required arguments to the constructor.
+const saleType = new IncreasingPrice(startPrice, endPrice, startTimestamp, endTimestamp)
+
+```
+
+## Static Properties
+
+| Property | Type | Description |
+| --- | --- | --- |
+| [INC\_DEC\_PRICE\_SOURCES](./incdecprice.md#INC_DEC_PRICE_SOURCES-property-static) | `(isInc: boolean) => Uint8Array` | |
+
+## Properties
+
+| Property | Type | Description |
+| --- | --- | --- |
+| [constants](./pricecurve.md#constants-property) | `BigNumberish[]` | *Inherited from [PriceCurve.constants](./pricecurve.md#constants-property)* |
+| [sources](./pricecurve.md#sources-property) | `BytesLike[]` | *Inherited from [PriceCurve.sources](./pricecurve.md#sources-property)* |
+
+## Methods
+
+| Method | Description |
+| --- | --- |
+| [applyExtraTimeDiscount(endTimestamp, extraTimeDiscountThreshold, extraTimeDiscount)](./pricecurve.md#applyExtraTimeDiscount-method-1) | Method to apply extra time discount to the sale. if sale's continues into extra time then those addresses that have met the critera of extra time discount which is already purchased a certain amount of rTKN will get some discount on price for their next purchase.
*Inherited from [PriceCurve.applyExtraTimeDiscount()](./pricecurve.md#applyExtraTimeDiscount-method-1)* |
+| [applyTierDiscount(tierAddress, tierDiscount, options)](./pricecurve.md#applyTierDiscount-method-1) | Method to apply tiers' discounts to the sale. Tiered addresses will get discount based on the tier they hold.
*Inherited from [PriceCurve.applyTierDiscount()](./pricecurve.md#applyTierDiscount-method-1)* |
+
+## Static Property Details
+
+
+
+### INC\_DEC\_PRICE\_SOURCES
+
+Signature:
+
+```typescript
+static INC_DEC_PRICE_SOURCES: (isInc: boolean) => Uint8Array;
+```
diff --git a/docs/classes/increasingprice.md b/docs/classes/increasingprice.md
deleted file mode 100644
index 5e8bb43..0000000
--- a/docs/classes/increasingprice.md
+++ /dev/null
@@ -1,56 +0,0 @@
-
-# Class IncreasingPrice
-
-- A sub-class of PriceCurve for creating an linear Increasing sale type.
-
-- Price starts at 'startPrice' and goes to 'endPrice' over the span of the sale's duration.
-
-Signature:
-
-```typescript
-class IncreasingPrice extends PriceCurve
-```
-
-## Example
-
-
-```typescript
-//For generating a Increasing Price sale type pass in the required arguments to the constructor.
-const saleType = new IncreasingPrice(startPrice, endPrice, startTimestamp, endTimestamp)
-
-```
-
-## Static Properties
-
-| Property | Type | Description |
-| --- | --- | --- |
-| [INC\_PRICE\_SOURCES](./increasingprice.md#INC_PRICE_SOURCES-property-static) | `() => Uint8Array` | |
-
-## Properties
-
-| Property | Type | Description |
-| --- | --- | --- |
-| [argumentsLength](./pricecurve.md#argumentsLength-property) | `BigNumberish` | *Inherited from [PriceCurve.argumentsLength](./pricecurve.md#argumentsLength-property)* |
-| [constants](./pricecurve.md#constants-property) | `BigNumberish[]` | *Inherited from [PriceCurve.constants](./pricecurve.md#constants-property)* |
-| [sources](./pricecurve.md#sources-property) | `BytesLike[]` | *Inherited from [PriceCurve.sources](./pricecurve.md#sources-property)* |
-| [stackLength](./pricecurve.md#stackLength-property) | `BigNumberish` | *Inherited from [PriceCurve.stackLength](./pricecurve.md#stackLength-property)* |
-
-## Methods
-
-| Method | Description |
-| --- | --- |
-| [applyExtraTimeDiscount(endTimestamp, extraTimeDiscountThreshold, extraTimeDiscount)](./pricecurve.md#applyExtraTimeDiscount-method-1) | Method to apply extra time discount to the sale. if sale's continues into extra time then those addresses that have met the critera of extra time discount which is already purchased a certain amount of rTKN will get some discount on price for their next purchase.
*Inherited from [PriceCurve.applyExtraTimeDiscount()](./pricecurve.md#applyExtraTimeDiscount-method-1)* |
-| [applyTierDiscount(tierAddress, tierDiscount, tierActivation)](./pricecurve.md#applyTierDiscount-method-1) | Method to apply tiers' discounts to the sale. Tiered addresses will get discount based on the tier they hold.
*Inherited from [PriceCurve.applyTierDiscount()](./pricecurve.md#applyTierDiscount-method-1)* |
-| [applyWalletCap(mode, options)](./pricecurve.md#applyWalletCap-method-1) | Method to apply cap per wallet to the sale. addresses can only buy that certain amount of rTKNs. With the option of applying multiplier for max cap per wallet.
*Inherited from [PriceCurve.applyWalletCap()](./pricecurve.md#applyWalletCap-method-1)* |
-
-## Static Property Details
-
-
-
-### INC\_PRICE\_SOURCES
-
-Signature:
-
-```typescript
-static INC_PRICE_SOURCES: () => Uint8Array;
-```
diff --git a/docs/classes/itier.md b/docs/classes/itier.md
deleted file mode 100644
index 69d4e11..0000000
--- a/docs/classes/itier.md
+++ /dev/null
@@ -1,67 +0,0 @@
-
-# Class ITier
-
-Class to interact with ITier contracts
-
-Generic class to interact with any ITier contract in chain with the basic methods and functions.
-
-`ITier` is a simple interface that contracts can implement to provide membership lists for other contracts.
-
-This class can be used to interact with any contract that implement the ITier interface in their code, but does not know if the contract has implemented the code. E.g: if a contract does not implementent `setTier` as a BalanceTier Contract, the call will be reverted.
-
-Signature:
-
-```typescript
-class ITier extends TierContract
-```
-
-## Static Properties
-
-| Property | Type | Description |
-| --- | --- | --- |
-| [getAddressesForChainId](./addressbook.md#getAddressesForChainId-property-static) | `(chainId: number) => Addresses` | Obtain all the addresses deployed in a specific network with a chain ID.
*Inherited from [AddressBook.getAddressesForChainId](./addressbook.md#getAddressesForChainId-property-static)* |
-| [getChainId](./raincontract.md#getChainId-property-static) | `(signerOrProvider: Signer \| Provider) => Promise` | Get the chain ID from a valid ethers provider.
Request to the provider stored in the signer which is the chain ID.
*Inherited from [RainContract.getChainId](./raincontract.md#getChainId-property-static)* |
-| [getSubgraphEndpoint](./addressbook.md#getSubgraphEndpoint-property-static) | `(chainId: number) => string` | Obtain the latest subgraph endpoint related to the version that use the SDK.
*Inherited from [AddressBook.getSubgraphEndpoint](./addressbook.md#getSubgraphEndpoint-property-static)* |
-| [nameBookReference](./raincontract.md#nameBookReference-property-static) | `string` | Name reference to find the address of the contract in the book address.
*Inherited from [RainContract.nameBookReference](./raincontract.md#nameBookReference-property-static)* |
-
-## Properties
-
-| Property | Type | Description |
-| --- | --- | --- |
-| [address](./raincontract.md#address-property) | `string` | The contract address of the instance.
*Inherited from [RainContract.address](./raincontract.md#address-property)* |
-| [connect](./itier.md#connect-property) | `(signer: Signer) => ITier` | Connect the current contract instance to a new ethers signer.
*Overrides [RainContract.connect](./raincontract.md#connect-property)* |
-| [levels](./tiercontract.md#levels-property) | `typeof Tier` | All the contract tier levels availables in all ITier contracts.
*Inherited from [TierContract.levels](./tiercontract.md#levels-property)* |
-| [report](./tiercontract.md#report-property) | `(account: string, overrides?: ReadTxOverrides) => Promise` | A tier report is a `uint256` that contains each of the block numbers each tier has been held continously since as a `uint32`.
*Inherited from [TierContract.report](./tiercontract.md#report-property)* |
-| [setTier](./tiercontract.md#setTier-property) | `(account: string, endTier: BigNumberish, data: BytesLike, overrides?: TxOverrides) => Promise` | Updates the tier of an account.
*Inherited from [TierContract.setTier](./tiercontract.md#setTier-property)* |
-| [signer](./raincontract.md#signer-property) | `Signer` | The ethers signer that is connected to the instance.
*Inherited from [RainContract.signer](./raincontract.md#signer-property)* |
-
-## Static Methods
-
-| Method | Description |
-| --- | --- |
-| [\_isChild(signer, maybeChild)](./factorycontract.md#_isChild-method-static-1) | Checks if address is registered as a child contract of the factory in the chain.
*Inherited from [FactoryContract.\_isChild()](./factorycontract.md#_isChild-method-static-1)* |
-| [getBookAddress(chainId)](./raincontract.md#getBookAddress-method-static-1) | Get the address stored in the book for a determined chain if it is available.
*Inherited from [RainContract.getBookAddress()](./raincontract.md#getBookAddress-method-static-1)* |
-| [getNewChildFromReceipt(receipt, parentContract)](./factorycontract.md#getNewChildFromReceipt-method-static-1) | Get the child from a receipt obtain from a Factory transaction
*Inherited from [FactoryContract.getNewChildFromReceipt()](./factorycontract.md#getNewChildFromReceipt-method-static-1)* |
-
-## Methods
-
-| Method | Description |
-| --- | --- |
-| [checkAddress(address, message)](./raincontract.md#checkAddress-method-1) | Check if an address is correctly formatted and throw an error if it is not an valid address
*Inherited from [RainContract.checkAddress()](./raincontract.md#checkAddress-method-1)* |
-| [currentTier(account, block)](./tiercontract.md#currentTier-method-1) | Get the current tier of an `account` in the Tier as an expression between `[0 - 8]`. Tier 0 is that a address has never interact with the Tier Contract.
*Inherited from [TierContract.currentTier()](./tiercontract.md#currentTier-method-1)* |
-
-## Property Details
-
-
-
-### connect
-
-Connect the current contract instance to a new ethers signer.
-
-*Overrides [RainContract.connect](./raincontract.md#connect-property)*
-
-Signature:
-
-```typescript
-readonly connect: (signer: Signer) => ITier;
-```
diff --git a/docs/classes/tiercontract.md b/docs/classes/itierv2.md
similarity index 53%
rename from docs/classes/tiercontract.md
rename to docs/classes/itierv2.md
index e1d1444..f14b211 100644
--- a/docs/classes/tiercontract.md
+++ b/docs/classes/itierv2.md
@@ -1,12 +1,28 @@
-# Class TierContract
+# Class ITierV2
-Combine the static methods that are present in factories with the ITier instance methods. Should be use to the TierFactories.
+Class to interact with any Rain Tier contract i.e ITierV2 contracts
+
+Generic class to interact with any ITierV2 contract in chain with the basic methods and functions. `ITierV2` is a simple interface that contracts can implement to provide membership lists for other contracts. And all other Rain Tier contract inherit form it. This class can be used to interact with any contract that implement the ITierV2 interface in their code, but does not know if the contract has implemented the code.
Signature:
```typescript
-abstract class TierContract extends FactoryContract
+class ITierV2 extends FactoryContract
+```
+
+## Example
+
+
+```typescript
+import { ITierV2 } from "rain-sdk";
+
+// to instantiate a new ethers.js ITierV2 contract from this class pass the contract address and signer
+const newTier = new ITierV2(tierAddress, signer);
+
+// to connect to an existing ITierV2 instance with a new signer
+newTier.connect(signer);
+
```
## Static Properties
@@ -23,10 +39,10 @@ abstract class TierContract extends FactoryContract
| Property | Type | Description |
| --- | --- | --- |
| [address](./raincontract.md#address-property) | `string` | The contract address of the instance.
*Inherited from [RainContract.address](./raincontract.md#address-property)* |
-| [connect](./raincontract.md#connect-property) | `(signer: Signer) => RainContract` | Connect the current contract instance to a new ethers signer.
*Inherited from [RainContract.connect](./raincontract.md#connect-property)* |
-| [levels](./tiercontract.md#levels-property) | `typeof Tier` | All the contract tier levels availables in all ITier contracts. |
-| [report](./tiercontract.md#report-property) | `(account: string, overrides?: ReadTxOverrides) => Promise` | A tier report is a `uint256` that contains each of the block numbers each tier has been held continously since as a `uint32`. |
-| [setTier](./tiercontract.md#setTier-property) | `(account: string, endTier: BigNumberish, data: BytesLike, overrides?: TxOverrides) => Promise` | Updates the tier of an account. |
+| [connect](./itierv2.md#connect-property) | `(signer: Signer) => ITierV2` | Conncect to this ITierV2 contract with another signer
*Overrides [RainContract.connect](./raincontract.md#connect-property)* |
+| [levels](./itierv2.md#levels-property) | `typeof Tier` | All the contract tier levels availables in all ITier contracts. |
+| [report](./itierv2.md#report-property) | `(account: string, context: BigNumberish[], overrides?: ReadTxOverrides) => Promise` | A tier report is a `uint256` that contains each of the block numbers each tier has been held continously since as a `uint32`. |
+| [reportTimeForTier](./itierv2.md#reportTimeForTier-property) | `(account: string, tier: BigNumberish, context: BigNumberish[], overrides?: ReadTxOverrides) => Promise` | Same as report but only returns the time for a single tier. Often the implementing contract can calculate a single tier more efficiently than all 8 tiers. If the consumer only needs one or a few tiers it MAY be much cheaper to request only those tiers individually. |
| [signer](./raincontract.md#signer-property) | `Signer` | The ethers signer that is connected to the instance.
*Inherited from [RainContract.signer](./raincontract.md#signer-property)* |
## Static Methods
@@ -42,10 +58,24 @@ abstract class TierContract extends FactoryContract
| Method | Description |
| --- | --- |
| [checkAddress(address, message)](./raincontract.md#checkAddress-method-1) | Check if an address is correctly formatted and throw an error if it is not an valid address
*Inherited from [RainContract.checkAddress()](./raincontract.md#checkAddress-method-1)* |
-| [currentTier(account, block)](./tiercontract.md#currentTier-method-1) | Get the current tier of an `account` in the Tier as an expression between `[0 - 8]`. Tier 0 is that a address has never interact with the Tier Contract. |
+| [currentTier(account, timestamp)](./itierv2.md#currentTier-method-1) | Get the current tier of an `account` in the Tier as an expression between `[0 - 8]`. Tier 0 is that a address has never interact with the Tier Contract. |
## Property Details
+
+
+### connect
+
+Conncect to this ITierV2 contract with another signer
+
+*Overrides [RainContract.connect](./raincontract.md#connect-property)*
+
+Signature:
+
+```typescript
+readonly connect: (signer: Signer) => ITierV2;
+```
+
### levels
@@ -64,40 +94,40 @@ readonly levels: typeof Tier;
A tier report is a `uint256` that contains each of the block numbers each tier has been held continously since as a `uint32`.
-There are 9 possible tier, starting with tier 0 for `0` offset or "never held any tier" then working up through 8x 4 byte offsets to the full 256 bits.
+There are 9 possible tier, starting with tier 0 for `0` offset or "never held any tier" and then working up through 8x 4 byte offsets to the full 256 bits.
Signature:
```typescript
-readonly report: (account: string, overrides?: ReadTxOverrides) => Promise;
+readonly report: (account: string, context: BigNumberish[], overrides?: ReadTxOverrides) => Promise;
```
-
+
-### setTier
+### reportTimeForTier
-Updates the tier of an account.
+Same as report but only returns the time for a single tier. Often the implementing contract can calculate a single tier more efficiently than all 8 tiers. If the consumer only needs one or a few tiers it MAY be much cheaper to request only those tiers individually.
-Users can set their own tier by calling `setTier` if is this option available on the Tier contract. ITier like BalanceTier does not allow this.
+The return value is a `uint256` for gas efficiency but the values will be bounded by `type(uint32).max` as no single tier can report a value higher than this.
Signature:
```typescript
-readonly setTier: (account: string, endTier: BigNumberish, data: BytesLike, overrides?: TxOverrides) => Promise;
+readonly reportTimeForTier: (account: string, tier: BigNumberish, context: BigNumberish[], overrides?: ReadTxOverrides) => Promise;
```
## Method Details
-### currentTier(account, block)
+### currentTier(account, timestamp)
Get the current tier of an `account` in the Tier as an expression between `[0 - 8]`. Tier 0 is that a address has never interact with the Tier Contract.
Signature:
```typescript
-currentTier(account: string, block?: number): Promise;
+currentTier(account: string, timestamp?: number): Promise;
```
#### Parameters
@@ -105,7 +135,7 @@ currentTier(account: string, block?: number): Promise;
| Parameter | Type | Description |
| --- | --- | --- |
| account | `string` | address to check the current tier |
-| block | `number` | (optional) check the level tier of an account with respect to a specific block |
+| timestamp | `number` | (optional) check the level tier of an account with respect to a specific timestamp |
Returns:
diff --git a/docs/classes/linearemissions.md b/docs/classes/linearemissions.md
index d602723..5960b07 100644
--- a/docs/classes/linearemissions.md
+++ b/docs/classes/linearemissions.md
@@ -13,23 +13,11 @@ class LinearEmissions
| Property | Type | Description |
| --- | --- | --- |
-| [argumentsLength](./linearemissions.md#argumentsLength-property) | `BigNumberish` | |
| [constants](./linearemissions.md#constants-property) | `BigNumberish[]` | |
| [sources](./linearemissions.md#sources-property) | `BytesLike[]` | |
-| [stackLength](./linearemissions.md#stackLength-property) | `BigNumberish` | |
## Property Details
-
-
-### argumentsLength
-
-Signature:
-
-```typescript
-argumentsLength: BigNumberish;
-```
-
### constants
@@ -49,13 +37,3 @@ constants: BigNumberish[];
```typescript
sources: BytesLike[];
```
-
-
-
-### stackLength
-
-Signature:
-
-```typescript
-stackLength: BigNumberish;
-```
diff --git a/docs/classes/matchmaker.md b/docs/classes/matchmaker.md
new file mode 100644
index 0000000..24a299a
--- /dev/null
+++ b/docs/classes/matchmaker.md
@@ -0,0 +1,164 @@
+
+# Class MatchMaker
+
+A class for finding matches among orders off-chain in a simulated environment
+
+Signature:
+
+```typescript
+class MatchMaker extends OrderbookSimulation
+```
+
+## Properties
+
+| Property | Type | Description |
+| --- | --- | --- |
+| [address](./orderbooksimulation.md#address-property) | `string` | The EmissionsERC20 address of this class that the simulation is done for. this is needed for THIS\_ADDRESS opcode and updating storage types after method calls, and needs to be a string number or hex string.
*Inherited from [OrderbookSimulation.address](./orderbooksimulation.md#address-property)* |
+| [blockNumber](./vmsimulation.md#blockNumber-property) | `number` | A property for producing block number for the class which will be used in BLOCK\_NUMBER opcode but BLOCK\_NUMBER opcode can also be passed at runtime
*Inherited from [vmSimulation.blockNumber](./vmsimulation.md#blockNumber-property)* |
+| [clearedCounterPartyFunds](./orderbooksimulation.md#clearedCounterPartyFunds-property) | [sClearedCounterPartyFunds](../interfaces/sclearedcounterpartyfunds.md) | The property that stores all the data of an order's total cleared amount to a specific counterparty address which needs to be in form of a string number or hex string
*Inherited from [OrderbookSimulation.clearedCounterPartyFunds](./orderbooksimulation.md#clearedCounterPartyFunds-property)* |
+| [clearedFunds](./orderbooksimulation.md#clearedFunds-property) | [sClearedFunds](../interfaces/sclearedfunds.md) | The property that stores all the data of an order's total cleared amount,
*Inherited from [OrderbookSimulation.clearedFunds](./orderbooksimulation.md#clearedFunds-property)* |
+| [erc1155s](./vmsimulation.md#erc1155s-property) | [sERC1155s](../interfaces/serc1155s.md) | A property of type erc1155s that act like a storage for simulation and stores the erc1155 token data. this is needed for IERC1155 related opcodes
*Inherited from [vmSimulation.erc1155s](./vmsimulation.md#erc1155s-property)* |
+| [erc20s](./vmsimulation.md#erc20s-property) | [sERC20s](../interfaces/serc20s.md) | A property of type erc20s that act like a storage for simulation and stores the erc20 token data. this is needed for IERC20 related opcodes
*Inherited from [vmSimulation.erc20s](./vmsimulation.md#erc20s-property)* |
+| [erc721s](./vmsimulation.md#erc721s-property) | [sERC721s](../interfaces/serc721s.md) | A property of type erc721s that act like a storage for simulation and stores the erc721 token data. this is needed for IERC721 related opcodes
*Inherited from [vmSimulation.erc721s](./vmsimulation.md#erc721s-property)* |
+| [foundMatches](./matchmaker.md#foundMatches-property) | {
orderA: string;
orderB: string;
}[] | The type of stores all the found matches |
+| [iTiers](./vmsimulation.md#iTiers-property) | [sITiers](../interfaces/sitiers.md) | A property of type itiers that act like a storage for simulation of Rain tier contracts. this is needed for ITIERV2\_REPORT and ITIERV2\_REPORT\_TIME\_FOR\_TIER opcodes.
*Inherited from [vmSimulation.iTiers](./vmsimulation.md#iTiers-property)* |
+| [OpFns](./orderbooksimulation.md#OpFns-property) | [FnPtrsJSVM](../interfaces/fnptrsjsvm.md) | Local Orderbook Opcodes' functions body for simulation that uses the class properties/types.
*Inherited from [OrderbookSimulation.OpFns](./orderbooksimulation.md#OpFns-property)* |
+| [orders](./orderbooksimulation.md#orders-property) | [sOrders](../interfaces/sorders.md) | The property that stores all the data of the class's orders,
*Inherited from [OrderbookSimulation.orders](./orderbooksimulation.md#orders-property)* |
+| [reservebook](./matchmaker.md#reservebook-property) | [ReserveBook](../interfaces/reservebook.md) | The ReserveBook property of the matchmaker |
+| [script](./vmsimulation.md#script-property) | [StateConfig](../interfaces/stateconfig.md) | The script to simulate
*Inherited from [vmSimulation.script](./vmsimulation.md#script-property)* |
+| [sender](./orderbooksimulation.md#sender-property) | `string` | A sender that performs the simulation transactions. this is needed for SENDER opcode simulation, and updating storage types after method calls and needs to be a string number or hex string.
*Inherited from [OrderbookSimulation.sender](./orderbooksimulation.md#sender-property)* |
+| [timestamp](./vmsimulation.md#timestamp-property) | `number` | A property for producing timestamp for the class which will be used in BLOCK\_TIMESTAMP opcode but BLOCK\_TIMESTAMP opcode can also be passed at runtime
*Inherited from [vmSimulation.timestamp](./vmsimulation.md#timestamp-property)* |
+| [vaults](./orderbooksimulation.md#vaults-property) | [sVaults](../interfaces/svaults.md) | The property that stores all the data of the class's vaults
*Inherited from [OrderbookSimulation.vaults](./orderbooksimulation.md#vaults-property)* |
+
+## Methods
+
+| Method | Description |
+| --- | --- |
+| [addAssets(erc20s, erc721s, erc1155s)](./vmsimulation.md#addAssets-method-1) | Method to add assets i.e erc20/721/1155 types objects
*Inherited from [vmSimulation.addAssets()](./vmsimulation.md#addAssets-method-1)* |
+| [addITiers(iTiers)](./vmsimulation.md#addITiers-method-1) | Method to add tier contract types objects to the class (iTiers)
*Inherited from [vmSimulation.addITiers()](./vmsimulation.md#addITiers-method-1)* |
+| [addOrder(order)](./matchmaker.md#addOrder-method-1) | Method that inherits from the parent class addOrder and after perfroming that will execute orderEval method
*Overrides [OrderbookSimulation.addOrder()](./orderbooksimulation.md#addOrder-method-1)* |
+| [clear(a, b, clearConfig, timestamp, blockNumber)](./orderbooksimulation.md#clear-method-1) | Method to perform the clear by JSVM for this simulation which will update all the present storage/types of the the class
*Inherited from [OrderbookSimulation.clear()](./orderbooksimulation.md#clear-method-1)* |
+| [deposit(sender, tokenAddress, vaultId, units, tokenDecimals)](./orderbooksimulation.md#deposit-method-1) | Method to dposit some units of token of tokenAddress into the vaultId of the sender
*Inherited from [OrderbookSimulation.deposit()](./orderbooksimulation.md#deposit-method-1)* |
+| [makeMatch(bounty)](./matchmaker.md#makeMatch-method-1) | The main method to perform matchmaking and find matches among orders |
+| [orderEval(order, timestamp, blockNumber)](./matchmaker.md#orderEval-method-1) | Method to evaluate and ReserveBook the order's script |
+| [removeOrder(order)](./orderbooksimulation.md#removeOrder-method-1) | Method to remove an order from the class's orders
*Inherited from [OrderbookSimulation.removeOrder()](./orderbooksimulation.md#removeOrder-method-1)* |
+| [runScript(data, index)](./vmsimulation.md#runScript-method-1) | Method to run the script using JSVM
*Inherited from [vmSimulation.runScript()](./vmsimulation.md#runScript-method-1)* |
+| [setContractAddress(contractAddress)](./vmsimulation.md#setContractAddress-method-1) | Method to set the class address property
*Inherited from [vmSimulation.setContractAddress()](./vmsimulation.md#setContractAddress-method-1)* |
+| [setScript(script)](./vmsimulation.md#setScript-method-1) | Method to set the class script
*Inherited from [vmSimulation.setScript()](./vmsimulation.md#setScript-method-1)* |
+| [setSender(senderAddress)](./vmsimulation.md#setSender-method-1) | Method to set the class sender property
*Inherited from [vmSimulation.setSender()](./vmsimulation.md#setSender-method-1)* |
+| [withdraw(sender, tokenAddress, vaultId, units, tokenDecimals)](./orderbooksimulation.md#withdraw-method-1) | Method to withdraw some units of token of tokenAddress from VaultId of the sender
*Inherited from [OrderbookSimulation.withdraw()](./orderbooksimulation.md#withdraw-method-1)* |
+
+## Property Details
+
+
+
+### foundMatches
+
+The type of stores all the found matches
+
+Signature:
+
+```typescript
+foundMatches: {
+ orderA: string;
+ orderB: string;
+ }[];
+```
+
+
+
+### reservebook
+
+The ReserveBook property of the matchmaker
+
+Signature:
+
+```typescript
+reservebook: ReserveBook;
+```
+
+## Method Details
+
+
+
+### addOrder(order)
+
+Method that inherits from the parent class addOrder and after perfroming that will execute orderEval method
+
+*Overrides [OrderbookSimulation.addOrder()](./orderbooksimulation.md#addOrder-method-1)*
+
+Signature:
+
+```typescript
+addOrder(order: sOrder): Promise;
+```
+
+#### Parameters
+
+| Parameter | Type | Description |
+| --- | --- | --- |
+| order | [sOrder](../interfaces/sorder.md) | the order to be added |
+
+Returns:
+
+`Promise`
+
+void
+
+
+
+### makeMatch(bounty)
+
+The main method to perform matchmaking and find matches among orders
+
+Signature:
+
+```typescript
+makeMatch(bounty: {
+ aBounty: string;
+ bBounty: string;
+ }): Promise<{
+ orderA: string;
+ orderB: string;
+ }[]>;
+```
+
+#### Parameters
+
+| Parameter | Type | Description |
+| --- | --- | --- |
+| bounty | {
aBounty: string;
bBounty: string;
} | the Bounty Vault IDs |
+
+Returns:
+
+`Promise<{
+ orderA: string;
+ orderB: string;
+ }[]>`
+
+
+
+### orderEval(order, timestamp, blockNumber)
+
+Method to evaluate and ReserveBook the order's script
+
+Signature:
+
+```typescript
+orderEval(order: sOrder, timestamp?: number, blockNumber?: number): Promise;
+```
+
+#### Parameters
+
+| Parameter | Type | Description |
+| --- | --- | --- |
+| order | [sOrder](../interfaces/sorder.md) | the order to be evaluated |
+| timestamp | `number` | |
+| blockNumber | `number` | |
+
+Returns:
+
+`Promise`
+
+void
+
diff --git a/docs/classes/noticeboard.md b/docs/classes/noticeboard.md
index f008c1e..2628273 100644
--- a/docs/classes/noticeboard.md
+++ b/docs/classes/noticeboard.md
@@ -47,7 +47,7 @@ const tx = await notice.createNotices([noticeArg]);
| Property | Type | Description |
| --- | --- | --- |
| [address](./raincontract.md#address-property) | `string` | The contract address of the instance.
*Inherited from [RainContract.address](./raincontract.md#address-property)* |
-| [connect](./noticeboard.md#connect-property) | `(signer: Signer) => NoticeBoard` | Connect the current contract instance to a new ethers signer.
*Overrides [RainContract.connect](./raincontract.md#connect-property)* |
+| [connect](./noticeboard.md#connect-property) | `(signer: Signer) => NoticeBoard` | Conncect to this Noticeboard contract with another signer
*Overrides [RainContract.connect](./raincontract.md#connect-property)* |
| [createNotices](./noticeboard.md#createNotices-property) | `(notices: NoticeStruct[], overrides?: TxOverrides) => Promise` | Anyone can create notices about some subject. The notice is opaque bytes. The indexer/GUI is expected to understand the context to decode/interpret it. The indexer/GUI is strongly recommended to filter out untrusted content. |
| [signer](./raincontract.md#signer-property) | `Signer` | The ethers signer that is connected to the instance.
*Inherited from [RainContract.signer](./raincontract.md#signer-property)* |
@@ -101,7 +101,7 @@ protected static readonly nameBookReference: string;
### connect
-Connect the current contract instance to a new ethers signer.
+Conncect to this Noticeboard contract with another signer
*Overrides [RainContract.connect](./raincontract.md#connect-property)*
diff --git a/docs/classes/orderbook.md b/docs/classes/orderbook.md
new file mode 100644
index 0000000..d047bfa
--- /dev/null
+++ b/docs/classes/orderbook.md
@@ -0,0 +1,219 @@
+
+# Class OrderBook
+
+A class for calling method on a Rain OrderBook contract.
+
+This class provides an easy way to interact with the OrderBook contract.
+
+Signature:
+
+```typescript
+class OrderBook extends RainContract
+```
+
+## Example
+
+
+```typescript
+import { OrderBook } from 'rain-sdk'
+
+const orderBook = await Orderbook.get(signer);
+or
+const orderBook = new OrderBook(address, signer);
+
+const addOrderArg = {
+ inputToken: token1Address;
+ inputVaultId: vaultID_1;
+ outputToken: token2Address;
+ outputVaultId: vaultID_2;
+ tracking: tracking;
+ vmStateConfig: _stateConfig;
+}
+
+const tx = await orderBook.addOrder(addOrderArg);
+
+```
+
+## Static Properties
+
+| Property | Type | Description |
+| --- | --- | --- |
+| [get](./orderbook.md#get-property-static) | `(signer: Signer) => Promise` | Get the OrderBook instance
The function ask to the provider inside of the ethers signer what is the chain identifier to get the address of the Orderbook Contract in this chain and connect to it. |
+| [getAddressesForChainId](./addressbook.md#getAddressesForChainId-property-static) | `(chainId: number) => Addresses` | Obtain all the addresses deployed in a specific network with a chain ID.
*Inherited from [AddressBook.getAddressesForChainId](./addressbook.md#getAddressesForChainId-property-static)* |
+| [getChainId](./raincontract.md#getChainId-property-static) | `(signerOrProvider: Signer \| Provider) => Promise` | Get the chain ID from a valid ethers provider.
Request to the provider stored in the signer which is the chain ID.
*Inherited from [RainContract.getChainId](./raincontract.md#getChainId-property-static)* |
+| [getSubgraphEndpoint](./addressbook.md#getSubgraphEndpoint-property-static) | `(chainId: number) => string` | Obtain the latest subgraph endpoint related to the version that use the SDK.
*Inherited from [AddressBook.getSubgraphEndpoint](./addressbook.md#getSubgraphEndpoint-property-static)* |
+| [nameBookReference](./orderbook.md#nameBookReference-property-static) | `string` | Name reference to find the address of the contract in the book address.
*Overrides [RainContract.nameBookReference](./raincontract.md#nameBookReference-property-static)* |
+| [Opcodes](./orderbook.md#Opcodes-property-static) | [OrderBookOpcodes](../types/orderbookopcodes.md) | All the opcodes avaialbles in the OrderBook contract. |
+
+## Properties
+
+| Property | Type | Description |
+| --- | --- | --- |
+| [addOrder](./orderbook.md#addOrder-property) | `(orderConfig_: OrderConfig, overrides?: TxOverrides) => Promise` | Adds an order config for signer (as the owner) into the Orderbook |
+| [address](./raincontract.md#address-property) | `string` | The contract address of the instance.
*Inherited from [RainContract.address](./raincontract.md#address-property)* |
+| [clear](./orderbook.md#clear-property) | `(a_: Order, b_: Order, clearConfig_: ClearConfig, overrides?: TxOverrides) => Promise` | Clears 2 matching order against each other, a\_ inputToken must match to b\_ outputToken and a\_ outputToken must match to b\_ inputToken. Order a\_ clears into Order b\_ and vice versa. The difference of the clearing amounts will go into the bounty's vaults and if any of them are negative then the transaction will revert |
+| [connect](./orderbook.md#connect-property) | `(signer: Signer) => OrderBook` | Connect to this Orderbook instance with a new signer
*Overrides [RainContract.connect](./raincontract.md#connect-property)* |
+| [deposit](./orderbook.md#deposit-property) | `(config_: DepositConfig, overrides?: TxOverrides) => Promise` | Allows the sender to deposit any tokens into their own vaults. The deposit will be 'config\_.amount' of the 'config\_.token' into 'config\_.vaultId' |
+| [packedFunctionPointers](./orderbook.md#packedFunctionPointers-property) | `(overrides?: ReadTxOverrides) => Promise` | Pointers to opcode functions, necessary for being able to read the packedBytes |
+| [removeOrder](./orderbook.md#removeOrder-property) | `(order_: Order, overrides?: TxOverrides) => Promise` | Removes an order from the Orderbook completely. |
+| [signer](./raincontract.md#signer-property) | `Signer` | The ethers signer that is connected to the instance.
*Inherited from [RainContract.signer](./raincontract.md#signer-property)* |
+| [storageOpcodesRange](./orderbook.md#storageOpcodesRange-property) | `(overrides?: ReadTxOverrides) => Promise` | Returns the pointer and length for sale's storage opcodes |
+| [withdraw](./orderbook.md#withdraw-property) | `(config_: WithdrawConfig, overrides?: TxOverrides) => Promise` | Allows the sender to withdraw any tokens from their own vaults. Notably if the amount is less than the current vault balance then the vault will be cleared to 0 rather than the withdraw transaction reverting. The withdraw will be 'config\_.amount' of the 'config\_.token' from 'config\_.vaultId' |
+
+## Static Methods
+
+| Method | Description |
+| --- | --- |
+| [getBookAddress(chainId)](./raincontract.md#getBookAddress-method-static-1) | Get the address stored in the book for a determined chain if it is available.
*Inherited from [RainContract.getBookAddress()](./raincontract.md#getBookAddress-method-static-1)* |
+
+## Methods
+
+| Method | Description |
+| --- | --- |
+| [checkAddress(address, message)](./raincontract.md#checkAddress-method-1) | Check if an address is correctly formatted and throw an error if it is not an valid address
*Inherited from [RainContract.checkAddress()](./raincontract.md#checkAddress-method-1)* |
+
+## Static Property Details
+
+
+
+### get
+
+Get the OrderBook instance
+
+The function ask to the provider inside of the ethers signer what is the chain identifier to get the address of the Orderbook Contract in this chain and connect to it.
+
+Signature:
+
+```typescript
+static get: (signer: Signer) => Promise;
+```
+
+
+
+### nameBookReference
+
+Name reference to find the address of the contract in the book address.
+
+*Overrides [RainContract.nameBookReference](./raincontract.md#nameBookReference-property-static)*
+
+Should be implemented in each class to find the factory or main address in the book.
+
+Signature:
+
+```typescript
+protected static readonly nameBookReference: string;
+```
+
+
+
+### Opcodes
+
+All the opcodes avaialbles in the OrderBook contract.
+
+This expose all the standard opcodes along with the specific local OrderBook opcodes.
+
+Signature:
+
+```typescript
+static Opcodes: OrderBookOpcodes;
+```
+
+## Property Details
+
+
+
+### addOrder
+
+Adds an order config for signer (as the owner) into the Orderbook
+
+Signature:
+
+```typescript
+readonly addOrder: (orderConfig_: OrderConfig, overrides?: TxOverrides) => Promise;
+```
+
+
+
+### clear
+
+Clears 2 matching order against each other, a\_ inputToken must match to b\_ outputToken and a\_ outputToken must match to b\_ inputToken. Order a\_ clears into Order b\_ and vice versa. The difference of the clearing amounts will go into the bounty's vaults and if any of them are negative then the transaction will revert
+
+Signature:
+
+```typescript
+readonly clear: (a_: Order, b_: Order, clearConfig_: ClearConfig, overrides?: TxOverrides) => Promise;
+```
+
+
+
+### connect
+
+Connect to this Orderbook instance with a new signer
+
+*Overrides [RainContract.connect](./raincontract.md#connect-property)*
+
+Signature:
+
+```typescript
+readonly connect: (signer: Signer) => OrderBook;
+```
+
+
+
+### deposit
+
+Allows the sender to deposit any tokens into their own vaults. The deposit will be 'config\_.amount' of the 'config\_.token' into 'config\_.vaultId'
+
+Signature:
+
+```typescript
+readonly deposit: (config_: DepositConfig, overrides?: TxOverrides) => Promise;
+```
+
+
+
+### packedFunctionPointers
+
+Pointers to opcode functions, necessary for being able to read the packedBytes
+
+Signature:
+
+```typescript
+readonly packedFunctionPointers: (overrides?: ReadTxOverrides) => Promise;
+```
+
+
+
+### removeOrder
+
+Removes an order from the Orderbook completely.
+
+Signature:
+
+```typescript
+readonly removeOrder: (order_: Order, overrides?: TxOverrides) => Promise;
+```
+
+
+
+### storageOpcodesRange
+
+Returns the pointer and length for sale's storage opcodes
+
+Signature:
+
+```typescript
+readonly storageOpcodesRange: (overrides?: ReadTxOverrides) => Promise;
+```
+
+
+
+### withdraw
+
+Allows the sender to withdraw any tokens from their own vaults. Notably if the amount is less than the current vault balance then the vault will be cleared to 0 rather than the withdraw transaction reverting. The withdraw will be 'config\_.amount' of the 'config\_.token' from 'config\_.vaultId'
+
+Signature:
+
+```typescript
+readonly withdraw: (config_: WithdrawConfig, overrides?: TxOverrides) => Promise;
+```
diff --git a/docs/classes/orderbooksimulation.md b/docs/classes/orderbooksimulation.md
new file mode 100644
index 0000000..e8865df
--- /dev/null
+++ b/docs/classes/orderbooksimulation.md
@@ -0,0 +1,272 @@
+
+# Class OrderbookSimulation
+
+A class for creating a simulation environment for simulating a Orderbook contract off-chain using JSVM. or to be used to perform off-chain matchmaking based on.
+
+Signature:
+
+```typescript
+class OrderbookSimulation extends vmSimulation
+```
+
+## Properties
+
+| Property | Type | Description |
+| --- | --- | --- |
+| [address](./orderbooksimulation.md#address-property) | `string` | The EmissionsERC20 address of this class that the simulation is done for. this is needed for THIS\_ADDRESS opcode and updating storage types after method calls, and needs to be a string number or hex string.
*Overrides [vmSimulation.address](./vmsimulation.md#address-property)* |
+| [blockNumber](./vmsimulation.md#blockNumber-property) | `number` | A property for producing block number for the class which will be used in BLOCK\_NUMBER opcode but BLOCK\_NUMBER opcode can also be passed at runtime
*Inherited from [vmSimulation.blockNumber](./vmsimulation.md#blockNumber-property)* |
+| [clearedCounterPartyFunds](./orderbooksimulation.md#clearedCounterPartyFunds-property) | [sClearedCounterPartyFunds](../interfaces/sclearedcounterpartyfunds.md) | The property that stores all the data of an order's total cleared amount to a specific counterparty address which needs to be in form of a string number or hex string |
+| [clearedFunds](./orderbooksimulation.md#clearedFunds-property) | [sClearedFunds](../interfaces/sclearedfunds.md) | The property that stores all the data of an order's total cleared amount, |
+| [erc1155s](./vmsimulation.md#erc1155s-property) | [sERC1155s](../interfaces/serc1155s.md) | A property of type erc1155s that act like a storage for simulation and stores the erc1155 token data. this is needed for IERC1155 related opcodes
*Inherited from [vmSimulation.erc1155s](./vmsimulation.md#erc1155s-property)* |
+| [erc20s](./vmsimulation.md#erc20s-property) | [sERC20s](../interfaces/serc20s.md) | A property of type erc20s that act like a storage for simulation and stores the erc20 token data. this is needed for IERC20 related opcodes
*Inherited from [vmSimulation.erc20s](./vmsimulation.md#erc20s-property)* |
+| [erc721s](./vmsimulation.md#erc721s-property) | [sERC721s](../interfaces/serc721s.md) | A property of type erc721s that act like a storage for simulation and stores the erc721 token data. this is needed for IERC721 related opcodes
*Inherited from [vmSimulation.erc721s](./vmsimulation.md#erc721s-property)* |
+| [iTiers](./vmsimulation.md#iTiers-property) | [sITiers](../interfaces/sitiers.md) | A property of type itiers that act like a storage for simulation of Rain tier contracts. this is needed for ITIERV2\_REPORT and ITIERV2\_REPORT\_TIME\_FOR\_TIER opcodes.
*Inherited from [vmSimulation.iTiers](./vmsimulation.md#iTiers-property)* |
+| [OpFns](./orderbooksimulation.md#OpFns-property) | [FnPtrsJSVM](../interfaces/fnptrsjsvm.md) | Local Orderbook Opcodes' functions body for simulation that uses the class properties/types.
*Overrides [vmSimulation.OpFns](./vmsimulation.md#OpFns-property)* |
+| [orders](./orderbooksimulation.md#orders-property) | [sOrders](../interfaces/sorders.md) | The property that stores all the data of the class's orders, |
+| [script](./vmsimulation.md#script-property) | [StateConfig](../interfaces/stateconfig.md) | The script to simulate
*Inherited from [vmSimulation.script](./vmsimulation.md#script-property)* |
+| [sender](./orderbooksimulation.md#sender-property) | `string` | A sender that performs the simulation transactions. this is needed for SENDER opcode simulation, and updating storage types after method calls and needs to be a string number or hex string.
*Overrides [vmSimulation.sender](./vmsimulation.md#sender-property)* |
+| [timestamp](./vmsimulation.md#timestamp-property) | `number` | A property for producing timestamp for the class which will be used in BLOCK\_TIMESTAMP opcode but BLOCK\_TIMESTAMP opcode can also be passed at runtime
*Inherited from [vmSimulation.timestamp](./vmsimulation.md#timestamp-property)* |
+| [vaults](./orderbooksimulation.md#vaults-property) | [sVaults](../interfaces/svaults.md) | The property that stores all the data of the class's vaults |
+
+## Methods
+
+| Method | Description |
+| --- | --- |
+| [addAssets(erc20s, erc721s, erc1155s)](./vmsimulation.md#addAssets-method-1) | Method to add assets i.e erc20/721/1155 types objects
*Inherited from [vmSimulation.addAssets()](./vmsimulation.md#addAssets-method-1)* |
+| [addITiers(iTiers)](./vmsimulation.md#addITiers-method-1) | Method to add tier contract types objects to the class (iTiers)
*Inherited from [vmSimulation.addITiers()](./vmsimulation.md#addITiers-method-1)* |
+| [addOrder(order)](./orderbooksimulation.md#addOrder-method-1) | Method to submit an order into the class orders |
+| [clear(a, b, clearConfig, timestamp, blockNumber)](./orderbooksimulation.md#clear-method-1) | Method to perform the clear by JSVM for this simulation which will update all the present storage/types of the the class |
+| [deposit(sender, tokenAddress, vaultId, units, tokenDecimals)](./orderbooksimulation.md#deposit-method-1) | Method to dposit some units of token of tokenAddress into the vaultId of the sender |
+| [removeOrder(order)](./orderbooksimulation.md#removeOrder-method-1) | Method to remove an order from the class's orders |
+| [runScript(data, index)](./vmsimulation.md#runScript-method-1) | Method to run the script using JSVM
*Inherited from [vmSimulation.runScript()](./vmsimulation.md#runScript-method-1)* |
+| [setContractAddress(contractAddress)](./vmsimulation.md#setContractAddress-method-1) | Method to set the class address property
*Inherited from [vmSimulation.setContractAddress()](./vmsimulation.md#setContractAddress-method-1)* |
+| [setScript(script)](./vmsimulation.md#setScript-method-1) | Method to set the class script
*Inherited from [vmSimulation.setScript()](./vmsimulation.md#setScript-method-1)* |
+| [setSender(senderAddress)](./vmsimulation.md#setSender-method-1) | Method to set the class sender property
*Inherited from [vmSimulation.setSender()](./vmsimulation.md#setSender-method-1)* |
+| [withdraw(sender, tokenAddress, vaultId, units, tokenDecimals)](./orderbooksimulation.md#withdraw-method-1) | Method to withdraw some units of token of tokenAddress from VaultId of the sender |
+
+## Property Details
+
+
+
+### address
+
+The EmissionsERC20 address of this class that the simulation is done for. this is needed for THIS\_ADDRESS opcode and updating storage types after method calls, and needs to be a string number or hex string.
+
+*Overrides [vmSimulation.address](./vmsimulation.md#address-property)*
+
+Signature:
+
+```typescript
+address: string;
+```
+
+
+
+### clearedCounterPartyFunds
+
+The property that stores all the data of an order's total cleared amount to a specific counterparty address which needs to be in form of a string number or hex string
+
+Signature:
+
+```typescript
+clearedCounterPartyFunds: sClearedCounterPartyFunds;
+```
+
+
+
+### clearedFunds
+
+The property that stores all the data of an order's total cleared amount,
+
+Signature:
+
+```typescript
+clearedFunds: sClearedFunds;
+```
+
+
+
+### OpFns
+
+Local Orderbook Opcodes' functions body for simulation that uses the class properties/types.
+
+*Overrides [vmSimulation.OpFns](./vmsimulation.md#OpFns-property)*
+
+Signature:
+
+```typescript
+protected OpFns: FnPtrsJSVM;
+```
+
+
+
+### orders
+
+The property that stores all the data of the class's orders,
+
+Signature:
+
+```typescript
+orders: sOrders;
+```
+
+
+
+### sender
+
+A sender that performs the simulation transactions. this is needed for SENDER opcode simulation, and updating storage types after method calls and needs to be a string number or hex string.
+
+*Overrides [vmSimulation.sender](./vmsimulation.md#sender-property)*
+
+Signature:
+
+```typescript
+sender: string;
+```
+
+
+
+### vaults
+
+The property that stores all the data of the class's vaults
+
+Signature:
+
+```typescript
+vaults: sVaults;
+```
+
+## Method Details
+
+
+
+### addOrder(order)
+
+Method to submit an order into the class orders
+
+Signature:
+
+```typescript
+addOrder(order: sOrder): void;
+```
+
+#### Parameters
+
+| Parameter | Type | Description |
+| --- | --- | --- |
+| order | [sOrder](../interfaces/sorder.md) | the order to add |
+
+Returns:
+
+`void`
+
+void
+
+
+
+### clear(a, b, clearConfig, timestamp, blockNumber)
+
+Method to perform the clear by JSVM for this simulation which will update all the present storage/types of the the class
+
+Signature:
+
+```typescript
+clear(a: sOrder, b: sOrder, clearConfig: sClearConfig, timestamp?: number, blockNumber?: number): Promise;
+```
+
+#### Parameters
+
+| Parameter | Type | Description |
+| --- | --- | --- |
+| a | [sOrder](../interfaces/sorder.md) | order A to clear |
+| b | [sOrder](../interfaces/sorder.md) | order B to clear |
+| clearConfig | [sClearConfig](../interfaces/sclearconfig.md) | the BountyConfig type to collect bounties of this clear |
+| timestamp | `number` | (optional) custom timestamp to be used when running the script |
+| blockNumber | `number` | (optional) custom block number to be used when running the script |
+
+Returns:
+
+`Promise`
+
+void
+
+
+
+### deposit(sender, tokenAddress, vaultId, units, tokenDecimals)
+
+Method to dposit some units of token of tokenAddress into the vaultId of the sender
+
+Signature:
+
+```typescript
+deposit(sender: string, tokenAddress: string, vaultId: string, units: number, tokenDecimals?: number): void;
+```
+
+#### Parameters
+
+| Parameter | Type | Description |
+| --- | --- | --- |
+| sender | `string` | sender that deposit is done for |
+| tokenAddress | `string` | the address of the token |
+| vaultId | `string` | the vault ID to deposit |
+| units | `number` | amount of token to deposit |
+| tokenDecimals | `number` | (optional) decimals of the token, 18 will be used as default |
+
+Returns:
+
+`void`
+
+void
+
+
+
+### removeOrder(order)
+
+Method to remove an order from the class's orders
+
+Signature:
+
+```typescript
+removeOrder(order: sOrder | string): void;
+```
+
+#### Parameters
+
+| Parameter | Type | Description |
+| --- | --- | --- |
+| order | `sOrder \| string` | the order to remove |
+
+Returns:
+
+`void`
+
+void
+
+
+
+### withdraw(sender, tokenAddress, vaultId, units, tokenDecimals)
+
+Method to withdraw some units of token of tokenAddress from VaultId of the sender
+
+Signature:
+
+```typescript
+withdraw(sender: string, tokenAddress: string, vaultId: string, units: number, tokenDecimals?: number): void;
+```
+
+#### Parameters
+
+| Parameter | Type | Description |
+| --- | --- | --- |
+| sender | `string` | sender that withdraw is done for |
+| tokenAddress | `string` | the address of the token |
+| vaultId | `string` | the vault ID to withdraw |
+| units | `number` | amount of token to withdraw |
+| tokenDecimals | `number` | |
+
+Returns:
+
+`void`
+
+void
+
diff --git a/docs/classes/parser.md b/docs/classes/parser.md
new file mode 100644
index 0000000..5e31cee
--- /dev/null
+++ b/docs/classes/parser.md
@@ -0,0 +1,285 @@
+
+# Class Parser
+
+Parser is a mini compiler to generate a valid StateConfig (deployable bytes) from a text script
+
+Signature:
+
+```typescript
+class Parser
+```
+
+## Example
+
+
+```typescript
+// to import
+import { Parser } from "rain-sdk";
+
+// to set the custom opmeta
+Parser.set(OpMeta)
+
+// to set the custom details of GTE and LTE opcodes
+Parser.setGteMeta(description?, data?, description?)
+Parser.setLteMeta(description?, data?, description?)
+
+// to execute the parsing and get parse tree object and StateConfig
+let parseTree;
+let stateConfig
+[ parseTree, stateConfig ] = Parser.get(textScript, customOpMeta, customMultiOutputPlaceholderChar);
+
+// to get parse tree object only
+let parseTree = Parser.getParseTree(textScript, customOpMeta, customMultiOutputPlaceholderChar);
+
+// to get StateConfig only
+let stateConfig = Parser.getStateConfig(textScript, customOpMeta, customMultiOutputPlaceholderChar);
+
+// to build StateConfig (bytes) from ParseTree object or a Node or array of Node
+let argument: Node || Node[] || ParseTree
+let stateConfig = Parser.buildBytes(argument)
+
+```
+
+## Static Properties
+
+| Property | Type | Description |
+| --- | --- | --- |
+| [constants](./parser.md#constants-property-static) | `BigNumberish[]` | |
+| [parseTree](./parser.md#parseTree-property-static) | [ParseTree](../types/parsetree.md) | |
+| [resolveMultiOutput](./parser.md#resolveMultiOutput-property-static) | `(totalCount: number, depthLevel: number) => void` | Method to resolve multi output nodes at current state of parsing |
+| [sources](./parser.md#sources-property-static) | `BytesLike[]` | |
+
+## Static Methods
+
+| Method | Description |
+| --- | --- |
+| [buildBytes(parseTree, offset)](./parser.md#buildBytes-method-static-1) | Method to get StateConfig (bytes) from a Parse Tree object or a Node or array of Nodes |
+| [get(expression, opmeta, multiOutputPlaceholderChar)](./parser.md#get-method-static-1) | Method to get parse tree object and StateConfig |
+| [getParseTree(expression, opmeta, multiOutputPlaceholderChar)](./parser.md#getParseTree-method-static-1) | Method to get the parse tree object |
+| [getStateConfig(expression, opmeta, multiOutputPlaceholderChar)](./parser.md#getStateConfig-method-static-1) | Method to get the StateConfig |
+| [setGteMeta(description, data, aliases)](./parser.md#setGteMeta-method-static-1) | Method to set the details of the GTE opcode |
+| [setLteMeta(description, data, aliases)](./parser.md#setLteMeta-method-static-1) | Method to set the details of the LTE opcode |
+| [updateArgs(config)](./parser.md#updateArgs-method-static-1) | Method to update the arguments of zipmaps after full bytes build (if any present) |
+
+## Static Property Details
+
+
+
+### constants
+
+Signature:
+
+```typescript
+static constants: BigNumberish[];
+```
+
+
+
+### parseTree
+
+Signature:
+
+```typescript
+static parseTree: ParseTree;
+```
+
+
+
+### resolveMultiOutput
+
+Method to resolve multi output nodes at current state of parsing
+
+Signature:
+
+```typescript
+static resolveMultiOutput: (totalCount: number, depthLevel: number) => void;
+```
+
+
+
+### sources
+
+Signature:
+
+```typescript
+static sources: BytesLike[];
+```
+
+## Static Method Details
+
+
+
+### buildBytes(parseTree, offset)
+
+Method to get StateConfig (bytes) from a Parse Tree object or a Node or array of Nodes
+
+Signature:
+
+```typescript
+static buildBytes(parseTree: Node | Node[] | Record | Record, offset?: number): StateConfig;
+```
+
+#### Parameters
+
+| Parameter | Type | Description |
+| --- | --- | --- |
+| parseTree | Node \| Node[] \| Record \| Record
| Tree like object (Parse Tree object or a Node or array of Nodes) to get the StateConfig from |
+| offset | `number` | This argument is used internally and should be ignored when calling this method externally |
+
+Returns:
+
+`StateConfig`
+
+StateConfig
+
+
+
+### get(expression, opmeta, multiOutputPlaceholderChar)
+
+Method to get parse tree object and StateConfig
+
+Signature:
+
+```typescript
+static get(expression: string, opmeta?: typeof OpMeta, multiOutputPlaceholderChar?: string): [ParseTree, StateConfig];
+```
+
+#### Parameters
+
+| Parameter | Type | Description |
+| --- | --- | --- |
+| expression | `string` | the text expression |
+| opmeta | `typeof OpMeta` | (optional) custom opmeta |
+| multiOutputPlaceholderChar | `string` | (optional) custom multi output placeholder character, default is "\_" |
+
+Returns:
+
+`[ParseTree, StateConfig]`
+
+Array of parse tree object and StateConfig
+
+
+
+### getParseTree(expression, opmeta, multiOutputPlaceholderChar)
+
+Method to get the parse tree object
+
+Signature:
+
+```typescript
+static getParseTree(expression: string, opmeta?: typeof OpMeta, multiOutputPlaceholderChar?: string): ParseTree;
+```
+
+#### Parameters
+
+| Parameter | Type | Description |
+| --- | --- | --- |
+| expression | `string` | the text expression |
+| opmeta | `typeof OpMeta` | (optional) custom opmeta |
+| multiOutputPlaceholderChar | `string` | (optional) custom multi output placeholder character, default is "\_" |
+
+Returns:
+
+`ParseTree`
+
+A parse tree object
+
+
+
+### getStateConfig(expression, opmeta, multiOutputPlaceholderChar)
+
+Method to get the StateConfig
+
+Signature:
+
+```typescript
+static getStateConfig(expression: string, opmeta?: typeof OpMeta, multiOutputPlaceholderChar?: string): StateConfig;
+```
+
+#### Parameters
+
+| Parameter | Type | Description |
+| --- | --- | --- |
+| expression | `string` | the text expression |
+| opmeta | `typeof OpMeta` | (optional) custom opmeta |
+| multiOutputPlaceholderChar | `string` | (optional) custom multi output placeholder character, default is "\_" |
+
+Returns:
+
+`StateConfig`
+
+A StateConfig
+
+
+
+### setGteMeta(description, data, aliases)
+
+Method to set the details of the GTE opcode
+
+Signature:
+
+```typescript
+static setGteMeta(description?: string, data?: any, aliases?: string[]): void;
+```
+
+#### Parameters
+
+| Parameter | Type | Description |
+| --- | --- | --- |
+| description | `string` | The description |
+| data | `any` | Optional data |
+| aliases | `string[]` | The aliases of GTE opcode |
+
+Returns:
+
+`void`
+
+
+
+### setLteMeta(description, data, aliases)
+
+Method to set the details of the LTE opcode
+
+Signature:
+
+```typescript
+static setLteMeta(description?: string, data?: any, aliases?: string[]): void;
+```
+
+#### Parameters
+
+| Parameter | Type | Description |
+| --- | --- | --- |
+| description | `string` | The description |
+| data | `any` | Optional data |
+| aliases | `string[]` | The aliases of LTE opcode |
+
+Returns:
+
+`void`
+
+
+
+### updateArgs(config)
+
+Method to update the arguments of zipmaps after full bytes build (if any present)
+
+Signature:
+
+```typescript
+static updateArgs(config: StateConfig): StateConfig;
+```
+
+#### Parameters
+
+| Parameter | Type | Description |
+| --- | --- | --- |
+| config | [StateConfig](../interfaces/stateconfig.md) | |
+
+Returns:
+
+`StateConfig`
+
diff --git a/docs/classes/pricecurve.md b/docs/classes/pricecurve.md
index e07a7b3..228d488 100644
--- a/docs/classes/pricecurve.md
+++ b/docs/classes/pricecurve.md
@@ -3,7 +3,7 @@
- PriceCurve is an class that all the other sale types (sub-classes) will inherit from.
-- the order of calling the methods of this class is important, meaning in order to get the desired result for the sale, mthods should be called in correct order, although it is worth saying that even if the order is not followed, the result will still be reliable if that is been done by intention. For example if we call 'applyExtraTime' method after the the 'applyTierDiscount' method, the extra time discount will be applied to the result of 'applyTierDiscount' and if before that, it will be vice versa. The general order for calling these methods is: 1.applyExtraTimeDiscount 2.applyTierDiscount 3.applyWalletCap
+- the order of calling the methods of this class is important, meaning in order to get the desired result for the sale, mthods should be called in correct order, although it is worth saying that even if the order is not followed, the result will still be reliable if that is been done by intention. For example if we call 'applyExtraTime' method after the the 'applyTierDiscount' method, the extra time discount will be applied to the result of 'applyTierDiscount' and if before that, it will be vice versa. The general order for calling these methods is: 1.applyExtraTimeDiscount 2.applyTierDiscount
Signature:
@@ -15,31 +15,18 @@ class PriceCurve
| Property | Type | Description |
| --- | --- | --- |
-| [argumentsLength](./pricecurve.md#argumentsLength-property) | `BigNumberish` | |
| [constants](./pricecurve.md#constants-property) | `BigNumberish[]` | |
| [sources](./pricecurve.md#sources-property) | `BytesLike[]` | |
-| [stackLength](./pricecurve.md#stackLength-property) | `BigNumberish` | |
## Methods
| Method | Description |
| --- | --- |
| [applyExtraTimeDiscount(endTimestamp, extraTimeDiscountThreshold, extraTimeDiscount)](./pricecurve.md#applyExtraTimeDiscount-method-1) | Method to apply extra time discount to the sale. if sale's continues into extra time then those addresses that have met the critera of extra time discount which is already purchased a certain amount of rTKN will get some discount on price for their next purchase. |
-| [applyTierDiscount(tierAddress, tierDiscount, tierActivation)](./pricecurve.md#applyTierDiscount-method-1) | Method to apply tiers' discounts to the sale. Tiered addresses will get discount based on the tier they hold. |
-| [applyWalletCap(mode, options)](./pricecurve.md#applyWalletCap-method-1) | Method to apply cap per wallet to the sale. addresses can only buy that certain amount of rTKNs. With the option of applying multiplier for max cap per wallet. |
+| [applyTierDiscount(tierAddress, tierDiscount, options)](./pricecurve.md#applyTierDiscount-method-1) | Method to apply tiers' discounts to the sale. Tiered addresses will get discount based on the tier they hold. |
## Property Details
-
-
-### argumentsLength
-
-Signature:
-
-```typescript
-argumentsLength: BigNumberish;
-```
-
### constants
@@ -60,16 +47,6 @@ constants: BigNumberish[];
sources: BytesLike[];
```
-
-
-### stackLength
-
-Signature:
-
-```typescript
-stackLength: BigNumberish;
-```
-
## Method Details
@@ -83,7 +60,7 @@ Method to apply extra time discount to the sale. if sale's continues into extra
Signature:
```typescript
-applyExtraTimeDiscount(endTimestamp: number, extraTimeDiscountThreshold: number, extraTimeDiscount: number): this;
+applyExtraTimeDiscount(endTimestamp: number, extraTimeDiscountThreshold: number, extraTimeDiscount: number): PriceCurve;
```
#### Parameters
@@ -96,20 +73,23 @@ applyExtraTimeDiscount(endTimestamp: number, extraTimeDiscountThreshold: number,
Returns:
-`this`
+`PriceCurve`
-this
+PriceCurve
-### applyTierDiscount(tierAddress, tierDiscount, tierActivation)
+### applyTierDiscount(tierAddress, tierDiscount, options)
Method to apply tiers' discounts to the sale. Tiered addresses will get discount based on the tier they hold.
Signature:
```typescript
-applyTierDiscount(tierAddress: string, tierDiscount: number[], tierActivation?: (number | string)[]): this;
+applyTierDiscount(tierAddress: string, tierDiscount: number[], options?: {
+ tierActivation?: (number | string)[];
+ tierContext?: BigNumber[];
+ }): PriceCurve;
```
#### Parameters
@@ -118,43 +98,11 @@ applyTierDiscount(tierAddress: string, tierDiscount: number[], tierActivation?:
| --- | --- | --- |
| tierAddress | `string` | The Tier contract address. |
| tierDiscount | `number[]` | An array of each tiers' discount ranging between 0 - 99. |
-| tierActivation | `(number \| string)[]` | (optional) An array of number of blocks for each tier that will be the required period of time for that tiered address to hold the tier's in order to be eligible for that tier's discount. |
-
-Returns:
-
-`this`
-
-this
-
-
-
-### applyWalletCap(mode, options)
-
-Method to apply cap per wallet to the sale. addresses can only buy that certain amount of rTKNs. With the option of applying multiplier for max cap per wallet.
-
-Signature:
-
-```typescript
-applyWalletCap(mode: WalletCapMode, options?: {
- minWalletCap?: number;
- maxWalletCap?: number;
- tierMultiplierMode?: boolean;
- tierAddress?: string;
- tierMultiplier?: number[];
- tierActivation?: (number | string)[];
- }): this;
-```
-
-#### Parameters
-
-| Parameter | Type | Description |
-| --- | --- | --- |
-| mode | [WalletCapMode](../enums/walletcapmode.md) | The mode that determines if there is max or min cap per wallet or both. |
-| options | {
minWalletCap?: number;
maxWalletCap?: number;
tierMultiplierMode?: boolean;
tierAddress?: string;
tierMultiplier?: number[];
tierActivation?: (number \| string)[];
} | (optional) Additional arguments to configure the cap per wallet behaviour: - (param) minWalletCap - The number for min cap per wallet, addresses cannot buy less number of rTKNs than this amount. - (param) maxWalletCap - The number for max cap per wallet, addresses cannot buy more number of rTKNs than this amount. - (param) tierMultiplierMode - Set true in order to apply Multiplier for max cap per wallet. - (param) tierAddress - The Tier contract address for tiers' max cap per wallet multiplier. - (param) tierMultiplier - An array of each tiers' Multiplier value. - (param) tierActivation - An array of number of blocks for each tier that will be the required period of time for that tiered address to hold the tier's in order to be eligible for that tier's multiplier. |
+| options | {
tierActivation?: (number \| string)[];
tierContext?: BigNumber[];
} | (optional) used for stake tier contracts - (param) tierActivation - An array of number of timestamps for each tier that will be the required period of time for that tiered address to hold the tier's in order to be eligible for that tier's discount. - (param) tierContext - an array of 8 items represtenting stake contract thresholds |
Returns:
-`this`
+`PriceCurve`
-this
+PriceCurve
diff --git a/docs/classes/rainjs.md b/docs/classes/rainjs.md
deleted file mode 100644
index c56cf57..0000000
--- a/docs/classes/rainjs.md
+++ /dev/null
@@ -1,135 +0,0 @@
-
-# Class RainJS
-
-- The javascript version of the RainVM, basically does the same job RainVM does but off-chain.
-
-Signature:
-
-```typescript
-class RainJS
-```
-
-## Static Properties
-
-| Property | Type | Description |
-| --- | --- | --- |
-| [Opcodes](./rainjs.md#Opcodes-property-static) | `typeof import("../classes/vm").AllStandardOps` | All of RainVM standard opcodes, i.e. AllStandardOps |
-
-## Properties
-
-| Property | Type | Description |
-| --- | --- | --- |
-| [\_OPCODE\_](./rainjs.md#_OPCODE_-property) | [ApplyOpFn](../interfaces/applyopfn.md) | key/value pair of opcodes and their functions for all standard opcodes |
-| [contract](./rainjs.md#contract-property) | `Contract` | An ethers Contract |
-| [lastState](./rainjs.md#lastState-property) | `BigNumber[]` | The result state of the executed Rainjs. |
-| [provider](./rainjs.md#provider-property) | `Provider` | An ethers provider. |
-| [signer](./rainjs.md#signer-property) | `Signer` | An ethers Signer. |
-
-## Methods
-
-| Method | Description |
-| --- | --- |
-| [run(data)](./rainjs.md#run-method-1) | Method to execute the RainJS. |
-
-## Static Property Details
-
-
-
-### Opcodes
-
-All of RainVM standard opcodes, i.e. AllStandardOps
-
-Signature:
-
-```typescript
-static Opcodes: typeof import("../classes/vm").AllStandardOps;
-```
-
-## Property Details
-
-
-
-### \_OPCODE\_
-
-key/value pair of opcodes and their functions for all standard opcodes
-
-Signature:
-
-```typescript
-protected readonly _OPCODE_: ApplyOpFn;
-```
-
-
-
-### contract
-
-An ethers Contract
-
-Signature:
-
-```typescript
-contract?: Contract;
-```
-
-
-
-### lastState
-
-The result state of the executed Rainjs.
-
-Signature:
-
-```typescript
-readonly lastState: BigNumber[];
-```
-
-
-
-### provider
-
-An ethers provider.
-
-Signature:
-
-```typescript
-provider?: Provider;
-```
-
-
-
-### signer
-
-An ethers Signer.
-
-Signature:
-
-```typescript
-signer?: Signer;
-```
-
-## Method Details
-
-
-
-### run(data)
-
-Method to execute the RainJS.
-
-Signature:
-
-```typescript
-run(data?: any): Promise;
-```
-
-#### Parameters
-
-| Parameter | Type | Description |
-| --- | --- | --- |
-| data | `any` | (optional) Used as additional info for some local opcodes or custom opcode functions i.e. applyOpFn. |
-
-Returns:
-
-`Promise`
-
-- An array represting the final state of the RainJS stack.
-
diff --git a/docs/classes/rainjsvm.md b/docs/classes/rainjsvm.md
new file mode 100644
index 0000000..2015ae6
--- /dev/null
+++ b/docs/classes/rainjsvm.md
@@ -0,0 +1,269 @@
+
+# Class RainJSVM
+
+- The javascript version of the RainVM, basically does the same job RainVM does but off-chain.
+
+Signature:
+
+```typescript
+class RainJSVM
+```
+
+## Properties
+
+| Property | Type | Description |
+| --- | --- | --- |
+| [applyOpFn](./rainjsvm.md#applyOpFn-property) | [FnPtrsJSVM](../interfaces/fnptrsjsvm.md) | It is a property for overriding the opcodes. Need to be passed at the time of construction because the RainJSVM opcode functions should be immutable after an instance has be created. |
+| [constant](./rainjsvm.md#constant-property) | `(operand: number, data?: any) => void` | |
+| [context](./rainjsvm.md#context-property) | `(operand: number, data?: any) => void` | |
+| [ContextRange](./rainjsvm.md#ContextRange-property) | `number` | Length of the valid context argument accessible by eval |
+| [debug](./rainjsvm.md#debug-property) | `(operand: number, data?: any) => void` | |
+| [fnPtrs](./rainjsvm.md#fnPtrs-property) | [FnPtrsJSVM](../interfaces/fnptrsjsvm.md) | key/value pair of opcodes and their functions for all standard opcodes |
+| [lastState](./rainjsvm.md#lastState-property) | `BigNumber[]` | The result state of the executed Rainjs. |
+| [self](./rainjsvm.md#self-property) | `string` | The contract address of the instance of this class used for THIS\_ADDRESS opcode |
+| [signer](./rainjsvm.md#signer-property) | `Signer` | An ethers Signer. |
+| [stack](./rainjsvm.md#stack-property) | `(operand: number, data?: any) => void` | |
+| [storage](./rainjsvm.md#storage-property) | `(operand: number, data?: any) => Promise` | |
+| [StorageOps](./rainjsvm.md#StorageOps-property) | [FnPtrsJSVM](../interfaces/fnptrsjsvm.md) | Object that contains the STORAGE opcode functions (i.e. local opcodes) |
+| [StorageRange](./rainjsvm.md#StorageRange-property) | `number` | Range of available storage variables accessible by eval |
+| [zipmap](./rainjsvm.md#zipmap-property) | `(operand: number, data?: any) => Promise