Skip to content

Commit

Permalink
export all jsons in compiled-contracts
Browse files Browse the repository at this point in the history
  • Loading branch information
krlosMata authored and invocamanman committed Mar 19, 2024
1 parent 13c092f commit 474dad6
Show file tree
Hide file tree
Showing 10 changed files with 116 additions and 54 deletions.
4 changes: 2 additions & 2 deletions compiled-contracts/PolygonRollupManager.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions compiled-contracts/PolygonRollupManagerMock.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions compiled-contracts/PolygonRollupManagerMockInternalTest.json

Large diffs are not rendered by default.

34 changes: 26 additions & 8 deletions compiled-contracts/PolygonValidiumEtrog.json

Large diffs are not rendered by default.

28 changes: 23 additions & 5 deletions compiled-contracts/PolygonZkEVMEtrog.json

Large diffs are not rendered by default.

28 changes: 23 additions & 5 deletions compiled-contracts/PolygonZkEVMExistentEtrog.json

Large diffs are not rendered by default.

15 changes: 4 additions & 11 deletions docs/v2/consensus/validium/PolygonValidiumEtrog.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ It is advised to use timelocks for the admin address in case of Validium since i
function sequenceBatchesValidium(
struct PolygonValidiumEtrog.ValidiumBatchData[] batches,
uint64 maxSequenceTimestamp,
uint64 initSequencedBatch,
uint256 currentSequenceNumber,
address l2Coinbase,
bytes dataAvailabilityMessage
) external
Expand All @@ -46,7 +46,7 @@ Allows a sequencer to send multiple batches
|`batches` | struct PolygonValidiumEtrog.ValidiumBatchData[] | Struct array which holds the necessary data to append new batches to the sequence
|`maxSequenceTimestamp` | uint64 | Max timestamp of the sequence. This timestamp must be inside a safety range (actual + 36 seconds).
This timestamp should be equal or higher of the last block inside the sequence, otherwise this batch will be invalidated by circuit.
|`initSequencedBatch` | uint64 | This parameter must match the current last batch sequenced.
|`currentSequenceNumber` | uint256 | This parameter must match the current sequenceNumber, which will be a counter of sequences.
This will be a protection for the sequencer to avoid sending undesired data
|`l2Coinbase` | address | Address that will receive the fees from L2
|`dataAvailabilityMessage` | bytes | Byte array containing the signatures and all the addresses of the committee in ascending order
Expand All @@ -58,9 +58,7 @@ note Pol is not a reentrant token
```solidity
function sequenceBatches(
struct PolygonRollupBaseEtrog.BatchData[] batches,
uint64 maxSequenceTimestamp,
uint64 initSequencedBatch,
address l2Coinbase
uint64 l2Coinbase
) public
```
Allows a sequencer to send multiple batches
Expand All @@ -70,12 +68,7 @@ Allows a sequencer to send multiple batches
| Name | Type | Description |
| :--- | :--- | :------------------------------------------------------------------- |
|`batches` | struct PolygonRollupBaseEtrog.BatchData[] | Struct array which holds the necessary data to append new batches to the sequence
|`maxSequenceTimestamp` | uint64 | Max timestamp of the sequence. This timestamp must be inside a safety range (actual + 36 seconds).
This timestamp should be equal or higher of the last block inside the sequence, otherwise this batch will be invalidated by circuit.
|`initSequencedBatch` | uint64 | This parameter must match the current last batch sequenced.
This will be a protection for the sequencer to avoid sending undesired data
|`l2Coinbase` | address | Address that will receive the fees from L2
note Pol is not a reentrant token
|`l2Coinbase` | uint64 | Address that will receive the fees from L2

