Skip to content

Commit

Permalink
feat: add contracts
Browse files Browse the repository at this point in the history
  • Loading branch information
3esmit committed Jun 24, 2024
1 parent eb130a4 commit 1974105
Show file tree
Hide file tree
Showing 69 changed files with 9,071 additions and 35,951 deletions.
110 changes: 96 additions & 14 deletions .gas-report
Original file line number Diff line number Diff line change
@@ -1,17 +1,99 @@
| script/Deploy.s.sol:Deploy contract | | | | | |
|-------------------------------------|-----------------|--------|--------|--------|---------|
| Deployment Cost | Deployment Size | | | | |
| 320782 | 2729 | | | | |
| Function Name | min | avg | median | max | # calls |
| run | 221942 | 221942 | 221942 | 221942 | 1 |


| src/Foo.sol:Foo contract | | | | | |
|--------------------------|-----------------|-----|--------|-----|---------|
| Deployment Cost | Deployment Size | | | | |
| 20275 | 131 | | | | |
| Function Name | min | avg | median | max | # calls |
| id | 235 | 235 | 235 | 235 | 1 |
| contracts/registry/UsernameRegistrar.sol:UsernameRegistrar contract | | | | | |
|---------------------------------------------------------------------|-----------------|--------|--------|--------|---------|
| Deployment Cost | Deployment Size | | | | |
| 3402568 | 17188 | | | | |
| Function Name | min | avg | median | max | # calls |
| activate | 46312 | 46554 | 46312 | 54312 | 33 |
| controller | 2414 | 2414 | 2414 | 2414 | 3 |
| dropUsername | 14543 | 14543 | 14543 | 14543 | 2 |
| ensNode | 406 | 1406 | 1406 | 2406 | 60 |
| ensRegistry | 2460 | 2460 | 2460 | 2460 | 3 |
| getAccountBalance | 504 | 504 | 504 | 504 | 15 |
| getAccountOwner | 517 | 517 | 517 | 517 | 15 |
| getCreationTime | 534 | 534 | 534 | 534 | 8 |
| migrateRegistry | 46313 | 46313 | 46313 | 46313 | 4 |
| moveRegistry | 61618 | 64743 | 61618 | 74118 | 4 |
| parentRegistry | 2415 | 2415 | 2415 | 2415 | 3 |
| price | 407 | 1709 | 2407 | 2407 | 43 |
| receiveApproval | 179225 | 226287 | 216007 | 296460 | 6 |
| register | 2347 | 161736 | 182881 | 295616 | 27 |
| release | 1397 | 18701 | 7181 | 67939 | 9 |
| releaseDelay | 2407 | 2407 | 2407 | 2407 | 11 |
| reserveSlash | 44793 | 44793 | 44793 | 44793 | 8 |
| reservedUsernamesMerkleRoot | 2386 | 2386 | 2386 | 2386 | 3 |
| resolver | 2373 | 2373 | 2373 | 2373 | 3 |
| slashAddressLikeUsername | 900 | 19479 | 1100 | 92995 | 5 |
| slashInvalidUsername | 841 | 19100 | 2749 | 91647 | 7 |
| slashSmallUsername | 93435 | 93435 | 93435 | 93435 | 1 |
| state | 396 | 396 | 396 | 396 | 2 |
| token | 2458 | 2458 | 2458 | 2458 | 3 |
| updateAccountOwner | 1879 | 4055 | 4133 | 6074 | 4 |
| updateRegistryPrice | 10674 | 10674 | 10674 | 10674 | 1 |
| usernameMinLength | 2341 | 2341 | 2341 | 2341 | 3 |


| contracts/test/MerkleProofWrapper.sol:MerkleProofWrapper contract | | | | | |
|-------------------------------------------------------------------|-----------------|------|--------|------|---------|
| Deployment Cost | Deployment Size | | | | |
| 104953 | 555 | | | | |
| Function Name | min | avg | median | max | # calls |
| verifyProof | 1084 | 1340 | 1463 | 1473 | 3 |


| lib/ens-contracts/contracts/registry/ENSRegistry.sol:ENSRegistry contract | | | | | |
|---------------------------------------------------------------------------|-----------------|-------|--------|-------|---------|
| Deployment Cost | Deployment Size | | | | |
| 508871 | 2519 | | | | |
| Function Name | min | avg | median | max | # calls |
| owner | 533 | 1229 | 533 | 2533 | 198 |
| resolver | 476 | 809 | 476 | 2476 | 12 |
| setOwner | 2395 | 2861 | 2395 | 5195 | 24 |
| setResolver | 4478 | 12438 | 4478 | 24378 | 15 |
| setSubnodeOwner | 3061 | 22583 | 24961 | 26961 | 109 |


