Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,6 @@ docs/

# Dotenv file
.env

# MacOS files
.DS_Store
2 changes: 1 addition & 1 deletion blocklock-solidity
Submodule blocklock-solidity updated 35 files
+10 −46 README.md
+2 −2 package-lock.json
+1 −1 package.json
+0 −67 script/DeployAllContracts.s.sol
+0 −23 script/DeployFactory.s.sol
+0 −96 script/README.md
+0 −14 script/json/README.md
+0 −9 script/libraries/Constants.sol
+0 −46 script/single-deployment/DeployBlocklockReceiver.s.sol
+0 −145 script/single-deployment/DeployBlocklockSender.s.sol
+0 −54 script/single-deployment/DeployBlocklockSignatureScheme.s.sol
+0 −90 script/single-deployment/DeployDecryptionSender.s.sol
+0 −48 script/single-deployment/DeploySignatureSchemeAddressProvider.s.sol
+0 −31 script/utils/EnvReader.sol
+0 −33 script/utils/JsonUtils.sol
+44 −33 src/AbstractBlocklockReceiver.sol
+34 −34 src/blocklock/BlocklockSender.sol
+7 −7 src/decryption-requests/DecryptionReceiverBase.sol
+42 −42 src/decryption-requests/DecryptionSender.sol
+2 −2 src/interfaces/IBlocklockReceiver.sol
+6 −4 src/interfaces/IBlocklockSender.sol
+2 −2 src/interfaces/IDecryptionReceiver.sol
+8 −8 src/interfaces/IDecryptionSender.sol
+3 −3 src/libraries/BLS.sol
+1 −1 src/libraries/TypesLib.sol
+8 −8 src/mocks/MockBlocklockReceiver.sol
+8 −8 src/mocks/MockBlocklockRevertingReceiver.sol
+8 −8 src/mocks/MockBlocklockStringReceiver.sol
+21 −105 test/forge/DirectFunding.t.sol
+23 −23 test/forge/SubscriptionFunding.t.sol
+23 −0 test/forge/base/Blocklock.t.sol
+1 −4 test/forge/base/Deployment.t.sol
+12 −14 test/hardhat/blocklock.test.ts
+274 −0 utils/mocks/create-blocklock-request.ts
+103 −0 utils/mocks/fetch-contract-data.ts
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "blocklock-js",
"version": "0.0.8-rc6",
"version": "1.0.0",
"description": "A library for encrypting and decrypting data for the future",
"source": "src/index.ts",
"main": "./dist/cjs/index.cjs",
Expand Down
9 changes: 7 additions & 2 deletions src/blocklock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
ARBITRUM_SEPOLIA,
AVALANCHE_C_CHAIN,
BASE_SEPOLIA,
BASE_MAINNET,
FILECOIN_CALIBNET,
FILECOIN_MAINNET,
OPTIMISM_SEPOLIA,
Expand Down Expand Up @@ -158,7 +159,7 @@ export class Blocklock {
const request = await this.blocklockSender.getRequest.staticCall(requestId)
const blockHeight = decodeCondition(request.condition)
return {
id: request.decryptionRequestID,
id: request.decryptionRequestId,
blockHeight: blockHeight,
ciphertext: parseSolidityCiphertext(request.ciphertext)
}
Expand All @@ -174,7 +175,7 @@ export class Blocklock {

return new Map(Array.from(
requests.map((event) => {
const id = event.args.requestID
const id = event.args.requestId
const blockHeight = decodeCondition(event.args.condition)

return [id, {
Expand Down Expand Up @@ -281,6 +282,10 @@ export class Blocklock {
return new Blocklock(rpc, BASE_SEPOLIA)
}

static createBaseMainnet(rpc: Signer | Provider): Blocklock {
return new Blocklock(rpc, BASE_MAINNET)
}

static createPolygonPos(rpc: Signer | Provider): Blocklock {
return new Blocklock(rpc, POLYGON_POS)
}
Expand Down
26 changes: 25 additions & 1 deletion src/networks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export const FILECOIN_CALIBNET: NetworkConfig = {
name: "filecoin_calibnet",
chainId: 314159n,
contractAddress: "0xF00aB3B64c81b6Ce51f8220EB2bFaa2D469cf702",
publicKey: BLOCKLOCK_TESTNET_PUBLIC_KEY,
publicKey: BLOCKLOCK_MAINNET_PUBLIC_KEY,
ibeOpts: {
hash: keccak_256,
k: 128,
Expand Down Expand Up @@ -91,6 +91,30 @@ export const BASE_SEPOLIA: NetworkConfig = {
gasMultiplierDefault: 10n,
}

export const BASE_MAINNET: NetworkConfig = {
name: "base_mainnet",
chainId: 8453n,
contractAddress: "0x8E7D2c0c968B5aCA6f7ce2ffaA76AEcf61235b9F",
publicKey: BLOCKLOCK_MAINNET_PUBLIC_KEY,
ibeOpts: {
hash: keccak_256,
k: 128,
expand_fn: "xmd",
dsts: {
H1_G1: encodeBytes(`BLOCKLOCK_BN254G1_XMD:KECCAK-256_SVDW_RO_H1_0x0000000000000000000000000000000000000000000000000000000000002105_`),
H2: encodeBytes(`BLOCKLOCK_BN254_XMD:KECCAK-256_H2_0x0000000000000000000000000000000000000000000000000000000000002105_`),
H3: encodeBytes(`BLOCKLOCK_BN254_XMD:KECCAK-256_H3_0x0000000000000000000000000000000000000000000000000000000000002105_`),
H4: encodeBytes(`BLOCKLOCK_BN254_XMD:KECCAK-256_H4_0x0000000000000000000000000000000000000000000000000000000000002105_`),
}
},
gasLimit: 100_000,
maxFeePerGas: ethers.parseUnits("0.2", "gwei"),
maxPriorityFeePerGas: ethers.parseUnits("0.2", "gwei"),
gasBufferPercent: 100n,
callbackGasLimitDefault: 1_000_000n,
gasMultiplierDefault: 10n,
}

export const POLYGON_POS: NetworkConfig = {
name: "polygon_pos",
chainId: 137n,
Expand Down
7 changes: 7 additions & 0 deletions test/integration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,13 @@ describe("Blocklock integration tests with supported networks", () => {
await runEncryptionTest(rpc, blocklock)
}, TIMEOUT)

it.skip("should encrypt and decrypt for base mainnet", async () => {
const rpc = createProvider(process.env.BASE_RPC_URL || "")
const wallet = new NonceManager(new Wallet(process.env.BASE_PRIVATE_KEY || "", rpc))
const blocklock = Blocklock.createBaseMainnet(wallet)
await runEncryptionTest(rpc, blocklock)
}, TIMEOUT)

it.skip("should encrypt and decrypt for filecoin mainnet", async () => {
const rpc = createProvider(process.env.FILECOIN_MAINNET_RPC_URL || "")
const wallet = new NonceManager(new Wallet(process.env.FILECOIN_MAINNET_PRIVATE_KEY || "", rpc))
Expand Down
Loading