Skip to content

Commit

Permalink
-`πŸ•―Β΄-
Browse files Browse the repository at this point in the history
  • Loading branch information
z0r0z committed Apr 12, 2024
1 parent efc921a commit 5e8a399
Show file tree
Hide file tree
Showing 15 changed files with 188 additions and 18 deletions.
8 changes: 4 additions & 4 deletions .gas-snapshot
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ DagonTest:testFailIsValidSignatureWeightedERC20() (gas: 246352)
DagonTest:testFailIsValidSignatureWeightedERC6909() (gas: 238917)
DagonTest:testFailIsValidSignatureWeightedERC721() (gas: 217237)
DagonTest:testFailSetTokenInvalidStd(address) (runs: 257, ΞΌ: 160117, ~: 160117)
DagonTest:testFailTransferFromInactiveAuth(address,address,uint96) (runs: 257, ΞΌ: 193368, ~: 194375)
DagonTest:testFailTransferOverBalance(address,address,uint96) (runs: 257, ΞΌ: 188186, ~: 189116)
DagonTest:testFailTransferFromInactiveAuth(address,address,uint96) (runs: 257, ΞΌ: 193523, ~: 194375)
DagonTest:testFailTransferOverBalance(address,address,uint96) (runs: 257, ΞΌ: 188264, ~: 189116)
DagonTest:testInstall() (gas: 139254)
DagonTest:testIsValidSignature() (gas: 152270)
DagonTest:testIsValidSignature2of3() (gas: 196098)
Expand All @@ -34,6 +34,6 @@ DagonTest:testSetThreshold() (gas: 149596)
DagonTest:testSetToken(address) (runs: 257, ΞΌ: 151457, ~: 151457)
DagonTest:testSetURI() (gas: 167668)
DagonTest:testSpoofSignatures(bytes) (runs: 257, ΞΌ: 19365, ~: 19294)
DagonTest:testTransfer(address,address,uint88) (runs: 257, ΞΌ: 177715, ~: 179496)
DagonTest:testTransferWithAuth(address,address,uint96) (runs: 257, ΞΌ: 181298, ~: 182257)
DagonTest:testTransfer(address,address,uint88) (runs: 257, ΞΌ: 177947, ~: 179496)
DagonTest:testTransferWithAuth(address,address,uint96) (runs: 257, ΞΌ: 181405, ~: 182257)
DagonTest:testUserVoted() (gas: 197077)
10 changes: 7 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,16 @@

Built with *[Foundry](https://github.com/foundry-rs/forge-std)* and *[Solady](https://github.com/vectorized/solady)*.

## Beta Deployment
## [Beta Deployment](https://contractscan.xyz/contract/0x0000000000001ADDcB933DD5028159dc965b5b7f)
> *Signature Validation Limit: ~1774 signatures*
Chain | Address |
Chains | Address |
----------------|-----------------------------------------|
Ethereum, Arbitrum, Optimism, Base, Blast, Zora, Polygon (& testnets) | [0x0000000000001ADDcB933DD5028159dc965b5b7f](https://etherscan.io/address/0x0000000000001ADDcB933DD5028159dc965b5b7f#code) |
Ethereum, Arbitrum, Optimism, Base, Blast, Zora, Gnosis, Polygon, Avalanche and BNB (& testnets) | [0x0000000000001ADDcB933DD5028159dc965b5b7f](https://etherscan.io/address/0x0000000000001ADDcB933DD5028159dc965b5b7f#code) |

> Summoner: [0x0000000000008de57636b43B33b2d6007Df5576e](https://etherscan.io/address/0x0000000000008de57636b43B33b2d6007Df5576e#code)
Dagon deployments are generated as [efficient create2 addresses](https://medium.com/coinmonks/on-efficient-ethereum-addresses-3fef0596e263) through the [canonical create2 factory](https://etherscan.io/address/0x0000000000ffe8b47b3e2130213b802212439497#code). As such they share the same exact address and code on every blockchain.

## Premise

Expand Down
82 changes: 82 additions & 0 deletions abi/Summoner.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
[
{
"type": "function",
"name": "summon",
"inputs": [
{
"name": "summoners",
"type": "tuple[]",
"internalType": "struct Summoner.Ownership[]",
"components": [
{
"name": "owner",
"type": "address",
"internalType": "address"
},
{
"name": "shares",
"type": "uint96",
"internalType": "uint96"
}
]
},
{
"name": "threshold",
"type": "uint88",
"internalType": "uint88"
},
{
"name": "locked",
"type": "bool",
"internalType": "bool"
},
{
"name": "salt",
"type": "bytes12",
"internalType": "bytes12"
}
],
"outputs": [
{
"name": "account",
"type": "address",
"internalType": "contract IAccounts"
}
],
"stateMutability": "payable"
},
{
"type": "function",
"name": "summonForToken",
"inputs": [
{
"name": "token",
"type": "address",
"internalType": "address"
},
{
"name": "standard",
"type": "uint8",
"internalType": "enum Summoner.Standard"
},
{
"name": "threshold",
"type": "uint88",
"internalType": "uint88"
},
{
"name": "salt",
"type": "bytes12",
"internalType": "bytes12"
}
],
"outputs": [
{
"name": "account",
"type": "address",
"internalType": "contract IAccounts"
}
],
"stateMutability": "payable"
}
]
10 changes: 7 additions & 3 deletions docs/src/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,16 @@

Built with *[Foundry](https://github.com/foundry-rs/forge-std)* and *[Solady](https://github.com/vectorized/solady)*.

## Beta Deployment
## [Beta Deployment](https://contractscan.xyz/contract/0x0000000000001ADDcB933DD5028159dc965b5b7f)
> *Signature Validation Limit: ~1774 signatures*
Chain | Address |
Chains | Address |
----------------|-----------------------------------------|
Ethereum, Arbitrum, Optimism, Base, Blast, Zora, Polygon (& testnets) | [0x0000000000001ADDcB933DD5028159dc965b5b7f](https://etherscan.io/address/0x0000000000001ADDcB933DD5028159dc965b5b7f#code) |
Ethereum, Arbitrum, Optimism, Base, Blast, Zora, Gnosis, Polygon, Avalanche and BNB (& testnets) | [0x0000000000001ADDcB933DD5028159dc965b5b7f](https://etherscan.io/address/0x0000000000001ADDcB933DD5028159dc965b5b7f#code) |

> Summoner: [0x0000000000008de57636b43B33b2d6007Df5576e](https://etherscan.io/address/0x0000000000008de57636b43B33b2d6007Df5576e#code)
Dagon deployments are generated as [efficient create2 addresses](https://medium.com/coinmonks/on-efficient-ethereum-addresses-3fef0596e263) through the [canonical create2 factory](https://etherscan.io/address/0x0000000000ffe8b47b3e2130213b802212439497#code). As such they share the same exact address and code on every blockchain.

## Premise

Expand Down
2 changes: 2 additions & 0 deletions docs/src/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@
- [Dagon](src/Dagon.sol/contract.Dagon.md)
- [IAuth](src/Dagon.sol/interface.IAuth.md)
- [IOwnable](src/Dagon.sol/interface.IOwnable.md)
- [Summoner](src/Summoner.sol/contract.Summoner.md)
- [IAccounts](src/Summoner.sol/interface.IAccounts.md)
2 changes: 1 addition & 1 deletion docs/src/src/Dagon.sol/contract.Dagon.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Dagon
[Git Source](https://github.com/Moloch-Mystics/dagon/blob/b2989fed9dbd3d5acc65a68f3f1f2d0fe58b892b/src/Dagon.sol)
[Git Source](https://github.com/Moloch-Mystics/dagon/blob/efc921a89c26d7bf4ef258e73ffcf64e1bdef80a/src/Dagon.sol)

**Inherits:**
ERC6909
Expand Down
2 changes: 1 addition & 1 deletion docs/src/src/Dagon.sol/interface.IAuth.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# IAuth
[Git Source](https://github.com/Moloch-Mystics/dagon/blob/b2989fed9dbd3d5acc65a68f3f1f2d0fe58b892b/src/Dagon.sol)
[Git Source](https://github.com/Moloch-Mystics/dagon/blob/efc921a89c26d7bf4ef258e73ffcf64e1bdef80a/src/Dagon.sol)

Simple authority interface for contracts.

Expand Down
2 changes: 1 addition & 1 deletion docs/src/src/Dagon.sol/interface.IOwnable.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# IOwnable
[Git Source](https://github.com/Moloch-Mystics/dagon/blob/b2989fed9dbd3d5acc65a68f3f1f2d0fe58b892b/src/Dagon.sol)
[Git Source](https://github.com/Moloch-Mystics/dagon/blob/efc921a89c26d7bf4ef258e73ffcf64e1bdef80a/src/Dagon.sol)

Simple ownership interface for handover requests.

Expand Down
2 changes: 2 additions & 0 deletions docs/src/src/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@
- [Dagon](Dagon.sol/contract.Dagon.md)
- [IAuth](Dagon.sol/interface.IAuth.md)
- [IOwnable](Dagon.sol/interface.IOwnable.md)
- [Summoner](Summoner.sol/contract.Summoner.md)
- [IAccounts](Summoner.sol/interface.IAccounts.md)
4 changes: 2 additions & 2 deletions docs/src/src/Summoner.sol/contract.Summoner.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Summoner
[Git Source](https://github.com/Moloch-Mystics/dagon/blob/3c50a9b175611229baf44017b0ba4f798e0515cb/src/Summoner.sol)
[Git Source](https://github.com/Moloch-Mystics/dagon/blob/efc921a89c26d7bf4ef258e73ffcf64e1bdef80a/src/Summoner.sol)

Simple summoner for Dagon (π’€­) group accounts.

Expand All @@ -8,7 +8,7 @@ Simple summoner for Dagon (π’€­) group accounts.
### DAGON

```solidity
address internal constant DAGON = 0x0000000000001D4B1320bB3c47380a3D1C3A1A0C;
address internal constant DAGON = 0x0000000000001ADDcB933DD5028159dc965b5b7f;
```


Expand Down
2 changes: 1 addition & 1 deletion docs/src/src/Summoner.sol/interface.IAccounts.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# IAccounts
[Git Source](https://github.com/Moloch-Mystics/dagon/blob/3c50a9b175611229baf44017b0ba4f798e0515cb/src/Summoner.sol)
[Git Source](https://github.com/Moloch-Mystics/dagon/blob/efc921a89c26d7bf4ef258e73ffcf64e1bdef80a/src/Summoner.sol)

*Simple interface for Nani (π’€­) user account creation and setup.*

Expand Down
2 changes: 1 addition & 1 deletion lib/accounts
Submodule accounts updated 58 files
+36 βˆ’23 .gas-snapshot
+9 βˆ’4 README.md
+545 βˆ’555 abi/Account.json
+122 βˆ’122 abi/Accounts.json
+226 βˆ’150 abi/JointValidator.json
+234 βˆ’0 abi/Keys.json
+749 βˆ’0 abi/NEETH.json
+127 βˆ’0 abi/Paymaster.json
+420 βˆ’0 abi/PaymentValidator.json
+661 βˆ’0 abi/PermitValidator.json
+2 βˆ’2 abi/Points.json
+13 βˆ’0 abi/RecoveryValidator.json
+169 βˆ’0 abi/TimeValidator.json
+5 βˆ’2 docs/src/README.md
+1 βˆ’1 docs/src/SUMMARY.md
+1 βˆ’1 docs/src/src/Account.sol/contract.Account.md
+1 βˆ’1 docs/src/src/Accounts.sol/contract.Accounts.md
+1 βˆ’1 docs/src/src/authority/Auth.sol/contract.Auth.md
+1 βˆ’1 docs/src/src/governance/Points.sol/contract.Points.md
+1 βˆ’1 docs/src/src/governance/Points.sol/interface.IERC1271.md
+1 βˆ’1 docs/src/src/governance/Points.sol/interface.IERC20.md
+0 βˆ’1 docs/src/src/governance/README.md
+1 βˆ’1 docs/src/src/governance/Token.sol/contract.Token.md
+1 βˆ’1 docs/src/src/governance/Words.sol/contract.Words.md
+1 βˆ’1 docs/src/src/ownership/Keys.sol/contract.Keys.md
+1 βˆ’1 docs/src/src/ownership/Keys.sol/interface.IAuth.md
+1 βˆ’1 docs/src/src/ownership/Keys.sol/interface.IOwnable.md
+1 βˆ’1 docs/src/src/paymasters/NEETH.sol/contract.NEETH.md
+1 βˆ’1 docs/src/src/paymasters/NEETH.sol/interface.IEntryPoint.md
+1 βˆ’1 docs/src/src/paymasters/NEETH.sol/interface.ISwapRouter.md
+20 βˆ’43 docs/src/src/paymasters/Paymaster.sol/contract.Paymaster.md
+1 βˆ’0 docs/src/src/paymasters/README.md
+1 βˆ’1 docs/src/src/utils/NEETH.sol/contract.NEETH.md
+1 βˆ’1 docs/src/src/validators/JointValidator.sol/contract.JointValidator.md
+14 βˆ’9 docs/src/src/validators/PaymentValidator.sol/contract.PaymentValidator.md
+1 βˆ’1 docs/src/src/validators/PaymentValidator.sol/interface.IERC20.md
+45 βˆ’1 docs/src/src/validators/PermitValidator.sol/contract.PermitValidator.md
+1 βˆ’1 docs/src/src/validators/PermitValidator.sol/interface.IExecutor.md
+10 βˆ’1 docs/src/src/validators/RecoveryValidator.sol/contract.RecoveryValidator.md
+1 βˆ’1 docs/src/src/validators/RecoveryValidator.sol/interface.ITransferOwnership.md
+1 βˆ’1 docs/src/src/validators/TimeValidator.sol/contract.TimeValidator.md
+1 βˆ’1 docs/src/src/validators/TimeValidator.sol/interface.IOwner.md
+1 βˆ’1 lib/forge-std
+1 βˆ’1 lib/solady
+0 βˆ’42 src/governance/Words.sol
+6 βˆ’8 src/ownership/Keys.sol
+130 βˆ’0 src/paymasters/Paymaster.sol
+18 βˆ’15 src/validators/PaymentValidator.sol
+63 βˆ’7 src/validators/PermitValidator.sol
+15 βˆ’6 src/validators/RecoveryValidator.sol
+1 βˆ’1 src/validators/TimeValidator.sol
+1 βˆ’1 test/Account.t.sol
+2 βˆ’28 test/governance/Points.t.sol
+1 βˆ’1 test/ownership/Keys.t.sol
+1 βˆ’1 test/validators/JointValidator.t.sol
+444 βˆ’0 test/validators/PaymentValidator.t.sol
+1 βˆ’50 test/validators/PermitValidator.t.sol
+8 βˆ’247 test/validators/RecoveryValidator.t.sol
Empty file modified scripts/initCodeHash.sh
100644 β†’ 100755
Empty file.
76 changes: 76 additions & 0 deletions src/Summoner.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
// α—ͺα—©GOα‘Ž π’€­ π’€­ π’€­ π’€­ π’€­ π’€­ π’€­ π’€­ π’€­ π’€­ π’€­
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity ^0.8.24;

/// @notice Simple summoner for Dagon (π’€­) group accounts.
/// @custom:version 1.0.0
contract Summoner {
address internal constant DAGON = 0x0000000000001ADDcB933DD5028159dc965b5b7f;
IAccounts internal constant FACTORY = IAccounts(0x000000000000dD366cc2E4432bB998e41DFD47C7);

struct Ownership {
address owner;
uint96 shares;
}

enum Standard {
DAGON,
ERC20,
ERC721,
ERC1155,
ERC6909
}

function summon(Ownership[] calldata summoners, uint88 threshold, bool locked, bytes12 salt)
public
payable
returns (IAccounts account)
{
account = IAccounts(
FACTORY.createAccount{value: msg.value}(
address(this), bytes32(abi.encodePacked(this, salt))
)
);
for (uint256 i; i != summoners.length; ++i) {
account.execute(
DAGON,
0,
abi.encodeWithSignature(
"mint(address,uint96)", summoners[i].owner, summoners[i].shares
)
);
}
if (locked) {
account.execute(DAGON, 0, abi.encodeWithSignature("setAuth(address)", address(0xdead)));
}
account.execute(DAGON, 0, abi.encodeWithSignature("setThreshold(uint88)", threshold));
account.execute(
address(account), 0, abi.encodeWithSignature("transferOwnership(address)", DAGON)
);
}

function summonForToken(address token, Standard standard, uint88 threshold, bytes12 salt)
public
payable
returns (IAccounts account)
{
account = IAccounts(
FACTORY.createAccount{value: msg.value}(
address(this), bytes32(abi.encodePacked(this, salt))
)
);
account.execute(
DAGON, 0, abi.encodeWithSignature("setToken(address,uint8)", token, standard)
);
account.execute(DAGON, 0, abi.encodeWithSignature("setThreshold(uint88)", threshold));
account.execute(
address(account), 0, abi.encodeWithSignature("transferOwnership(address)", DAGON)
);
}
}

/// @dev Simple interface for Nani (π’€­) user account creation and setup.
interface IAccounts {
function createAccount(address, bytes32) external payable returns (address);
function execute(address, uint256, bytes calldata) external payable returns (bytes memory);
}

0 comments on commit 5e8a399

Please sign in to comment.