| lib/ens-contracts/contracts/resolvers/PublicResolver.sol:PublicResolver contract | | | | | |
|----------------------------------------------------------------------------------|-----------------|-------|--------|-------|---------|
| Deployment Cost | Deployment Size | | | | |
| 1936168 | 9732 | | | | |
| Function Name | min | avg | median | max | # calls |
| addr | 1431 | 2011 | 1431 | 3173 | 6 |
| pubkey | 647 | 1980 | 647 | 4647 | 6 |
| setAddr | 31672 | 31672 | 31672 | 31672 | 4 |
| setPubkey | 47679 | 48679 | 48679 | 49679 | 4 |


| lib/minime/contracts/MiniMeToken.sol:MiniMeToken contract | | | | | |
|-----------------------------------------------------------|-----------------|--------|--------|--------|---------|
| Deployment Cost | Deployment Size | | | | |
| 1778095 | 10235 | | | | |
| Function Name | min | avg | median | max | # calls |
| allowance | 763 | 829 | 763 | 2763 | 30 |
| approve | 3072 | 26261 | 27248 | 31748 | 24 |
| approveAndCall | 207970 | 255032 | 244752 | 325205 | 6 |
| generateTokens | 94463 | 94463 | 94463 | 94463 | 27 |
| transfer | 8527 | 42256 | 50744 | 73156 | 7 |
| transferFrom | 4089 | 50070 | 51773 | 51773 | 28 |


| script/Deploy.s.sol:Deploy contract | | | | | |
|-------------------------------------|-----------------|----------|----------|----------|---------|
| Deployment Cost | Deployment Size | | | | |
| 13947631 | 70759 | | | | |
| Function Name | min | avg | median | max | # calls |
| migration | 3489520 | 3489520 | 3489520 | 3489520 | 4 |
| run | 13054107 | 13054107 | 13054107 | 13054107 | 38 |


| script/DeploymentConfig.s.sol:DeploymentConfig contract | | | | | |
|---------------------------------------------------------|-----------------|------|--------|-------|---------|
| Deployment Cost | Deployment Size | | | | |
| 9560657 | 49600 | | | | |
| Function Name | min | avg | median | max | # calls |
| ETH_LABELHASH | 240 | 240 | 240 | 240 | 38 |
| ETH_NAMEHASH | 239 | 239 | 239 | 239 | 80 |
| getActiveNetworkConfig | 2964 | 3864 | 2964 | 20964 | 80 |
| getNameHash | 520 | 520 | 520 | 520 | 80 |



