Skip to content

Commit

Permalink
chore: update readme, add license
Browse files Browse the repository at this point in the history
  • Loading branch information
petejkim committed Mar 3, 2022
1 parent 7b1222a commit 2297bcd
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 82 deletions.
13 changes: 13 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Copyright 2022 Coinbase, Inc.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
105 changes: 25 additions & 80 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,38 +1,31 @@
# Solidity Template

My favorite setup for writing Solidity smart contracts.

- [Hardhat](https://github.com/nomiclabs/hardhat): compile and run the smart
contracts on a local development network
- [TypeChain](https://github.com/ethereum-ts/TypeChain): generate TypeScript
types for smart contracts
- [Ethers](https://github.com/ethers-io/ethers.js/): renowned Ethereum library
and wallet implementation
- [Waffle](https://github.com/EthWorks/Waffle): tooling for writing
comprehensive smart contract tests
- [Solhint](https://github.com/protofire/solhint): linter
- [Solcover](https://github.com/sc-forks/solidity-coverage): code coverage
- [Prettier Plugin Solidity](https://github.com/prettier-solidity/prettier-plugin-solidity):
code formatter

This is a GitHub template, which means you can reuse it as many times as you
want. You can do that by clicking the "Use this template" button at the top of
the page.
# Coinbase Offchain Resolver

## Usage

### Pre Requisites

Before running any command, you need to create a `.env` file and set a BIP-39
compatible mnemonic as an environment variable. Follow the example in
`.env.example`. If you don't already have a mnemonic, use this
[website](https://iancoleman.io/bip39/) to generate one.
```
Client Offchain Resolver Contract Gateway
| resolve(dnsname, lookup) | |
|-------------------------------------------->| |
| | |
| error: OffchainLookup(addr, url, data, ...) | |
|<--------------------------------------------| |
| | |
| | GET /{addr}/{data} |
|---------------------------------------------------------------------->|
| | |
| response: (result, expires, sig) | |
|<----------------------------------------------------------------------|
| | |
| resolveWithProof(response, data) | |
|-------------------------------------------->| |
| | |
| result (or an error if invalid) | |
|<--------------------------------------------| |
| | |
```

Then, proceed with installing dependencies:
Please refer to the tests for `.resolve` and `.resolveWithProof` in
`CoinbaseResolver.test.ts` to learn more about how this works.

```sh
yarn install
```
## Usage

### Compile

Expand Down Expand Up @@ -73,51 +66,3 @@ Run the Mocha tests:
```sh
$ yarn test
```

### Coverage

Generate the code coverage report:

```sh
$ yarn coverage
```

### Report Gas

See the gas usage per unit test and average gas per method call:

```sh
$ REPORT_GAS=true yarn test
```

### Clean

Delete the smart contract artifacts, the coverage reports and the Hardhat cache:

```sh
$ yarn clean
```

### Deploy

Deploy the contracts to Hardhat Network:

```sh
$ yarn deploy --greeting "Bonjour, le monde!"
```

## Syntax Highlighting

If you use VSCode, you can enjoy syntax highlighting for your Solidity code via
the [vscode-solidity](https://github.com/juanfranblanco/vscode-solidity)
extension. The recommended approach to set the compiler version is to add the
following fields to your VSCode user settings:

```json
{
"solidity.compileUsingRemoteVersion": "v0.8.4+commit.c7e474f2",
"solidity.defaultCompiler": "remote"
}
```

Where of course `v0.8.4+commit.c7e474f2` can be replaced with any other version.
2 changes: 1 addition & 1 deletion contracts/CoinbaseResolver.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-License-Identifier: MIT
// SPDX-License-Identifier: Apache-2.0

pragma solidity 0.8.12;

Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "minting",
"name": "coinbase-ens-contract",
"private": true,
"license": "Apache-2.0",
"version": "1.0.0",
"devDependencies": {
"@codechecks/client": "^0.1.12",
Expand Down

0 comments on commit 2297bcd

Please sign in to comment.