@argonprotocol/testing 1.4.10 → 1.4.11

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.
@@ -512,7 +512,7 @@ services:
512
512
  - ARGON_TOKEN_ADDRESS=${ARGON_TOKEN_ADDRESS:-3e622317f8C93f7328350cF0B56d9eD4C620C5d6}
513
513
  - ARGONOT_TOKEN_ADDRESS=${ARGONOT_TOKEN_ADDRESS:-3e622317f8C93f7328350cF0B56d9eD4C620C5d6}
514
514
  - BLS_API_KEY=${BLS_API_KEY}
515
- - INFURA_PROJECT_ID=${INFURA_PROJECT_ID}
515
+ - ETHEREUM_RPC_URLS=${ETHEREUM_RPC_URLS}
516
516
  - ORACLE_CPI_CACHE_PATH=/tmp/oracle/data/US_CPI_State.json
517
517
  profiles:
518
518
  - price-oracle-live
package/lib/index.cjs CHANGED
@@ -1356,10 +1356,14 @@ async function delay2(ms) {
1356
1356
  var import_mainchain6 = require("@argonprotocol/mainchain");
1357
1357
  var import_viem3 = require("viem");
1358
1358
  var {
1359
+ encodeMintingGatewayGlobalIssuanceCouncilRotateTarget,
1359
1360
  encodeMintingGatewayMintingAuthorityActivationTarget,
1360
1361
  encodeMintingGatewayMintingAuthorityDeactivateTarget,
1361
1362
  hashMintingGatewayActivateMintingAuthority,
1362
1363
  hashMintingGatewayGatewayUpdateApproval,
1364
+ hashMintingGatewayGlobalIssuanceCouncil: hashMintingGatewayGlobalIssuanceCouncil2,
1365
+ hashMintingGatewayRotateGlobalIssuanceCouncil,
1366
+ hashMintingGatewayRotateGlobalIssuanceCouncilApproval,
1363
1367
  mintingGatewayAbi,
1364
1368
  MINTING_GATEWAY_UPDATE_KINDS
1365
1369
  } = import_mainchain6.EvmContracts;
@@ -1437,7 +1441,8 @@ async function getReadyEthereumGatewayUpdates(client, gatewayClient, options = {
1437
1441
  }
1438
1442
  const update = await buildGatewayUpdate(client, destinationChain, hashContext, queueNonce, {
1439
1443
  entry,
1440
- approvingCouncilHash
1444
+ approvingCouncilHash,
1445
+ councilCache
1441
1446
  });
1442
1447
  candidateUpdates.push(update);
1443
1448
  expectedPreviousApprovalHash = toHexValue(entry.approvalHash);
@@ -1468,7 +1473,42 @@ async function getReadyEthereumGatewayUpdates(client, gatewayClient, options = {
1468
1473
  };
1469
1474
  }
1470
1475
  async function buildGatewayUpdate(client, destinationChain, hashContext, queueNonce, queueItem) {
1471
- const { entry, approvingCouncilHash } = queueItem;
1476
+ const { entry, approvingCouncilHash, councilCache } = queueItem;
1477
+ if (entry.target.isGlobalIssuanceCouncilRotation) {
1478
+ const signatures = getSortedSignatures(entry.signatures);
1479
+ const nextCouncilHash = toHexValue(entry.target.asGlobalIssuanceCouncilRotation);
1480
+ const nextCouncil = await loadCouncilByHash(client, nextCouncilHash, councilCache);
1481
+ const target = {
1482
+ council: councilToSnapshot(nextCouncil),
1483
+ epochMicrogonsPerArgonot: nextCouncil.epochMicrogonsPerArgonot
1484
+ };
1485
+ const calculatedCouncilHash = hashMintingGatewayGlobalIssuanceCouncil2({
1486
+ ...target.council,
1487
+ epochMicrogonsPerArgonot: target.epochMicrogonsPerArgonot
1488
+ });
1489
+ const targetPayloadHash = hashMintingGatewayRotateGlobalIssuanceCouncil(hashContext, target);
1490
+ const approvalHash = hashMintingGatewayRotateGlobalIssuanceCouncilApproval(hashContext, {
1491
+ queueNonce,
1492
+ approvingCouncilHash,
1493
+ previousUpdateHash: toHexValue(entry.previousApprovalHash),
1494
+ target
1495
+ });
1496
+ if (calculatedCouncilHash !== nextCouncilHash) {
1497
+ throw new Error(`Queue nonce ${queueNonce} target council hash does not match council`);
1498
+ }
1499
+ if (toHexValue(entry.targetPayloadHash) !== targetPayloadHash) {
1500
+ throw new Error(`Queue nonce ${queueNonce} target payload hash does not match council`);
1501
+ }
1502
+ if (toHexValue(entry.approvalHash) !== approvalHash) {
1503
+ throw new Error(`Queue nonce ${queueNonce} approval hash does not match council rotation`);
1504
+ }
1505
+ return {
1506
+ queueNonce,
1507
+ kind: MINTING_GATEWAY_UPDATE_KINDS.globalIssuanceCouncilRotate,
1508
+ payload: encodeMintingGatewayGlobalIssuanceCouncilRotateTarget(target),
1509
+ signatures
1510
+ };
1511
+ }
1472
1512
  if (entry.target.isMintingAuthorityActivation) {
1473
1513
  const signatures = getSortedSignatures(entry.signatures);
1474
1514
  const signingKey = (0, import_viem3.getAddress)(toHexValue(entry.target.asMintingAuthorityActivation));
@@ -1554,6 +1594,7 @@ async function loadCouncilByHash(client, councilHash, cache) {
1554
1594
  }
1555
1595
  const council = councilOption.unwrap();
1556
1596
  const loaded = {
1597
+ epochMicrogonsPerArgonot: council.epochMicrogonsPerArgonot.toBigInt(),
1557
1598
  totalWeight: council.totalWeight.toBigInt(),
1558
1599
  members: [...council.members.entries()].map(([signer, member]) => ({
1559
1600
  signer: (0, import_viem3.getAddress)(toHexValue(signer)),
@@ -1986,14 +2027,17 @@ var TestMintingAuthorityActor = class {
1986
2027
  );
1987
2028
  const currentTick = await this.harness.mainchainClient.query.ticks.currentTick();
1988
2029
  await this.harness.submit(
1989
- this.harness.mainchainClient.tx.priceIndex.submit({
1990
- btcUsdPrice: (0, import_mainchain7.toFixedNumber)(6e4, 18),
1991
- argonotUsdPrice: (0, import_mainchain7.toFixedNumber)(1, 18),
1992
- argonUsdPrice: (0, import_mainchain7.toFixedNumber)(1, 18),
1993
- argonUsdTargetPrice: (0, import_mainchain7.toFixedNumber)(1, 18),
1994
- argonTimeWeightedAverageLiquidity: (0, import_mainchain7.toFixedNumber)(1e6, 18),
1995
- tick: currentTick.toBigInt()
1996
- }),
2030
+ this.harness.mainchainClient.tx.priceIndex.submit(
2031
+ {
2032
+ btcUsdPrice: (0, import_mainchain7.toFixedNumber)(6e4, 18),
2033
+ argonotUsdPrice: (0, import_mainchain7.toFixedNumber)(1, 18),
2034
+ argonUsdPrice: (0, import_mainchain7.toFixedNumber)(1, 18),
2035
+ argonUsdTargetPrice: (0, import_mainchain7.toFixedNumber)(1, 18),
2036
+ argonTimeWeightedAverageLiquidity: (0, import_mainchain7.toFixedNumber)(1e6, 18),
2037
+ tick: currentTick.toBigInt()
2038
+ },
2039
+ null
2040
+ ),
1997
2041
  this.operator
1998
2042
  );
1999
2043
  await this.harness.submit(