Expand Down
42 changes: 41 additions & 1 deletion .gas-snapshot
Original file line number Diff line number Diff line change
@@ -1 +1,41 @@
FooTest:test_Example() (gas: 8662)
MerkleProofTest:testVerifyProof_InvalidLengthProof() (gas: 18347)
MerkleProofTest:testVerifyProof_InvalidProof() (gas: 19315)
MerkleProofTest:testVerifyProof_ValidProof() (gas: 19390)
UsernameRegistrarActivateTest:testActivateRegistry() (gas: 103750)
UsernameRegistrarActivateTest:testDeployment() (gas: 44066)
UsernameRegistrarActivateTest:testRegisterUnactivated() (gas: 10899)
UsernameRegistrarActivateTest:testUser() (gas: 2381)
UsernameRegistrarRegisterTest:testDeployment() (gas: 44066)
UsernameRegistrarRegisterTest:testMoveRegistry() (gas: 3608109)
UsernameRegistrarRegisterTest:testRegisterAlreadyInUse() (gas: 346672)
UsernameRegistrarRegisterTest:testRegisterUsername() (gas: 326741)
UsernameRegistrarRegisterTest:testRegisterUsernameApproveAndCall() (gas: 329447)
UsernameRegistrarRegisterTest:testRegisterUsernameWithAccountAndPubKey() (gas: 457681)
UsernameRegistrarRegisterTest:testRegisterUsernameWithAccountAndPubKeyApproveAndCall() (gas: 460516)
UsernameRegistrarRegisterTest:testRegisterUsernameWithNoAllowanceOrBalance() (gas: 322802)
UsernameRegistrarRegisterTest:testRegisterUsernameWithOnlyAddress() (gas: 409167)
UsernameRegistrarRegisterTest:testRegisterUsernameWithOnlyAddressApproveAndCall() (gas: 411910)
UsernameRegistrarRegisterTest:testRegisterUsernameWithOnlyPubkey() (gas: 425643)
UsernameRegistrarRegisterTest:testRegisterUsernameWithOnlyPubkeyApproveAndCall() (gas: 428388)
UsernameRegistrarRegisterTest:testRegisterUsernameWithoutAnything() (gas: 329789)
UsernameRegistrarRegisterTest:testRegisterUsernameWithoutAnythingApproveAndCall() (gas: 332577)
UsernameRegistrarRegisterTest:testReleaseUsername() (gas: 296384)
UsernameRegistrarRegisterTest:testReleaseUsernameByNewOwner() (gas: 337116)
UsernameRegistrarRegisterTest:testReleaseWhenMigrated() (gas: 3838975)
UsernameRegistrarRegisterTest:testReleaseWhenMigratedByOldOwner() (gas: 3846579)
UsernameRegistrarRegisterTest:testShouldNotReleaseUsernameBeforeDelay() (gas: 329620)
UsernameRegistrarRegisterTest:testShouldNotReleaseUsernameFromOther() (gas: 329566)
UsernameRegistrarRegisterTest:testShouldNotReleaseUsernameNotRegistered() (gas: 334190)
UsernameRegistrarRegisterTest:testShouldNotSlashUsernameThatDoesNotStartWith0AndIsBiggerThan12() (gas: 373854)
UsernameRegistrarRegisterTest:testShouldNotSlashUsernameThatDoesNotStartWith0xAndIsBiggerThan12() (gas: 374020)
UsernameRegistrarRegisterTest:testShouldNotSlashUsernameThatStartsWith0xButDoesNotUseHexChars() (gas: 374333)
UsernameRegistrarRegisterTest:testShouldNotSlashUsernameThatStartsWith0xButIsSmallerThan12() (gas: 373775)
UsernameRegistrarRegisterTest:testShouldNotSlashValidUsername() (gas: 377392)
UsernameRegistrarRegisterTest:testSlashAddressLikeUsername() (gas: 387824)
UsernameRegistrarRegisterTest:testSlashInvalidUsername() (gas: 427093)
UsernameRegistrarRegisterTest:testSlashSmallUsername() (gas: 388158)
UsernameRegistrarRegisterTest:testUpdateAccountOwner() (gas: 3958584)
UsernameRegistrarRegisterTest:testUpdateRegistryPrice() (gas: 21924)
UsernameRegistrarRegisterTest:testUser() (gas: 2404)
UsernameRegistrarTest:testDeployment() (gas: 44066)
UsernameRegistrarTest:testUser() (gas: 2359)
36 changes: 0 additions & 36 deletions .github/scripts/rename.sh

This file was deleted.

4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -139,11 +139,11 @@ jobs:
with: { java-version: "11", java-package: jre }

- name: Install Certora CLI
run: pip3 install certora-cli==5.0.5
run: pip3 install certora-cli-beta

- name: Install Solidity
run: |
wget https://github.com/ethereum/solidity/releases/download/v0.8.19/solc-static-linux
wget https://github.com/ethereum/solidity/releases/download/v0.8.25/solc-static-linux
chmod +x solc-static-linux
sudo mv solc-static-linux /usr/local/bin/solc
Expand Down
52 changes: 0 additions & 52 deletions .github/workflows/create.yml

This file was deleted.

12 changes: 12 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,15 @@
branch = "v1"
path = lib/forge-std
url = https://github.com/foundry-rs/forge-std
[submodule "lib/ens-contracts"]
path = lib/ens-contracts
url = https://github.com/ensdomains/ens-contracts
[submodule "lib/buffer"]
path = lib/buffer
url = https://github.com/ensdomains/buffer
[submodule "lib/openzeppelin-contracts"]
path = lib/openzeppelin-contracts
url = https://github.com/OpenZeppelin/openzeppelin-contracts
[submodule "lib/minime"]
path = lib/minime
url = https://github.com/vacp2p/minime
6 changes: 6 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,9 @@ pnpm-lock.yaml
yarn.lock

slither.config.json

.eslintrc.json
.solhint.json
.vscode/*.json
app/languages/*.json
reservedNames.json
3 changes: 2 additions & 1 deletion .solhint.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"extends": "solhint:recommended",
"rules": {
"code-complexity": ["error", 8],
"compiler-version": ["error", ">=0.8.19"],
"compiler-version": ["error", ">=0.8.25"],
"func-name-mixedcase": "off",
"func-visibility": ["error", { "ignoreConstructors": true }],
"max-line-length": ["error", 120],
Expand All @@ -11,3 +11,4 @@
"not-rely-on-time": "off"
}
}

5 changes: 3 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@
"editor.defaultFormatter": "tamasfe.even-better-toml"
},
"npm.exclude": "**/lib/**",
"solidity.formatter": "forge"
}
"solidity.formatter": "forge",
"solidity.defaultCompiler": "localNodeModule"
}
Loading

0 comments on commit 1974105

Please sign in to comment.