@agoric/vats 0.15.2-dev-7ed74d7.0 → 0.15.2-dev-20db966.0

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agoric/vats",
3
- "version": "0.15.2-dev-7ed74d7.0+7ed74d7",
3
+ "version": "0.15.2-dev-20db966.0+20db966",
4
4
  "description": "Agoric's Vat library",
5
5
  "type": "module",
6
6
  "main": "./index.js",
@@ -22,19 +22,19 @@
22
22
  "author": "Agoric",
23
23
  "license": "Apache-2.0",
24
24
  "dependencies": {
25
- "@agoric/cosmic-proto": "0.4.1-dev-7ed74d7.0+7ed74d7",
26
- "@agoric/ertp": "0.16.3-dev-7ed74d7.0+7ed74d7",
27
- "@agoric/governance": "0.10.4-dev-7ed74d7.0+7ed74d7",
28
- "@agoric/internal": "0.3.3-dev-7ed74d7.0+7ed74d7",
29
- "@agoric/network": "0.1.1-dev-7ed74d7.0+7ed74d7",
30
- "@agoric/notifier": "0.6.3-dev-7ed74d7.0+7ed74d7",
31
- "@agoric/store": "0.9.3-dev-7ed74d7.0+7ed74d7",
32
- "@agoric/swingset-vat": "0.32.3-dev-7ed74d7.0+7ed74d7",
33
- "@agoric/time": "0.3.3-dev-7ed74d7.0+7ed74d7",
34
- "@agoric/vat-data": "0.5.3-dev-7ed74d7.0+7ed74d7",
35
- "@agoric/vow": "0.1.1-dev-7ed74d7.0+7ed74d7",
36
- "@agoric/zoe": "0.26.3-dev-7ed74d7.0+7ed74d7",
37
- "@agoric/zone": "0.2.3-dev-7ed74d7.0+7ed74d7",
25
+ "@agoric/cosmic-proto": "0.4.1-dev-20db966.0+20db966",
26
+ "@agoric/ertp": "0.16.3-dev-20db966.0+20db966",
27
+ "@agoric/governance": "0.10.4-dev-20db966.0+20db966",
28
+ "@agoric/internal": "0.3.3-dev-20db966.0+20db966",
29
+ "@agoric/network": "0.1.1-dev-20db966.0+20db966",
30
+ "@agoric/notifier": "0.6.3-dev-20db966.0+20db966",
31
+ "@agoric/store": "0.9.3-dev-20db966.0+20db966",
32
+ "@agoric/swingset-vat": "0.32.3-dev-20db966.0+20db966",
33
+ "@agoric/time": "0.3.3-dev-20db966.0+20db966",
34
+ "@agoric/vat-data": "0.5.3-dev-20db966.0+20db966",
35
+ "@agoric/vow": "0.1.1-dev-20db966.0+20db966",
36
+ "@agoric/zoe": "0.26.3-dev-20db966.0+20db966",
37
+ "@agoric/zone": "0.2.3-dev-20db966.0+20db966",
38
38
  "@endo/errors": "^1.2.10",
39
39
  "@endo/far": "^1.1.11",
40
40
  "@endo/import-bundle": "^1.4.0",
@@ -47,7 +47,7 @@
47
47
  "jessie.js": "^0.3.4"
48
48
  },
49
49
  "devDependencies": {
50
- "@agoric/swingset-liveslots": "0.10.3-dev-7ed74d7.0+7ed74d7",
50
+ "@agoric/swingset-liveslots": "0.10.3-dev-20db966.0+20db966",
51
51
  "@endo/bundle-source": "^4.0.0",
52
52
  "@endo/init": "^1.1.9",
53
53
  "ava": "^5.3.0",
@@ -79,5 +79,5 @@
79
79
  "typeCoverage": {
80
80
  "atLeast": 90.49
81
81
  },
82
- "gitHead": "7ed74d76185ae163c4df6254e8ff6b76cfac56ce"
82
+ "gitHead": "20db966fd47f925ec353be0a79efcc24278a7539"
83
83
  }
@@ -1 +1 @@
1
- {"version":3,"file":"fake-bridge.d.ts","sourceRoot":"","sources":["fake-bridge.js"],"names":[],"mappings":"AAkBA,6EAA6E;AAE7E,6BAA8B,QAAQ,CAAC;AAehC,yCAPI,OAAO,cAAc,EAAE,IAAI,6BAEnC;IAAwB,QAAQ;IACH,UAAU,kBAAtB,IAAI;CACrB,GAAU,oBAAoB,MAAM,CAAC,CA4FvC;AAOM,wCAJI,OAAO,cAAc,EAAE,IAAI,cAC3B,CAAC,GAAG,KAAA,KAAK,IAAI,GACX,oBAAoB,MAAM,CAAC,CAwCvC;AAED,yCAA0C,uBAAuB,CAAC;;;;;A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B,CAAC,GAAG,KAAA,KAAK,IAAI,GACX,oBAAoB,WAAW,CAAC,CAuC5C;uBA3Za;IAAE,CAAC,OAAO,EAAE,MAAM,GAAG;QAAE,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAA;CAAE;yCAPX,iBAAiB"}
@@ -79,15 +79,19 @@ export const makeFakeBankBridge = (
79
79
  Fail`invalid address ${address}`;
80
80
  balances[address] ||= {};
81
81
  balances[address][denom] ||= 0n;
82
+ const current = currentBalance({ address, denom });
82
83
 
83
84
  if (type === 'VBANK_GRAB') {
84
- balances[address][denom] = Nat(
85
- currentBalance({ address, denom }) - BigInt(amount),
86
- );
85
+ // Check if there are insufficient funds
86
+ if (current < BigInt(amount)) {
87
+ throw Error(
88
+ // Mimic Cosmos SDK v0.47 behavior: if denom's current balance is 0, then render as empty string.
89
+ `cannot grab ${amount}${denom} coins: spendable balance ${current === 0n ? '' : current + denom} is smaller than ${amount}${denom}: insufficient funds`,
90
+ );
91
+ }
92
+ balances[address][denom] = Nat(current - BigInt(amount));
87
93
  } else {
88
- balances[address][denom] = Nat(
89
- currentBalance({ address, denom }) + BigInt(amount),
90
- );
94
+ balances[address][denom] = Nat(current + BigInt(amount));
91
95
  }
92
96
 
93
97
  lastNonce += 1n;