### setDataAvailabilityProtocol
```solidity
Expand Down
4 changes: 2 additions & 2 deletions docs/v2/lib/PolygonRollupBaseEtrog.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ Note if a wrapped token of the bridge is used, the original network and address
function sequenceBatches(
struct PolygonRollupBaseEtrog.BatchData[] batches,
uint64 maxSequenceTimestamp,
uint64 initSequencedBatch,
uint256 currentSequenceNumber,
address l2Coinbase
) public
```
Expand All @@ -68,7 +68,7 @@ Allows a sequencer to send multiple batches
|`batches` | struct PolygonRollupBaseEtrog.BatchData[] | Struct array which holds the necessary data to append new batches to the sequence
|`maxSequenceTimestamp` | uint64 | Max timestamp of the sequence. This timestamp must be inside a safety range (actual + 36 seconds).
This timestamp should be equal or higher of the last block inside the sequence, otherwise this batch will be invalidated by circuit.
|`initSequencedBatch` | uint64 | This parameter must match the current last batch sequenced.
|`currentSequenceNumber` | uint256 | This parameter must match the current sequenceNumber, which will be a counter of sequences.
This will be a protection for the sequencer to avoid sending undesired data
|`l2Coinbase` | address | Address that will receive the fees from L2
note Pol is not a reentrant token
Expand Down
37 changes: 20 additions & 17 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
module.exports.PolygonZkEVMBridge = require('./compiled-contracts/PolygonZkEVMBridge.json');
module.exports.PolygonZkEVMGlobalExitRoot = require('./compiled-contracts/PolygonZkEVMGlobalExitRoot.json');
module.exports.PolygonZkEVMGlobalExitRootL2 = require('./compiled-contracts/PolygonZkEVMGlobalExitRootL2.json');
module.exports.PolygonZkEVM = require('./compiled-contracts/PolygonZkEVM.json');
module.exports.TokenWrapped = require('./compiled-contracts/TokenWrapped.json');
module.exports.FflonkVerifier = require('./compiled-contracts/FflonkVerifier.json');
module.exports.PolygonZkEVMBridgeMock = require('./compiled-contracts/PolygonZkEVMBridgeMock.json');
module.exports.ERC20PermitMock = require('./compiled-contracts/ERC20PermitMock.json');
module.exports.PolygonZkEVMGlobalExitRootL2Mock = require('./compiled-contracts/PolygonZkEVMGlobalExitRootL2Mock.json');
module.exports.PolygonZkEVMGlobalExitRootMock = require('./compiled-contracts/PolygonZkEVMGlobalExitRootMock.json');
module.exports.PolygonZkEVMMock = require('./compiled-contracts/PolygonZkEVMMock.json');
module.exports.VerifierRollupHelperMock = require('./compiled-contracts/VerifierRollupHelperMock.json');
module.exports.PermitHelper = require('./src/permit-helper');
module.exports.ProxyAdmin = require('./compiled-contracts/ProxyAdmin.json');
module.exports.TransparentUpgradeableProxy = require('./compiled-contracts/TransparentUpgradeableProxy.json');
module.exports.PolygonZkEVMDeployer = require('./compiled-contracts/PolygonZkEVMDeployer.json');
module.exports.PolygonZkEVMTimelock = require('./compiled-contracts/PolygonZkEVMTimelock.json');
const fs = require('fs')
const path = require('path')

const compileContracts = {}
const pathToCompiledContracts = path.join(__dirname, './compiled-contracts')

function exportCompileContracts(pathDir) {
fs.readdirSync(pathDir).forEach(file => {
const fullName = path.join(pathDir, file)
const pathInfo = path.parse(fullName);

if (pathInfo.ext === '.json') {
compileContracts[pathInfo.name] = require(fullName);
}
})
}

exportCompileContracts(pathToCompiledContracts);

module.exports = compileContracts;
12 changes: 12 additions & 0 deletions test/index.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/* eslint-disable no-restricted-syntax */
const { expect } = require('chai');
const index = require('../index');

describe('should export index', () => {
it('should validate all abi exports', async () => {
for (const file of Object.keys(index)) {
expect(index[file]).to.be.an('object');
expect(index[file]).to.have.property('abi');
}
});
});

0 comments on commit 474dad6

Please sign in to comment.