Skip to content

Commit

Permalink
Merge pull request #10 from openfort-xyz/post-audit/ver-0.5.1
Browse files Browse the repository at this point in the history
Upgrade post audit version 0.5.1
  • Loading branch information
eloi010 authored Dec 27, 2023
2 parents 2c0e0b4 + b623ccc commit 42c9dd9
Show file tree
Hide file tree
Showing 97 changed files with 7,528 additions and 10,041 deletions.
4 changes: 3 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Entry point v0.6.0
ENTRY_POINT_ADDRESS="0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789"
ERC6551_REGISTRY_ADDRESS="0x000000006551c19487814612e58FE06813775758"
PAYMASTER_ADDRESS=
MNEMONIC="test test test test test test test test test test test junk"
VERSION_SALT=0x00
Expand All @@ -20,7 +21,8 @@ AVALANCHE_OPENFORT_RPC="zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz"
GNOSIS_RPC="zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz"
GNOSIS_CHIADO_RPC="zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz"
BASE_RPC="zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz"
BASE_TEST_RPC="zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz"
BASE_GOERLI_RPC="zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz"
BASE_SEPOLIA_RPC="zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz"
OASYS_MAINNET_RPC="zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz"
OASYS_TEST_RPC="zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz"
KLAYTN_MAINNET_RPC="zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz"
Expand Down
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@
[submodule "lib/account-abstraction"]
path = lib/account-abstraction
url = [email protected]:eth-infinitism/account-abstraction.git
[submodule "lib/erc6551"]
path = lib/erc6551
url = https://github.com/erc6551/reference
22 changes: 15 additions & 7 deletions .solhint.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
{
"extends": "solhint:recommended",
"rules": {
"compiler-version": ["error",">=0.7.5"],
"func-visibility": ["off",{"ignoreConstructors":true}],
"mark-callable-contracts": ["off"]
}
"extends": "solhint:recommended",
"rules": {
"avoid-low-level-calls": "off",
"code-complexity": ["error", 9],
"compiler-version": ["error", ">=0.8.19"],
"contract-name-camelcase": "off",
"const-name-snakecase": "off",
"func-name-mixedcase": "off",
"func-visibility": ["error", { "ignoreConstructors": true }],
"max-line-length": ["error", 123],
"named-parameters-mapping": "warn",
"no-empty-blocks": "off",
"not-rely-on-time": "off",
"var-name-mixedcase": "off"
}
}
16 changes: 15 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
{
"solidity.compileUsingRemoteVersion": "v0.8.19+commit.7dd6d404"
"solidity.compileUsingRemoteVersion": "v0.8.19+commit.7dd6d404",
"solidity.defaultCompiler": "localFile",
"solidity.compileUsingLocalVersion": "v0.8.19+commit.7dd6d404",
"solidity.packageDefaultDependenciesDirectory": "node_modules/, lib/",
"solidity.formatter": "forge",
"solidity.packageDefaultDependenciesContractsDirectory": "node_modules/, lib/",
"solidity.remappings": [
"@openzeppelin/=node_modules/@openzeppelin/",
"account-abstraction/=lib/account-abstraction/contracts/",
"ds-test/=lib/forge-std/lib/ds-test/src/",
"eth-gas-reporter/=node_modules/eth-gas-reporter/",
"forge-std/=lib/forge-std/src/",
"hardhat/=node_modules/hardhat/",
"erc6551/=lib/erc6551/",
]
}
40 changes: 9 additions & 31 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ Use the `lcov` report format and `genhtml` to view the coverage data in a nice w
./script/gasProfile.sh
```

### Deploy Static and Upgradeable factories to all chains
### Deploy Upgradeable and Managed factories to all chains

```
./script/deployAllChains.sh
Expand All @@ -84,31 +84,17 @@ Use the `lcov` report format and `genhtml` to view the coverage data in a nice w
forge script CheckDeposits --force
```

### Deploy one static factory and one account

Simulation:

```
forge script StaticOpenfortDeploy --fork-url $<rpc_network>
```

Actual deployment:

```
forge script StaticOpenfortDeploy --fork-url $<rpc_network> --verify --broadcast
```

### Deploy one upgradeable factory and one account

Simulation:

```
forge script UpgradeableOpenfortDeploy --fork-url $<rpc_network>
forge script --force script/deployManagedAccounts.s.sol -vvvvv --optimizer-runs 1000000 --slow --fork-url $<rpc_network>
```

Actual deployment:
```
forge script UpgradeableOpenfortDeploy --fork-url $<rpc_network> --verify --broadcast
forge script --force script/deployManagedAccounts.s.sol -vvvvv --optimizer-runs 1000000 --slow --fork-url $<rpc_network> --broadcast --verify --etherscan-api-key $<api_key>
```

### Compare gas costs
Expand Down Expand Up @@ -147,14 +133,6 @@ If you run into the error `ImportError: cannot import name 'getargspec' from 'in

As of June 2023, the current average gas cost for deploying or using the different smart contracts of this project is:

### Static Accounts
| Smart Contract | Description | # of deployments per game/ecosystem | Avg gas cost |
| :----------------- | :---------------------------------- | :---------------------------------- | :------------------------ |
| StaticOpenfortFactory | Deploy factory (containing StaticOpenfortAccount's implementation) | 1 | ~2,500,000 |
| StaticOpenfortAccount | Create a new static account using the `createAccountWithNonce()` of the factory | indefinite | ~150,000 |
| StaticOpenfortAccount | Updating the EntryPoint address using `updateEntryPoint()` | indefinite | ~1,500 |
| StaticOpenfortAccount | Transferring the ownership using `transferOwnership()` | indefinite | ~25,000 |

### Upgradeable Accounts
| Smart Contract | Description | # of deployments per game/ecosystem | Avg gas cost |
| :----------------- | :---------------------------------- | :---------------------------------- | :------------------------ |
Expand All @@ -171,9 +149,9 @@ As of June 2023, the current average gas cost for deploying or using the differe
## Gas Stats in USD
The gas price range is reported as the daily average gas price for the first 90 days of 2023 ± one standard deviation.

| Blockchain | Gas Price Range | Token Price | Create an Static account | Create an Upgradeable account |
| :------------- | :-------------------- | :---------------- | :------ | :------ |
| Ethereum | 30.5 ± 10.5 gwei | ~$1800 | $5.5-$11 | $7.5-15 |
| Polygon | 220 ± 108 gwei | ~$0.67 | $0.01-$0.035 | $0.015-$0.045 |
| Avalanche | 36 ± 4.5 nAVAX | ~$12.8 | $0.06-0.08 | $0.08-$0.11 |
| BSC | 7 ± 0.55 gwei | ~$240 | $0.24-$0.28 | $0.32-$0.36|
| Blockchain | Gas Price Range | Token Price | Create an Upgradeable account |
| :------------- | :-------------------- | :---------------- | :------ |
| Ethereum | 30.5 ± 10.5 gwei | ~$1800 | $7.5-15 |
| Polygon | 220 ± 108 gwei | ~$0.67 | $0.015-$0.045 |
| Avalanche | 36 ± 4.5 nAVAX | ~$12.8 | $0.08-$0.11 |
| BSC | 7 ± 0.55 gwei | ~$240 | $0.32-$0.36 |
Loading

0 comments on commit 42c9dd9

Please sign in to comment.