forked from Sol-DAO/solbase
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
07d6272
commit 538f3a8
Showing
13 changed files
with
587 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Basic build/test configuration. | ||
export DAPP_SOLC_VERSION=0.8.6 | ||
export DAPP_BUILD_OPTIMIZE=1 | ||
export DAPP_BUILD_OPTIMIZE_RUNS=1000000000 | ||
export DAPP_LINK_TEST_LIBRARIES=0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
*.sol linguist-language=Solidity | ||
.dapprc linguist-language=Shell |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
name: Tests | ||
|
||
on: [push, pull_request] | ||
|
||
jobs: | ||
tests: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-node@v2 | ||
- uses: cachix/install-nix-action@v13 | ||
- uses: cachix/cachix-action@v10 | ||
with: | ||
name: dapp | ||
|
||
- name: Install dependencies | ||
run: nix-shell --run 'make' | ||
|
||
- name: Run tests | ||
run: nix-shell --run 'dapp test' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
/out | ||
/node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"solidity.packageDefaultDependenciesContractsDirectory": "src", | ||
"solidity.packageDefaultDependenciesDirectory": "lib", | ||
"solidity.compileUsingRemoteVersion": "v0.8.6", | ||
"files.associations": { | ||
".dapprc": "shellscript" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# Install, update, build and test everything. | ||
all: solc install update | ||
# Install proper solc version. | ||
solc:; nix-env -f https://github.com/dapphub/dapptools/archive/master.tar.gz -iA solc-static-versions.solc_0_8_6 | ||
# Install npm dependencies. | ||
install:; npm install | ||
# Install dapp dependencies. | ||
update:; dapp update |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"name": "@rari-capital/dappsys", | ||
"version": "1.0.0", | ||
"description": "Rari Capital's modern fork of some key Dappsys contracts.", | ||
"files": [ | ||
"src/**/*.sol" | ||
], | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/Rari-Capital/dappsys.git" | ||
}, | ||
"devDependencies": { | ||
"prettier": "^2.3.1", | ||
"prettier-plugin-solidity": "^1.0.0-beta.13" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
// SPDX-License-Identifier: GPL-3.0-only | ||
pragma solidity >=0.4.23; | ||
|
||
import "./DSAuthority.sol"; | ||
|
||
/// @notice Provides a flexible and updatable auth pattern which is completely separate from application logic. | ||
abstract contract DSAuth { | ||
event LogSetAuthority(address indexed authority); | ||
event LogSetOwner(address indexed owner); | ||
|
||
DSAuthority public authority; | ||
address public owner; | ||
|
||
constructor() { | ||
owner = msg.sender; | ||
emit LogSetOwner(msg.sender); | ||
} | ||
|
||
function setOwner(address owner_) external auth { | ||
owner = owner_; | ||
emit LogSetOwner(owner); | ||
} | ||
|
||
function setAuthority(DSAuthority authority_) external auth { | ||
authority = authority_; | ||
emit LogSetAuthority(address(authority)); | ||
} | ||
|
||
modifier auth() { | ||
require(isAuthorized(msg.sender, msg.sig), "ds-auth-unauthorized"); | ||
_; | ||
} | ||
|
||
function isAuthorized(address src, bytes4 sig) internal view returns (bool) { | ||
if (src == address(this)) { | ||
return true; | ||
} else if (src == owner) { | ||
return true; | ||
} else if (authority == DSAuthority(address(0))) { | ||
return false; | ||
} else { | ||
return authority.canCall(src, address(this), sig); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// SPDX-License-Identifier: GPL-3.0-only | ||
pragma solidity >=0.4.23; | ||
|
||
/// @notice A generic interface for a contract which provides authorization data to a DSAuth instance. | ||
interface DSAuthority { | ||
function canCall( | ||
address src, | ||
address dst, | ||
bytes4 sig | ||
) external view returns (bool); | ||
} |
Oops, something went wrong.