Skip to content

Commit

Permalink
Merge pull request #277 from DXgovernance/v2.0
Browse files Browse the repository at this point in the history
dxdao-contracts v2.0
  • Loading branch information
AugustoL authored Mar 15, 2023
2 parents 70e9658 + bd3bf8f commit 8b42f57
Show file tree
Hide file tree
Showing 210 changed files with 42,886 additions and 30,760 deletions.
3 changes: 2 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
coverage
coverage
docs
4 changes: 4 additions & 0 deletions .gitbook.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
root: ./
structure:
readme: README.md
summary: docs/SUMMARY.md
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ name: Tests

on:
pull_request:
branches:
- develop
branches: ["**"]
push:
branches: ["**"]
workflow_dispatch:
Expand Down Expand Up @@ -36,3 +35,4 @@ jobs:
with:
coverage-file: coverage/lcov.info
minimum-coverage: 80

5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,7 @@ tags
.log/
yarn-error.log
venv/
contracts/hardhat-dependency-compiler
contracts/hardhat-dependency-compiler
types
.turbo
bytecodes
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
docs
3 changes: 2 additions & 1 deletion .solcover.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
module.exports = {
skipFiles: ["daostack/", "deploy/", "test/", "utils/"],
skipFiles: ["test/", "utils/", "hardhat-dependency-compiler/"],
istanbulReporter: ["lcov"],
configureYulOptimizer: true,
};
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -226,12 +226,16 @@ An ERC20Guild with the functionality to migrate the ERC20 voting token used, the

#### SnapshotERC20Guild

An ERC20Guild that keeps track of the voting power by saving a snapshot of the voting power each time a lock/withdraw of tokens happens. The voting power to be used on a proposal would be the one that the guild had at the moment of the proposal creation.
An ERC20Guild that keeps track of the voting power by saving a snapshot of the voting power each time a mint/burn of tokens happens. The voting power to be used on a proposal would be the one that the guild had at the moment of the proposal creation.

#### SnapshotERC20REPGuild

An ERC20Guild designed to with with a ERC20 Reputation Token, a token that is not transferable only can be minted and burned by the guild itself. Very similar to the REP token used by dxdao, this allows the guild to be used as a "mini" dxdao, a stepping stone to later growth to a governance 2.0 stack.

### Contracts Documentation

[See auto-generated solidity documentation here](/docs/SUMMARY.md)

### Utils

The smart contracts used to facilitate and automate the deployment of the DXdao.
42 changes: 42 additions & 0 deletions contracts/dao/DAOAvatar.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
// SPDX-License-Identifier: AGPL-3.0
pragma solidity ^0.8.17;

import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";

/**
* @title DAO Avatar
* @dev The avatar, representing the DAO, owned by the DAO, controls the reputation and funds of the DAO.
*/
contract DAOAvatar is OwnableUpgradeable {
/// @notice Emitted when the call was executed
event CallExecuted(address indexed to, bytes data, uint256 value, bool callSuccess, bytes callData);

receive() external payable {}

/**
* @dev Initialize the avatar contract.
* @param owner The address of the owner
*/
function initialize(address owner) public initializer {
__Ownable_init();
transferOwnership(owner);
}

/**
* @dev Perform a call to an arbitrary contract
* @param to The contract's address to call
* @param data ABI-encoded contract call to call `_to` address.
* @param value Value (ETH) to transfer with the transaction
* @return callSuccess Whether call was executed successfully or not
* @return callData Call data returned
*/
function executeCall(
address to,
bytes memory data,
uint256 value
) public onlyOwner returns (bool callSuccess, bytes memory callData) {
(callSuccess, callData) = to.call{value: value}(data);
emit CallExecuted(to, data, value, callSuccess, callData);
return (callSuccess, callData);
}
}
Loading

0 comments on commit 8b42f57

Please sign in to comment.