Skip to content

Commit

Permalink
Python SDK (#490)
Browse files Browse the repository at this point in the history
* Feat/python sdk storage (#387)

* Change boto3 to minio

* Python sdk staking module (#419)

* Python KVStore SDK (#432)

* fix reward pool event and subgraph (#452)

* Python sdk staking module (#419)

* Python Escrow SDK (#458)

* use erc20 token interface for escrow python sdk (#478)

* remove unused codebase and rebuild test scripts (#481)

* Upload README
  • Loading branch information
leric7 committed May 23, 2023
1 parent a7a7ac0 commit 067d3f6
Show file tree
Hide file tree
Showing 44 changed files with 5,137 additions and 4,613 deletions.
7 changes: 6 additions & 1 deletion packages/core/contracts/RewardPool.sol
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,12 @@ contract RewardPool is IRewardPool, OwnableUpgradeable, UUPSUpgradeable {
totalFee = totalFee + fees;

// Add reward record
Reward memory reward = Reward(_escrowAddress, _slasher, rewardAfterFee);
Reward memory reward = Reward(
_escrowAddress,
_staker,
_slasher,
rewardAfterFee
);
rewards[_escrowAddress].push(reward);

emit RewardAdded(_escrowAddress, _staker, _slasher, rewardAfterFee);
Expand Down
1 change: 1 addition & 0 deletions packages/core/contracts/interfaces/IRewardPool.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ interface IRewardPool {
*/
struct Reward {
address escrowAddress;
address staker;
address slasher;
uint256 tokens; // Tokens allocated to a escrowAddress
}
Expand Down
2 changes: 1 addition & 1 deletion packages/core/scripts/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ async function main() {
const Staking = await ethers.getContractFactory('Staking');
const stakingContract = await upgrades.deployProxy(
Staking,
[HMTokenContract.address, 1, 1],
[HMTokenContract.address, 1, 10],
{ initializer: 'initialize', kind: 'uups' }
);
await stakingContract.deployed();
Expand Down
3 changes: 0 additions & 3 deletions packages/sdk/python/human-protocol-sdk/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,3 @@ dist
# ABIs
artifacts
contracts

# Minio Data
minio/data
27 changes: 16 additions & 11 deletions packages/sdk/python/human-protocol-sdk/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,27 @@ build-contracts:
format:
pipenv run black .

start-minio:
docker compose -f ./minio/docker-compose.yml up -d
unit-test:
make build-contracts
./scripts/run-unit-test.sh

stop-minio:
docker compose -f ./minio/docker-compose.yml down -v
e2e-start-minio:
docker compose -f ./test/e2e/minio/docker-compose.yml up -d

run-test:
e2e-stop-minio:
docker compose -f ./test/e2e/minio/docker-compose.yml down -v

e2e-test:
make build-contracts
make start-minio
./scripts/run-test.sh
make stop-minio
make e2e-start-minio
./scripts/run-e2e-test.sh
make e2e-stop-minio

run-test:
make unit-test
make e2e-test

build-package:
make clean-package
make build-contracts
python3 setup.py sdist bdist_wheel

generate-html-docs:
./scripts/generate-docs.sh --format html
3 changes: 2 additions & 1 deletion packages/sdk/python/human-protocol-sdk/Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,15 @@ verify_ssl = true
[dev-packages]

[packages]
boto3 = "*"
cryptography = "*"
hmt-basemodels = "==0.1.18"
sphinx = "*"
black = "*"
pylint = "*"
pytest = "*"
web3 = "==5.24.0"
minio = "*"
validators = "*"

[requires]
python_version = "3"
Expand Down
Loading

1 comment on commit 067d3f6

@vercel
Copy link

@vercel vercel bot commented on 067d3f6 May 23, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

fortune-exchange-oracle-server – ./packages/examples/fortune/exchange-oracle/server

fortune-exchange-oracle-server.vercel.app
fortune-exchange-oracle-server-humanprotocol.vercel.app
exchange-server.humanprotocol.org
fortune-exchange-oracle-server-git-develop-humanprotocol.vercel.app

Please sign in to comment.