mirror of
https://github.com/emo2007/block-accounting.git
synced 2025-01-18 15:36:27 +00:00
multisig init
This commit is contained in:
parent
2fefe16f61
commit
aff46e2f5a
7
.idea/prettier.xml
Normal file
7
.idea/prettier.xml
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="PrettierConfiguration">
|
||||||
|
<option name="myConfigurationMode" value="AUTOMATIC" />
|
||||||
|
<option name="myRunOnSave" value="true" />
|
||||||
|
</component>
|
||||||
|
</project>
|
@ -1 +1,8 @@
|
|||||||
|
![LOGIN FLOW](./login-flow.png "Login")
|
||||||
![Example architecture](./arch.png "Arch")
|
![Example architecture](./arch.png "Arch")
|
||||||
|
|
||||||
|
|
||||||
|
# Registration Flow
|
||||||
|
- On First Login - Owner inputs his SEED_KEY (mnemonic), creates an organization, we save its seed hash for future login and signing internal txs.
|
||||||
|
- When inviting an employee to organization- we generate an invitation link, then after clicking on this link - the user is asked for seed, if he's already registered or able to generate a seed for new account.
|
||||||
|
-
|
File diff suppressed because one or more lines are too long
@ -1,4 +0,0 @@
|
|||||||
{
|
|
||||||
"_format": "hh-sol-dbg-1",
|
|
||||||
"buildInfo": "../../build-info/22662767f8b1a09e64d324318d70c2ac.json"
|
|
||||||
}
|
|
@ -1,74 +0,0 @@
|
|||||||
{
|
|
||||||
"_format": "hh-sol-artifact-1",
|
|
||||||
"contractName": "Lock",
|
|
||||||
"sourceName": "contracts/Lock.sol",
|
|
||||||
"abi": [
|
|
||||||
{
|
|
||||||
"inputs": [
|
|
||||||
{
|
|
||||||
"internalType": "uint256",
|
|
||||||
"name": "_unlockTime",
|
|
||||||
"type": "uint256"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"stateMutability": "payable",
|
|
||||||
"type": "constructor"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"anonymous": false,
|
|
||||||
"inputs": [
|
|
||||||
{
|
|
||||||
"indexed": false,
|
|
||||||
"internalType": "uint256",
|
|
||||||
"name": "amount",
|
|
||||||
"type": "uint256"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"indexed": false,
|
|
||||||
"internalType": "uint256",
|
|
||||||
"name": "when",
|
|
||||||
"type": "uint256"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"name": "Withdrawal",
|
|
||||||
"type": "event"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"inputs": [],
|
|
||||||
"name": "owner",
|
|
||||||
"outputs": [
|
|
||||||
{
|
|
||||||
"internalType": "address payable",
|
|
||||||
"name": "",
|
|
||||||
"type": "address"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"stateMutability": "view",
|
|
||||||
"type": "function"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"inputs": [],
|
|
||||||
"name": "unlockTime",
|
|
||||||
"outputs": [
|
|
||||||
{
|
|
||||||
"internalType": "uint256",
|
|
||||||
"name": "",
|
|
||||||
"type": "uint256"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"stateMutability": "view",
|
|
||||||
"type": "function"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"inputs": [],
|
|
||||||
"name": "withdraw",
|
|
||||||
"outputs": [],
|
|
||||||
"stateMutability": "nonpayable",
|
|
||||||
"type": "function"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"bytecode": "0x60806040526040516105d83803806105d8833981810160405281019061002591906100f0565b804210610067576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161005e906101a0565b60405180910390fd5b8060008190555033600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550506101c0565b600080fd5b6000819050919050565b6100cd816100ba565b81146100d857600080fd5b50565b6000815190506100ea816100c4565b92915050565b600060208284031215610106576101056100b5565b5b6000610114848285016100db565b91505092915050565b600082825260208201905092915050565b7f556e6c6f636b2074696d652073686f756c6420626520696e207468652066757460008201527f7572650000000000000000000000000000000000000000000000000000000000602082015250565b600061018a60238361011d565b91506101958261012e565b604082019050919050565b600060208201905081810360008301526101b98161017d565b9050919050565b610409806101cf6000396000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c8063251c1aa3146100465780633ccfd60b146100645780638da5cb5b1461006e575b600080fd5b61004e61008c565b60405161005b919061024a565b60405180910390f35b61006c610092565b005b61007661020b565b60405161008391906102a6565b60405180910390f35b60005481565b6000544210156100d7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100ce9061031e565b60405180910390fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610167576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161015e9061038a565b60405180910390fd5b7fbf2ed60bd5b5965d685680c01195c9514e4382e28e3a5a2d2d5244bf59411b9347426040516101989291906103aa565b60405180910390a1600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc479081150290604051600060405180830381858888f19350505050158015610208573d6000803e3d6000fd5b50565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000819050919050565b61024481610231565b82525050565b600060208201905061025f600083018461023b565b92915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600061029082610265565b9050919050565b6102a081610285565b82525050565b60006020820190506102bb6000830184610297565b92915050565b600082825260208201905092915050565b7f596f752063616e27742077697468647261772079657400000000000000000000600082015250565b60006103086016836102c1565b9150610313826102d2565b602082019050919050565b60006020820190508181036000830152610337816102fb565b9050919050565b7f596f75206172656e277420746865206f776e6572000000000000000000000000600082015250565b60006103746014836102c1565b915061037f8261033e565b602082019050919050565b600060208201905081810360008301526103a381610367565b9050919050565b60006040820190506103bf600083018561023b565b6103cc602083018461023b565b939250505056fea264697066735822122022a2b65355af697b0725f7bcddf1c94be908ee67893e84bd3442d61fdc82585064736f6c63430008180033",
|
|
||||||
"deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100415760003560e01c8063251c1aa3146100465780633ccfd60b146100645780638da5cb5b1461006e575b600080fd5b61004e61008c565b60405161005b919061024a565b60405180910390f35b61006c610092565b005b61007661020b565b60405161008391906102a6565b60405180910390f35b60005481565b6000544210156100d7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100ce9061031e565b60405180910390fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610167576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161015e9061038a565b60405180910390fd5b7fbf2ed60bd5b5965d685680c01195c9514e4382e28e3a5a2d2d5244bf59411b9347426040516101989291906103aa565b60405180910390a1600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc479081150290604051600060405180830381858888f19350505050158015610208573d6000803e3d6000fd5b50565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000819050919050565b61024481610231565b82525050565b600060208201905061025f600083018461023b565b92915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600061029082610265565b9050919050565b6102a081610285565b82525050565b60006020820190506102bb6000830184610297565b92915050565b600082825260208201905092915050565b7f596f752063616e27742077697468647261772079657400000000000000000000600082015250565b60006103086016836102c1565b9150610313826102d2565b602082019050919050565b60006020820190508181036000830152610337816102fb565b9050919050565b7f596f75206172656e277420746865206f776e6572000000000000000000000000600082015250565b60006103746014836102c1565b915061037f8261033e565b602082019050919050565b600060208201905081810360008301526103a381610367565b9050919050565b60006040820190506103bf600083018561023b565b6103cc602083018461023b565b939250505056fea264697066735822122022a2b65355af697b0725f7bcddf1c94be908ee67893e84bd3442d61fdc82585064736f6c63430008180033",
|
|
||||||
"linkReferences": {},
|
|
||||||
"deployedLinkReferences": {}
|
|
||||||
}
|
|
41
cache/solidity-files-cache.json
vendored
41
cache/solidity-files-cache.json
vendored
@ -1,41 +0,0 @@
|
|||||||
{
|
|
||||||
"_format": "hh-sol-cache-2",
|
|
||||||
"files": {
|
|
||||||
"/Users/nikitapoznyakov/Desktop/work/block-accounting/contracts/Lock.sol": {
|
|
||||||
"lastModificationDate": 1714595956954,
|
|
||||||
"contentHash": "dacf0d5cb5b45dc83086de5bc1c26c2c",
|
|
||||||
"sourceName": "contracts/Lock.sol",
|
|
||||||
"solcConfig": {
|
|
||||||
"version": "0.8.24",
|
|
||||||
"settings": {
|
|
||||||
"evmVersion": "paris",
|
|
||||||
"optimizer": {
|
|
||||||
"enabled": false,
|
|
||||||
"runs": 200
|
|
||||||
},
|
|
||||||
"outputSelection": {
|
|
||||||
"*": {
|
|
||||||
"*": [
|
|
||||||
"abi",
|
|
||||||
"evm.bytecode",
|
|
||||||
"evm.deployedBytecode",
|
|
||||||
"evm.methodIdentifiers",
|
|
||||||
"metadata"
|
|
||||||
],
|
|
||||||
"": [
|
|
||||||
"ast"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"imports": [],
|
|
||||||
"versionPragmas": [
|
|
||||||
"^0.8.24"
|
|
||||||
],
|
|
||||||
"artifacts": [
|
|
||||||
"Lock"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
109
contract/contracts/MultiSigWallet.sol
Normal file
109
contract/contracts/MultiSigWallet.sol
Normal file
@ -0,0 +1,109 @@
|
|||||||
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
|
pragma solidity ^0.8.20;
|
||||||
|
|
||||||
|
contract MultiSigWallet {
|
||||||
|
event Deposit (address indexed sender, uint amount, uint balance);
|
||||||
|
event SubmitTransaction (
|
||||||
|
address indexed owener,
|
||||||
|
uint indexed txIndex,
|
||||||
|
address indexed to,
|
||||||
|
uint value,
|
||||||
|
bytes data
|
||||||
|
);
|
||||||
|
|
||||||
|
event ConfirmTransaction(address indexed owner, uint indexed txIndex);
|
||||||
|
event RevokeConfirmation(address indexed owner, uint indexed txIndex);
|
||||||
|
event ExecuteTransaction(address indexed owner, uint indexed txIndex);
|
||||||
|
|
||||||
|
address[] public owners;
|
||||||
|
|
||||||
|
mapping(address => bool) public isOwner;
|
||||||
|
|
||||||
|
uint public numConfirmationsRequired;
|
||||||
|
|
||||||
|
struct Transaction {
|
||||||
|
address to;
|
||||||
|
uint value;
|
||||||
|
bytes data;
|
||||||
|
bool executed;
|
||||||
|
uint numConfirmations;
|
||||||
|
}
|
||||||
|
|
||||||
|
mapping(uint => mapping(address => bool)) public isConfirmed;
|
||||||
|
|
||||||
|
Transaction[] public transactions;
|
||||||
|
|
||||||
|
modifier txExists(uint _txIndex){
|
||||||
|
require(_txIndex < transactions.length, "tx does not exist");
|
||||||
|
_;
|
||||||
|
}
|
||||||
|
|
||||||
|
modifier notConfirmed(uint _txIndex) {
|
||||||
|
require(!isConfirmed[_txIndex][msg.sender], "tx already confirmed");
|
||||||
|
_;
|
||||||
|
}
|
||||||
|
|
||||||
|
modifier notExecuted(uint _txIndex){
|
||||||
|
require(!transactions[_txIndex].executed, "tx already confirmed");
|
||||||
|
_;
|
||||||
|
}
|
||||||
|
|
||||||
|
constructor(address[] memory _owners, uint _numConfirmationsRequired){
|
||||||
|
require(_owners.length > 0, "owners required");
|
||||||
|
require(_numConfirmationsRequired > 0 && _numConfirmationsRequired <= owners.length,
|
||||||
|
"invalid number of required confirmations");
|
||||||
|
for (uint i = 0; i < _owners.length; i++) {
|
||||||
|
address owner = _owners[i];
|
||||||
|
require(owner != address(0), "invalid owner");
|
||||||
|
require(!isOwner[owner], "owner not unique");
|
||||||
|
isOwner[owner] = true;
|
||||||
|
owners.push(owner);
|
||||||
|
}
|
||||||
|
numConfirmationsRequired = _numConfirmationsRequired;
|
||||||
|
}
|
||||||
|
|
||||||
|
receive() external payable {
|
||||||
|
emit Deposit(msg.sender, msg.value, address(this).balance);
|
||||||
|
}
|
||||||
|
|
||||||
|
function submitTransaction(address _to, uint _value, bytes memory _data) public onlyOwner {
|
||||||
|
uint txIndex = transactions.length;
|
||||||
|
transactions.push(
|
||||||
|
Transaction({
|
||||||
|
to: _to,
|
||||||
|
value: _value,
|
||||||
|
data: _data,
|
||||||
|
executed: false,
|
||||||
|
numConfirmations: 0
|
||||||
|
})
|
||||||
|
);
|
||||||
|
emit SubmitTransaction(msg.sender, txIndex, _to, _value, _data);
|
||||||
|
}
|
||||||
|
|
||||||
|
function confirmTransaction(
|
||||||
|
uint _txIndex
|
||||||
|
) public onlyOwner txExists(_txIndex) notExecuted(_txIndex) notConfirmed(_txIndex) {
|
||||||
|
Transaction storage transaction = transactions[_txIndex];
|
||||||
|
transaction.numConfirmations +=1;
|
||||||
|
isConfirmed[_txIndex][msg.sender] = true;
|
||||||
|
emit ConfirmTransaction(msg.sender, _txIndex);
|
||||||
|
}
|
||||||
|
|
||||||
|
function executeTransaction(uint _txIndex) public onlyOwner txExists(_txIndex) notExecuted(_txIndex){
|
||||||
|
Transaction storage transaction = transactions[_txIndex];
|
||||||
|
require(
|
||||||
|
transaction.numConfirmations >=numConfirmationsRequired, "cannot execute tx"
|
||||||
|
);
|
||||||
|
transaction.executed = true;
|
||||||
|
(bool, success, ) = transaction.to.call{value: transaction.value}(transaction.data);
|
||||||
|
require(success, "tx failed");
|
||||||
|
emit ExecuteTransaction(msg.sender, _txIndex);
|
||||||
|
}
|
||||||
|
|
||||||
|
function revokeConfirmation(uint _txIndex) public onlyOwner txExists(_txIndex) notExecuted(_txIndex) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
BIN
login-flow.png
Normal file
BIN
login-flow.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 36 KiB |
@ -1,140 +0,0 @@
|
|||||||
/* Autogenerated file. Do not edit manually. */
|
|
||||||
/* tslint:disable */
|
|
||||||
/* eslint-disable */
|
|
||||||
import type {
|
|
||||||
BaseContract,
|
|
||||||
BigNumberish,
|
|
||||||
BytesLike,
|
|
||||||
FunctionFragment,
|
|
||||||
Result,
|
|
||||||
Interface,
|
|
||||||
EventFragment,
|
|
||||||
ContractRunner,
|
|
||||||
ContractMethod,
|
|
||||||
Listener,
|
|
||||||
} from "ethers";
|
|
||||||
import type {
|
|
||||||
TypedContractEvent,
|
|
||||||
TypedDeferredTopicFilter,
|
|
||||||
TypedEventLog,
|
|
||||||
TypedLogDescription,
|
|
||||||
TypedListener,
|
|
||||||
TypedContractMethod,
|
|
||||||
} from "./common";
|
|
||||||
|
|
||||||
export interface LockInterface extends Interface {
|
|
||||||
getFunction(
|
|
||||||
nameOrSignature: "owner" | "unlockTime" | "withdraw"
|
|
||||||
): FunctionFragment;
|
|
||||||
|
|
||||||
getEvent(nameOrSignatureOrTopic: "Withdrawal"): EventFragment;
|
|
||||||
|
|
||||||
encodeFunctionData(functionFragment: "owner", values?: undefined): string;
|
|
||||||
encodeFunctionData(
|
|
||||||
functionFragment: "unlockTime",
|
|
||||||
values?: undefined
|
|
||||||
): string;
|
|
||||||
encodeFunctionData(functionFragment: "withdraw", values?: undefined): string;
|
|
||||||
|
|
||||||
decodeFunctionResult(functionFragment: "owner", data: BytesLike): Result;
|
|
||||||
decodeFunctionResult(functionFragment: "unlockTime", data: BytesLike): Result;
|
|
||||||
decodeFunctionResult(functionFragment: "withdraw", data: BytesLike): Result;
|
|
||||||
}
|
|
||||||
|
|
||||||
export namespace WithdrawalEvent {
|
|
||||||
export type InputTuple = [amount: BigNumberish, when: BigNumberish];
|
|
||||||
export type OutputTuple = [amount: bigint, when: bigint];
|
|
||||||
export interface OutputObject {
|
|
||||||
amount: bigint;
|
|
||||||
when: bigint;
|
|
||||||
}
|
|
||||||
export type Event = TypedContractEvent<InputTuple, OutputTuple, OutputObject>;
|
|
||||||
export type Filter = TypedDeferredTopicFilter<Event>;
|
|
||||||
export type Log = TypedEventLog<Event>;
|
|
||||||
export type LogDescription = TypedLogDescription<Event>;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface Lock extends BaseContract {
|
|
||||||
connect(runner?: ContractRunner | null): Lock;
|
|
||||||
waitForDeployment(): Promise<this>;
|
|
||||||
|
|
||||||
interface: LockInterface;
|
|
||||||
|
|
||||||
queryFilter<TCEvent extends TypedContractEvent>(
|
|
||||||
event: TCEvent,
|
|
||||||
fromBlockOrBlockhash?: string | number | undefined,
|
|
||||||
toBlock?: string | number | undefined
|
|
||||||
): Promise<Array<TypedEventLog<TCEvent>>>;
|
|
||||||
queryFilter<TCEvent extends TypedContractEvent>(
|
|
||||||
filter: TypedDeferredTopicFilter<TCEvent>,
|
|
||||||
fromBlockOrBlockhash?: string | number | undefined,
|
|
||||||
toBlock?: string | number | undefined
|
|
||||||
): Promise<Array<TypedEventLog<TCEvent>>>;
|
|
||||||
|
|
||||||
on<TCEvent extends TypedContractEvent>(
|
|
||||||
event: TCEvent,
|
|
||||||
listener: TypedListener<TCEvent>
|
|
||||||
): Promise<this>;
|
|
||||||
on<TCEvent extends TypedContractEvent>(
|
|
||||||
filter: TypedDeferredTopicFilter<TCEvent>,
|
|
||||||
listener: TypedListener<TCEvent>
|
|
||||||
): Promise<this>;
|
|
||||||
|
|
||||||
once<TCEvent extends TypedContractEvent>(
|
|
||||||
event: TCEvent,
|
|
||||||
listener: TypedListener<TCEvent>
|
|
||||||
): Promise<this>;
|
|
||||||
once<TCEvent extends TypedContractEvent>(
|
|
||||||
filter: TypedDeferredTopicFilter<TCEvent>,
|
|
||||||
listener: TypedListener<TCEvent>
|
|
||||||
): Promise<this>;
|
|
||||||
|
|
||||||
listeners<TCEvent extends TypedContractEvent>(
|
|
||||||
event: TCEvent
|
|
||||||
): Promise<Array<TypedListener<TCEvent>>>;
|
|
||||||
listeners(eventName?: string): Promise<Array<Listener>>;
|
|
||||||
removeAllListeners<TCEvent extends TypedContractEvent>(
|
|
||||||
event?: TCEvent
|
|
||||||
): Promise<this>;
|
|
||||||
|
|
||||||
owner: TypedContractMethod<[], [string], "view">;
|
|
||||||
|
|
||||||
unlockTime: TypedContractMethod<[], [bigint], "view">;
|
|
||||||
|
|
||||||
withdraw: TypedContractMethod<[], [void], "nonpayable">;
|
|
||||||
|
|
||||||
getFunction<T extends ContractMethod = ContractMethod>(
|
|
||||||
key: string | FunctionFragment
|
|
||||||
): T;
|
|
||||||
|
|
||||||
getFunction(
|
|
||||||
nameOrSignature: "owner"
|
|
||||||
): TypedContractMethod<[], [string], "view">;
|
|
||||||
getFunction(
|
|
||||||
nameOrSignature: "unlockTime"
|
|
||||||
): TypedContractMethod<[], [bigint], "view">;
|
|
||||||
getFunction(
|
|
||||||
nameOrSignature: "withdraw"
|
|
||||||
): TypedContractMethod<[], [void], "nonpayable">;
|
|
||||||
|
|
||||||
getEvent(
|
|
||||||
key: "Withdrawal"
|
|
||||||
): TypedContractEvent<
|
|
||||||
WithdrawalEvent.InputTuple,
|
|
||||||
WithdrawalEvent.OutputTuple,
|
|
||||||
WithdrawalEvent.OutputObject
|
|
||||||
>;
|
|
||||||
|
|
||||||
filters: {
|
|
||||||
"Withdrawal(uint256,uint256)": TypedContractEvent<
|
|
||||||
WithdrawalEvent.InputTuple,
|
|
||||||
WithdrawalEvent.OutputTuple,
|
|
||||||
WithdrawalEvent.OutputObject
|
|
||||||
>;
|
|
||||||
Withdrawal: TypedContractEvent<
|
|
||||||
WithdrawalEvent.InputTuple,
|
|
||||||
WithdrawalEvent.OutputTuple,
|
|
||||||
WithdrawalEvent.OutputObject
|
|
||||||
>;
|
|
||||||
};
|
|
||||||
}
|
|
@ -1,131 +0,0 @@
|
|||||||
/* Autogenerated file. Do not edit manually. */
|
|
||||||
/* tslint:disable */
|
|
||||||
/* eslint-disable */
|
|
||||||
import type {
|
|
||||||
FunctionFragment,
|
|
||||||
Typed,
|
|
||||||
EventFragment,
|
|
||||||
ContractTransaction,
|
|
||||||
ContractTransactionResponse,
|
|
||||||
DeferredTopicFilter,
|
|
||||||
EventLog,
|
|
||||||
TransactionRequest,
|
|
||||||
LogDescription,
|
|
||||||
} from "ethers";
|
|
||||||
|
|
||||||
export interface TypedDeferredTopicFilter<_TCEvent extends TypedContractEvent>
|
|
||||||
extends DeferredTopicFilter {}
|
|
||||||
|
|
||||||
export interface TypedContractEvent<
|
|
||||||
InputTuple extends Array<any> = any,
|
|
||||||
OutputTuple extends Array<any> = any,
|
|
||||||
OutputObject = any
|
|
||||||
> {
|
|
||||||
(...args: Partial<InputTuple>): TypedDeferredTopicFilter<
|
|
||||||
TypedContractEvent<InputTuple, OutputTuple, OutputObject>
|
|
||||||
>;
|
|
||||||
name: string;
|
|
||||||
fragment: EventFragment;
|
|
||||||
getFragment(...args: Partial<InputTuple>): EventFragment;
|
|
||||||
}
|
|
||||||
|
|
||||||
type __TypechainAOutputTuple<T> = T extends TypedContractEvent<
|
|
||||||
infer _U,
|
|
||||||
infer W
|
|
||||||
>
|
|
||||||
? W
|
|
||||||
: never;
|
|
||||||
type __TypechainOutputObject<T> = T extends TypedContractEvent<
|
|
||||||
infer _U,
|
|
||||||
infer _W,
|
|
||||||
infer V
|
|
||||||
>
|
|
||||||
? V
|
|
||||||
: never;
|
|
||||||
|
|
||||||
export interface TypedEventLog<TCEvent extends TypedContractEvent>
|
|
||||||
extends Omit<EventLog, "args"> {
|
|
||||||
args: __TypechainAOutputTuple<TCEvent> & __TypechainOutputObject<TCEvent>;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface TypedLogDescription<TCEvent extends TypedContractEvent>
|
|
||||||
extends Omit<LogDescription, "args"> {
|
|
||||||
args: __TypechainAOutputTuple<TCEvent> & __TypechainOutputObject<TCEvent>;
|
|
||||||
}
|
|
||||||
|
|
||||||
export type TypedListener<TCEvent extends TypedContractEvent> = (
|
|
||||||
...listenerArg: [
|
|
||||||
...__TypechainAOutputTuple<TCEvent>,
|
|
||||||
TypedEventLog<TCEvent>,
|
|
||||||
...undefined[]
|
|
||||||
]
|
|
||||||
) => void;
|
|
||||||
|
|
||||||
export type MinEthersFactory<C, ARGS> = {
|
|
||||||
deploy(...a: ARGS[]): Promise<C>;
|
|
||||||
};
|
|
||||||
|
|
||||||
export type GetContractTypeFromFactory<F> = F extends MinEthersFactory<
|
|
||||||
infer C,
|
|
||||||
any
|
|
||||||
>
|
|
||||||
? C
|
|
||||||
: never;
|
|
||||||
export type GetARGsTypeFromFactory<F> = F extends MinEthersFactory<any, any>
|
|
||||||
? Parameters<F["deploy"]>
|
|
||||||
: never;
|
|
||||||
|
|
||||||
export type StateMutability = "nonpayable" | "payable" | "view";
|
|
||||||
|
|
||||||
export type BaseOverrides = Omit<TransactionRequest, "to" | "data">;
|
|
||||||
export type NonPayableOverrides = Omit<
|
|
||||||
BaseOverrides,
|
|
||||||
"value" | "blockTag" | "enableCcipRead"
|
|
||||||
>;
|
|
||||||
export type PayableOverrides = Omit<
|
|
||||||
BaseOverrides,
|
|
||||||
"blockTag" | "enableCcipRead"
|
|
||||||
>;
|
|
||||||
export type ViewOverrides = Omit<TransactionRequest, "to" | "data">;
|
|
||||||
export type Overrides<S extends StateMutability> = S extends "nonpayable"
|
|
||||||
? NonPayableOverrides
|
|
||||||
: S extends "payable"
|
|
||||||
? PayableOverrides
|
|
||||||
: ViewOverrides;
|
|
||||||
|
|
||||||
export type PostfixOverrides<A extends Array<any>, S extends StateMutability> =
|
|
||||||
| A
|
|
||||||
| [...A, Overrides<S>];
|
|
||||||
export type ContractMethodArgs<
|
|
||||||
A extends Array<any>,
|
|
||||||
S extends StateMutability
|
|
||||||
> = PostfixOverrides<{ [I in keyof A]-?: A[I] | Typed }, S>;
|
|
||||||
|
|
||||||
export type DefaultReturnType<R> = R extends Array<any> ? R[0] : R;
|
|
||||||
|
|
||||||
// export interface ContractMethod<A extends Array<any> = Array<any>, R = any, D extends R | ContractTransactionResponse = R | ContractTransactionResponse> {
|
|
||||||
export interface TypedContractMethod<
|
|
||||||
A extends Array<any> = Array<any>,
|
|
||||||
R = any,
|
|
||||||
S extends StateMutability = "payable"
|
|
||||||
> {
|
|
||||||
(...args: ContractMethodArgs<A, S>): S extends "view"
|
|
||||||
? Promise<DefaultReturnType<R>>
|
|
||||||
: Promise<ContractTransactionResponse>;
|
|
||||||
|
|
||||||
name: string;
|
|
||||||
|
|
||||||
fragment: FunctionFragment;
|
|
||||||
|
|
||||||
getFragment(...args: ContractMethodArgs<A, S>): FunctionFragment;
|
|
||||||
|
|
||||||
populateTransaction(
|
|
||||||
...args: ContractMethodArgs<A, S>
|
|
||||||
): Promise<ContractTransaction>;
|
|
||||||
staticCall(
|
|
||||||
...args: ContractMethodArgs<A, "view">
|
|
||||||
): Promise<DefaultReturnType<R>>;
|
|
||||||
send(...args: ContractMethodArgs<A, S>): Promise<ContractTransactionResponse>;
|
|
||||||
estimateGas(...args: ContractMethodArgs<A, S>): Promise<bigint>;
|
|
||||||
staticCallResult(...args: ContractMethodArgs<A, "view">): Promise<R>;
|
|
||||||
}
|
|
@ -1,133 +0,0 @@
|
|||||||
/* Autogenerated file. Do not edit manually. */
|
|
||||||
/* tslint:disable */
|
|
||||||
/* eslint-disable */
|
|
||||||
import {
|
|
||||||
Contract,
|
|
||||||
ContractFactory,
|
|
||||||
ContractTransactionResponse,
|
|
||||||
Interface,
|
|
||||||
} from "ethers";
|
|
||||||
import type {
|
|
||||||
Signer,
|
|
||||||
BigNumberish,
|
|
||||||
ContractDeployTransaction,
|
|
||||||
ContractRunner,
|
|
||||||
} from "ethers";
|
|
||||||
import type { PayableOverrides } from "../common";
|
|
||||||
import type { Lock, LockInterface } from "../Lock";
|
|
||||||
|
|
||||||
const _abi = [
|
|
||||||
{
|
|
||||||
inputs: [
|
|
||||||
{
|
|
||||||
internalType: "uint256",
|
|
||||||
name: "_unlockTime",
|
|
||||||
type: "uint256",
|
|
||||||
},
|
|
||||||
],
|
|
||||||
stateMutability: "payable",
|
|
||||||
type: "constructor",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
anonymous: false,
|
|
||||||
inputs: [
|
|
||||||
{
|
|
||||||
indexed: false,
|
|
||||||
internalType: "uint256",
|
|
||||||
name: "amount",
|
|
||||||
type: "uint256",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
indexed: false,
|
|
||||||
internalType: "uint256",
|
|
||||||
name: "when",
|
|
||||||
type: "uint256",
|
|
||||||
},
|
|
||||||
],
|
|
||||||
name: "Withdrawal",
|
|
||||||
type: "event",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
inputs: [],
|
|
||||||
name: "owner",
|
|
||||||
outputs: [
|
|
||||||
{
|
|
||||||
internalType: "address payable",
|
|
||||||
name: "",
|
|
||||||
type: "address",
|
|
||||||
},
|
|
||||||
],
|
|
||||||
stateMutability: "view",
|
|
||||||
type: "function",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
inputs: [],
|
|
||||||
name: "unlockTime",
|
|
||||||
outputs: [
|
|
||||||
{
|
|
||||||
internalType: "uint256",
|
|
||||||
name: "",
|
|
||||||
type: "uint256",
|
|
||||||
},
|
|
||||||
],
|
|
||||||
stateMutability: "view",
|
|
||||||
type: "function",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
inputs: [],
|
|
||||||
name: "withdraw",
|
|
||||||
outputs: [],
|
|
||||||
stateMutability: "nonpayable",
|
|
||||||
type: "function",
|
|
||||||
},
|
|
||||||
] as const;
|
|
||||||
|
|
||||||
const _bytecode =
|
|
||||||
"0x60806040526040516105d83803806105d8833981810160405281019061002591906100f0565b804210610067576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161005e906101a0565b60405180910390fd5b8060008190555033600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550506101c0565b600080fd5b6000819050919050565b6100cd816100ba565b81146100d857600080fd5b50565b6000815190506100ea816100c4565b92915050565b600060208284031215610106576101056100b5565b5b6000610114848285016100db565b91505092915050565b600082825260208201905092915050565b7f556e6c6f636b2074696d652073686f756c6420626520696e207468652066757460008201527f7572650000000000000000000000000000000000000000000000000000000000602082015250565b600061018a60238361011d565b91506101958261012e565b604082019050919050565b600060208201905081810360008301526101b98161017d565b9050919050565b610409806101cf6000396000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c8063251c1aa3146100465780633ccfd60b146100645780638da5cb5b1461006e575b600080fd5b61004e61008c565b60405161005b919061024a565b60405180910390f35b61006c610092565b005b61007661020b565b60405161008391906102a6565b60405180910390f35b60005481565b6000544210156100d7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100ce9061031e565b60405180910390fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610167576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161015e9061038a565b60405180910390fd5b7fbf2ed60bd5b5965d685680c01195c9514e4382e28e3a5a2d2d5244bf59411b9347426040516101989291906103aa565b60405180910390a1600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc479081150290604051600060405180830381858888f19350505050158015610208573d6000803e3d6000fd5b50565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000819050919050565b61024481610231565b82525050565b600060208201905061025f600083018461023b565b92915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600061029082610265565b9050919050565b6102a081610285565b82525050565b60006020820190506102bb6000830184610297565b92915050565b600082825260208201905092915050565b7f596f752063616e27742077697468647261772079657400000000000000000000600082015250565b60006103086016836102c1565b9150610313826102d2565b602082019050919050565b60006020820190508181036000830152610337816102fb565b9050919050565b7f596f75206172656e277420746865206f776e6572000000000000000000000000600082015250565b60006103746014836102c1565b915061037f8261033e565b602082019050919050565b600060208201905081810360008301526103a381610367565b9050919050565b60006040820190506103bf600083018561023b565b6103cc602083018461023b565b939250505056fea264697066735822122022a2b65355af697b0725f7bcddf1c94be908ee67893e84bd3442d61fdc82585064736f6c63430008180033";
|
|
||||||
|
|
||||||
type LockConstructorParams =
|
|
||||||
| [signer?: Signer]
|
|
||||||
| ConstructorParameters<typeof ContractFactory>;
|
|
||||||
|
|
||||||
const isSuperArgs = (
|
|
||||||
xs: LockConstructorParams
|
|
||||||
): xs is ConstructorParameters<typeof ContractFactory> => xs.length > 1;
|
|
||||||
|
|
||||||
export class Lock__factory extends ContractFactory {
|
|
||||||
constructor(...args: LockConstructorParams) {
|
|
||||||
if (isSuperArgs(args)) {
|
|
||||||
super(...args);
|
|
||||||
} else {
|
|
||||||
super(_abi, _bytecode, args[0]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override getDeployTransaction(
|
|
||||||
_unlockTime: BigNumberish,
|
|
||||||
overrides?: PayableOverrides & { from?: string }
|
|
||||||
): Promise<ContractDeployTransaction> {
|
|
||||||
return super.getDeployTransaction(_unlockTime, overrides || {});
|
|
||||||
}
|
|
||||||
override deploy(
|
|
||||||
_unlockTime: BigNumberish,
|
|
||||||
overrides?: PayableOverrides & { from?: string }
|
|
||||||
) {
|
|
||||||
return super.deploy(_unlockTime, overrides || {}) as Promise<
|
|
||||||
Lock & {
|
|
||||||
deploymentTransaction(): ContractTransactionResponse;
|
|
||||||
}
|
|
||||||
>;
|
|
||||||
}
|
|
||||||
override connect(runner: ContractRunner | null): Lock__factory {
|
|
||||||
return super.connect(runner) as Lock__factory;
|
|
||||||
}
|
|
||||||
|
|
||||||
static readonly bytecode = _bytecode;
|
|
||||||
static readonly abi = _abi;
|
|
||||||
static createInterface(): LockInterface {
|
|
||||||
return new Interface(_abi) as LockInterface;
|
|
||||||
}
|
|
||||||
static connect(address: string, runner?: ContractRunner | null): Lock {
|
|
||||||
return new Contract(address, _abi, runner) as unknown as Lock;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,4 +0,0 @@
|
|||||||
/* Autogenerated file. Do not edit manually. */
|
|
||||||
/* tslint:disable */
|
|
||||||
/* eslint-disable */
|
|
||||||
export { Lock__factory } from "./Lock__factory";
|
|
63
typechain-types/hardhat.d.ts
vendored
63
typechain-types/hardhat.d.ts
vendored
@ -1,63 +0,0 @@
|
|||||||
/* Autogenerated file. Do not edit manually. */
|
|
||||||
/* tslint:disable */
|
|
||||||
/* eslint-disable */
|
|
||||||
|
|
||||||
import { ethers } from "ethers";
|
|
||||||
import {
|
|
||||||
DeployContractOptions,
|
|
||||||
FactoryOptions,
|
|
||||||
HardhatEthersHelpers as HardhatEthersHelpersBase,
|
|
||||||
} from "@nomicfoundation/hardhat-ethers/types";
|
|
||||||
|
|
||||||
import * as Contracts from ".";
|
|
||||||
|
|
||||||
declare module "hardhat/types/runtime" {
|
|
||||||
interface HardhatEthersHelpers extends HardhatEthersHelpersBase {
|
|
||||||
getContractFactory(
|
|
||||||
name: "Lock",
|
|
||||||
signerOrOptions?: ethers.Signer | FactoryOptions
|
|
||||||
): Promise<Contracts.Lock__factory>;
|
|
||||||
|
|
||||||
getContractAt(
|
|
||||||
name: "Lock",
|
|
||||||
address: string | ethers.Addressable,
|
|
||||||
signer?: ethers.Signer
|
|
||||||
): Promise<Contracts.Lock>;
|
|
||||||
|
|
||||||
deployContract(
|
|
||||||
name: "Lock",
|
|
||||||
signerOrOptions?: ethers.Signer | DeployContractOptions
|
|
||||||
): Promise<Contracts.Lock>;
|
|
||||||
|
|
||||||
deployContract(
|
|
||||||
name: "Lock",
|
|
||||||
args: any[],
|
|
||||||
signerOrOptions?: ethers.Signer | DeployContractOptions
|
|
||||||
): Promise<Contracts.Lock>;
|
|
||||||
|
|
||||||
// default types
|
|
||||||
getContractFactory(
|
|
||||||
name: string,
|
|
||||||
signerOrOptions?: ethers.Signer | FactoryOptions
|
|
||||||
): Promise<ethers.ContractFactory>;
|
|
||||||
getContractFactory(
|
|
||||||
abi: any[],
|
|
||||||
bytecode: ethers.BytesLike,
|
|
||||||
signer?: ethers.Signer
|
|
||||||
): Promise<ethers.ContractFactory>;
|
|
||||||
getContractAt(
|
|
||||||
nameOrAbi: string | any[],
|
|
||||||
address: string | ethers.Addressable,
|
|
||||||
signer?: ethers.Signer
|
|
||||||
): Promise<ethers.Contract>;
|
|
||||||
deployContract(
|
|
||||||
name: string,
|
|
||||||
signerOrOptions?: ethers.Signer | DeployContractOptions
|
|
||||||
): Promise<ethers.Contract>;
|
|
||||||
deployContract(
|
|
||||||
name: string,
|
|
||||||
args: any[],
|
|
||||||
signerOrOptions?: ethers.Signer | DeployContractOptions
|
|
||||||
): Promise<ethers.Contract>;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,6 +0,0 @@
|
|||||||
/* Autogenerated file. Do not edit manually. */
|
|
||||||
/* tslint:disable */
|
|
||||||
/* eslint-disable */
|
|
||||||
export type { Lock } from "./Lock";
|
|
||||||
export * as factories from "./factories";
|
|
||||||
export { Lock__factory } from "./factories/Lock__factory";
|
|
Loading…
Reference in New Issue
Block a user