Skip to content
Draft
Show file tree
Hide file tree
Changes from 10 commits
Commits
Show all changes
91 commits
Select commit Hold shift + click to select a range
c44d554
rename previous contracts folder to -old, create new contracts package
seansing9 Jul 26, 2024
998ff58
update readme
seansing9 Jul 26, 2024
4ab4595
add draft docker files
seansing9 Jul 26, 2024
a8b4391
add asset transfer functions to smart wallet
seansing9 Jul 29, 2024
1de4c7d
update smart wallet to import interfaces manually
seansing9 Jul 29, 2024
7295d03
update config, package.json
seansing9 Jul 30, 2024
1d5bb29
added wip contracts-sdk-new package
seansing9 Aug 12, 2024
5d6e038
merged develop
seansing9 Aug 12, 2024
d9c6162
update contracts, and new contracts-sdk
seansing9 Aug 19, 2024
1a9e35d
update contracts, added unit test read me for smart wallet factory, u…
seansing9 Aug 22, 2024
3db67f8
removed typechain-types folder, add gitignore
seansing9 Aug 27, 2024
434fae0
p256 additions
TtheBC01 Oct 6, 2024
46f08bf
updates to smart wallet
TtheBC01 Oct 7, 2024
f5bf1b6
update
TtheBC01 Oct 7, 2024
7b6d88c
argument consolidation
TtheBC01 Oct 8, 2024
beda889
fix spellings
seansing Oct 8, 2024
9f8a653
update wallet factory contract
seansing Oct 8, 2024
c33d2fd
update wallet factory contract quote claim
seansing Oct 8, 2024
adc3c39
update wallet factory contract claim functions
seansing Oct 8, 2024
8ce35f7
add getter for deployedSnickerdoodleWalletAddressToOwner mapping to r…
seansing Oct 8, 2024
6122724
start unit tests
TtheBC01 Oct 9, 2024
9f9b142
update unit test and config to use ethers
seansing Oct 9, 2024
7d640c7
update comments
seansing Oct 9, 2024
d29c5e5
first unit test
TtheBC01 Oct 9, 2024
46f9858
update to tests
TtheBC01 Oct 9, 2024
345a029
new unit tests for snickerdoodle wallet
TtheBC01 Oct 9, 2024
ec49045
bug fix smart wallet
TtheBC01 Oct 9, 2024
eb17ced
created stand alone struct contract for cleaner function interfaces
TtheBC01 Oct 10, 2024
c4868ed
added mock erc20 token
TtheBC01 Oct 10, 2024
71eb16d
updated testnet readme file, smartwalletfactory tasks to ethers, add …
seansing9 Oct 10, 2024
db7bf3f
updated testnet readme file using base sepolia
seansing9 Oct 11, 2024
ac4b219
new operator gateway contract plus erc7529 contracts
TtheBC01 Oct 14, 2024
33caa75
fixed compile error
TtheBC01 Oct 14, 2024
4fbbefd
added operator factory methods
TtheBC01 Oct 15, 2024
ed92b1d
make factory upgradeable, included upgradeable OApp contracts
seansing9 Oct 15, 2024
7b98163
update comments for required function implementations
seansing9 Oct 15, 2024
29c8f2d
add contract size reporter, transparent proxies module
seansing9 Oct 15, 2024
c2e59a9
add stoage to oappreceiver and sender
seansing9 Oct 15, 2024
1086102
merge
TtheBC01 Oct 15, 2024
d1d36f7
Merge branch 'feature/new-contracts-package' of https://github.com/Sn…
TtheBC01 Oct 15, 2024
41d33d3
new ignition modules and some refactoring of the factory
TtheBC01 Oct 16, 2024
fb78553
fixed some bugs in ignition modules
TtheBC01 Oct 16, 2024
5422994
bootstrapped some tests and more fixes to ignition modules
TtheBC01 Oct 16, 2024
f2ae1f1
fix bug (missed Ownable init), update 'claim' to 'reserve'
seansing9 Oct 16, 2024
5061c4b
WIP update hardhat tasks and testnet testing README
seansing9 Oct 16, 2024
1741dc8
fix typo
seansing9 Oct 16, 2024
415a52c
small refactor from names to usernames
TtheBC01 Oct 16, 2024
27b1c4f
Merge branch 'feature/new-contracts-package' of https://github.com/Sn…
TtheBC01 Oct 16, 2024
881c8cf
tweaks on usernames and helper function in ignition modules
TtheBC01 Oct 17, 2024
0b2467f
added EndpointV2Mock to pass tests of LZ0 contracts
TtheBC01 Oct 17, 2024
92f09d5
first test on SnickerdoodleFactory.sol
TtheBC01 Oct 17, 2024
6df9e4c
update receiving address for wallet message's _lzSend(), add module f…
seansing9 Oct 17, 2024
f7db6fb
add todo comment to operator gateway
seansing9 Oct 17, 2024
6eff4ed
wip debugging
seansing9 Oct 18, 2024
b5a1c41
update to contract tests
TtheBC01 Oct 19, 2024
7f52f80
Merge branch 'feature/new-contracts-package' of https://github.com/Sn…
TtheBC01 Oct 19, 2024
deca81b
fixed factory tests
TtheBC01 Oct 19, 2024
9135a2d
refactor to send operator and wallet hashes over Layer0
TtheBC01 Oct 20, 2024
7545de8
fixed contract, updated readme with working testnet flow
seansing9 Oct 20, 2024
52d3a31
merged feature/new-contracts-package
seansing9 Oct 20, 2024
b5c027b
wallets initializer takes a p256key array
TtheBC01 Oct 21, 2024
ad13810
Merge branch 'feature/new-contracts-package' of https://github.com/Sn…
TtheBC01 Oct 21, 2024
2fc5d1f
fixed factory test
TtheBC01 Oct 21, 2024
97b3862
wallet init now takes p256 array and updates hash on new wallets
TtheBC01 Oct 22, 2024
261670b
added gas reporter, replaced tmp contracts with OZ 5.1.0, update test…
seansing9 Oct 22, 2024
c2d3022
clean up hardhat tasks
seansing9 Oct 22, 2024
53d6fce
fix spellings
seansing9 Oct 22, 2024
da3d441
add getters, natspec params, update version
seansing9 Oct 23, 2024
39db5e9
fix bug for adding evm account, add test to check for it, update test…
seansing9 Oct 23, 2024
3e1e375
update operator hash implemented
TtheBC01 Oct 25, 2024
ffea15b
first missing override
TtheBC01 Oct 25, 2024
82d67e7
formatting
TtheBC01 Oct 25, 2024
1bb3bbd
initialize SmartClearinghouse contract
TtheBC01 Oct 25, 2024
e9843b4
rename AuthenticatorData to P256VerificationData
seansing9 Oct 25, 2024
43f21ac
first pass at clearinghouse contract
TtheBC01 Oct 26, 2024
494d80c
Merge branch 'feature/new-contracts-package' of https://github.com/Sn…
TtheBC01 Oct 26, 2024
8e870d0
add getter
seansing9 Oct 28, 2024
7974c19
update docker scripts, add module for lzendpointv2mock
seansing9 Oct 29, 2024
4ea2c62
add comment to dockerfile
seansing9 Oct 29, 2024
6cdfe8b
new execute method for wallet, removed domain arg in factory
TtheBC01 Oct 30, 2024
f2e0acd
Merge branch 'feature/new-contracts-package' of https://github.com/Sn…
TtheBC01 Oct 30, 2024
a8689ca
finish merge
TtheBC01 Oct 30, 2024
31b465c
added missing authorize function
TtheBC01 Oct 30, 2024
a8b62f8
added funds transfer function
TtheBC01 Oct 30, 2024
420b3e6
fix comments, add missing adminAccounts param when hashing on destin…
seansing9 Oct 30, 2024
7f31f09
add unit test to test execute function
seansing9 Oct 30, 2024
d9bd4a6
remove .only
seansing9 Oct 30, 2024
1e9e67d
add EOA check to operator initalize
seansing9 Oct 30, 2024
26a4ae8
refactor _verifyP256
TtheBC01 Oct 30, 2024
27b6235
tweak _verifyP256
TtheBC01 Oct 30, 2024
35d2b7c
added helper function to look up wallet addresses
TtheBC01 Oct 30, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@
"@glazed/devtools": "^0.2.0",
"@google-cloud/storage": "^6.7.0",
"@jest/types": "^29.0.3",
"@layerzerolabs/lz-evm-oapp-v2": "^2.3.33",
"@nomicfoundation/hardhat-chai-matchers": "^2.0.0",
"@nomicfoundation/hardhat-ethers": "^3.0.0",
"@nomicfoundation/hardhat-network-helpers": "^1.0.0",
Expand Down
1 change: 1 addition & 0 deletions packages/contracts-old/.env-sample
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
MNEMONIC =
23 changes: 23 additions & 0 deletions packages/contracts-old/DEPLOYMENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Contract Deployment Addresses

