Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gnosis Safe bootstrap #217

Merged
merged 49 commits into from
Feb 28, 2019
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
74c7817
Add Gnosis Safe contracts repository
marcelomorgado Feb 18, 2019
60bc0b8
Move 3rd-parties to a properly directory
marcelomorgado Feb 18, 2019
e933ed7
Third parties scripts refactoring
marcelomorgado Feb 18, 2019
32373e7
GnosisSafe basic test suite
marcelomorgado Feb 18, 2019
c3e2ef2
GnosisSafe deposit test case
marcelomorgado Feb 18, 2019
b810dbd
Dry tasit-contract GnosisSafe test suite (move test cases to tasit-id…
marcelomorgado Feb 19, 2019
aac6710
Renaming GnosisSafe test suite file
marcelomorgado Feb 19, 2019
c6cfd20
Bootstraping tasit-identity-contract
marcelomorgado Feb 19, 2019
be5e2be
Transfer/Withdraw ethers test case
marcelomorgado Feb 25, 2019
88a8c91
Merge branch 'develop' into feature/gnosis-safe
marcelomorgado Feb 25, 2019
13ee3f2
Add decentraland repositories
marcelomorgado Feb 25, 2019
85eded4
Transfer/Withdraw ERC20 test case
marcelomorgado Feb 25, 2019
4060c24
Refactoring ERC20 transfer implementation
marcelomorgado Feb 25, 2019
324514a
Refactoring
marcelomorgado Feb 26, 2019
42861c9
Test case with dispatch simulation (without waiting)
marcelomorgado Feb 26, 2019
67e0d66
Initial test cases for Gnosis Safe on identity-contract package
marcelomorgado Feb 27, 2019
20cf5e4
Move unit test helpers to tasit-action
marcelomorgado Feb 27, 2019
2885b14
Refactoring tasit-action test suites to use global hooks
marcelomorgado Feb 27, 2019
71fd4f2
Refactoring tasit-account test suites to use global hooks
marcelomorgado Feb 27, 2019
7b7f929
Refactoring tasit-identity-contract test suites to use global hooks
marcelomorgado Feb 27, 2019
efac39a
Forcing blockchain state reversion between test cases & suites
marcelomorgado Feb 27, 2019
419829a
Dry ropsten test suite
marcelomorgado Feb 27, 2019
d5abde3
Comment extra gas usage
marcelomorgado Feb 27, 2019
8ba8af5
Move accounts creation to helper
marcelomorgado Feb 27, 2019
9b8697e
Change Gnosis Safe owner
marcelomorgado Feb 28, 2019
cfa2d41
Fix test suite
marcelomorgado Feb 28, 2019
1518352
resolve conflict
marcelomorgado Feb 28, 2019
e4b2423
Resolving conflict
marcelomorgado Feb 28, 2019
ec6caa0
Merge branch 'develop' into feature/gnosis-safe
marcelomorgado Feb 28, 2019
92ab120
Mocha update
marcelomorgado Feb 28, 2019
d538b28
Returning with --no-timeouts option to tasit-sdk test suite script
marcelomorgado Feb 28, 2019
e23cb53
Fixing comment grammar
marcelomorgado Feb 28, 2019
4534eb0
Renaming ERC20 and ERC721 contracts files
marcelomorgado Feb 28, 2019
5a550d9
Renaming ERC20 and ERC721
marcelomorgado Feb 28, 2019
56ef03a
Disable parallelism from lerna test script
marcelomorgado Feb 28, 2019
96e7f84
Refactoring
marcelomorgado Feb 28, 2019
c02d296
Update package-lock.json
marcelomorgado Feb 28, 2019
b0015a8
Move test tasit-action config to helper
marcelomorgado Feb 28, 2019
97899b6
Using another account to send funds to the safe instead of the same a…
marcelomorgado Feb 28, 2019
6e41ca8
Add tasit-contracts/build folder removal to clean:all script
marcelomorgado Feb 28, 2019
34464ad
Renaming ERC20/ERC721 files - tasit-contract
marcelomorgado Feb 28, 2019
bc984bf
Renaming ERC20/ERC721 - tasit-contracts
marcelomorgado Feb 28, 2019
b043fcf
Renaming ERC20/ERC721 files - tasit-action
marcelomorgado Feb 28, 2019
373a720
Renaming ERC20/ERC721 - tasit-action
marcelomorgado Feb 28, 2019
52e3623
Renaming ERC20/ERC721 - tasit-identity-contract
marcelomorgado Feb 28, 2019
59e65b0
Refactoring
marcelomorgado Feb 28, 2019
b9d4323
Renaming some GnosisSafe test cases descriptions
marcelomorgado Feb 28, 2019
f5ead9a
CI fix
marcelomorgado Feb 28, 2019
b929ebd
GnosisSafe.setSigners()
marcelomorgado Feb 28, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 11 additions & 30 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"publish": "npm run clean:all && npm run bootstrap && npm test && npm run clean:3rd-parties && npx lerna publish",
"bootstrap": "npx lerna bootstrap --hoist",
"ganache:start:ropsten": "npx ganache-cli --fork https://ropsten.infura.io/latest --blockTime 0.1 -m 'beach swap combine paper music cook electric bullet trust actress liquid asthma' --gasLimit 1000000000000 --host 0.0.0.0 > /dev/null 2>&1 &",
"ganache:start": "npx ganache-cli -m 'beach swap combine paper music cook electric bullet trust actress liquid asthma' --gasLimit 1000000000 --host 0.0.0.0 > /dev/null 2>&1 &",
"ganache:start": "npx ganache-cli --noVMErrorsOnRPCResponse true -m 'beach swap combine paper music cook electric bullet trust actress liquid asthma' --gasLimit 1000000000 --host 0.0.0.0 > /dev/null 2>&1 &",
pcowgill marked this conversation as resolved.
Show resolved Hide resolved
"ganache:stop": "kill `ps ax|grep ganache-cli|grep -v grep| awk '{print $1}'` 2> /dev/null; exit 0",
"truffle:migrate": "npx lerna run migrate --scope tasit-contracts",
"pretest": "npm run ganache:stop && npm run ganache:start && npm run truffle:migrate",
Expand Down
3 changes: 2 additions & 1 deletion packages/tasit-action/src/TasitAction.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@ import Land from "./erc721/Land";
import Decentraland from "./marketplace/Decentraland";
import Estate from "./erc721/Estate";
import Mana from "./erc20/Mana";
import DetailedERC20 from "./erc20/DetailedERC20";

export { Contract, NFT, Land, Decentraland, Estate, Mana };

export const ERC20 = { Mana };
export const ERC20 = { Mana, DetailedERC20 };
pcowgill marked this conversation as resolved.
Show resolved Hide resolved
export const ERC721 = { Land, Estate, NFT };
export const Marketplace = { Decentraland };

Expand Down
4 changes: 4 additions & 0 deletions packages/tasit-action/src/contract/Contract.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ export class Contract extends Subscription {
return this.#ethersContract.address;
};

getABI = () => {
return this.#ethersContract.interface.abi;
};

// For testing purposes
_getProvider = () => {
return this.#provider;
Expand Down
1 change: 1 addition & 0 deletions packages/tasit-action/src/contract/Contract.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ describe("TasitAction.Contract", () => {
expect(sampleContract.getValue).to.exist;
expect(sampleContract.setValue).to.exist;
expect(sampleContract._getProvider()).to.exist;
expect(sampleContract.getABI()).to.deep.equal(contractABI);

provider = sampleContract._getProvider();
testcaseSnaphotId = await createSnapshot(provider);
Expand Down
9 changes: 9 additions & 0 deletions packages/tasit-action/src/erc20/DetailedERC20.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import Contract from "../contract/Contract";
import detailedERC20ABI from "../../../tasit-contracts/abi/DetailedERC20.json";

export default class DetailedERC20 extends Contract {
constructor(address, wallet) {
const abi = detailedERC20ABI;
super(address, abi, wallet);
}
}
13 changes: 13 additions & 0 deletions packages/tasit-action/src/erc20/DetailedERC20.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import DetailedERC20 from "./DetailedERC20";

// Note: Under the current `tasit-contracts` setup DetailedERC20 aways will deployed with this address
pcowgill marked this conversation as resolved.
Show resolved Hide resolved
// See https://github.com/tasitlabs/TasitSDK/issues/138
const DETAILED_ERC20_ADDRESS = "0x37E1A58dD465D33263D00185D065Ee36DD34CDb4";

describe("TasitAction.ERC20.DetailedERC20", () => {
it("should get the DetailedERC20 name", async function() {
const erc20 = new DetailedERC20(DETAILED_ERC20_ADDRESS);
const name = await erc20.name();
expect(name).to.equal("Detailed ERC20 Token");
});
});
2 changes: 1 addition & 1 deletion packages/tasit-action/src/erc20/Mana.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Mana from "./Mana";

import { local as localAddresses } from "../../../tasit-contracts/decentraland/addresses";
import { local as localAddresses } from "../../../tasit-contracts/3rd-parties/decentraland/addresses";
const { MANAToken: MANA_ADDRESS } = localAddresses;

describe("TasitAction.Decentraland.Mana", () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/tasit-action/src/erc721/Estate.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Estate from "./Estate";

import { local as localAddresses } from "../../../tasit-contracts/decentraland/addresses";
import { local as localAddresses } from "../../../tasit-contracts/3rd-parties/decentraland/addresses";
const { EstateRegistry: ESTATE_ADDRESS } = localAddresses;

describe("TasitAction.ERC721.Estate", () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/tasit-action/src/erc721/Land.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Land from "./Land";

import { local as localAddresses } from "../../../tasit-contracts/decentraland/addresses";
import { local as localAddresses } from "../../../tasit-contracts/3rd-parties/decentraland/addresses";
const { LANDProxy: LAND_PROXY_ADDRESS } = localAddresses;

describe("TasitAction.ERC721.Land", () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/tasit-action/src/marketplace/Decentraland.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Decentraland from "./Decentraland";

import { local as localAddresses } from "../../../tasit-contracts/decentraland/addresses";
import { local as localAddresses } from "../../../tasit-contracts/3rd-parties/decentraland/addresses";
const { Marketplace: MARKETPLACE_ADDRESS } = localAddresses;

describe("TasitAction.Marketplace.Decentraland", () => {
Expand Down
13 changes: 13 additions & 0 deletions packages/tasit-contracts/3rd-parties/decentraland/addresses.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
const decentralandAddresses = require("./contracts/addresses.json");

const { ropsten } = decentralandAddresses;

const local = {
MANAToken: "0x332bfb4d705d3ce37c4bf06141c7104984e91e79",
EstateRegistry: "0x6191bc768c2339da9eab9e589fc8bf0b3ab80975",
LANDRegistry: "0x773f11ed472aa43e4ebaa963bcfbbea5a10c1bbd",
LANDProxy: "0x1212f783f11611b0c029d5e6f86a23be621669e0",
Marketplace: "0x70960e803a2bbe90c7db34edfdc2d1e81ed46b79",
};

module.exports = { ropsten, local };
Submodule marketplace-contracts updated from 000000 to 190ab9
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ then
fi


DECENTRALAND_DIR="$PROJECT_DIR/decentraland";
DECENTRALAND_DIR="$PROJECT_DIR/3rd-parties/decentraland";
REPOS="mana land marketplace-contracts"

for repo in $REPOS;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ then
exit;
fi

DECENTRALAND_DIR="$PROJECT_DIR/decentraland";
DECENTRALAND_DIR="$PROJECT_DIR/3rd-parties/decentraland";

# Use list of repository_name:commit_hash:is_npm
REPOS="\
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ then
exit;
fi

DECENTRALAND_DIR="$PROJECT_DIR/decentraland"
DECENTRALAND_DIR="$PROJECT_DIR/3rd-parties/decentraland"

# mana
cp $DECENTRALAND_DIR/scripts/3_mana_migrations.js $DECENTRALAND_DIR/mana/migrations
Expand Down
5 changes: 5 additions & 0 deletions packages/tasit-contracts/3rd-parties/gnosis/addresses.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
const local = {
GnosisSafe: "0x9a4a2e7ed3ee6d481624f5392d8c6169c62065b7",
};

module.exports = { local };
1 change: 1 addition & 0 deletions packages/tasit-contracts/3rd-parties/gnosis/safe-contracts
Submodule safe-contracts added at 427d6f
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
var ProxyFactory = artifacts.require("./ProxyFactory.sol");
var GnosisSafe = artifacts.require("./GnosisSafe.sol");
var StateChannelModule = artifacts.require("./StateChannelModule.sol");
var DailyLimitModule = artifacts.require("./DailyLimitModule.sol");
var SocialRecoveryModule = artifacts.require("./SocialRecoveryModule.sol");
var WhitelistModule = artifacts.require("./WhitelistModule.sol");
var CreateAndAddModules = artifacts.require("./CreateAndAddModules.sol");
var MultiSend = artifacts.require("./MultiSend.sol");
pcowgill marked this conversation as resolved.
Show resolved Hide resolved

const anaAddress = "0xd68649157A061454e2c63c175236b07e98Bd9512";
const bobAddress = "0x8a5D5298dcceA526754064b8094e663162E1dBEa";

module.exports = function(deployer) {
deployer.deploy(ProxyFactory);
deployer.deploy(GnosisSafe).then(function(safe) {
safe.setup([anaAddress], 1, 0, 0);
return safe;
});
deployer.deploy(StateChannelModule).then(function(module) {
pcowgill marked this conversation as resolved.
Show resolved Hide resolved
module.setup();
return module;
});
deployer.deploy(DailyLimitModule).then(function(module) {
module.setup([], []);
return module;
});
deployer.deploy(SocialRecoveryModule).then(function(module) {
module.setup([anaAddress, bobAddress], 2);
return module;
});
deployer.deploy(WhitelistModule).then(function(module) {
module.setup([]);
return module;
});
deployer.deploy(CreateAndAddModules);
deployer.deploy(MultiSend);
pcowgill marked this conversation as resolved.
Show resolved Hide resolved
};
18 changes: 18 additions & 0 deletions packages/tasit-contracts/3rd-parties/gnosis/scripts/clean.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/bash
PROJECT_DIR=$1;

if [ -z "$PROJECT_DIR" ];
then
echo "Error! Use: ./$0 <tasit-contract-dir>";
exit;
fi


GNOSIS_DIR="$PROJECT_DIR/3rd-parties/gnosis";
REPOS="safe-contracts"

for repo in $REPOS;
do
REPO_DIR="$GNOSIS_DIR/$repo";
cd $REPO_DIR && git reset --hard && git clean -f
done
35 changes: 35 additions & 0 deletions packages/tasit-contracts/3rd-parties/gnosis/scripts/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/bin/bash
PROJECT_DIR=$1;

if [ -z "$PROJECT_DIR" ];
then
echo "Error! Use: ./$0 <tasit-contract-dir>";
exit;
fi

GNOSIS_DIR="$PROJECT_DIR/3rd-parties/gnosis";

# Use list of repository_name:commit_hash:is_npm
REPOS="safe-contracts:427d6f7e779431333c54bcb4d4cde31e4d57ce96:true";

for clone in $REPOS;
do
REPO=`echo $clone | awk -F ':' '{print $1}'`;
COMMIT=`echo $clone | awk -F ':' '{print $2}'`;
IS_NPM=`echo $clone | awk -F ':' '{print $3}'`;

REPO_DIR="$GNOSIS_DIR/$REPO";

if [ ! -e "$REPO_DIR/package.json" ];
then
rm -rf $REPO_DIR;
git clone https://github.com/gnosis/$REPO.git $REPO_DIR;
cd $REPO_DIR && git fetch origin $COMMIT && git reset --hard FETCH_HEAD;
fi

if [ $IS_NPM ];
then
npm i --prefix $REPO_DIR;
fi

done
Loading