Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deployments #176

Merged
merged 4 commits into from
Jul 10, 2023
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
15 changes: 1 addition & 14 deletions contracts/modules/commons/ModuleHooks.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,11 @@ import "./ModuleStorage.sol";
import "./ModuleERC165.sol";

import "../../interfaces/receivers/IERC1155Receiver.sol";
import "../../interfaces/receivers/IERC777Receiver.sol";
import "../../interfaces/receivers/IERC721Receiver.sol";
import "../../interfaces/receivers/IERC223Receiver.sol";


contract ModuleHooks is IERC1155Receiver, IERC777Receiver, IERC721Receiver, IERC223Receiver, IModuleHooks, ModuleERC165, ModuleSelfAuth {
contract ModuleHooks is IERC1155Receiver, IERC721Receiver, IModuleHooks, ModuleERC165, ModuleSelfAuth {
// HOOKS_KEY = keccak256("org.arcadeum.module.hooks.hooks");
bytes32 private constant HOOKS_KEY = bytes32(0xbe27a319efc8734e89e26ba4bc95f5c788584163b959f03fa04e2d7ab4b9a120);

Expand Down Expand Up @@ -95,12 +94,6 @@ contract ModuleHooks is IERC1155Receiver, IERC777Receiver, IERC721Receiver, IERC
return ModuleHooks.onERC1155BatchReceived.selector;
}

/**
* @notice Handle the receipt of ERC777 token types.
*/
// solhint-disable-next-line no-empty-blocks
function tokensReceived(address, address, address, uint256, bytes calldata, bytes calldata) external override virtual {}

/**
* @notice Handle the receipt of a single ERC721 token.
* @return `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`
Expand All @@ -109,11 +102,6 @@ contract ModuleHooks is IERC1155Receiver, IERC777Receiver, IERC721Receiver, IERC
return ModuleHooks.onERC721Received.selector;
}

/**
* @notice Handle the receipt of ERC223 tokens.
*/
function tokenFallback(address, uint256, bytes calldata) external override virtual {} // solhint-disable-line no-empty-blocks

/**
* @notice Routes fallback calls through hooks
*/
Expand Down Expand Up @@ -147,7 +135,6 @@ contract ModuleHooks is IERC1155Receiver, IERC777Receiver, IERC721Receiver, IERC
if (
_interfaceID == type(IModuleHooks).interfaceId ||
_interfaceID == type(IERC1155Receiver).interfaceId ||
_interfaceID == type(IERC777Receiver).interfaceId ||
_interfaceID == type(IERC721Receiver).interfaceId ||
_interfaceID == type(IERC223Receiver).interfaceId
) {
Expand Down
2 changes: 1 addition & 1 deletion contracts/modules/utils/RequireUtils.sol
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ contract RequireUtils {
* @param _expiration Expiration to check
*/
function requireNonExpired(uint256 _expiration) external view {
require(block.timestamp <= _expiration, "RequireUtils#requireNonExpired: EXPIRED");
require(block.timestamp < _expiration, "RequireUtils#requireNonExpired: EXPIRED");
}

/**
Expand Down
6 changes: 1 addition & 5 deletions foundry_test/modules/utils/RequireUtils.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -54,16 +54,12 @@ contract SubModuleNonceTest is AdvTest {
}

function test_requireNonExpired(uint256 _expiration) external {
if (block.timestamp > _expiration) {
if (block.timestamp >= _expiration) {
vm.expectRevert(bytes('RequireUtils#requireNonExpired: EXPIRED'));
}
requireUtils.requireNonExpired(_expiration);
}

function test_requireNonExpiredWithExactBlock() external view {
requireUtils.requireNonExpired(block.timestamp);
}

function test_requireMinNonce(uint160 _space, uint96 _nonce, uint96 _nonceToCheck) external {
imp.writeNonce(_space, _nonce);
uint256 encoded = abi.decode(abi.encodePacked(_space, _nonceToCheck), (uint256));
Expand Down
5 changes: 2 additions & 3 deletions hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,20 @@ const config: HardhatUserConfig = {
settings: {
optimizer: {
enabled: true,
runs: 500000
runs: 500000,
}
}
},
networks: {
mainnet: networkConfig('mainnet'),
ropsten: networkConfig('ropsten'),
rinkeby: networkConfig('rinkeby'),
kovan: networkConfig('kovan'),
goerli: networkConfig('goerli'),
polygon: networkConfig('polygon'),
polygonZkevm: networkConfig('polygon-zkevm'),
mumbai: networkConfig('mumbai'),
arbitrum: networkConfig('arbitrum'),
arbitrumTestnet: networkConfig('arbitrum-testnet'),
arbitrumGoerli: networkConfig('arbitrum-goerli'),
arbitrumNova: networkConfig('arbitrum-nova'),
optimism: networkConfig('optimism'),
bnb: networkConfig('bnb'),
Expand Down
22 changes: 22 additions & 0 deletions networks/arbitrumGoerli.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
[
{
"contractName": "WalletFactory",
"address": "0xFaA5c0b14d1bED5C888Ca655B9a8A5911F78eF4A"
},
{
"contractName": "MainModule",
"address": "0xfBf8f1A5E00034762D928f46d438B947f5d4065d"
},
{
"contractName": "MainModuleUpgradable",
"address": "0x4222dcA3974E39A8b41c411FeDDE9b09Ae14b911"
},
{
"contractName": "GuestModule",
"address": "0xfea230Ee243f88BC698dD8f1aE93F8301B6cdfaE"
},
{
"contractName": "SequenceUtils",
"address": "0xdbbFa3cB3B087B64F4ef5E3D20Dda2488AA244e6"
}
]
25 changes: 14 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
"private": true,
"license": "Apache-2.0",
"scripts": {
"postinstall": "yarn build",
"build": "yarn compile && yarn adapter",
"compile": "hardhat --max-memory 4096 compile",
"clean": "rimraf artifacts && rimraf cache",
Expand All @@ -16,15 +15,19 @@
"release": "yarn publish src",
"lint": "yarn lint:ts && yarn lint:sol",
"lint:fix": "yarn lint:ts:fix && yarn lint:sol:fix",
"lint:sol": "solhint './contracts/**/*.sol'",
"lint:sol:fix": "solhint './contracts/**/*.sol' --fix",
"lint:ts": "eslint -c .eslintrc.js './**/*.ts'",
"lint:ts:fix": "eslint -c .eslintrc.js --fix './**/*.ts'",
"lint:sol": "solhint \"./contracts/**/*.sol\"",
"lint:sol:fix": "solhint \"./contracts/**/*.sol\" --fix",
"lint:ts": "eslint -c .eslintrc.js \"./**/*.ts\"",
"lint:ts:fix": "eslint -c .eslintrc.js --fix \"./**/*.ts\"",
"format": "prettier --write ./**/*.ts",
"adapter": "rimraf gen && typechain --target ethers-v5 --out-dir gen/typechain './artifacts/contracts/**/*[^dbg].json'"
"adapter": "typechain --target ethers-v5 --out-dir gen/typechain \"./artifacts/contracts/**/*[^dbg].json\""
},
"main": "gen/adapter/index.js",
"types": "gen/typechain/index.ts",
"files": [
"./contracts/**/*.sol",
"!**/*Mock*",
"./gen/typechain"
],
"husky": {
"hooks": {
"pre-commit": "yarn lint",
Expand All @@ -37,7 +40,6 @@
"@nomiclabs/hardhat-truffle5": "^2.0.0",
"@nomiclabs/hardhat-web3": "^2.0.0",
"@tenderly/hardhat-tenderly": "^1.0.11",
"@typechain/ethers-v5": "^7.0.1",
"@types/chai-as-promised": "^7.1.0",
"@types/chai-string": "^1.4.1",
"@types/mocha": "^8.2.1",
Expand All @@ -56,7 +58,6 @@
"eslint-plugin-import": "^2.22.0",
"eslint-plugin-prettier": "^3.3.1",
"ethereum-waffle": "^3.4.4",
"ethers": "^5.7.2",
"ganache-cli": "6.12.2",
"hardhat": "^2.16.1",
"hardhat-gas-reporter": "1.0.4",
Expand All @@ -66,6 +67,7 @@
"scrypt": "github:barrysteyn/node-scrypt#fb60a8d3c158fe115a624b5ffa7480f3a24b03fb",
"solhint": "^3.4.1",
"solidity-coverage": "0.8.3",
"threads": "^1.7.0",
"ts-node": "^10.9.1",
"typechain": "^8.1.0",
"typescript": "^4.7.4",
Expand All @@ -81,7 +83,8 @@
"extra": ""
},
"dependencies": {
"keccak256": "^1.0.6",
"threads": "^1.7.0"
"@typechain/ethers-v5": "^7.0.1",
"ethers": "^5.7.2",
"keccak256": "^1.0.6"
}
}
1 change: 0 additions & 1 deletion test/ERC165.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { expect, interfaceIdOf, randomHex } from './utils'
const interfaceIds = [
'IERC223Receiver',
'IERC721Receiver',
'IERC777Receiver',
'IERC1155Receiver',
'IERC1271Wallet',
'IModuleAuth',
Expand Down
84 changes: 48 additions & 36 deletions utils/config-loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,23 @@ import * as path from 'path'
import { HttpNetworkConfig } from 'hardhat/types'
import { ethers } from 'ethers'

type EthereumNetworksTypes = 'rinkeby' | 'ropsten' | 'kovan' | 'goerli' | 'mainnet' | 'mumbai' | 'polygon' | 'arbitrum' | 'arbitrum-testnet' | 'arbitrum-nova' | 'optimism' | 'bnb' | 'gnosis' | 'polygon-zkevm' | 'avalanche' | 'bnb-testnet' | 'avalanche-fuji'
type EthereumNetworksTypes =
| 'mainnet'
| 'ropsten'
| 'kovan'
| 'goerli'
| 'polygon'
| 'polygon-zkevm'
| 'mumbai'
| 'arbitrum'
| 'arbitrum-goerli'
| 'arbitrum-nova'
| 'optimism'
| 'bnb'
| 'bnb-testnet'
| 'gnosis'
| 'avalanche'
| 'avalanche-fuji'

export const getEnvConfig = (env: string) => {
const envFile = path.resolve(__dirname, `../config/${env}.env`)
Expand Down Expand Up @@ -34,12 +50,15 @@ export const networkRpcUrl = (network: EthereumNetworksTypes): string => {
case 'polygon':
return 'https://nodes.sequence.app/polygon'

case 'arbitrum-testnet':
return 'https://rinkeby.arbitrum.io/rpc'
case 'polygon-zkevm':
return 'https://zkevm-rpc.com'

case 'arbitrum':
return 'https://endpoints.omniatech.io/v1/arbitrum/one/public'


case 'arbitrum-goerli':
return 'https://goerli-rollup.arbitrum.io/rpc'

case 'arbitrum-nova':
return 'https://nova.arbitrum.io/rpc'

Expand All @@ -49,18 +68,15 @@ export const networkRpcUrl = (network: EthereumNetworksTypes): string => {
case 'bnb':
return 'https://bsc-dataseed3.binance.org'

case 'bnb-testnet':
return 'https://endpoints.omniatech.io/v1/bsc/testnet/public'

case 'gnosis':
return 'https://gnosis-mainnet.public.blastapi.io'

case 'polygon-zkevm':
return 'https://zkevm-rpc.com'

case 'avalanche':
return 'https://endpoints.omniatech.io/v1/avax/mainnet/public'

case 'bnb-testnet':
return 'https://endpoints.omniatech.io/v1/bsc/testnet/public'

case 'avalanche-fuji':
return 'https://endpoints.omniatech.io/v1/avax/fuji/public'

Expand All @@ -70,35 +86,33 @@ export const networkRpcUrl = (network: EthereumNetworksTypes): string => {
}

export const networkChainId = (network: EthereumNetworksTypes): number => {
const config = getEnvConfig('PROD')

switch (network) {
case 'mumbai':
return 80001
case 'mainnet':
return 1

case 'ropsten':
return 3

case 'goerli':
return 5

case 'kovan':
return 42

case 'mumbai':
return 80001

case 'polygon':
return 137

case 'arbitrum-testnet':
return 421611
case 'polygon-zkevm':
return 1101

case 'arbitrum':
return 42161

case 'rinkeby':
return 4

case 'goerli':
return 5

case 'mainnet':
return 1

case 'kovan':
return 42
case 'arbitrum-goerli':
return 421613

case 'arbitrum-nova':
return 42170
Expand All @@ -109,30 +123,28 @@ export const networkChainId = (network: EthereumNetworksTypes): number => {
case 'bnb':
return 56

case 'bnb-testnet':
return 97

case 'gnosis':
return 100

case 'polygon-zkevm':
return 1101

case 'avalanche':
return 43114

case 'bnb-testnet':
return 97

case 'avalanche-fuji':
return 43113
}
}

export const networkConfig = (network: EthereumNetworksTypes): HttpNetworkConfig & { etherscan?: string } => {
const config = getEnvConfig('PROD')
const prodConfig = getEnvConfig('PROD')
const networkConfig = getEnvConfig(network)
return {
url: networkRpcUrl(network),
chainId: networkChainId(network),
accounts: {
mnemonic: config['ETH_MNEMONIC'],
mnemonic: networkConfig['ETH_MNEMONIC'] ?? prodConfig['ETH_MNEMONIC'],
initialIndex: 0,
count: 10,
path: `m/44'/60'/0'/0`,
Expand All @@ -143,6 +155,6 @@ export const networkConfig = (network: EthereumNetworksTypes): HttpNetworkConfig
gasMultiplier: networkGasMultiplier(network),
timeout: 20000,
httpHeaders: {},
etherscan: config['ETHERSCAN']
etherscan: networkConfig['ETHERSCAN'] ?? prodConfig['ETHERSCAN']
}
}
Loading