You can check for any contract associated w/ snickerdoodle.com at [erc7529.snickerdoodle.com](https://erc7529.snickerdoodle.com/).

## `snickerdoodlelabs/devchain:0.1.2`

Local blockchain created by running the `snickerdoodlelabs/devchain` docker image with the `dev` flag enabled.

- Protocol Token: `0x9fE46736679d2D9a65F0992F2272dE9f3c7fa6e0`
- Consent Contract Implementation: `0x5FbDB2315678afecb367f032d93F642f64180aa3`
- Consent Factory: `0xDc64a140Aa3E981100a9becA4E685f962f0cF6C9`
- Questionnaires Contract: `0x0165878A594ca255338adfa4d48449f69242Eb8F`

## Fuji Network

Official Avalanche Testnet:

- Protocol Token: `0x73F4391c2669f79F15480d3e2Bb22e0792c682bE`
- Consent Contract Implementation: `0xF6E4d9fA6d35bf45AF9DaDb4931B7499B9De04fC`
- Consent Factory: `0x5b6c961538E65b6EaCaf09Ec8E93D5f5f1d1afcC`
- Questionnaires Contract: `0x692F3657c24B91Cb8516b9622b1F271E03cBcEC9`
- Timelock Controller: `TBD`
- Governor Contract: `TBD`
16 changes: 16 additions & 0 deletions packages/contracts-old/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
FROM node:18-slim

# we need tmux for background sessions and curl for fetching avalanche tools
RUN apt update -y \
&& apt install -y vim tmux curl git

WORKDIR /root

# copy the contracts package into the working directory
COPY . .

# install contracts package dependencies
RUN npm install
RUN npm install -D @nomicfoundation/hardhat-toolbox solidity-coverage dotenv

ENTRYPOINT [ "/bin/bash", "entrypoint.sh" ]
File renamed without changes.
75 changes: 75 additions & 0 deletions packages/contracts-old/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
![Contracts](https://github.com/SnickerdoodleLabs/Snickerdoodle-Theme-Light/blob/main/snickerdoodle_horizontal_notab.png?raw=true)

# Snickerdoodle Protocol Contracts Package

## Package Contents

- [contracts](/packages/contracts/contracts/): Subdirectory containing all Snickerdoodle Protocol smart contracts
- [docs](/packages/contracts/docs/): Auto-generated API documentation of public and external contract methods
- [scripts](/packages/contracts/scripts/): Hardhat [scripts](https://hardhat.org/guides/scripts.html) for deploying different configurations of the smart contract stack
- [subnets](/packages/contracts/subnets/): A subdirectory containing configurations for launching local, testnet, and mainnet [Avalanche Subnets](https://docs.avax.network/subnets)
- [tasks](/packages/contracts/tasks/): Hardhat [task definitions](https://hardhat.org/guides/create-task.html) for interacting with smart contract deployments
- [test](/packages/contracts/test/): Hardhat [unit tests](https://hardhat.org/guides/waffle-testing.html) for the Snickerdoodle Protocol smart contract stack
- [hardhat.config.js](/packages/contracts/hardhat.config.js): [Configuration file](https://hardhat.org/config/) for the Hardhat development framework

## Summary

The Snickerdoodle Contracts stack consists of the following primary components:

### [consent](/packages/contracts/contracts/consent/README.md)

Contains an upgradable EIP721 compatible NFT implementation and an associated contract factory.

### [token](/packages/contracts/contracts/token/README.md)

Contains an EIP20 compatible token, wrapper token (for subnet deployments), and a vesting contract.

### [registry](/packages/contracts/contracts/registry/README.md)

Contains an EIP721 compatible registry contract for storing Snickerdoodle account recovery details.

### [governance](/packages/contracts/contracts/governance/README.md)

Contains the implementation of the Snickerdoodle Protocol governance DAO.

### Install Dependencies

Steps to install and run this project this locally:

```shell
git clone https://github.com/SnickerdoodleLabs/protocol.git
cd protocol
yarn install
```

### Compiling Contracts

Use Hardhat to compile the protocol contracts like this:

```shell
cd /packages/contracts
yarn compile
yarn test
```

This command will create a subdirectory called `artifacts` which will contain the contract [ABI](https://docs.soliditylang.org/en/v0.8.13/abi-spec.html) and bytecode for all contracts in the `contracts` subdirectory.

### Docker

A pre-built docker image for local development against the contract stack is available at
[`snickerdoodlelabs/devchain`](https://hub.docker.com/repository/docker/snickerdoodlelabs/devchain).
Run a local subnet like this:

```shell
docker run -d -p 8545:8545 --rm snickerdoodlelabs/devchain
```

Run a [Hardhat node](https://hardhat.org/hardhat-network/docs/overview) like this:

```shell
docker run -d -p 8569:8569 --name devchain --rm --env NETWORK=dev snickerdoodlelabs/devchain
```

## Deployment Addresses

A list of Snickerdoodle Protocol contract addresses can be found [here](/packages/contracts/DEPLOYMENTS.md).
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
// SPDX-License-Identifier: MIT
// Compatible with OpenZeppelin Contracts ^5.0.0
pragma solidity ^0.8.20;

import "@openzeppelin/contracts-upgradeable/governance/GovernorUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/governance/extensions/GovernorSettingsUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/governance/extensions/GovernorCountingSimpleUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/governance/extensions/GovernorStorageUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/governance/extensions/GovernorVotesUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/governance/extensions/GovernorVotesQuorumFractionUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/governance/extensions/GovernorTimelockControlUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";

contract SnickerdoodleGovernor is Initializable, GovernorUpgradeable, GovernorSettingsUpgradeable, GovernorCountingSimpleUpgradeable, GovernorStorageUpgradeable, GovernorVotesUpgradeable, GovernorVotesQuorumFractionUpgradeable, GovernorTimelockControlUpgradeable {
/// @custom:oz-upgrades-unsafe-allow constructor
constructor() {
_disableInitializers();
}

function initialize(IVotes _token, TimelockControllerUpgradeable _timelock)
initializer public
{
__Governor_init("SnickerdoodleGovernor");
__GovernorSettings_init(7200 /* 1 day */, 50400 /* 1 week */, 0);
__GovernorCountingSimple_init();
__GovernorStorage_init();
__GovernorVotes_init(_token);
__GovernorVotesQuorumFraction_init(4);
__GovernorTimelockControl_init(_timelock);
}

// The following functions are overrides required by Solidity.

function votingDelay()
public
view
override(GovernorUpgradeable, GovernorSettingsUpgradeable)
returns (uint256)
{
return super.votingDelay();
}

function votingPeriod()
public
view
override(GovernorUpgradeable, GovernorSettingsUpgradeable)
returns (uint256)
{
return super.votingPeriod();
}

function quorum(uint256 blockNumber)
public
view
override(GovernorUpgradeable, GovernorVotesQuorumFractionUpgradeable)
returns (uint256)
{
return super.quorum(blockNumber);
}

function state(uint256 proposalId)
public
view
override(GovernorUpgradeable, GovernorTimelockControlUpgradeable)
returns (ProposalState)
{
return super.state(proposalId);
}

function proposalNeedsQueuing(uint256 proposalId)
public
view
override(GovernorUpgradeable, GovernorTimelockControlUpgradeable)
returns (bool)
{
return super.proposalNeedsQueuing(proposalId);
}

function proposalThreshold()
public
view
override(GovernorUpgradeable, GovernorSettingsUpgradeable)
returns (uint256)
{
return super.proposalThreshold();
}

function _propose(address[] memory targets, uint256[] memory values, bytes[] memory calldatas, string memory description, address proposer)
internal
override(GovernorUpgradeable, GovernorStorageUpgradeable)
returns (uint256)
{
return super._propose(targets, values, calldatas, description, proposer);
}

function _queueOperations(uint256 proposalId, address[] memory targets, uint256[] memory values, bytes[] memory calldatas, bytes32 descriptionHash)
internal
override(GovernorUpgradeable, GovernorTimelockControlUpgradeable)
returns (uint48)
{
return super._queueOperations(proposalId, targets, values, calldatas, descriptionHash);
}

function _executeOperations(uint256 proposalId, address[] memory targets, uint256[] memory values, bytes[] memory calldatas, bytes32 descriptionHash)
internal
override(GovernorUpgradeable, GovernorTimelockControlUpgradeable)
{
super._executeOperations(proposalId, targets, values, calldatas, descriptionHash);
}

function _cancel(address[] memory targets, uint256[] memory values, bytes[] memory calldatas, bytes32 descriptionHash)
internal
override(GovernorUpgradeable, GovernorTimelockControlUpgradeable)
returns (uint256)
{
return super._cancel(targets, values, calldatas, descriptionHash);
}

function _executor()
internal
view
override(GovernorUpgradeable, GovernorTimelockControlUpgradeable)
returns (address)
{
return super._executor();
}
}
9 changes: 9 additions & 0 deletions packages/contracts-old/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash

tmux new -d -s hardhat npx hardhat node

# deploy the scripts to the running instance
npx hardhat run scripts/deploy-factory-and-consent.cts --network localhost

# keeps main thread of execution from exiting
tail -f /dev/null
46 changes: 46 additions & 0 deletions packages/contracts-old/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{
"name": "@snickerdoodlelabs/contracts",
"version": "1.0.1",
"description": "Smart contracts for the Snickerdoodle Protocol",
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/SnickerdoodleLabs/SDL-Contracts"
},
"files": [
"contracts/",
"artifacts/"
],
"scripts": {
"compile": "npx hardhat compile",
"test": "npx hardhat test",
"script": "npx hardhat run",
"dockerize": "docker build -t snickerdoodlelabs/devchain:0.1.3 -f Dockerfile --progress=plain .",
"docker-push": "docker push snickerdoodlelabs/devchain:0.1.2",
"redocgen": "npx hardhat clean && npx hardhat compile && npx hardhat docgen && node scripts/docgenTitleFix.js"
},
"type": "commonjs",
"dependencies": {
"@openzeppelin/contracts": "^5.0.2",
"@openzeppelin/contracts-upgradeable": "^5.0.2",
"@prb/math": "^4.0.2",
"@snickerdoodlelabs/erc7529": "workspace:^",
"dotenv": "^16.0.1",
"fs": "^0.0.1-security",
"it-all": "^1.0.6",
"solidity-coverage": "^0.7.21",
"solidity-docgen": "^0.6.0-beta.16"
},
"devDependencies": {
"@nomicfoundation/hardhat-chai-matchers": "^2.0.0",
"@nomicfoundation/hardhat-ethers": "^3.0.0",
"@nomicfoundation/hardhat-network-helpers": "^1.0.0",
"@nomicfoundation/hardhat-verify": "^2.0.0",
"@openzeppelin/hardhat-upgrades": "^3.0.4",
"hardhat": "^2.21.0",
"hardhat-contract-sizer": "^2.10.0",
"hardhat-gas-reporter": "^1.0.10",
"ts-node": "^10.8.0",
"typescript": "^5.2.2"
}
}
5 changes: 5 additions & 0 deletions packages/contracts-old/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"compilerOptions": {
"module": "CommonJS"
}
}
Loading