remove mining related staff

This commit is contained in:
smart_ex 2022-05-12 13:03:29 +10:00
parent 8d2bad2a41
commit 6f66b34288
16 changed files with 690 additions and 750322 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1,252 +0,0 @@
[
{
"inputs": [
{
"internalType": "bytes32",
"name": "_torn",
"type": "bytes32"
},
{
"internalType": "bytes32",
"name": "_miner",
"type": "bytes32"
},
{
"internalType": "uint256",
"name": "_miningCap",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "_initialLiquidity",
"type": "uint256"
}
],
"stateMutability": "nonpayable",
"type": "constructor"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "uint256",
"name": "newWeight",
"type": "uint256"
}
],
"name": "PoolWeightUpdated",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "recipient",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "pTORN",
"type": "uint256"
},
{
"indexed": false,
"internalType": "uint256",
"name": "TORN",
"type": "uint256"
}
],
"name": "Swap",
"type": "event"
},
{
"inputs": [],
"name": "DURATION",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "initialLiquidity",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "liquidity",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "miner",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "poolWeight",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "bytes32",
"name": "node",
"type": "bytes32"
}
],
"name": "resolve",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "startTimestamp",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "tokensSold",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "torn",
"outputs": [
{
"internalType": "contract IERC20",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "recipient",
"type": "address"
},
{
"internalType": "uint256",
"name": "amount",
"type": "uint256"
}
],
"name": "swap",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "amount",
"type": "uint256"
}
],
"name": "getExpectedReturn",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "tornVirtualBalance",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "newWeight",
"type": "uint256"
}
],
"name": "setPoolWeight",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
}
]

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -13,7 +13,11 @@ import type {
Signer,
utils,
} from "ethers";
import type { FunctionFragment, Result } from "@ethersproject/abi";
import type {
FunctionFragment,
Result,
EventFragment,
} from "@ethersproject/abi";
import type { Listener, Provider } from "@ethersproject/providers";
import type {
TypedEventFilter,
@ -22,135 +26,213 @@ import type {
OnEvent,
} from "./common";
export declare namespace GovernanceAggregator {
export type ProposalStruct = {
proposer: string;
target: string;
startTime: BigNumberish;
endTime: BigNumberish;
forVotes: BigNumberish;
againstVotes: BigNumberish;
executed: boolean;
extended: boolean;
state: BigNumberish;
};
export type ProposalStructOutput = [
string,
string,
BigNumber,
BigNumber,
BigNumber,
BigNumber,
boolean,
boolean,
number
] & {
proposer: string;
target: string;
startTime: BigNumber;
endTime: BigNumber;
forVotes: BigNumber;
againstVotes: BigNumber;
executed: boolean;
extended: boolean;
state: number;
};
}
export interface AggregatorAbiInterface extends utils.Interface {
contractName: "AggregatorAbi";
functions: {
"bulkResolve(bytes32[])": FunctionFragment;
"getAllProposals(address)": FunctionFragment;
"getGovernanceBalances(address,address[])": FunctionFragment;
"getPricesInETH(address[],uint256[])": FunctionFragment;
"getUserData(address,address)": FunctionFragment;
"minerRates(address,address[])": FunctionFragment;
"resolve(bytes32)": FunctionFragment;
"swapState(address)": FunctionFragment;
"miningData(address,address[],address)": FunctionFragment;
"marketData(address[],uint256[],address)": FunctionFragment;
"addConnector(address)": FunctionFragment;
"addOracle(address,uint8)": FunctionFragment;
"connectors()": FunctionFragment;
"getRate(address,address,bool)": FunctionFragment;
"getRateToEth(address,bool)": FunctionFragment;
"multiWrapper()": FunctionFragment;
"oracles()": FunctionFragment;
"owner()": FunctionFragment;
"removeConnector(address)": FunctionFragment;
"removeOracle(address,uint8)": FunctionFragment;
"renounceOwnership()": FunctionFragment;
"setMultiWrapper(address)": FunctionFragment;
"transferOwnership(address)": FunctionFragment;
};
getFunction(
nameOrSignatureOrTopic:
| "bulkResolve"
| "getAllProposals"
| "getGovernanceBalances"
| "getPricesInETH"
| "getUserData"
| "minerRates"
| "resolve"
| "swapState"
| "miningData"
| "marketData"
| "addConnector"
| "addOracle"
| "connectors"
| "getRate"
| "getRateToEth"
| "multiWrapper"
| "oracles"
| "owner"
| "removeConnector"
| "removeOracle"
| "renounceOwnership"
| "setMultiWrapper"
| "transferOwnership"
): FunctionFragment;
encodeFunctionData(
functionFragment: "bulkResolve",
values: [BytesLike[]]
): string;
encodeFunctionData(
functionFragment: "getAllProposals",
functionFragment: "addConnector",
values: [string]
): string;
encodeFunctionData(
functionFragment: "getGovernanceBalances",
values: [string, string[]]
functionFragment: "addOracle",
values: [string, BigNumberish]
): string;
encodeFunctionData(
functionFragment: "getPricesInETH",
values: [string[], BigNumberish[]]
functionFragment: "connectors",
values?: undefined
): string;
encodeFunctionData(
functionFragment: "getUserData",
values: [string, string]
functionFragment: "getRate",
values: [string, string, boolean]
): string;
encodeFunctionData(
functionFragment: "minerRates",
values: [string, string[]]
): string;
encodeFunctionData(functionFragment: "resolve", values: [BytesLike]): string;
encodeFunctionData(functionFragment: "swapState", values: [string]): string;
encodeFunctionData(
functionFragment: "miningData",
values: [string, string[], string]
functionFragment: "getRateToEth",
values: [string, boolean]
): string;
encodeFunctionData(
functionFragment: "marketData",
values: [string[], BigNumberish[], string]
functionFragment: "multiWrapper",
values?: undefined
): string;
encodeFunctionData(functionFragment: "oracles", values?: undefined): string;
encodeFunctionData(functionFragment: "owner", values?: undefined): string;
encodeFunctionData(
functionFragment: "removeConnector",
values: [string]
): string;
encodeFunctionData(
functionFragment: "removeOracle",
values: [string, BigNumberish]
): string;
encodeFunctionData(
functionFragment: "renounceOwnership",
values?: undefined
): string;
encodeFunctionData(
functionFragment: "setMultiWrapper",
values: [string]
): string;
encodeFunctionData(
functionFragment: "transferOwnership",
values: [string]
): string;
decodeFunctionResult(
functionFragment: "bulkResolve",
functionFragment: "addConnector",
data: BytesLike
): Result;
decodeFunctionResult(functionFragment: "addOracle", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "connectors", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "getRate", data: BytesLike): Result;
decodeFunctionResult(
functionFragment: "getRateToEth",
data: BytesLike
): Result;
decodeFunctionResult(
functionFragment: "getAllProposals",
functionFragment: "multiWrapper",
data: BytesLike
): Result;
decodeFunctionResult(functionFragment: "oracles", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "owner", data: BytesLike): Result;
decodeFunctionResult(
functionFragment: "removeConnector",
data: BytesLike
): Result;
decodeFunctionResult(
functionFragment: "getGovernanceBalances",
functionFragment: "removeOracle",
data: BytesLike
): Result;
decodeFunctionResult(
functionFragment: "getPricesInETH",
functionFragment: "renounceOwnership",
data: BytesLike
): Result;
decodeFunctionResult(
functionFragment: "getUserData",
functionFragment: "setMultiWrapper",
data: BytesLike
): Result;
decodeFunctionResult(
functionFragment: "transferOwnership",
data: BytesLike
): Result;
decodeFunctionResult(functionFragment: "minerRates", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "resolve", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "swapState", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "miningData", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "marketData", data: BytesLike): Result;
events: {};
events: {
"ConnectorAdded(address)": EventFragment;
"ConnectorRemoved(address)": EventFragment;
"MultiWrapperUpdated(address)": EventFragment;
"OracleAdded(address,uint8)": EventFragment;
"OracleRemoved(address,uint8)": EventFragment;
"OwnershipTransferred(address,address)": EventFragment;
};
getEvent(nameOrSignatureOrTopic: "ConnectorAdded"): EventFragment;
getEvent(nameOrSignatureOrTopic: "ConnectorRemoved"): EventFragment;
getEvent(nameOrSignatureOrTopic: "MultiWrapperUpdated"): EventFragment;
getEvent(nameOrSignatureOrTopic: "OracleAdded"): EventFragment;
getEvent(nameOrSignatureOrTopic: "OracleRemoved"): EventFragment;
getEvent(nameOrSignatureOrTopic: "OwnershipTransferred"): EventFragment;
}
export interface ConnectorAddedEventObject {
connector: string;
}
export type ConnectorAddedEvent = TypedEvent<
[string],
ConnectorAddedEventObject
>;
export type ConnectorAddedEventFilter = TypedEventFilter<ConnectorAddedEvent>;
export interface ConnectorRemovedEventObject {
connector: string;
}
export type ConnectorRemovedEvent = TypedEvent<
[string],
ConnectorRemovedEventObject
>;
export type ConnectorRemovedEventFilter =
TypedEventFilter<ConnectorRemovedEvent>;
export interface MultiWrapperUpdatedEventObject {
multiWrapper: string;
}
export type MultiWrapperUpdatedEvent = TypedEvent<
[string],
MultiWrapperUpdatedEventObject
>;
export type MultiWrapperUpdatedEventFilter =
TypedEventFilter<MultiWrapperUpdatedEvent>;
export interface OracleAddedEventObject {
oracle: string;
oracleType: number;
}
export type OracleAddedEvent = TypedEvent<
[string, number],
OracleAddedEventObject
>;
export type OracleAddedEventFilter = TypedEventFilter<OracleAddedEvent>;
export interface OracleRemovedEventObject {
oracle: string;
oracleType: number;
}
export type OracleRemovedEvent = TypedEvent<
[string, number],
OracleRemovedEventObject
>;
export type OracleRemovedEventFilter = TypedEventFilter<OracleRemovedEvent>;
export interface OwnershipTransferredEventObject {
previousOwner: string;
newOwner: string;
}
export type OwnershipTransferredEvent = TypedEvent<
[string, string],
OwnershipTransferredEventObject
>;
export type OwnershipTransferredEventFilter =
TypedEventFilter<OwnershipTransferredEvent>;
export interface AggregatorAbi extends BaseContract {
contractName: "AggregatorAbi";
connect(signerOrProvider: Signer | Provider | string): this;
attach(addressOrName: string): this;
deployed(): Promise<this>;
@ -177,345 +259,338 @@ export interface AggregatorAbi extends BaseContract {
removeListener: OnEvent<this>;
functions: {
bulkResolve(
domains: BytesLike[],
addConnector(
connector: string,
overrides?: Overrides & { from?: string | Promise<string> }
): Promise<ContractTransaction>;
getAllProposals(
governance: string,
addOracle(
oracle: string,
oracleKind: BigNumberish,
overrides?: Overrides & { from?: string | Promise<string> }
): Promise<ContractTransaction>;
connectors(
overrides?: CallOverrides
): Promise<[string[]] & { allConnectors: string[] }>;
getRate(
srcToken: string,
dstToken: string,
useWrappers: boolean,
overrides?: CallOverrides
): Promise<[BigNumber] & { weightedRate: BigNumber }>;
getRateToEth(
srcToken: string,
useSrcWrappers: boolean,
overrides?: CallOverrides
): Promise<[BigNumber] & { weightedRate: BigNumber }>;
multiWrapper(overrides?: CallOverrides): Promise<[string]>;
oracles(
overrides?: CallOverrides
): Promise<
[GovernanceAggregator.ProposalStructOutput[]] & {
proposals: GovernanceAggregator.ProposalStructOutput[];
}
[string[], number[]] & { allOracles: string[]; oracleTypes: number[] }
>;
getGovernanceBalances(
governance: string,
accs: string[],
overrides?: CallOverrides
): Promise<[BigNumber[]] & { amounts: BigNumber[] }>;
owner(overrides?: CallOverrides): Promise<[string]>;
getPricesInETH(
fromTokens: string[],
oneUnitAmounts: BigNumberish[],
overrides?: CallOverrides
): Promise<[BigNumber[]] & { prices: BigNumber[] }>;
removeConnector(
connector: string,
overrides?: Overrides & { from?: string | Promise<string> }
): Promise<ContractTransaction>;
getUserData(
governance: string,
account: string,
overrides?: CallOverrides
): Promise<
[BigNumber, BigNumber, BigNumber, BigNumber, string] & {
balance: BigNumber;
latestProposalId: BigNumber;
latestProposalIdState: BigNumber;
timelock: BigNumber;
delegatee: string;
}
>;
removeOracle(
oracle: string,
oracleKind: BigNumberish,
overrides?: Overrides & { from?: string | Promise<string> }
): Promise<ContractTransaction>;
minerRates(
miner: string,
instances: string[],
overrides?: CallOverrides
): Promise<[BigNumber[]] & { _rates: BigNumber[] }>;
renounceOwnership(
overrides?: Overrides & { from?: string | Promise<string> }
): Promise<ContractTransaction>;
resolve(node: BytesLike, overrides?: CallOverrides): Promise<[string]>;
setMultiWrapper(
_multiWrapper: string,
overrides?: Overrides & { from?: string | Promise<string> }
): Promise<ContractTransaction>;
swapState(
swap: string,
overrides?: CallOverrides
): Promise<
[BigNumber, BigNumber] & { balance: BigNumber; poolWeight: BigNumber }
>;
miningData(
miner: string,
instances: string[],
swap: string,
overrides?: CallOverrides
): Promise<
[BigNumber[], BigNumber, BigNumber] & {
_rates: BigNumber[];
balance: BigNumber;
poolWeight: BigNumber;
}
>;
marketData(
fromTokens: string[],
oneUnitAmounts: BigNumberish[],
swap: string,
overrides?: CallOverrides
): Promise<
[BigNumber[], BigNumber] & { prices: BigNumber[]; balance: BigNumber }
>;
transferOwnership(
newOwner: string,
overrides?: Overrides & { from?: string | Promise<string> }
): Promise<ContractTransaction>;
};
bulkResolve(
domains: BytesLike[],
addConnector(
connector: string,
overrides?: Overrides & { from?: string | Promise<string> }
): Promise<ContractTransaction>;
getAllProposals(
governance: string,
overrides?: CallOverrides
): Promise<GovernanceAggregator.ProposalStructOutput[]>;
addOracle(
oracle: string,
oracleKind: BigNumberish,
overrides?: Overrides & { from?: string | Promise<string> }
): Promise<ContractTransaction>;
getGovernanceBalances(
governance: string,
accs: string[],
overrides?: CallOverrides
): Promise<BigNumber[]>;
connectors(overrides?: CallOverrides): Promise<string[]>;
getPricesInETH(
fromTokens: string[],
oneUnitAmounts: BigNumberish[],
getRate(
srcToken: string,
dstToken: string,
useWrappers: boolean,
overrides?: CallOverrides
): Promise<BigNumber[]>;
): Promise<BigNumber>;
getUserData(
governance: string,
account: string,
getRateToEth(
srcToken: string,
useSrcWrappers: boolean,
overrides?: CallOverrides
): Promise<BigNumber>;
multiWrapper(overrides?: CallOverrides): Promise<string>;
oracles(
overrides?: CallOverrides
): Promise<
[BigNumber, BigNumber, BigNumber, BigNumber, string] & {
balance: BigNumber;
latestProposalId: BigNumber;
latestProposalIdState: BigNumber;
timelock: BigNumber;
delegatee: string;
}
[string[], number[]] & { allOracles: string[]; oracleTypes: number[] }
>;
minerRates(
miner: string,
instances: string[],
overrides?: CallOverrides
): Promise<BigNumber[]>;
owner(overrides?: CallOverrides): Promise<string>;
resolve(node: BytesLike, overrides?: CallOverrides): Promise<string>;
removeConnector(
connector: string,
overrides?: Overrides & { from?: string | Promise<string> }
): Promise<ContractTransaction>;
swapState(
swap: string,
overrides?: CallOverrides
): Promise<
[BigNumber, BigNumber] & { balance: BigNumber; poolWeight: BigNumber }
>;
removeOracle(
oracle: string,
oracleKind: BigNumberish,
overrides?: Overrides & { from?: string | Promise<string> }
): Promise<ContractTransaction>;
miningData(
miner: string,
instances: string[],
swap: string,
overrides?: CallOverrides
): Promise<
[BigNumber[], BigNumber, BigNumber] & {
_rates: BigNumber[];
balance: BigNumber;
poolWeight: BigNumber;
}
>;
renounceOwnership(
overrides?: Overrides & { from?: string | Promise<string> }
): Promise<ContractTransaction>;
marketData(
fromTokens: string[],
oneUnitAmounts: BigNumberish[],
swap: string,
overrides?: CallOverrides
): Promise<
[BigNumber[], BigNumber] & { prices: BigNumber[]; balance: BigNumber }
>;
setMultiWrapper(
_multiWrapper: string,
overrides?: Overrides & { from?: string | Promise<string> }
): Promise<ContractTransaction>;
transferOwnership(
newOwner: string,
overrides?: Overrides & { from?: string | Promise<string> }
): Promise<ContractTransaction>;
callStatic: {
bulkResolve(
domains: BytesLike[],
overrides?: CallOverrides
): Promise<string[]>;
addConnector(connector: string, overrides?: CallOverrides): Promise<void>;
getAllProposals(
governance: string,
addOracle(
oracle: string,
oracleKind: BigNumberish,
overrides?: CallOverrides
): Promise<GovernanceAggregator.ProposalStructOutput[]>;
): Promise<void>;
getGovernanceBalances(
governance: string,
accs: string[],
connectors(overrides?: CallOverrides): Promise<string[]>;
getRate(
srcToken: string,
dstToken: string,
useWrappers: boolean,
overrides?: CallOverrides
): Promise<BigNumber[]>;
): Promise<BigNumber>;
getPricesInETH(
fromTokens: string[],
oneUnitAmounts: BigNumberish[],
getRateToEth(
srcToken: string,
useSrcWrappers: boolean,
overrides?: CallOverrides
): Promise<BigNumber[]>;
): Promise<BigNumber>;
getUserData(
governance: string,
account: string,
multiWrapper(overrides?: CallOverrides): Promise<string>;
oracles(
overrides?: CallOverrides
): Promise<
[BigNumber, BigNumber, BigNumber, BigNumber, string] & {
balance: BigNumber;
latestProposalId: BigNumber;
latestProposalIdState: BigNumber;
timelock: BigNumber;
delegatee: string;
}
[string[], number[]] & { allOracles: string[]; oracleTypes: number[] }
>;
minerRates(
miner: string,
instances: string[],
overrides?: CallOverrides
): Promise<BigNumber[]>;
owner(overrides?: CallOverrides): Promise<string>;
resolve(node: BytesLike, overrides?: CallOverrides): Promise<string>;
swapState(
swap: string,
removeConnector(
connector: string,
overrides?: CallOverrides
): Promise<
[BigNumber, BigNumber] & { balance: BigNumber; poolWeight: BigNumber }
>;
): Promise<void>;
miningData(
miner: string,
instances: string[],
swap: string,
removeOracle(
oracle: string,
oracleKind: BigNumberish,
overrides?: CallOverrides
): Promise<
[BigNumber[], BigNumber, BigNumber] & {
_rates: BigNumber[];
balance: BigNumber;
poolWeight: BigNumber;
}
>;
): Promise<void>;
marketData(
fromTokens: string[],
oneUnitAmounts: BigNumberish[],
swap: string,
renounceOwnership(overrides?: CallOverrides): Promise<void>;
setMultiWrapper(
_multiWrapper: string,
overrides?: CallOverrides
): Promise<
[BigNumber[], BigNumber] & { prices: BigNumber[]; balance: BigNumber }
>;
): Promise<void>;
transferOwnership(
newOwner: string,
overrides?: CallOverrides
): Promise<void>;
};
filters: {};
filters: {
"ConnectorAdded(address)"(connector?: null): ConnectorAddedEventFilter;
ConnectorAdded(connector?: null): ConnectorAddedEventFilter;
"ConnectorRemoved(address)"(connector?: null): ConnectorRemovedEventFilter;
ConnectorRemoved(connector?: null): ConnectorRemovedEventFilter;
"MultiWrapperUpdated(address)"(
multiWrapper?: null
): MultiWrapperUpdatedEventFilter;
MultiWrapperUpdated(multiWrapper?: null): MultiWrapperUpdatedEventFilter;
"OracleAdded(address,uint8)"(
oracle?: null,
oracleType?: null
): OracleAddedEventFilter;
OracleAdded(oracle?: null, oracleType?: null): OracleAddedEventFilter;
"OracleRemoved(address,uint8)"(
oracle?: null,
oracleType?: null
): OracleRemovedEventFilter;
OracleRemoved(oracle?: null, oracleType?: null): OracleRemovedEventFilter;
"OwnershipTransferred(address,address)"(
previousOwner?: string | null,
newOwner?: string | null
): OwnershipTransferredEventFilter;
OwnershipTransferred(
previousOwner?: string | null,
newOwner?: string | null
): OwnershipTransferredEventFilter;
};
estimateGas: {
bulkResolve(
domains: BytesLike[],
addConnector(
connector: string,
overrides?: Overrides & { from?: string | Promise<string> }
): Promise<BigNumber>;
getAllProposals(
governance: string,
addOracle(
oracle: string,
oracleKind: BigNumberish,
overrides?: Overrides & { from?: string | Promise<string> }
): Promise<BigNumber>;
connectors(overrides?: CallOverrides): Promise<BigNumber>;
getRate(
srcToken: string,
dstToken: string,
useWrappers: boolean,
overrides?: CallOverrides
): Promise<BigNumber>;
getGovernanceBalances(
governance: string,
accs: string[],
getRateToEth(
srcToken: string,
useSrcWrappers: boolean,
overrides?: CallOverrides
): Promise<BigNumber>;
getPricesInETH(
fromTokens: string[],
oneUnitAmounts: BigNumberish[],
overrides?: CallOverrides
multiWrapper(overrides?: CallOverrides): Promise<BigNumber>;
oracles(overrides?: CallOverrides): Promise<BigNumber>;
owner(overrides?: CallOverrides): Promise<BigNumber>;
removeConnector(
connector: string,
overrides?: Overrides & { from?: string | Promise<string> }
): Promise<BigNumber>;
getUserData(
governance: string,
account: string,
overrides?: CallOverrides
removeOracle(
oracle: string,
oracleKind: BigNumberish,
overrides?: Overrides & { from?: string | Promise<string> }
): Promise<BigNumber>;
minerRates(
miner: string,
instances: string[],
overrides?: CallOverrides
renounceOwnership(
overrides?: Overrides & { from?: string | Promise<string> }
): Promise<BigNumber>;
resolve(node: BytesLike, overrides?: CallOverrides): Promise<BigNumber>;
swapState(swap: string, overrides?: CallOverrides): Promise<BigNumber>;
miningData(
miner: string,
instances: string[],
swap: string,
overrides?: CallOverrides
setMultiWrapper(
_multiWrapper: string,
overrides?: Overrides & { from?: string | Promise<string> }
): Promise<BigNumber>;
marketData(
fromTokens: string[],
oneUnitAmounts: BigNumberish[],
swap: string,
overrides?: CallOverrides
transferOwnership(
newOwner: string,
overrides?: Overrides & { from?: string | Promise<string> }
): Promise<BigNumber>;
};
populateTransaction: {
bulkResolve(
domains: BytesLike[],
addConnector(
connector: string,
overrides?: Overrides & { from?: string | Promise<string> }
): Promise<PopulatedTransaction>;
getAllProposals(
governance: string,
addOracle(
oracle: string,
oracleKind: BigNumberish,
overrides?: Overrides & { from?: string | Promise<string> }
): Promise<PopulatedTransaction>;
connectors(overrides?: CallOverrides): Promise<PopulatedTransaction>;
getRate(
srcToken: string,
dstToken: string,
useWrappers: boolean,
overrides?: CallOverrides
): Promise<PopulatedTransaction>;
getGovernanceBalances(
governance: string,
accs: string[],
getRateToEth(
srcToken: string,
useSrcWrappers: boolean,
overrides?: CallOverrides
): Promise<PopulatedTransaction>;
getPricesInETH(
fromTokens: string[],
oneUnitAmounts: BigNumberish[],
overrides?: CallOverrides
multiWrapper(overrides?: CallOverrides): Promise<PopulatedTransaction>;
oracles(overrides?: CallOverrides): Promise<PopulatedTransaction>;
owner(overrides?: CallOverrides): Promise<PopulatedTransaction>;
removeConnector(
connector: string,
overrides?: Overrides & { from?: string | Promise<string> }
): Promise<PopulatedTransaction>;
getUserData(
governance: string,
account: string,
overrides?: CallOverrides
removeOracle(
oracle: string,
oracleKind: BigNumberish,
overrides?: Overrides & { from?: string | Promise<string> }
): Promise<PopulatedTransaction>;
minerRates(
miner: string,
instances: string[],
overrides?: CallOverrides
renounceOwnership(
overrides?: Overrides & { from?: string | Promise<string> }
): Promise<PopulatedTransaction>;
resolve(
node: BytesLike,
overrides?: CallOverrides
setMultiWrapper(
_multiWrapper: string,
overrides?: Overrides & { from?: string | Promise<string> }
): Promise<PopulatedTransaction>;
swapState(
swap: string,
overrides?: CallOverrides
): Promise<PopulatedTransaction>;
miningData(
miner: string,
instances: string[],
swap: string,
overrides?: CallOverrides
): Promise<PopulatedTransaction>;
marketData(
fromTokens: string[],
oneUnitAmounts: BigNumberish[],
swap: string,
overrides?: CallOverrides
transferOwnership(
newOwner: string,
overrides?: Overrides & { from?: string | Promise<string> }
): Promise<PopulatedTransaction>;
};
}

File diff suppressed because it is too large Load Diff

View File

@ -1,394 +0,0 @@
/* Autogenerated file. Do not edit manually. */
/* tslint:disable */
/* eslint-disable */
import type {
BaseContract,
BigNumber,
BigNumberish,
BytesLike,
CallOverrides,
ContractTransaction,
Overrides,
PopulatedTransaction,
Signer,
utils,
} from "ethers";
import type {
FunctionFragment,
Result,
EventFragment,
} from "@ethersproject/abi";
import type { Listener, Provider } from "@ethersproject/providers";
import type {
TypedEventFilter,
TypedEvent,
TypedListener,
OnEvent,
} from "./common";
export interface SwapAbiInterface extends utils.Interface {
functions: {
"DURATION()": FunctionFragment;
"initialLiquidity()": FunctionFragment;
"liquidity()": FunctionFragment;
"miner()": FunctionFragment;
"poolWeight()": FunctionFragment;
"resolve(bytes32)": FunctionFragment;
"startTimestamp()": FunctionFragment;
"tokensSold()": FunctionFragment;
"torn()": FunctionFragment;
"swap(address,uint256)": FunctionFragment;
"getExpectedReturn(uint256)": FunctionFragment;
"tornVirtualBalance()": FunctionFragment;
"setPoolWeight(uint256)": FunctionFragment;
};
getFunction(
nameOrSignatureOrTopic:
| "DURATION"
| "initialLiquidity"
| "liquidity"
| "miner"
| "poolWeight"
| "resolve"
| "startTimestamp"
| "tokensSold"
| "torn"
| "swap"
| "getExpectedReturn"
| "tornVirtualBalance"
| "setPoolWeight"
): FunctionFragment;
encodeFunctionData(functionFragment: "DURATION", values?: undefined): string;
encodeFunctionData(
functionFragment: "initialLiquidity",
values?: undefined
): string;
encodeFunctionData(functionFragment: "liquidity", values?: undefined): string;
encodeFunctionData(functionFragment: "miner", values?: undefined): string;
encodeFunctionData(
functionFragment: "poolWeight",
values?: undefined
): string;
encodeFunctionData(functionFragment: "resolve", values: [BytesLike]): string;
encodeFunctionData(
functionFragment: "startTimestamp",
values?: undefined
): string;
encodeFunctionData(
functionFragment: "tokensSold",
values?: undefined
): string;
encodeFunctionData(functionFragment: "torn", values?: undefined): string;
encodeFunctionData(
functionFragment: "swap",
values: [string, BigNumberish]
): string;
encodeFunctionData(
functionFragment: "getExpectedReturn",
values: [BigNumberish]
): string;
encodeFunctionData(
functionFragment: "tornVirtualBalance",
values?: undefined
): string;
encodeFunctionData(
functionFragment: "setPoolWeight",
values: [BigNumberish]
): string;
decodeFunctionResult(functionFragment: "DURATION", data: BytesLike): Result;
decodeFunctionResult(
functionFragment: "initialLiquidity",
data: BytesLike
): Result;
decodeFunctionResult(functionFragment: "liquidity", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "miner", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "poolWeight", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "resolve", data: BytesLike): Result;
decodeFunctionResult(
functionFragment: "startTimestamp",
data: BytesLike
): Result;
decodeFunctionResult(functionFragment: "tokensSold", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "torn", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "swap", data: BytesLike): Result;
decodeFunctionResult(
functionFragment: "getExpectedReturn",
data: BytesLike
): Result;
decodeFunctionResult(
functionFragment: "tornVirtualBalance",
data: BytesLike
): Result;
decodeFunctionResult(
functionFragment: "setPoolWeight",
data: BytesLike
): Result;
events: {
"PoolWeightUpdated(uint256)": EventFragment;
"Swap(address,uint256,uint256)": EventFragment;
};
getEvent(nameOrSignatureOrTopic: "PoolWeightUpdated"): EventFragment;
getEvent(nameOrSignatureOrTopic: "Swap"): EventFragment;
}
export interface PoolWeightUpdatedEventObject {
newWeight: BigNumber;
}
export type PoolWeightUpdatedEvent = TypedEvent<
[BigNumber],
PoolWeightUpdatedEventObject
>;
export type PoolWeightUpdatedEventFilter =
TypedEventFilter<PoolWeightUpdatedEvent>;
export interface SwapEventObject {
recipient: string;
pTORN: BigNumber;
TORN: BigNumber;
}
export type SwapEvent = TypedEvent<
[string, BigNumber, BigNumber],
SwapEventObject
>;
export type SwapEventFilter = TypedEventFilter<SwapEvent>;
export interface SwapAbi extends BaseContract {
connect(signerOrProvider: Signer | Provider | string): this;
attach(addressOrName: string): this;
deployed(): Promise<this>;
interface: SwapAbiInterface;
queryFilter<TEvent extends TypedEvent>(
event: TypedEventFilter<TEvent>,
fromBlockOrBlockhash?: string | number | undefined,
toBlock?: string | number | undefined
): Promise<Array<TEvent>>;
listeners<TEvent extends TypedEvent>(
eventFilter?: TypedEventFilter<TEvent>
): Array<TypedListener<TEvent>>;
listeners(eventName?: string): Array<Listener>;
removeAllListeners<TEvent extends TypedEvent>(
eventFilter: TypedEventFilter<TEvent>
): this;
removeAllListeners(eventName?: string): this;
off: OnEvent<this>;
on: OnEvent<this>;
once: OnEvent<this>;
removeListener: OnEvent<this>;
functions: {
DURATION(overrides?: CallOverrides): Promise<[BigNumber]>;
initialLiquidity(overrides?: CallOverrides): Promise<[BigNumber]>;
liquidity(overrides?: CallOverrides): Promise<[BigNumber]>;
miner(overrides?: CallOverrides): Promise<[string]>;
poolWeight(overrides?: CallOverrides): Promise<[BigNumber]>;
resolve(node: BytesLike, overrides?: CallOverrides): Promise<[string]>;
startTimestamp(overrides?: CallOverrides): Promise<[BigNumber]>;
tokensSold(overrides?: CallOverrides): Promise<[BigNumber]>;
torn(overrides?: CallOverrides): Promise<[string]>;
swap(
recipient: string,
amount: BigNumberish,
overrides?: Overrides & { from?: string | Promise<string> }
): Promise<ContractTransaction>;
getExpectedReturn(
amount: BigNumberish,
overrides?: CallOverrides
): Promise<[BigNumber]>;
tornVirtualBalance(overrides?: CallOverrides): Promise<[BigNumber]>;
setPoolWeight(
newWeight: BigNumberish,
overrides?: Overrides & { from?: string | Promise<string> }
): Promise<ContractTransaction>;
};
DURATION(overrides?: CallOverrides): Promise<BigNumber>;
initialLiquidity(overrides?: CallOverrides): Promise<BigNumber>;
liquidity(overrides?: CallOverrides): Promise<BigNumber>;
miner(overrides?: CallOverrides): Promise<string>;
poolWeight(overrides?: CallOverrides): Promise<BigNumber>;
resolve(node: BytesLike, overrides?: CallOverrides): Promise<string>;
startTimestamp(overrides?: CallOverrides): Promise<BigNumber>;
tokensSold(overrides?: CallOverrides): Promise<BigNumber>;
torn(overrides?: CallOverrides): Promise<string>;
swap(
recipient: string,
amount: BigNumberish,
overrides?: Overrides & { from?: string | Promise<string> }
): Promise<ContractTransaction>;
getExpectedReturn(
amount: BigNumberish,
overrides?: CallOverrides
): Promise<BigNumber>;
tornVirtualBalance(overrides?: CallOverrides): Promise<BigNumber>;
setPoolWeight(
newWeight: BigNumberish,
overrides?: Overrides & { from?: string | Promise<string> }
): Promise<ContractTransaction>;
callStatic: {
DURATION(overrides?: CallOverrides): Promise<BigNumber>;
initialLiquidity(overrides?: CallOverrides): Promise<BigNumber>;
liquidity(overrides?: CallOverrides): Promise<BigNumber>;
miner(overrides?: CallOverrides): Promise<string>;
poolWeight(overrides?: CallOverrides): Promise<BigNumber>;
resolve(node: BytesLike, overrides?: CallOverrides): Promise<string>;
startTimestamp(overrides?: CallOverrides): Promise<BigNumber>;
tokensSold(overrides?: CallOverrides): Promise<BigNumber>;
torn(overrides?: CallOverrides): Promise<string>;
swap(
recipient: string,
amount: BigNumberish,
overrides?: CallOverrides
): Promise<void>;
getExpectedReturn(
amount: BigNumberish,
overrides?: CallOverrides
): Promise<BigNumber>;
tornVirtualBalance(overrides?: CallOverrides): Promise<BigNumber>;
setPoolWeight(
newWeight: BigNumberish,
overrides?: CallOverrides
): Promise<void>;
};
filters: {
"PoolWeightUpdated(uint256)"(
newWeight?: null
): PoolWeightUpdatedEventFilter;
PoolWeightUpdated(newWeight?: null): PoolWeightUpdatedEventFilter;
"Swap(address,uint256,uint256)"(
recipient?: string | null,
pTORN?: null,
TORN?: null
): SwapEventFilter;
Swap(recipient?: string | null, pTORN?: null, TORN?: null): SwapEventFilter;
};
estimateGas: {
DURATION(overrides?: CallOverrides): Promise<BigNumber>;
initialLiquidity(overrides?: CallOverrides): Promise<BigNumber>;
liquidity(overrides?: CallOverrides): Promise<BigNumber>;
miner(overrides?: CallOverrides): Promise<BigNumber>;
poolWeight(overrides?: CallOverrides): Promise<BigNumber>;
resolve(node: BytesLike, overrides?: CallOverrides): Promise<BigNumber>;
startTimestamp(overrides?: CallOverrides): Promise<BigNumber>;
tokensSold(overrides?: CallOverrides): Promise<BigNumber>;
torn(overrides?: CallOverrides): Promise<BigNumber>;
swap(
recipient: string,
amount: BigNumberish,
overrides?: Overrides & { from?: string | Promise<string> }
): Promise<BigNumber>;
getExpectedReturn(
amount: BigNumberish,
overrides?: CallOverrides
): Promise<BigNumber>;
tornVirtualBalance(overrides?: CallOverrides): Promise<BigNumber>;
setPoolWeight(
newWeight: BigNumberish,
overrides?: Overrides & { from?: string | Promise<string> }
): Promise<BigNumber>;
};
populateTransaction: {
DURATION(overrides?: CallOverrides): Promise<PopulatedTransaction>;
initialLiquidity(overrides?: CallOverrides): Promise<PopulatedTransaction>;
liquidity(overrides?: CallOverrides): Promise<PopulatedTransaction>;
miner(overrides?: CallOverrides): Promise<PopulatedTransaction>;
poolWeight(overrides?: CallOverrides): Promise<PopulatedTransaction>;
resolve(
node: BytesLike,
overrides?: CallOverrides
): Promise<PopulatedTransaction>;
startTimestamp(overrides?: CallOverrides): Promise<PopulatedTransaction>;
tokensSold(overrides?: CallOverrides): Promise<PopulatedTransaction>;
torn(overrides?: CallOverrides): Promise<PopulatedTransaction>;
swap(
recipient: string,
amount: BigNumberish,
overrides?: Overrides & { from?: string | Promise<string> }
): Promise<PopulatedTransaction>;
getExpectedReturn(
amount: BigNumberish,
overrides?: CallOverrides
): Promise<PopulatedTransaction>;
tornVirtualBalance(
overrides?: CallOverrides
): Promise<PopulatedTransaction>;
setPoolWeight(
newWeight: BigNumberish,
overrides?: Overrides & { from?: string | Promise<string> }
): Promise<PopulatedTransaction>;
};
}

View File

@ -10,107 +10,198 @@ const _abi = [
{
inputs: [
{
internalType: "bytes32[]",
name: "domains",
type: "bytes32[]",
internalType: "contract MultiWrapper",
name: "_multiWrapper",
type: "address",
},
],
name: "bulkResolve",
outputs: [
{
internalType: "address[]",
name: "result",
internalType: "contract IOracle[]",
name: "existingOracles",
type: "address[]",
},
{
internalType: "enum OffchainOracle.OracleType[]",
name: "oracleTypes",
type: "uint8[]",
},
{
internalType: "contract IERC20[]",
name: "existingConnectors",
type: "address[]",
},
{
internalType: "contract IERC20",
name: "wBase",
type: "address",
},
],
stateMutability: "nonpayable",
type: "constructor",
},
{
anonymous: false,
inputs: [
{
indexed: false,
internalType: "contract IERC20",
name: "connector",
type: "address",
},
],
name: "ConnectorAdded",
type: "event",
},
{
anonymous: false,
inputs: [
{
indexed: false,
internalType: "contract IERC20",
name: "connector",
type: "address",
},
],
name: "ConnectorRemoved",
type: "event",
},
{
anonymous: false,
inputs: [
{
indexed: false,
internalType: "contract MultiWrapper",
name: "multiWrapper",
type: "address",
},
],
name: "MultiWrapperUpdated",
type: "event",
},
{
anonymous: false,
inputs: [
{
indexed: false,
internalType: "contract IOracle",
name: "oracle",
type: "address",
},
{
indexed: false,
internalType: "enum OffchainOracle.OracleType",
name: "oracleType",
type: "uint8",
},
],
name: "OracleAdded",
type: "event",
},
{
anonymous: false,
inputs: [
{
indexed: false,
internalType: "contract IOracle",
name: "oracle",
type: "address",
},
{
indexed: false,
internalType: "enum OffchainOracle.OracleType",
name: "oracleType",
type: "uint8",
},
],
name: "OracleRemoved",
type: "event",
},
{
anonymous: false,
inputs: [
{
indexed: true,
internalType: "address",
name: "previousOwner",
type: "address",
},
{
indexed: true,
internalType: "address",
name: "newOwner",
type: "address",
},
],
name: "OwnershipTransferred",
type: "event",
},
{
inputs: [
{
internalType: "contract IERC20",
name: "connector",
type: "address",
},
],
name: "addConnector",
outputs: [],
stateMutability: "nonpayable",
type: "function",
},
{
inputs: [
{
internalType: "contract Governance",
name: "governance",
type: "address",
},
],
name: "getAllProposals",
outputs: [
{
components: [
{
internalType: "address",
name: "proposer",
internalType: "contract IOracle",
name: "oracle",
type: "address",
},
{
internalType: "address",
name: "target",
type: "address",
},
{
internalType: "uint256",
name: "startTime",
type: "uint256",
},
{
internalType: "uint256",
name: "endTime",
type: "uint256",
},
{
internalType: "uint256",
name: "forVotes",
type: "uint256",
},
{
internalType: "uint256",
name: "againstVotes",
type: "uint256",
},
{
internalType: "bool",
name: "executed",
type: "bool",
},
{
internalType: "bool",
name: "extended",
type: "bool",
},
{
internalType: "enum Governance.ProposalState",
name: "state",
internalType: "enum OffchainOracle.OracleType",
name: "oracleKind",
type: "uint8",
},
],
internalType: "struct GovernanceAggregator.Proposal[]",
name: "proposals",
type: "tuple[]",
},
],
stateMutability: "view",
name: "addOracle",
outputs: [],
stateMutability: "nonpayable",
type: "function",
},
{
inputs: [
inputs: [],
name: "connectors",
outputs: [
{
internalType: "contract Governance",
name: "governance",
type: "address",
},
{
internalType: "address[]",
name: "accs",
internalType: "contract IERC20[]",
name: "allConnectors",
type: "address[]",
},
],
name: "getGovernanceBalances",
stateMutability: "view",
type: "function",
},
{
inputs: [
{
internalType: "contract IERC20",
name: "srcToken",
type: "address",
},
{
internalType: "contract IERC20",
name: "dstToken",
type: "address",
},
{
internalType: "bool",
name: "useWrappers",
type: "bool",
},
],
name: "getRate",
outputs: [
{
internalType: "uint256[]",
name: "amounts",
type: "uint256[]",
internalType: "uint256",
name: "weightedRate",
type: "uint256",
},
],
stateMutability: "view",
@ -119,104 +210,61 @@ const _abi = [
{
inputs: [
{
internalType: "address[]",
name: "fromTokens",
internalType: "contract IERC20",
name: "srcToken",
type: "address",
},
{
internalType: "bool",
name: "useSrcWrappers",
type: "bool",
},
],
name: "getRateToEth",
outputs: [
{
internalType: "uint256",
name: "weightedRate",
type: "uint256",
},
],
stateMutability: "view",
type: "function",
},
{
inputs: [],
name: "multiWrapper",
outputs: [
{
internalType: "contract MultiWrapper",
name: "",
type: "address",
},
],
stateMutability: "view",
type: "function",
},
{
inputs: [],
name: "oracles",
outputs: [
{
internalType: "contract IOracle[]",
name: "allOracles",
type: "address[]",
},
{
internalType: "uint256[]",
name: "oneUnitAmounts",
type: "uint256[]",
},
],
name: "getPricesInETH",
outputs: [
{
internalType: "uint256[]",
name: "prices",
type: "uint256[]",
internalType: "enum OffchainOracle.OracleType[]",
name: "oracleTypes",
type: "uint8[]",
},
],
stateMutability: "view",
type: "function",
},
{
inputs: [
{
internalType: "contract Governance",
name: "governance",
type: "address",
},
{
internalType: "address",
name: "account",
type: "address",
},
],
name: "getUserData",
outputs: [
{
internalType: "uint256",
name: "balance",
type: "uint256",
},
{
internalType: "uint256",
name: "latestProposalId",
type: "uint256",
},
{
internalType: "uint256",
name: "latestProposalIdState",
type: "uint256",
},
{
internalType: "uint256",
name: "timelock",
type: "uint256",
},
{
internalType: "address",
name: "delegatee",
type: "address",
},
],
stateMutability: "view",
type: "function",
},
{
inputs: [
{
internalType: "contract Miner",
name: "miner",
type: "address",
},
{
internalType: "address[]",
name: "instances",
type: "address[]",
},
],
name: "minerRates",
outputs: [
{
internalType: "uint256[]",
name: "_rates",
type: "uint256[]",
},
],
stateMutability: "view",
type: "function",
},
{
inputs: [
{
internalType: "bytes32",
name: "node",
type: "bytes32",
},
],
name: "resolve",
inputs: [],
name: "owner",
outputs: [
{
internalType: "address",
@ -230,98 +278,65 @@ const _abi = [
{
inputs: [
{
internalType: "contract RewardSwap",
name: "swap",
internalType: "contract IERC20",
name: "connector",
type: "address",
},
],
name: "swapState",
outputs: [
{
internalType: "uint256",
name: "balance",
type: "uint256",
},
{
internalType: "uint256",
name: "poolWeight",
type: "uint256",
},
],
stateMutability: "view",
name: "removeConnector",
outputs: [],
stateMutability: "nonpayable",
type: "function",
},
{
inputs: [
{
internalType: "contract Miner",
name: "miner",
internalType: "contract IOracle",
name: "oracle",
type: "address",
},
{
internalType: "address[]",
name: "instances",
type: "address[]",
},
{
internalType: "contract RewardSwap",
name: "swap",
type: "address",
internalType: "enum OffchainOracle.OracleType",
name: "oracleKind",
type: "uint8",
},
],
name: "miningData",
outputs: [
{
internalType: "uint256[]",
name: "_rates",
type: "uint256[]",
name: "removeOracle",
outputs: [],
stateMutability: "nonpayable",
type: "function",
},
{
internalType: "uint256",
name: "balance",
type: "uint256",
},
{
internalType: "uint256",
name: "poolWeight",
type: "uint256",
},
],
stateMutability: "view",
inputs: [],
name: "renounceOwnership",
outputs: [],
stateMutability: "nonpayable",
type: "function",
},
{
inputs: [
{
internalType: "address[]",
name: "fromTokens",
type: "address[]",
},
{
internalType: "uint256[]",
name: "oneUnitAmounts",
type: "uint256[]",
},
{
internalType: "contract RewardSwap",
name: "swap",
internalType: "contract MultiWrapper",
name: "_multiWrapper",
type: "address",
},
],
name: "marketData",
outputs: [
{
internalType: "uint256[]",
name: "prices",
type: "uint256[]",
name: "setMultiWrapper",
outputs: [],
stateMutability: "nonpayable",
type: "function",
},
{
internalType: "uint256",
name: "balance",
type: "uint256",
inputs: [
{
internalType: "address",
name: "newOwner",
type: "address",
},
],
stateMutability: "view",
name: "transferOwnership",
outputs: [],
stateMutability: "nonpayable",
type: "function",
},
];

View File

@ -1,273 +0,0 @@
/* Autogenerated file. Do not edit manually. */
/* tslint:disable */
/* eslint-disable */
import { Contract, Signer, utils } from "ethers";
import type { Provider } from "@ethersproject/providers";
import type { SwapAbi, SwapAbiInterface } from "../SwapAbi";
const _abi = [
{
inputs: [
{
internalType: "bytes32",
name: "_torn",
type: "bytes32",
},
{
internalType: "bytes32",
name: "_miner",
type: "bytes32",
},
{
internalType: "uint256",
name: "_miningCap",
type: "uint256",
},
{
internalType: "uint256",
name: "_initialLiquidity",
type: "uint256",
},
],
stateMutability: "nonpayable",
type: "constructor",
},
{
anonymous: false,
inputs: [
{
indexed: false,
internalType: "uint256",
name: "newWeight",
type: "uint256",
},
],
name: "PoolWeightUpdated",
type: "event",
},
{
anonymous: false,
inputs: [
{
indexed: true,
internalType: "address",
name: "recipient",
type: "address",
},
{
indexed: false,
internalType: "uint256",
name: "pTORN",
type: "uint256",
},
{
indexed: false,
internalType: "uint256",
name: "TORN",
type: "uint256",
},
],
name: "Swap",
type: "event",
},
{
inputs: [],
name: "DURATION",
outputs: [
{
internalType: "uint256",
name: "",
type: "uint256",
},
],
stateMutability: "view",
type: "function",
},
{
inputs: [],
name: "initialLiquidity",
outputs: [
{
internalType: "uint256",
name: "",
type: "uint256",
},
],
stateMutability: "view",
type: "function",
},
{
inputs: [],
name: "liquidity",
outputs: [
{
internalType: "uint256",
name: "",
type: "uint256",
},
],
stateMutability: "view",
type: "function",
},
{
inputs: [],
name: "miner",
outputs: [
{
internalType: "address",
name: "",
type: "address",
},
],
stateMutability: "view",
type: "function",
},
{
inputs: [],
name: "poolWeight",
outputs: [
{
internalType: "uint256",
name: "",
type: "uint256",
},
],
stateMutability: "view",
type: "function",
},
{
inputs: [
{
internalType: "bytes32",
name: "node",
type: "bytes32",
},
],
name: "resolve",
outputs: [
{
internalType: "address",
name: "",
type: "address",
},
],
stateMutability: "view",
type: "function",
},
{
inputs: [],
name: "startTimestamp",
outputs: [
{
internalType: "uint256",
name: "",
type: "uint256",
},
],
stateMutability: "view",
type: "function",
},
{
inputs: [],
name: "tokensSold",
outputs: [
{
internalType: "uint256",
name: "",
type: "uint256",
},
],
stateMutability: "view",
type: "function",
},
{
inputs: [],
name: "torn",
outputs: [
{
internalType: "contract IERC20",
name: "",
type: "address",
},
],
stateMutability: "view",
type: "function",
},
{
inputs: [
{
internalType: "address",
name: "recipient",
type: "address",
},
{
internalType: "uint256",
name: "amount",
type: "uint256",
},
],
name: "swap",
outputs: [],
stateMutability: "nonpayable",
type: "function",
},
{
inputs: [
{
internalType: "uint256",
name: "amount",
type: "uint256",
},
],
name: "getExpectedReturn",
outputs: [
{
internalType: "uint256",
name: "",
type: "uint256",
},
],
stateMutability: "view",
type: "function",
},
{
inputs: [],
name: "tornVirtualBalance",
outputs: [
{
internalType: "uint256",
name: "",
type: "uint256",
},
],
stateMutability: "view",
type: "function",
},
{
inputs: [
{
internalType: "uint256",
name: "newWeight",
type: "uint256",
},
],
name: "setPoolWeight",
outputs: [],
stateMutability: "nonpayable",
type: "function",
},
];
export class SwapAbi__factory {
static readonly abi = _abi;
static createInterface(): SwapAbiInterface {
return new utils.Interface(_abi) as SwapAbiInterface;
}
static connect(
address: string,
signerOrProvider: Signer | Provider
): SwapAbi {
return new Contract(address, _abi, signerOrProvider) as SwapAbi;
}
}

View File

@ -1,20 +1,17 @@
/* Autogenerated file. Do not edit manually. */
/* tslint:disable */
/* eslint-disable */
export type { AggregatorAbi } from "./AggregatorAbi";
export type { MulticallAbi } from "./MulticallAbi";
export type { OffchainOracleAbi } from "./OffchainOracleAbi";
export type { MiningAbi } from "./MiningAbi";
export type { ProxyLightABI } from "./ProxyLightABI";
export type { SwapAbi } from "./SwapAbi";
export type { TornadoABI } from "./TornadoABI";
export type { TornadoProxyABI } from "./TornadoProxyABI";
export * as factories from "./factories";
export { AggregatorAbi__factory } from "./factories/AggregatorAbi__factory";
export { MiningAbi__factory } from "./factories/MiningAbi__factory";
export { MulticallAbi__factory } from "./factories/MulticallAbi__factory";
export { OffchainOracleAbi__factory } from "./factories/OffchainOracleAbi__factory";
export { ProxyLightABI__factory } from "./factories/ProxyLightABI__factory";
export { SwapAbi__factory } from "./factories/SwapAbi__factory";
export { TornadoABI__factory } from "./factories/TornadoABI__factory";
export { TornadoProxyABI__factory } from "./factories/TornadoProxyABI__factory";
export type { AggregatorAbi } from './AggregatorAbi';
export type { MulticallAbi } from './MulticallAbi';
export type { OffchainOracleAbi } from './OffchainOracleAbi';
export type { ProxyLightABI } from './ProxyLightABI';
export type { TornadoABI } from './TornadoABI';
export type { TornadoProxyABI } from './TornadoProxyABI';
export * as factories from './factories';
export { AggregatorAbi__factory } from './factories/AggregatorAbi__factory';
export { MiningAbi__factory } from './factories/MiningAbi__factory';
export { MulticallAbi__factory } from './factories/MulticallAbi__factory';
export { OffchainOracleAbi__factory } from './factories/OffchainOracleAbi__factory';
export { ProxyLightABI__factory } from './factories/ProxyLightABI__factory';
export { TornadoABI__factory } from './factories/TornadoABI__factory';
export { TornadoProxyABI__factory } from './factories/TornadoProxyABI__factory';

File diff suppressed because one or more lines are too long

Binary file not shown.

View File

@ -20,7 +20,6 @@
"license": "MIT",
"dependencies": {
"bullmq": "^1.80.6",
"circomlib": "git+https://github.com/tornadocash/circomlib.git#3b492f9801573eebcfe1b6c584afe8a3beecf2b4",
"dotenv": "^8.2.0",
"eth-ens-namehash": "^2.0.8",
"ethers": "^5.6.4",
@ -32,8 +31,7 @@
"json-schema-to-ts": "^2.2.0",
"node-fetch": "^2.6.7",
"torn-token": "link:../torn-token",
"tornado-anonymity-mining": "^2.1.2",
"tx-manager": "^0.4.1",
"tx-manager": "^0.4.6",
"uuid": "^8.3.0",
"web3": "^1.3.0",
"web3-core-promievent": "^1.3.0",

14
src/queue/index.ts Normal file
View File

@ -0,0 +1,14 @@
import { Queue, Worker } from 'bullmq';
import { redis } from '../modules';
import { priceProcessor } from './priceProcessor';
import { Token } from '../types';
import { netId } from '../config';
import { relayerProcessor } from './relayerProcessor';
const connection = redis.getClient();
export const priceQueue = new Queue<Token[], any>('price', { connection });
export const getPriceWorker = () => new Worker(priceQueue.name, priceProcessor, { connection });
export const relayerQueue = new Queue(`relayer_${netId}`, { connection });
export const getRelayerWorker = () => new Worker(relayerQueue.name, relayerProcessor, { connection });

View File

@ -1,66 +0,0 @@
import { getTornadoMiningContract, getTornadoProxyContract } from '../modules/contracts';
import { MiningAbi, TornadoProxyABI } from '../../contracts';
import { NewAccountEvent } from '../../contracts/MiningAbi';
import MerkleTree from 'fixed-merkle-tree';
import { minerMerkleTreeHeight, netId } from '../config';
import { poseidon } from 'circomlib';
import { BigNumber } from 'ethers';
import { readJSON } from '../modules';
const poseidonHash = (items) => BigNumber.from(poseidon(items)).toString();
const poseidonHash2 = (a, b) => poseidonHash([a, b]);
export class TreeService {
proxy: TornadoProxyABI;
miner: MiningAbi;
tree: MerkleTree;
constructor() {
this.proxy = getTornadoProxyContract();
this.miner = getTornadoMiningContract();
}
async initTree() {
const cachedEvents = await readJSON(`../../cache/accounts_farmer_${netId}.json`);
console.log('loaded cached events', cachedEvents.length);
const cachedCommitments = cachedEvents.map(e => BigNumber.from(e.commitment).toString());
const [{ blockNumber: fromBlock }] = cachedEvents.slice(-1);
console.log('fetching new events');
const newEvents = await this.fetchEvents(fromBlock);
console.log('fetched', newEvents.length);
const newCommitments = newEvents
.sort((a, b) => a.args.index.sub(b.args.index).toNumber())
.map(e => BigNumber.from(e.args.commitment).toString())
.filter((item, index, arr) => !index || item !== arr[index - 1]);
const commitments = cachedCommitments.concat(newCommitments);
console.log(newEvents.slice(-1), commitments.slice(-1));
console.log('create tree');
this.tree = new MerkleTree(minerMerkleTreeHeight, commitments, { hashFunction: poseidonHash2 });
const rootOnContract = await this.miner.callStatic.getLastAccountRoot();
console.log(this.tree.root, BigNumber.from(rootOnContract).toString());
}
async fetchEvents(fromBlock: number, toBlock?: number): Promise<NewAccountEvent[]> {
toBlock = toBlock ?? await this.proxy.provider.getBlockNumber();
if (fromBlock <= toBlock) {
try {
const newAccountEvent = this.miner.filters.NewAccount();
return await this.miner.queryFilter(newAccountEvent, fromBlock, toBlock);
} catch (error) {
const midBlock = (fromBlock + toBlock) >> 1;
if (midBlock - fromBlock < 2) {
throw new Error(`error fetching events: ${error.message}`);
}
const result = await Promise.all([this.fetchEvents(fromBlock, midBlock), this.fetchEvents(midBlock + 1, toBlock)]);
return result.flat();
}
}
return [];
}
}

File diff suppressed because it is too large Load Diff