Skip to content

Commit

Permalink
revert: add TitleEscrowCloneable (#32) (#33)
Browse files Browse the repository at this point in the history
This reverts commit a1914ef.
  • Loading branch information
superical authored Sep 27, 2021
1 parent a1914ef commit cf9a5f1
Show file tree
Hide file tree
Showing 28 changed files with 27,926 additions and 29,501 deletions.
5 changes: 4 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ workflows:
jobs:
build:
docker:
- image: 'circleci/node:14'
- image: 'circleci/node:12.13.0'
# if need to wait .. => https://support.circleci.com/hc/en-us/articles/360006773953-Race-Conditions-Wait-For-Database
- image: trufflesuite/ganache-cli:v6.12.2
command: [ganache-cli -h 0.0.0.0 -p 8545 -i 1337 -s foobar -e 100000000000000000000]
steps:
- checkout
- run:
Expand Down
7 changes: 5 additions & 2 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"parser": "@babel/eslint-parser",
"parser": "babel-eslint",
"extends": ["airbnb-base", "plugin:prettier/recommended"],
"env": {
"jest": true
Expand All @@ -12,7 +12,10 @@
}
},
"globals": {
"ethers": "writable"
"artifacts": "readonly",
"contract": "readonly",
"assert": "readonly",
"web3": "writable"
},
"rules": {
"import/extensions": "off",
Expand Down
6 changes: 1 addition & 5 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,4 @@ yarn-error.log
/src/contracts
/dist
/build
/types
/cache
/artifacts
/contracts/artifacts
/contracts/.deps
/types
4 changes: 1 addition & 3 deletions .solhint.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
"extends": ["solhint:recommended"],
"plugins": ["prettier"],
"rules": {
"indent": ["error", 2],
"compiler-version": ["error", "^0.8.0"],
"func-visibility": ["warn",{"ignoreConstructors": true}]
"indent": ["error", 2]
}
}
57 changes: 35 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,33 +37,37 @@ The contract supports [all ERC721 methods](http://erc721.org/)

### TitleEscrow

The TradeTrustErc721 Token Registry will clone a new TitleEscrow internally when minting or restoring titles.
Deploying new TitleEscrow

#### Minting Title Escrow
```ts
import { TradeTrustErc721Factory } from "@govtechsg/token-registry";

const connectedRegistry = TradeTrustErc721Factory.connect(existingERC721Address, signer);
const tx = await connectedRegistry.mintTitle(beneficiaryAddress, holderAddress, tokenId);
````

#### Restoring Title Escrow
```ts
import { TradeTrustErc721Factory } from "@govtechsg/token-registry";
import {TitleEscrowFactory} from "@govtechsg/token-registry";

const connectedRegistry = TradeTrustErc721Factory.connect(existingERC721Address, signer);
const tx = await connectedRegistry.restoreTitle(beneficiaryAddress, holderAddress, existingTokenId);
````
const factory = new TitleEscrowFactory(signer1);
const escrowInstance = await factory.deploy(tokenRegistry.address, account1, account2);
```

#### Connecting to an existing TitleEscrow on Ethereum
Connecting to existing TitleEscrow on Ethereum

```ts
import {TitleEscrowFactory} from "@govtechsg/token-registry";

const connectedEscrow = TitleEscrowFactory.connect(existingTitleEscrowAddress, signer1);
```

For list of available functions on TitleEscrow simply check the type definitions as they are automatically generated using typechain.
List of available functions on TitleEscrow

```text
_tokenId
approvedTransferTarget
beneficiary
holder
status
supportsInterface
tokenRegistry
changeHolder
endorseTransfer
transferTo
```

## Provider & Signer

Expand All @@ -85,16 +89,25 @@ const signerFromMnemonic = Wallet.fromMnemonic("MNEMONIC-HERE");
signerFromMnemonic.connect(provider);
```


# Development
This repository's development framework uses (HardHat)[https://hardhat.org/getting-started/].

Tests are run using `npm run test`, more development tasks can be found in the package.json scripts.
## Setup

```sh
npm install
npm lint
npm test
npx hardhat <command>
npm truffle <command>
```

## Notes

If you are using vscode, you may need to link the openzeppelin libraries. See https://github.com/juanfranblanco/vscode-solidity#openzeppelin

if you are trying to run tests locally, install truffle globally and then do execute these commands within the project dir.
```sh
truffle develop
```
once the development blockchain is spun up, the interactive console should look like this:
```
truffle(develop)>
```
at the prompt type test
83 changes: 0 additions & 83 deletions contracts/Clones.sol

This file was deleted.

Loading

0 comments on commit cf9a5f1

Please sign in to comment.