randomness-js
Version:
A library for consuming, verifying and using randomness from the dcipher network
412 lines (404 loc) • 16.3 kB
text/typescript
/* Autogenerated file. Do not edit manually. */
/* tslint:disable */
/* eslint-disable */
import {
Contract,
ContractFactory,
ContractTransactionResponse,
Interface,
} from "ethers";
import type {
Signer,
BigNumberish,
AddressLike,
ContractDeployTransaction,
ContractRunner,
} from "ethers";
import type { NonPayableOverrides } from "../common";
import type {
ChainlinkVRFSubscriptionConsumer,
ChainlinkVRFSubscriptionConsumerInterface,
} from "../ChainlinkVRFSubscriptionConsumer";
const _abi = [
{
type: "constructor",
inputs: [
{
name: "subscriptionId",
type: "uint256",
internalType: "uint256",
},
{
name: "_vrfCoordinator",
type: "address",
internalType: "address",
},
],
stateMutability: "nonpayable",
},
{
type: "function",
name: "acceptOwnership",
inputs: [],
outputs: [],
stateMutability: "nonpayable",
},
{
type: "function",
name: "addConsumer",
inputs: [
{
name: "subId",
type: "uint256",
internalType: "uint256",
},
{
name: "consumer",
type: "address",
internalType: "address",
},
],
outputs: [],
stateMutability: "nonpayable",
},
{
type: "function",
name: "createSubscription",
inputs: [],
outputs: [
{
name: "",
type: "uint256",
internalType: "uint256",
},
],
stateMutability: "nonpayable",
},
{
type: "function",
name: "fundSubscriptionWithNative",
inputs: [
{
name: "subId",
type: "uint256",
internalType: "uint256",
},
],
outputs: [],
stateMutability: "payable",
},
{
type: "function",
name: "getRandomWords",
inputs: [
{
name: "_requestId",
type: "uint256",
internalType: "uint256",
},
],
outputs: [
{
name: "",
type: "uint256[]",
internalType: "uint256[]",
},
],
stateMutability: "view",
},
{
type: "function",
name: "owner",
inputs: [],
outputs: [
{
name: "",
type: "address",
internalType: "address",
},
],
stateMutability: "view",
},
{
type: "function",
name: "randomWordsOf",
inputs: [
{
name: "",
type: "uint256",
internalType: "uint256",
},
{
name: "",
type: "uint256",
internalType: "uint256",
},
],
outputs: [
{
name: "",
type: "uint256",
internalType: "uint256",
},
],
stateMutability: "view",
},
{
type: "function",
name: "rawFulfillRandomWords",
inputs: [
{
name: "requestId",
type: "uint256",
internalType: "uint256",
},
{
name: "randomWords",
type: "uint256[]",
internalType: "uint256[]",
},
],
outputs: [],
stateMutability: "nonpayable",
},
{
type: "function",
name: "requestId",
inputs: [],
outputs: [
{
name: "",
type: "uint256",
internalType: "uint256",
},
],
stateMutability: "view",
},
{
type: "function",
name: "requestRandomWords",
inputs: [
{
name: "callbackGasLimit",
type: "uint32",
internalType: "uint32",
},
],
outputs: [
{
name: "_requestId",
type: "uint256",
internalType: "uint256",
},
],
stateMutability: "nonpayable",
},
{
type: "function",
name: "s_vrfCoordinator",
inputs: [],
outputs: [
{
name: "",
type: "address",
internalType: "contract IVRFCoordinatorV2Plus",
},
],
stateMutability: "view",
},
{
type: "function",
name: "setCoordinator",
inputs: [
{
name: "_vrfCoordinator",
type: "address",
internalType: "address",
},
],
outputs: [],
stateMutability: "nonpayable",
},
{
type: "function",
name: "setSubscription",
inputs: [
{
name: "subId",
type: "uint256",
internalType: "uint256",
},
],
outputs: [],
stateMutability: "nonpayable",
},
{
type: "function",
name: "transferOwnership",
inputs: [
{
name: "to",
type: "address",
internalType: "address",
},
],
outputs: [],
stateMutability: "nonpayable",
},
{
type: "event",
name: "CoordinatorSet",
inputs: [
{
name: "vrfCoordinator",
type: "address",
indexed: false,
internalType: "address",
},
],
anonymous: false,
},
{
type: "event",
name: "OwnershipTransferRequested",
inputs: [
{
name: "from",
type: "address",
indexed: true,
internalType: "address",
},
{
name: "to",
type: "address",
indexed: true,
internalType: "address",
},
],
anonymous: false,
},
{
type: "event",
name: "OwnershipTransferred",
inputs: [
{
name: "from",
type: "address",
indexed: true,
internalType: "address",
},
{
name: "to",
type: "address",
indexed: true,
internalType: "address",
},
],
anonymous: false,
},
{
type: "error",
name: "OnlyCoordinatorCanFulfill",
inputs: [
{
name: "have",
type: "address",
internalType: "address",
},
{
name: "want",
type: "address",
internalType: "address",
},
],
},
{
type: "error",
name: "OnlyOwnerOrCoordinator",
inputs: [
{
name: "have",
type: "address",
internalType: "address",
},
{
name: "owner",
type: "address",
internalType: "address",
},
{
name: "coordinator",
type: "address",
internalType: "address",
},
],
},
{
type: "error",
name: "ZeroAddress",
inputs: [],
},
] as const;
const _bytecode =
"0x608060405234801561000f575f5ffd5b50604051610ffd380380610ffd83398101604081905261002e916101ae565b8033805f816100845760405162461bcd60e51b815260206004820152601860248201527f43616e6e6f7420736574206f776e657220746f207a65726f000000000000000060448201526064015b60405180910390fd5b5f80546001600160a01b0319166001600160a01b03848116919091179091558116156100b3576100b381610106565b5050506001600160a01b0381166100dd5760405163d92e233d60e01b815260040160405180910390fd5b600280546001600160a01b0319166001600160a01b0392909216919091179055506005556101e8565b336001600160a01b0382160361015e5760405162461bcd60e51b815260206004820152601760248201527f43616e6e6f74207472616e7366657220746f2073656c66000000000000000000604482015260640161007b565b600180546001600160a01b0319166001600160a01b038381169182179092555f8054604051929316917fed8889f560326eb138920d842192f0eb3dd22b4f139c87a2c57538e05bae12789190a350565b5f5f604083850312156101bf575f5ffd5b825160208401519092506001600160a01b03811681146101dd575f5ffd5b809150509250929050565b610e08806101f55f395ff3fe6080604052600436106100d8575f3560e01c80638ea981171161007c578063a21a23e411610057578063a21a23e41461024b578063bec4c08c1461025f578063e726f2e11461027e578063f2fde38b1461029d575f5ffd5b80638ea98117146101ed57806395b55cfc1461020c5780639eccacf61461021f575f5ffd5b80634b3c08f3116100b75780634b3c08f31461014457806379ba50971461017057806388b660a6146101845780638da5cb5b146101a3575f5ffd5b80626d6cae146100dc578063064e96a0146101045780631fe543e314610125575b5f5ffd5b3480156100e7575f5ffd5b506100f160035481565b6040519081526020015b60405180910390f35b34801561010f575f5ffd5b5061012361011e366004610b92565b600555565b005b348015610130575f5ffd5b5061012361013f366004610ba9565b6102bc565b34801561014f575f5ffd5b5061016361015e366004610b92565b610344565b6040516100fb9190610c23565b34801561017b575f5ffd5b506101236103a3565b34801561018f575f5ffd5b506100f161019e366004610c65565b61049f565b3480156101ae575f5ffd5b505f5473ffffffffffffffffffffffffffffffffffffffff165b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016100fb565b3480156101f8575f5ffd5b50610123610207366004610cad565b6104ca565b61012361021a366004610b92565b610652565b34801561022a575f5ffd5b506002546101c89073ffffffffffffffffffffffffffffffffffffffff1681565b348015610256575f5ffd5b506100f16106d7565b34801561026a575f5ffd5b50610123610279366004610ccd565b610773565b348015610289575f5ffd5b506100f1610298366004610cf7565b6107ec565b3480156102a8575f5ffd5b506101236102b7366004610cad565b6108d1565b60025473ffffffffffffffffffffffffffffffffffffffff163314610334576002546040517f1cf993f400000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff90911660248201526044015b60405180910390fd5b61033f8383836108e5565b505050565b5f8181526004602090815260409182902080548351818402810184019094528084526060939283018282801561039757602002820191905f5260205f20905b815481526020019060010190808311610383575b50505050509050919050565b60015473ffffffffffffffffffffffffffffffffffffffff163314610424576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f4d7573742062652070726f706f736564206f776e657200000000000000000000604482015260640161032b565b5f8054337fffffffffffffffffffffffff00000000000000000000000000000000000000008083168217845560018054909116905560405173ffffffffffffffffffffffffffffffffffffffff90921692909183917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a350565b6004602052815f5260405f2081815481106104b8575f80fd5b905f5260205f20015f91509150505481565b5f5473ffffffffffffffffffffffffffffffffffffffff163314801590610509575060025473ffffffffffffffffffffffffffffffffffffffff163314155b1561058c573361052d5f5473ffffffffffffffffffffffffffffffffffffffff1690565b6002546040517f061db9c100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff9384166004820152918316602483015291909116604482015260640161032b565b73ffffffffffffffffffffffffffffffffffffffff81166105d9576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600280547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081179091556040519081527fd1a6a14209a385a964d036e404cb5cfb71f4000cdb03c9366292430787261be69060200160405180910390a150565b6002546040517f95b55cfc0000000000000000000000000000000000000000000000000000000081526004810183905273ffffffffffffffffffffffffffffffffffffffff909116906395b55cfc9034906024015f604051808303818588803b1580156106bd575f5ffd5b505af11580156106cf573d5f5f3e3d5ffd5b505050505050565b600254604080517fa21a23e400000000000000000000000000000000000000000000000000000000815290515f9273ffffffffffffffffffffffffffffffffffffffff169163a21a23e4916004808301926020929190829003018187875af1158015610745573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906107699190610d1a565b6005819055919050565b61077b610903565b6002546040517fbec4c08c0000000000000000000000000000000000000000000000000000000081526004810184905273ffffffffffffffffffffffffffffffffffffffff83811660248301529091169063bec4c08c906044015f604051808303815f87803b1580156106bd575f5ffd5b5f6107f5610903565b6002546040805160c0810182525f8152600554602080830191909152600382840181905263ffffffff8716606084015260016080840181905284519283019094528382529373ffffffffffffffffffffffffffffffffffffffff1691639b1c385e9160a082019061086590610985565b8152506040518263ffffffff1660e01b81526004016108849190610d31565b6020604051808303815f875af11580156108a0573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906108c49190610d1a565b6003819055949350505050565b6108d9610903565b6108e281610a41565b50565b5f8381526004602052604090206108fd908383610b35565b50505050565b5f5473ffffffffffffffffffffffffffffffffffffffff163314610983576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f4f6e6c792063616c6c61626c65206279206f776e657200000000000000000000604482015260640161032b565b565b60607f92fd13387c7fe7befbc38d303d6468778fb9731bc4583f17d92989c6fcfdeaaa826040516024016109be91511515815260200190565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff000000000000000000000000000000000000000000000000000000009093169290921790915292915050565b3373ffffffffffffffffffffffffffffffffffffffff821603610ac0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601760248201527f43616e6e6f74207472616e7366657220746f2073656c66000000000000000000604482015260640161032b565b600180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff8381169182179092555f8054604051929316917fed8889f560326eb138920d842192f0eb3dd22b4f139c87a2c57538e05bae12789190a350565b828054828255905f5260205f20908101928215610b6e579160200282015b82811115610b6e578235825591602001919060010190610b53565b50610b7a929150610b7e565b5090565b5b80821115610b7a575f8155600101610b7f565b5f60208284031215610ba2575f5ffd5b5035919050565b5f5f5f60408486031215610bbb575f5ffd5b83359250602084013567ffffffffffffffff811115610bd8575f5ffd5b8401601f81018613610be8575f5ffd5b803567ffffffffffffffff811115610bfe575f5ffd5b8660208260051b8401011115610c12575f5ffd5b939660209190910195509293505050565b602080825282518282018190525f918401906040840190835b81811015610c5a578351835260209384019390920191600101610c3c565b509095945050505050565b5f5f60408385031215610c76575f5ffd5b50508035926020909101359150565b803573ffffffffffffffffffffffffffffffffffffffff81168114610ca8575f5ffd5b919050565b5f60208284031215610cbd575f5ffd5b610cc682610c85565b9392505050565b5f5f60408385031215610cde575f5ffd5b82359150610cee60208401610c85565b90509250929050565b5f60208284031215610d07575f5ffd5b813563ffffffff81168114610cc6575f5ffd5b5f60208284031215610d2a575f5ffd5b5051919050565b60208152815160208201526020820151604082015261ffff604083015116606082015263ffffffff606083015116608082015263ffffffff60808301511660a08201525f60a083015160c08084015280518060e0850152806020830161010086015e5f61010082860101526101007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f830116850101925050509291505056fea2646970667358221220b371f1d9e18829e41d1e00e5faeb7b80c17d346a187a975c52545a1c3810df5c64736f6c634300081c0033";
type ChainlinkVRFSubscriptionConsumerConstructorParams =
| [signer?: Signer]
| ConstructorParameters<typeof ContractFactory>;
const isSuperArgs = (
xs: ChainlinkVRFSubscriptionConsumerConstructorParams
): xs is ConstructorParameters<typeof ContractFactory> => xs.length > 1;
export class ChainlinkVRFSubscriptionConsumer__factory extends ContractFactory {
constructor(...args: ChainlinkVRFSubscriptionConsumerConstructorParams) {
if (isSuperArgs(args)) {
super(...args);
} else {
super(_abi, _bytecode, args[0]);
}
}
override getDeployTransaction(
subscriptionId: BigNumberish,
_vrfCoordinator: AddressLike,
overrides?: NonPayableOverrides & { from?: string }
): Promise<ContractDeployTransaction> {
return super.getDeployTransaction(
subscriptionId,
_vrfCoordinator,
overrides || {}
);
}
override deploy(
subscriptionId: BigNumberish,
_vrfCoordinator: AddressLike,
overrides?: NonPayableOverrides & { from?: string }
) {
return super.deploy(
subscriptionId,
_vrfCoordinator,
overrides || {}
) as Promise<
ChainlinkVRFSubscriptionConsumer & {
deploymentTransaction(): ContractTransactionResponse;
}
>;
}
override connect(
runner: ContractRunner | null
): ChainlinkVRFSubscriptionConsumer__factory {
return super.connect(runner) as ChainlinkVRFSubscriptionConsumer__factory;
}
static readonly bytecode = _bytecode;
static readonly abi = _abi;
static createInterface(): ChainlinkVRFSubscriptionConsumerInterface {
return new Interface(_abi) as ChainlinkVRFSubscriptionConsumerInterface;
}
static connect(
address: string,
runner?: ContractRunner | null
): ChainlinkVRFSubscriptionConsumer {
return new Contract(
address,
_abi,
runner
) as unknown as ChainlinkVRFSubscriptionConsumer;
}
}