Skip to content

Commit

Permalink
Merge pull request #10 from valory-xyz/feat/staking
Browse files Browse the repository at this point in the history
Staking support
  • Loading branch information
angrybayblade authored Feb 20, 2024
2 parents 6283003 + 7e69191 commit 6ddc144
Show file tree
Hide file tree
Showing 19 changed files with 2,176 additions and 137 deletions.
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,12 @@ yarn-error.log*
next-env.d.ts

# python
data
backend/__pycache__/
backend/scripts/__pycache__/
.operate/
data/
__pycache__/
tmp/
temp/
temp/

!backend/operate/data
11 changes: 10 additions & 1 deletion backend/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"""Operate app entrypoint."""


import os
from pathlib import Path

from aea_ledger_ethereum.ethereum import EthereumCrypto
Expand All @@ -35,6 +36,10 @@
from typing_extensions import Annotated
from uvicorn.main import run as uvicorn

DEFAULT_HARDHAT_KEY = (
"0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80"
).encode()


class App(Resource):
"""App resource."""
Expand Down Expand Up @@ -63,7 +68,11 @@ def make(self) -> None:
self._keys.mkdir(exist_ok=True)
if not self._key.exists():
# TODO: Add support for multiple master keys
self._key.write_bytes(EthereumCrypto().private_key.encode())
self._key.write_bytes(
DEFAULT_HARDHAT_KEY
if os.environ.get("DEV", "false") == "true"
else EthereumCrypto().private_key.encode()
)

@property
def json(self) -> None:
Expand Down
24 changes: 24 additions & 0 deletions backend/operate/data/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# -*- coding: utf-8 -*-
# ------------------------------------------------------------------------------
#
# Copyright 2024 Valory AG
#
# 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.
#
# ------------------------------------------------------------------------------

"""Data module."""

from pathlib import Path

DATA_DIR = Path(__file__).parent
20 changes: 20 additions & 0 deletions backend/operate/data/contracts/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# -*- coding: utf-8 -*-
# ------------------------------------------------------------------------------
#
# Copyright 2023 Valory AG
#
# 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.
#
# ------------------------------------------------------------------------------

"""Contract packages."""
20 changes: 20 additions & 0 deletions backend/operate/data/contracts/service_staking_token/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# -*- coding: utf-8 -*-
# ------------------------------------------------------------------------------
#
# Copyright 2023 Valory AG
#
# 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.
#
# ------------------------------------------------------------------------------

"""This module contains the support resources for the agent registry contract."""
Loading

0 comments on commit 6ddc144

Please sign in to comment.