@leofcoin/standards 0.2.2 → 0.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,11 +1,11 @@
1
- {
2
- "$schema": "https://unpkg.com/@changesets/config@3.0.0/schema.json",
3
- "changelog": "@changesets/cli/changelog",
4
- "commit": true,
5
- "fixed": [],
6
- "linked": [],
7
- "access": "public",
8
- "baseBranch": "main",
9
- "updateInternalDependencies": "patch",
10
- "ignore": []
11
- }
1
+ {
2
+ "$schema": "https://unpkg.com/@changesets/config@3.0.0/schema.json",
3
+ "changelog": "@changesets/cli/changelog",
4
+ "commit": true,
5
+ "fixed": [],
6
+ "linked": [],
7
+ "access": "public",
8
+ "baseBranch": "main",
9
+ "updateInternalDependencies": "patch",
10
+ "ignore": []
11
+ }
@@ -40,6 +40,7 @@ export default class TokenReceiver extends PublicVoting implements IPublicVoting
40
40
  * @returns {boolean} promise
41
41
  */
42
42
  _burnTokenToReceive(): Promise<boolean>;
43
+ _canPay(): Promise<any>;
43
44
  changeVoteType(type: TokenReceiverState['voteType']): Promise<void>;
44
45
  getTokensOut(amount: typeof BigNumber, receiver: address): void;
45
46
  changeTokenAmountToReceive(): void;
@@ -76,6 +76,10 @@ class TokenReceiver extends PublicVoting {
76
76
  async _burnTokenToReceive() {
77
77
  return msg.staticCall(this.#tokenToReceive, 'burn', [this.#tokenAmountToReceive]);
78
78
  }
79
+ async _canPay() {
80
+ const amount = await msg.call(this.#tokenToReceive, 'balance', []);
81
+ return amount.gte(this.tokenAmountToReceive);
82
+ }
79
83
  #changeTokenToReceive(address) {
80
84
  this.#tokenToReceive = address;
81
85
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leofcoin/standards",
3
- "version": "0.2.2",
3
+ "version": "0.2.3",
4
4
  "description": "Contract standards",
5
5
  "type": "module",
6
6
  "exports": {
@@ -98,6 +98,11 @@ export default class TokenReceiver extends PublicVoting implements IPublicVoting
98
98
  return msg.staticCall(this.#tokenToReceive, 'burn', [this.#tokenAmountToReceive])
99
99
  }
100
100
 
101
+ async _canPay() {
102
+ const amount = await msg.call(this.#tokenToReceive, 'balance', [])
103
+ return amount.gte(this.tokenAmountToReceive)
104
+ }
105
+
101
106
  #changeTokenToReceive(address: address) {
102
107
  this.#tokenToReceive = address
103
108
  }