-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
10 oct update. fds_contract done with all tests passed. first draft o…
…f fds_tx created
- Loading branch information
1 parent
333570c
commit 22ecc5f
Showing
13 changed files
with
294 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"abi":[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"count","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"increment","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"}],"ast":{"ast_type":"SourceUnit","children":[{"ast_type":"PragmaDirective","children":[],"classification":0,"col_offset":-1,"end_col_offset":-1,"end_lineno":-1,"lineno":-1,"src":{"jump_code":"","length":22,"start":32}},{"ast_type":"ContractDefinition","children":[{"ast_type":"VariableDeclaration","children":[{"ast_type":"ElementaryTypeName","children":[],"classification":0,"col_offset":-1,"end_col_offset":-1,"end_lineno":-1,"lineno":-1,"name":"address","src":{"jump_code":"","length":7,"start":92}}],"classification":0,"col_offset":-1,"end_col_offset":-1,"end_lineno":-1,"lineno":-1,"name":"owner","src":{"jump_code":"","length":20,"start":92}},{"ast_type":"VariableDeclaration","children":[{"ast_type":"ElementaryTypeName","children":[],"classification":0,"col_offset":-1,"end_col_offset":-1,"end_lineno":-1,"lineno":-1,"name":"uint256","src":{"jump_code":"","length":7,"start":118}}],"classification":0,"col_offset":-1,"end_col_offset":-1,"end_lineno":-1,"lineno":-1,"name":"count","src":{"jump_code":"","length":20,"start":118}},{"ast_type":"FunctionDefinition","children":[{"ast_type":"Block","children":[{"ast_type":"ExpressionStatement","children":[{"ast_type":"Assignment","children":[{"ast_type":"Identifier","children":[],"classification":0,"col_offset":-1,"end_col_offset":-1,"end_lineno":-1,"lineno":-1,"name":"owner","src":{"jump_code":"","length":5,"start":169}},{"ast_type":"MemberAccess","children":[{"ast_type":"Identifier","children":[],"classification":0,"col_offset":-1,"end_col_offset":-1,"end_lineno":-1,"lineno":-1,"name":"msg","src":{"jump_code":"","length":3,"start":177}}],"classification":0,"col_offset":-1,"end_col_offset":-1,"end_lineno":-1,"lineno":-1,"src":{"jump_code":"","length":10,"start":177}}],"classification":0,"col_offset":-1,"end_col_offset":-1,"end_lineno":-1,"lineno":-1,"src":{"jump_code":"","length":18,"start":169}}],"classification":0,"col_offset":-1,"end_col_offset":-1,"end_lineno":-1,"lineno":-1,"src":{"jump_code":"","length":18,"start":169}}],"classification":0,"col_offset":-1,"end_col_offset":-1,"end_lineno":-1,"lineno":-1,"src":{"jump_code":"","length":35,"start":159}},{"ast_type":"ParameterList","children":[],"classification":0,"col_offset":-1,"end_col_offset":-1,"end_lineno":-1,"lineno":-1,"src":{"jump_code":"","length":2,"start":156}},{"ast_type":"ParameterList","children":[],"classification":0,"col_offset":-1,"end_col_offset":-1,"end_lineno":-1,"lineno":-1,"src":{"jump_code":"","start":159}}],"classification":1,"col_offset":-1,"end_col_offset":-1,"end_lineno":-1,"lineno":-1,"name":"","src":{"jump_code":"","length":49,"start":145}},{"ast_type":"FunctionDefinition","children":[{"ast_type":"Block","children":[{"ast_type":"Return","children":[{"ast_type":"Identifier","children":[],"classification":0,"col_offset":-1,"end_col_offset":-1,"end_lineno":-1,"lineno":-1,"name":"count","src":{"jump_code":"","length":5,"start":269}}],"classification":0,"col_offset":-1,"end_col_offset":-1,"end_lineno":-1,"lineno":-1,"src":{"jump_code":"","length":12,"start":262}}],"classification":0,"col_offset":-1,"end_col_offset":-1,"end_lineno":-1,"lineno":-1,"src":{"jump_code":"","length":29,"start":252}},{"ast_type":"ParameterList","children":[],"classification":0,"col_offset":-1,"end_col_offset":-1,"end_lineno":-1,"lineno":-1,"src":{"jump_code":"","length":2,"start":217}},{"ast_type":"ParameterList","children":[{"ast_type":"VariableDeclaration","children":[{"ast_type":"ElementaryTypeName","children":[],"classification":0,"col_offset":-1,"end_col_offset":-1,"end_lineno":-1,"lineno":-1,"name":"uint256","src":{"jump_code":"","length":7,"start":243}}],"classification":0,"col_offset":-1,"end_col_offset":-1,"end_lineno":-1,"lineno":-1,"name":"","src":{"jump_code":"","length":7,"start":243}}],"classification":0,"col_offset":-1,"end_col_offset":-1,"end_lineno":-1,"lineno":-1,"src":{"jump_code":"","length":9,"start":242}}],"classification":1,"col_offset":-1,"end_col_offset":-1,"end_lineno":-1,"lineno":-1,"name":"getCount","src":{"jump_code":"","length":81,"start":200}},{"ast_type":"FunctionDefinition","children":[{"ast_type":"Block","children":[{"ast_type":"Return","children":[{"ast_type":"UnaryOperation","children":[{"ast_type":"Identifier","children":[],"classification":0,"col_offset":-1,"end_col_offset":-1,"end_lineno":-1,"lineno":-1,"name":"count","src":{"jump_code":"","length":5,"start":352}}],"classification":0,"col_offset":-1,"end_col_offset":-1,"end_lineno":-1,"lineno":-1,"src":{"jump_code":"","length":7,"start":352}}],"classification":0,"col_offset":-1,"end_col_offset":-1,"end_lineno":-1,"lineno":-1,"src":{"jump_code":"","length":14,"start":345}}],"classification":0,"col_offset":-1,"end_col_offset":-1,"end_lineno":-1,"lineno":-1,"src":{"jump_code":"","length":31,"start":335}},{"ast_type":"ParameterList","children":[],"classification":0,"col_offset":-1,"end_col_offset":-1,"end_lineno":-1,"lineno":-1,"src":{"jump_code":"","length":2,"start":305}},{"ast_type":"ParameterList","children":[{"ast_type":"VariableDeclaration","children":[{"ast_type":"ElementaryTypeName","children":[],"classification":0,"col_offset":-1,"end_col_offset":-1,"end_lineno":-1,"lineno":-1,"name":"uint256","src":{"jump_code":"","length":7,"start":326}}],"classification":0,"col_offset":-1,"end_col_offset":-1,"end_lineno":-1,"lineno":-1,"name":"","src":{"jump_code":"","length":7,"start":326}}],"classification":0,"col_offset":-1,"end_col_offset":-1,"end_lineno":-1,"lineno":-1,"src":{"jump_code":"","length":9,"start":325}}],"classification":1,"col_offset":-1,"end_col_offset":-1,"end_lineno":-1,"lineno":-1,"name":"increment","src":{"jump_code":"","length":79,"start":287}}],"classification":0,"col_offset":-1,"end_col_offset":-1,"end_lineno":-1,"lineno":-1,"name":"SolidityTestContract","src":{"jump_code":"","length":312,"start":56}}],"classification":0,"col_offset":-1,"end_col_offset":-1,"end_lineno":-1,"lineno":-1,"src":{"jump_code":"","length":337,"start":32}},"contractName":"SolidityTestContract","deploymentBytecode":{"bytecode":"0x608060405234801561001057600080fd5b50600080546001600160a01b0319163317905561010e806100326000396000f3fe6080604052348015600f57600080fd5b506004361060465760003560e01c806306661abd14604b5780638da5cb5b146066578063a87d942c14608f578063d09de08a146096575b600080fd5b605360015481565b6040519081526020015b60405180910390f35b6000546078906001600160a01b031681565b6040516001600160a01b039091168152602001605d565b6001546053565b6053600180546000918260a78360b0565b91905055905090565b600060001982141560d157634e487b7160e01b600052601160045260246000fd5b506001019056fea264697066735822122001fe99b1c685802a63efc7614ec8b95700cde60ed68ecac2b2ce07be13549f2064736f6c63430008080033"},"devdoc":{"kind":"dev","methods":{},"version":1},"runtimeBytecode":{"bytecode":"0x6080604052348015600f57600080fd5b506004361060465760003560e01c806306661abd14604b5780638da5cb5b146066578063a87d942c14608f578063d09de08a146096575b600080fd5b605360015481565b6040519081526020015b60405180910390f35b6000546078906001600160a01b031681565b6040516001600160a01b039091168152602001605d565b6001546053565b6053600180546000918260a78360b0565b91905055905090565b600060001982141560d157634e487b7160e01b600052601160045260246000fd5b506001019056fea264697066735822122001fe99b1c685802a63efc7614ec8b95700cde60ed68ecac2b2ce07be13549f2064736f6c63430008080033"},"sourceId":"SolidityTestContract.sol","sourcemap":"56:312:0:-:0;;;145:49;;;;;;;;;-1:-1:-1;169:5:0;:18;;-1:-1:-1;;;;;;169:18:0;177:10;169:18;;;56:312;;;;;;","userdoc":{"kind":"user","methods":{},"version":1}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity 0.8.8; | ||
|
||
contract SolidityTestContract { | ||
address public owner; | ||
uint256 public count; | ||
|
||
constructor() { | ||
owner = msg.sender; | ||
} | ||
|
||
function getCount() external view returns (uint256) { | ||
return count; | ||
} | ||
|
||
function increment() external returns (uint256) { | ||
return count++; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
from ape.api.accounts import AccountAPI | ||
from ape.contracts.base import ContractContainer, ContractInstance | ||
from ape.types import AddressType | ||
|
||
from fds.fds_contract import FDSContract | ||
from fds.utils.types import AbiType | ||
|
||
|
||
class Tx: | ||
def __init__(self, account: AccountAPI): | ||
self.account = account | ||
self.contract_address = None | ||
|
||
def getContract( | ||
self, account: AccountAPI, address: AddressType, abi: AbiType | ||
) -> ContractInstance: | ||
self.account = account | ||
self.address = address | ||
self.abi = abi | ||
|
||
contract = FDSContract(self.account) | ||
return contract.at(address=address, abi=self.abi) | ||
|
||
def deployContract( | ||
self, contract: ContractContainer, *args, publish: bool = False, **kwargs | ||
) -> ContractInstance: | ||
contract = FDSContract(self.account) # type: ignore | ||
|
||
return contract.deploy(contract=contract, *args, publish=publish, **kwargs) | ||
|
||
def syncNonce(self, account: AccountAPI) -> int: | ||
""" | ||
Sync the nonce with the account. This is used to prevent | ||
accidental re - authenticating a user when they change their account. | ||
@param account - The account to sync the nonce with. Must be an instance of AccountAPI. | ||
@return The nonce | ||
""" | ||
self.account = account | ||
|
||
return self.account.nonce |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.