diff --git a/apps/ethereum/tribes/src/pages/_app.tsx b/apps/ethereum/tribes/src/pages/_app.tsx index fa707f39..e3428bd8 100644 --- a/apps/ethereum/tribes/src/pages/_app.tsx +++ b/apps/ethereum/tribes/src/pages/_app.tsx @@ -10,7 +10,7 @@ import { ToastContainer } from 'react-toastify'; import 'react-toastify/dist/ReactToastify.css'; // Change your Tenant ID here. -const TENANT_ID = '0xDf61226090C2475D9ec7c494684d2715b61F130c'; +const TENANT_ID = '0x62a7aa79a52591Ccc62B71729329A80a666fA50f'; function MyApp({ Component, pageProps }: AppProps) { const hyperverse = initialize({ @@ -26,7 +26,7 @@ function MyApp({ Component, pageProps }: AppProps) { }, { bundle: RandomPick, - tenantId: '0x45e4c90801b1a17c178bB9855aA181A886DAA603', + tenantId: null, }, ], }); diff --git a/packages/hyperverse-ethereum-randompick/artifacts/contracts/RandomPick.sol/RandomPick.json b/packages/hyperverse-ethereum-randompick/artifacts/contracts/RandomPick.sol/RandomPick.json index 2134c8fc..2979d3f2 100644 --- a/packages/hyperverse-ethereum-randompick/artifacts/contracts/RandomPick.sol/RandomPick.json +++ b/packages/hyperverse-ethereum-randompick/artifacts/contracts/RandomPick.sol/RandomPick.json @@ -4,7 +4,23 @@ "sourceName": "contracts/RandomPick.sol", "abi": [ { - "inputs": [], + "inputs": [ + { + "internalType": "address", + "name": "vrfCoordinator", + "type": "address" + }, + { + "internalType": "address", + "name": "linkToken", + "type": "address" + }, + { + "internalType": "bytes32", + "name": "key", + "type": "bytes32" + } + ], "stateMutability": "nonpayable", "type": "constructor" }, @@ -127,8 +143,8 @@ "type": "function" } ], - "bytecode": "0x60c060405234801561001057600080fd5b5073b3dccb4cf7a26f6cf6b120cf5a73875b7bbc655b7301be23585060835e02b77ef475b0cc51aa1e07098173ffffffffffffffffffffffffffffffffffffffff1660a08173ffffffffffffffffffffffffffffffffffffffff1660601b815250508073ffffffffffffffffffffffffffffffffffffffff1660808173ffffffffffffffffffffffffffffffffffffffff1660601b8152505050507f2ed0feb3e7fd2022120aa84fab1945545a9f2ffc9076fd6156fa96eaff4c131160001b60018190555067016345785d8a000060028190555060805160601c60a05160601c610ed661011d60003960008181610340015261044d01526000818161015701526104110152610ed66000f3fe608060405234801561001057600080fd5b50600436106100575760003560e01c80634c6b25b11461005c578063816dd4901461008c57806394917f4c146100bc57806394985ddd146100ec578063bc64beee14610108575b600080fd5b6100766004803603810190610071919061084c565b610138565b6040516100839190610afa565b60405180910390f35b6100a660048036038101906100a191906107e2565b610150565b6040516100b39190610a71565b60405180910390f35b6100d660048036038101906100d19190610875565b61030d565b6040516100e39190610afa565b60405180910390f35b61010660048036038101906101019190610875565b61033e565b005b610122600480360381019061011d919061084c565b6103da565b60405161012f91906109ef565b60405180910390f35b60036020528060005260406000206000915090505481565b60006002547f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b81526004016101ae91906109ef565b60206040518083038186803b1580156101c657600080fd5b505afa1580156101da573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101fe91906108b1565b101561023f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161023690610b15565b60405180910390fd5b600061024f60015460025461040d565b905082600460008381526020019081526020016000209080519060200190610278929190610679565b50336005600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055507f3d95cbc75e00c352f4ac7c91bc32f77836c6eff14f4cbef2a3eb8905a4eca7b433826040516102fc929190610a0a565b60405180910390a180915050919050565b6004602052816000526040600020818154811061032957600080fd5b90600052602060002001600091509150505481565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146103cc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103c390610b35565b60405180910390fd5b6103d6828261056c565b5050565b60056020528060005260406000206000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60007f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16634000aea07f000000000000000000000000000000000000000000000000000000000000000084866000604051602001610481929190610a8c565b6040516020818303038152906040526040518463ffffffff1660e01b81526004016104ae93929190610a33565b602060405180830381600087803b1580156104c857600080fd5b505af11580156104dc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105009190610823565b506000610522846000306000808981526020019081526020016000205461060a565b90506001600080868152602001908152602001600020546105439190610bd3565b600080868152602001908152602001600020819055506105638482610646565b91505092915050565b600060046000848152602001908152602001600020805490509050600081836105959190610cfd565b90506004600085815260200190815260200160002081815481106105e2577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000200154600360008681526020019081526020016000208190555050505050565b6000848484846040516020016106239493929190610ab5565b6040516020818303038152906040528051906020012060001c9050949350505050565b6000828260405160200161065b9291906109c3565b60405160208183030381529060405280519060200120905092915050565b8280548282559060005260206000209081019282156106b5579160200282015b828111156106b4578251825591602001919060010190610699565b5b5090506106c291906106c6565b5090565b5b808211156106df5760008160009055506001016106c7565b5090565b60006106f66106f184610b7a565b610b55565b9050808382526020820190508285602086028201111561071557600080fd5b60005b85811015610745578161072b88826107a3565b845260208401935060208301925050600181019050610718565b5050509392505050565b600082601f83011261076057600080fd5b81356107708482602086016106e3565b91505092915050565b60008151905061078881610e44565b92915050565b60008135905061079d81610e5b565b92915050565b6000813590506107b281610e72565b92915050565b6000813590506107c781610e89565b92915050565b6000815190506107dc81610e89565b92915050565b6000602082840312156107f457600080fd5b600082013567ffffffffffffffff81111561080e57600080fd5b61081a8482850161074f565b91505092915050565b60006020828403121561083557600080fd5b600061084384828501610779565b91505092915050565b60006020828403121561085e57600080fd5b600061086c8482850161078e565b91505092915050565b6000806040838503121561088857600080fd5b60006108968582860161078e565b92505060206108a7858286016107b8565b9150509250929050565b6000602082840312156108c357600080fd5b60006108d1848285016107cd565b91505092915050565b6108e381610c29565b82525050565b6108f281610c47565b82525050565b61090961090482610c47565b610ce9565b82525050565b600061091a82610ba6565b6109248185610bb1565b9350610934818560208601610c85565b61093d81610dbb565b840191505092915050565b61095181610c51565b82525050565b6000610964602b83610bc2565b915061096f82610dcc565b604082019050919050565b6000610987601f83610bc2565b915061099282610e1b565b602082019050919050565b6109a681610c7b565b82525050565b6109bd6109b882610c7b565b610cf3565b82525050565b60006109cf82856108f8565b6020820191506109df82846109ac565b6020820191508190509392505050565b6000602082019050610a0460008301846108da565b92915050565b6000604082019050610a1f60008301856108da565b610a2c60208301846108e9565b9392505050565b6000606082019050610a4860008301866108da565b610a55602083018561099d565b8181036040830152610a67818461090f565b9050949350505050565b6000602082019050610a8660008301846108e9565b92915050565b6000604082019050610aa160008301856108e9565b610aae602083018461099d565b9392505050565b6000608082019050610aca60008301876108e9565b610ad7602083018661099d565b610ae460408301856108da565b610af1606083018461099d565b95945050505050565b6000602082019050610b0f6000830184610948565b92915050565b60006020820190508181036000830152610b2e81610957565b9050919050565b60006020820190508181036000830152610b4e8161097a565b9050919050565b6000610b5f610b70565b9050610b6b8282610cb8565b919050565b6000604051905090565b600067ffffffffffffffff821115610b9557610b94610d8c565b5b602082029050602081019050919050565b600081519050919050565b600082825260208201905092915050565b600082825260208201905092915050565b6000610bde82610c7b565b9150610be983610c7b565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115610c1e57610c1d610d2e565b5b828201905092915050565b6000610c3482610c5b565b9050919050565b60008115159050919050565b6000819050919050565b6000819050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b60005b83811015610ca3578082015181840152602081019050610c88565b83811115610cb2576000848401525b50505050565b610cc182610dbb565b810181811067ffffffffffffffff82111715610ce057610cdf610d8c565b5b80604052505050565b6000819050919050565b6000819050919050565b6000610d0882610c7b565b9150610d1383610c7b565b925082610d2357610d22610d5d565b5b828206905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f4e6f7420656e6f756768204c494e4b202d2066696c6c20636f6e74726163742060008201527f7769746820666175636574000000000000000000000000000000000000000000602082015250565b7f4f6e6c7920565246436f6f7264696e61746f722063616e2066756c66696c6c00600082015250565b610e4d81610c3b565b8114610e5857600080fd5b50565b610e6481610c47565b8114610e6f57600080fd5b50565b610e7b81610c51565b8114610e8657600080fd5b50565b610e9281610c7b565b8114610e9d57600080fd5b5056fea26469706673582212207e5894b476f0d46facfa4872791b634b2f715098ab3466adc631fc6f825421cb64736f6c63430008040033", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100575760003560e01c80634c6b25b11461005c578063816dd4901461008c57806394917f4c146100bc57806394985ddd146100ec578063bc64beee14610108575b600080fd5b6100766004803603810190610071919061084c565b610138565b6040516100839190610afa565b60405180910390f35b6100a660048036038101906100a191906107e2565b610150565b6040516100b39190610a71565b60405180910390f35b6100d660048036038101906100d19190610875565b61030d565b6040516100e39190610afa565b60405180910390f35b61010660048036038101906101019190610875565b61033e565b005b610122600480360381019061011d919061084c565b6103da565b60405161012f91906109ef565b60405180910390f35b60036020528060005260406000206000915090505481565b60006002547f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b81526004016101ae91906109ef565b60206040518083038186803b1580156101c657600080fd5b505afa1580156101da573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101fe91906108b1565b101561023f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161023690610b15565b60405180910390fd5b600061024f60015460025461040d565b905082600460008381526020019081526020016000209080519060200190610278929190610679565b50336005600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055507f3d95cbc75e00c352f4ac7c91bc32f77836c6eff14f4cbef2a3eb8905a4eca7b433826040516102fc929190610a0a565b60405180910390a180915050919050565b6004602052816000526040600020818154811061032957600080fd5b90600052602060002001600091509150505481565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146103cc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103c390610b35565b60405180910390fd5b6103d6828261056c565b5050565b60056020528060005260406000206000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60007f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16634000aea07f000000000000000000000000000000000000000000000000000000000000000084866000604051602001610481929190610a8c565b6040516020818303038152906040526040518463ffffffff1660e01b81526004016104ae93929190610a33565b602060405180830381600087803b1580156104c857600080fd5b505af11580156104dc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105009190610823565b506000610522846000306000808981526020019081526020016000205461060a565b90506001600080868152602001908152602001600020546105439190610bd3565b600080868152602001908152602001600020819055506105638482610646565b91505092915050565b600060046000848152602001908152602001600020805490509050600081836105959190610cfd565b90506004600085815260200190815260200160002081815481106105e2577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000200154600360008681526020019081526020016000208190555050505050565b6000848484846040516020016106239493929190610ab5565b6040516020818303038152906040528051906020012060001c9050949350505050565b6000828260405160200161065b9291906109c3565b60405160208183030381529060405280519060200120905092915050565b8280548282559060005260206000209081019282156106b5579160200282015b828111156106b4578251825591602001919060010190610699565b5b5090506106c291906106c6565b5090565b5b808211156106df5760008160009055506001016106c7565b5090565b60006106f66106f184610b7a565b610b55565b9050808382526020820190508285602086028201111561071557600080fd5b60005b85811015610745578161072b88826107a3565b845260208401935060208301925050600181019050610718565b5050509392505050565b600082601f83011261076057600080fd5b81356107708482602086016106e3565b91505092915050565b60008151905061078881610e44565b92915050565b60008135905061079d81610e5b565b92915050565b6000813590506107b281610e72565b92915050565b6000813590506107c781610e89565b92915050565b6000815190506107dc81610e89565b92915050565b6000602082840312156107f457600080fd5b600082013567ffffffffffffffff81111561080e57600080fd5b61081a8482850161074f565b91505092915050565b60006020828403121561083557600080fd5b600061084384828501610779565b91505092915050565b60006020828403121561085e57600080fd5b600061086c8482850161078e565b91505092915050565b6000806040838503121561088857600080fd5b60006108968582860161078e565b92505060206108a7858286016107b8565b9150509250929050565b6000602082840312156108c357600080fd5b60006108d1848285016107cd565b91505092915050565b6108e381610c29565b82525050565b6108f281610c47565b82525050565b61090961090482610c47565b610ce9565b82525050565b600061091a82610ba6565b6109248185610bb1565b9350610934818560208601610c85565b61093d81610dbb565b840191505092915050565b61095181610c51565b82525050565b6000610964602b83610bc2565b915061096f82610dcc565b604082019050919050565b6000610987601f83610bc2565b915061099282610e1b565b602082019050919050565b6109a681610c7b565b82525050565b6109bd6109b882610c7b565b610cf3565b82525050565b60006109cf82856108f8565b6020820191506109df82846109ac565b6020820191508190509392505050565b6000602082019050610a0460008301846108da565b92915050565b6000604082019050610a1f60008301856108da565b610a2c60208301846108e9565b9392505050565b6000606082019050610a4860008301866108da565b610a55602083018561099d565b8181036040830152610a67818461090f565b9050949350505050565b6000602082019050610a8660008301846108e9565b92915050565b6000604082019050610aa160008301856108e9565b610aae602083018461099d565b9392505050565b6000608082019050610aca60008301876108e9565b610ad7602083018661099d565b610ae460408301856108da565b610af1606083018461099d565b95945050505050565b6000602082019050610b0f6000830184610948565b92915050565b60006020820190508181036000830152610b2e81610957565b9050919050565b60006020820190508181036000830152610b4e8161097a565b9050919050565b6000610b5f610b70565b9050610b6b8282610cb8565b919050565b6000604051905090565b600067ffffffffffffffff821115610b9557610b94610d8c565b5b602082029050602081019050919050565b600081519050919050565b600082825260208201905092915050565b600082825260208201905092915050565b6000610bde82610c7b565b9150610be983610c7b565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115610c1e57610c1d610d2e565b5b828201905092915050565b6000610c3482610c5b565b9050919050565b60008115159050919050565b6000819050919050565b6000819050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b60005b83811015610ca3578082015181840152602081019050610c88565b83811115610cb2576000848401525b50505050565b610cc182610dbb565b810181811067ffffffffffffffff82111715610ce057610cdf610d8c565b5b80604052505050565b6000819050919050565b6000819050919050565b6000610d0882610c7b565b9150610d1383610c7b565b925082610d2357610d22610d5d565b5b828206905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f4e6f7420656e6f756768204c494e4b202d2066696c6c20636f6e74726163742060008201527f7769746820666175636574000000000000000000000000000000000000000000602082015250565b7f4f6e6c7920565246436f6f7264696e61746f722063616e2066756c66696c6c00600082015250565b610e4d81610c3b565b8114610e5857600080fd5b50565b610e6481610c47565b8114610e6f57600080fd5b50565b610e7b81610c51565b8114610e8657600080fd5b50565b610e9281610c7b565b8114610e9d57600080fd5b5056fea26469706673582212207e5894b476f0d46facfa4872791b634b2f715098ab3466adc631fc6f825421cb64736f6c63430008040033", + "bytecode": "0x60c06040523480156200001157600080fd5b50604051620010ce380380620010ce8339818101604052810190620000379190620000f6565b82828173ffffffffffffffffffffffffffffffffffffffff1660a08173ffffffffffffffffffffffffffffffffffffffff1660601b815250508073ffffffffffffffffffffffffffffffffffffffff1660808173ffffffffffffffffffffffffffffffffffffffff1660601b8152505050508060018190555067016345785d8a0000600281905550505050620001be565b600081519050620000d9816200018a565b92915050565b600081519050620000f081620001a4565b92915050565b6000806000606084860312156200010c57600080fd5b60006200011c86828701620000c8565b93505060206200012f86828701620000c8565b92505060406200014286828701620000df565b9150509250925092565b600062000159826200016a565b9050919050565b6000819050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b62000195816200014c565b8114620001a157600080fd5b50565b620001af8162000160565b8114620001bb57600080fd5b50565b60805160601c60a05160601c610ed6620001f860003960008181610340015261044d01526000818161015701526104110152610ed66000f3fe608060405234801561001057600080fd5b50600436106100575760003560e01c80634c6b25b11461005c578063816dd4901461008c57806394917f4c146100bc57806394985ddd146100ec578063bc64beee14610108575b600080fd5b6100766004803603810190610071919061084c565b610138565b6040516100839190610afa565b60405180910390f35b6100a660048036038101906100a191906107e2565b610150565b6040516100b39190610a71565b60405180910390f35b6100d660048036038101906100d19190610875565b61030d565b6040516100e39190610afa565b60405180910390f35b61010660048036038101906101019190610875565b61033e565b005b610122600480360381019061011d919061084c565b6103da565b60405161012f91906109ef565b60405180910390f35b60036020528060005260406000206000915090505481565b60006002547f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b81526004016101ae91906109ef565b60206040518083038186803b1580156101c657600080fd5b505afa1580156101da573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101fe91906108b1565b101561023f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161023690610b15565b60405180910390fd5b600061024f60015460025461040d565b905082600460008381526020019081526020016000209080519060200190610278929190610679565b50336005600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055507f3d95cbc75e00c352f4ac7c91bc32f77836c6eff14f4cbef2a3eb8905a4eca7b433826040516102fc929190610a0a565b60405180910390a180915050919050565b6004602052816000526040600020818154811061032957600080fd5b90600052602060002001600091509150505481565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146103cc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103c390610b35565b60405180910390fd5b6103d6828261056c565b5050565b60056020528060005260406000206000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60007f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16634000aea07f000000000000000000000000000000000000000000000000000000000000000084866000604051602001610481929190610a8c565b6040516020818303038152906040526040518463ffffffff1660e01b81526004016104ae93929190610a33565b602060405180830381600087803b1580156104c857600080fd5b505af11580156104dc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105009190610823565b506000610522846000306000808981526020019081526020016000205461060a565b90506001600080868152602001908152602001600020546105439190610bd3565b600080868152602001908152602001600020819055506105638482610646565b91505092915050565b600060046000848152602001908152602001600020805490509050600081836105959190610cfd565b90506004600085815260200190815260200160002081815481106105e2577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000200154600360008681526020019081526020016000208190555050505050565b6000848484846040516020016106239493929190610ab5565b6040516020818303038152906040528051906020012060001c9050949350505050565b6000828260405160200161065b9291906109c3565b60405160208183030381529060405280519060200120905092915050565b8280548282559060005260206000209081019282156106b5579160200282015b828111156106b4578251825591602001919060010190610699565b5b5090506106c291906106c6565b5090565b5b808211156106df5760008160009055506001016106c7565b5090565b60006106f66106f184610b7a565b610b55565b9050808382526020820190508285602086028201111561071557600080fd5b60005b85811015610745578161072b88826107a3565b845260208401935060208301925050600181019050610718565b5050509392505050565b600082601f83011261076057600080fd5b81356107708482602086016106e3565b91505092915050565b60008151905061078881610e44565b92915050565b60008135905061079d81610e5b565b92915050565b6000813590506107b281610e72565b92915050565b6000813590506107c781610e89565b92915050565b6000815190506107dc81610e89565b92915050565b6000602082840312156107f457600080fd5b600082013567ffffffffffffffff81111561080e57600080fd5b61081a8482850161074f565b91505092915050565b60006020828403121561083557600080fd5b600061084384828501610779565b91505092915050565b60006020828403121561085e57600080fd5b600061086c8482850161078e565b91505092915050565b6000806040838503121561088857600080fd5b60006108968582860161078e565b92505060206108a7858286016107b8565b9150509250929050565b6000602082840312156108c357600080fd5b60006108d1848285016107cd565b91505092915050565b6108e381610c29565b82525050565b6108f281610c47565b82525050565b61090961090482610c47565b610ce9565b82525050565b600061091a82610ba6565b6109248185610bb1565b9350610934818560208601610c85565b61093d81610dbb565b840191505092915050565b61095181610c51565b82525050565b6000610964602b83610bc2565b915061096f82610dcc565b604082019050919050565b6000610987601f83610bc2565b915061099282610e1b565b602082019050919050565b6109a681610c7b565b82525050565b6109bd6109b882610c7b565b610cf3565b82525050565b60006109cf82856108f8565b6020820191506109df82846109ac565b6020820191508190509392505050565b6000602082019050610a0460008301846108da565b92915050565b6000604082019050610a1f60008301856108da565b610a2c60208301846108e9565b9392505050565b6000606082019050610a4860008301866108da565b610a55602083018561099d565b8181036040830152610a67818461090f565b9050949350505050565b6000602082019050610a8660008301846108e9565b92915050565b6000604082019050610aa160008301856108e9565b610aae602083018461099d565b9392505050565b6000608082019050610aca60008301876108e9565b610ad7602083018661099d565b610ae460408301856108da565b610af1606083018461099d565b95945050505050565b6000602082019050610b0f6000830184610948565b92915050565b60006020820190508181036000830152610b2e81610957565b9050919050565b60006020820190508181036000830152610b4e8161097a565b9050919050565b6000610b5f610b70565b9050610b6b8282610cb8565b919050565b6000604051905090565b600067ffffffffffffffff821115610b9557610b94610d8c565b5b602082029050602081019050919050565b600081519050919050565b600082825260208201905092915050565b600082825260208201905092915050565b6000610bde82610c7b565b9150610be983610c7b565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115610c1e57610c1d610d2e565b5b828201905092915050565b6000610c3482610c5b565b9050919050565b60008115159050919050565b6000819050919050565b6000819050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b60005b83811015610ca3578082015181840152602081019050610c88565b83811115610cb2576000848401525b50505050565b610cc182610dbb565b810181811067ffffffffffffffff82111715610ce057610cdf610d8c565b5b80604052505050565b6000819050919050565b6000819050919050565b6000610d0882610c7b565b9150610d1383610c7b565b925082610d2357610d22610d5d565b5b828206905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f4e6f7420656e6f756768204c494e4b202d2066696c6c20636f6e74726163742060008201527f7769746820666175636574000000000000000000000000000000000000000000602082015250565b7f4f6e6c7920565246436f6f7264696e61746f722063616e2066756c66696c6c00600082015250565b610e4d81610c3b565b8114610e5857600080fd5b50565b610e6481610c47565b8114610e6f57600080fd5b50565b610e7b81610c51565b8114610e8657600080fd5b50565b610e9281610c7b565b8114610e9d57600080fd5b5056fea264697066735822122077e0b9c801d7478b29c8e9a6afdf2ad3b5e810372e8e97634420ffd5dafb066d64736f6c63430008040033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100575760003560e01c80634c6b25b11461005c578063816dd4901461008c57806394917f4c146100bc57806394985ddd146100ec578063bc64beee14610108575b600080fd5b6100766004803603810190610071919061084c565b610138565b6040516100839190610afa565b60405180910390f35b6100a660048036038101906100a191906107e2565b610150565b6040516100b39190610a71565b60405180910390f35b6100d660048036038101906100d19190610875565b61030d565b6040516100e39190610afa565b60405180910390f35b61010660048036038101906101019190610875565b61033e565b005b610122600480360381019061011d919061084c565b6103da565b60405161012f91906109ef565b60405180910390f35b60036020528060005260406000206000915090505481565b60006002547f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b81526004016101ae91906109ef565b60206040518083038186803b1580156101c657600080fd5b505afa1580156101da573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101fe91906108b1565b101561023f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161023690610b15565b60405180910390fd5b600061024f60015460025461040d565b905082600460008381526020019081526020016000209080519060200190610278929190610679565b50336005600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055507f3d95cbc75e00c352f4ac7c91bc32f77836c6eff14f4cbef2a3eb8905a4eca7b433826040516102fc929190610a0a565b60405180910390a180915050919050565b6004602052816000526040600020818154811061032957600080fd5b90600052602060002001600091509150505481565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146103cc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103c390610b35565b60405180910390fd5b6103d6828261056c565b5050565b60056020528060005260406000206000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60007f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16634000aea07f000000000000000000000000000000000000000000000000000000000000000084866000604051602001610481929190610a8c565b6040516020818303038152906040526040518463ffffffff1660e01b81526004016104ae93929190610a33565b602060405180830381600087803b1580156104c857600080fd5b505af11580156104dc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105009190610823565b506000610522846000306000808981526020019081526020016000205461060a565b90506001600080868152602001908152602001600020546105439190610bd3565b600080868152602001908152602001600020819055506105638482610646565b91505092915050565b600060046000848152602001908152602001600020805490509050600081836105959190610cfd565b90506004600085815260200190815260200160002081815481106105e2577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000200154600360008681526020019081526020016000208190555050505050565b6000848484846040516020016106239493929190610ab5565b6040516020818303038152906040528051906020012060001c9050949350505050565b6000828260405160200161065b9291906109c3565b60405160208183030381529060405280519060200120905092915050565b8280548282559060005260206000209081019282156106b5579160200282015b828111156106b4578251825591602001919060010190610699565b5b5090506106c291906106c6565b5090565b5b808211156106df5760008160009055506001016106c7565b5090565b60006106f66106f184610b7a565b610b55565b9050808382526020820190508285602086028201111561071557600080fd5b60005b85811015610745578161072b88826107a3565b845260208401935060208301925050600181019050610718565b5050509392505050565b600082601f83011261076057600080fd5b81356107708482602086016106e3565b91505092915050565b60008151905061078881610e44565b92915050565b60008135905061079d81610e5b565b92915050565b6000813590506107b281610e72565b92915050565b6000813590506107c781610e89565b92915050565b6000815190506107dc81610e89565b92915050565b6000602082840312156107f457600080fd5b600082013567ffffffffffffffff81111561080e57600080fd5b61081a8482850161074f565b91505092915050565b60006020828403121561083557600080fd5b600061084384828501610779565b91505092915050565b60006020828403121561085e57600080fd5b600061086c8482850161078e565b91505092915050565b6000806040838503121561088857600080fd5b60006108968582860161078e565b92505060206108a7858286016107b8565b9150509250929050565b6000602082840312156108c357600080fd5b60006108d1848285016107cd565b91505092915050565b6108e381610c29565b82525050565b6108f281610c47565b82525050565b61090961090482610c47565b610ce9565b82525050565b600061091a82610ba6565b6109248185610bb1565b9350610934818560208601610c85565b61093d81610dbb565b840191505092915050565b61095181610c51565b82525050565b6000610964602b83610bc2565b915061096f82610dcc565b604082019050919050565b6000610987601f83610bc2565b915061099282610e1b565b602082019050919050565b6109a681610c7b565b82525050565b6109bd6109b882610c7b565b610cf3565b82525050565b60006109cf82856108f8565b6020820191506109df82846109ac565b6020820191508190509392505050565b6000602082019050610a0460008301846108da565b92915050565b6000604082019050610a1f60008301856108da565b610a2c60208301846108e9565b9392505050565b6000606082019050610a4860008301866108da565b610a55602083018561099d565b8181036040830152610a67818461090f565b9050949350505050565b6000602082019050610a8660008301846108e9565b92915050565b6000604082019050610aa160008301856108e9565b610aae602083018461099d565b9392505050565b6000608082019050610aca60008301876108e9565b610ad7602083018661099d565b610ae460408301856108da565b610af1606083018461099d565b95945050505050565b6000602082019050610b0f6000830184610948565b92915050565b60006020820190508181036000830152610b2e81610957565b9050919050565b60006020820190508181036000830152610b4e8161097a565b9050919050565b6000610b5f610b70565b9050610b6b8282610cb8565b919050565b6000604051905090565b600067ffffffffffffffff821115610b9557610b94610d8c565b5b602082029050602081019050919050565b600081519050919050565b600082825260208201905092915050565b600082825260208201905092915050565b6000610bde82610c7b565b9150610be983610c7b565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115610c1e57610c1d610d2e565b5b828201905092915050565b6000610c3482610c5b565b9050919050565b60008115159050919050565b6000819050919050565b6000819050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b60005b83811015610ca3578082015181840152602081019050610c88565b83811115610cb2576000848401525b50505050565b610cc182610dbb565b810181811067ffffffffffffffff82111715610ce057610cdf610d8c565b5b80604052505050565b6000819050919050565b6000819050919050565b6000610d0882610c7b565b9150610d1383610c7b565b925082610d2357610d22610d5d565b5b828206905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f4e6f7420656e6f756768204c494e4b202d2066696c6c20636f6e74726163742060008201527f7769746820666175636574000000000000000000000000000000000000000000602082015250565b7f4f6e6c7920565246436f6f7264696e61746f722063616e2066756c66696c6c00600082015250565b610e4d81610c3b565b8114610e5857600080fd5b50565b610e6481610c47565b8114610e6f57600080fd5b50565b610e7b81610c51565b8114610e8657600080fd5b50565b610e9281610c7b565b8114610e9d57600080fd5b5056fea264697066735822122077e0b9c801d7478b29c8e9a6afdf2ad3b5e810372e8e97634420ffd5dafb066d64736f6c63430008040033", "linkReferences": {}, "deployedLinkReferences": {} } diff --git a/packages/hyperverse-ethereum-randompick/contracts.json b/packages/hyperverse-ethereum-randompick/contracts.json index ea2343f7..e5a821a1 100644 --- a/packages/hyperverse-ethereum-randompick/contracts.json +++ b/packages/hyperverse-ethereum-randompick/contracts.json @@ -1,17 +1,26 @@ { - "metis": { - "testnet": { - "contractAddress": "0x5536B64dA409349E3Feb5d7e949B28716506e937" - } - }, - "ethereum": { - "testnet": { - "contractAddress": "0xeed9846eD6E8525eB9866835ED67b1913a5361CF" - } - }, - "avalanche": { - "testnet": { - "contractAddress": "0xC7ca00A24da99Eb8AFD3eE1511801eBAFc49C368" - } - } + "metis": { + "testnet": { + "contractAddress": "0x5536B64dA409349E3Feb5d7e949B28716506e937" + }, + "mainnet": {} + }, + "ethereum": { + "testnet": { + "contractAddress": "0x340554DDb594ccce941709Eb976f86ed5E241F3c" + }, + "mainnet": {} + }, + "avalanche": { + "testnet": { + "contractAddress": "0xC7ca00A24da99Eb8AFD3eE1511801eBAFc49C368" + }, + "mainnet": {} + }, + "polygon": { + "testnet": { + "contractAddress": "0x995d701c0CaAeDA88DBF21727202F3a61AF01177" + }, + "mainnet": {} + } } diff --git a/packages/hyperverse-ethereum-randompick/contracts/RandomPick.sol b/packages/hyperverse-ethereum-randompick/contracts/RandomPick.sol index 2573e0d6..ad7e1916 100644 --- a/packages/hyperverse-ethereum-randompick/contracts/RandomPick.sol +++ b/packages/hyperverse-ethereum-randompick/contracts/RandomPick.sol @@ -29,13 +29,13 @@ contract RandomPick is VRFConsumerBase { * Key Hash: 0x2ed0feb3e7fd2022120aa84fab1945545a9f2ffc9076fd6156fa96eaff4c1311 * Fee: 0.1 LINK */ - constructor() + constructor(address vrfCoordinator, address linkToken, bytes32 key) VRFConsumerBase( - 0xb3dCcb4Cf7a26f6cf6B120Cf5A73875B7BBc655B, // VRF Coordinator - 0x01BE23585060835E02B77ef475b0Cc51aA1e0709 // LINK Token on Rinkeby + vrfCoordinator, // VRF Coordinator + linkToken // LINK Token on Rinkeby ) { - keyHash = 0x2ed0feb3e7fd2022120aa84fab1945545a9f2ffc9076fd6156fa96eaff4c1311; + keyHash = key; fee = 0.1 * 10**18; // 0.1 LINK (Varies by network) } diff --git a/packages/hyperverse-ethereum-randompick/hardhat.config.js b/packages/hyperverse-ethereum-randompick/hardhat.config.js index 5fb4f6e5..a186dbbc 100644 --- a/packages/hyperverse-ethereum-randompick/hardhat.config.js +++ b/packages/hyperverse-ethereum-randompick/hardhat.config.js @@ -17,6 +17,9 @@ task('accounts', 'Prints the list of accounts', async (taskArgs, hre) => { /** * @type import('hardhat/config').HardhatUserConfig */ + +const accounts = process.env.NEXT_PRIVATE_KEY !== undefined ? [process.env.NEXT_PRIVATE_KEY] : []; + module.exports = { solidity: '0.8.4', defaultNetwork: 'hardhat', @@ -24,18 +27,19 @@ module.exports = { hardhat: {}, ethereum: { url: `https://rinkeby.infura.io/v3/${process.env.NEXT_PUBLIC_INFURA_API_KEY}`, - accounts: - process.env.NEXT_PRIVATE_KEY !== undefined ? [process.env.NEXT_PRIVATE_KEY] : [], + accounts }, metis: { url: 'https://stardust.metis.io/?owner=588', - accounts: - process.env.NEXT_PRIVATE_KEY !== undefined ? [process.env.NEXT_PRIVATE_KEY] : [], + accounts }, avalanche: { url: 'https://api.avax-test.network/ext/bc/C/rpc', - accounts: - process.env.NEXT_PRIVATE_KEY !== undefined ? [process.env.NEXT_PRIVATE_KEY] : [], + accounts }, - }, + polygon: { + url: 'https://rpc-mumbai.maticvigil.com', + accounts + } + } }; diff --git a/packages/hyperverse-ethereum-randompick/package.json b/packages/hyperverse-ethereum-randompick/package.json index e5d9b4da..d02289b3 100644 --- a/packages/hyperverse-ethereum-randompick/package.json +++ b/packages/hyperverse-ethereum-randompick/package.json @@ -1,51 +1,50 @@ { - "name": "@decentology/hyperverse-ethereum-randompick", - "version": "1.0.11", - "source": "./source/index.ts", - "types": "./distribution/index.d.ts", - "module": "./distribution/index.es.js", - "main": "./distribution/index.js", - "license": "MIT", - "scripts": { - "test": "hardhat test", - "build": "parcel build", - "clean": "rimraf ./distribution", - "deploy": "run-p deploy-ethereum deploy-metis deploy-avalanche", - "deploy-ethereum": "hardhat run scripts/deploy.js --network ethereum ", - "deploy-metis": "hardhat run scripts/deploy.js --network metis", - "deploy-avalanche": "hardhat run scripts/deploy.js --network avalanche" - }, - "publishConfig": { - "access": "public" - }, - "peerDependencies": { - "react": "^17.0.2" - }, - "files": [ - "distribution", - "utils" - ], - "dependencies": { - "@chainlink/contracts": "^0.4.0", - "@decentology/hyperverse": "^1.0.9", - "@decentology/hyperverse-ethereum": "^1.0.9", - "@decentology/hyperverse-storage-skynet": "^1.0.8", - "@decentology/unstated-next": "^1.1.1", - "ethers": "^5.5.3", - "react-query": "^3.34.7", - "react-use": "^17.3.2", - "skynet-js": "^4.0.23-beta" - }, - "devDependencies": { - "@decentology/config": "^1.0.0", - "@nomiclabs/hardhat-ethers": "^2.0.4", - "@nomiclabs/hardhat-waffle": "^2.0.2", - "chai": "^4.3.4", - "dotnet": "^1.1.4", - "ethereum-waffle": "^3.4.0", - "hardhat": "^2.8.3", - "npm-run-all": "^4.1.5", - "parcel": "^2.2.1", - "rimraf": "^3.0.2" - } + "name": "@decentology/hyperverse-ethereum-randompick", + "version": "1.0.11", + "source": "./source/index.ts", + "types": "./distribution/index.d.ts", + "module": "./distribution/index.es.js", + "main": "./distribution/index.js", + "license": "MIT", + "scripts": { + "test": "hardhat test", + "build": "parcel build", + "clean": "rimraf ./distribution", + "deploy": "run-p deploy-ethereum deploy-polygon", + "deploy-ethereum": "hardhat run scripts/deploy.js --network ethereum ", + "deploy-polygon": "hardhat run scripts/deploy.js --network polygon" + }, + "publishConfig": { + "access": "public" + }, + "peerDependencies": { + "react": "^17.0.2" + }, + "files": [ + "distribution", + "utils" + ], + "dependencies": { + "@chainlink/contracts": "^0.4.0", + "@decentology/hyperverse": "^1.0.9", + "@decentology/hyperverse-ethereum": "^1.0.9", + "@decentology/hyperverse-storage-skynet": "^1.0.8", + "@decentology/unstated-next": "^1.1.1", + "ethers": "^5.5.3", + "react-query": "^3.34.7", + "react-use": "^17.3.2", + "skynet-js": "^4.0.23-beta" + }, + "devDependencies": { + "@decentology/config": "^1.0.0", + "@nomiclabs/hardhat-ethers": "^2.0.4", + "@nomiclabs/hardhat-waffle": "^2.0.2", + "chai": "^4.3.4", + "dotnet": "^1.1.4", + "ethereum-waffle": "^3.4.0", + "hardhat": "^2.8.3", + "npm-run-all": "^4.1.5", + "parcel": "^2.2.1", + "rimraf": "^3.0.2" + } } diff --git a/packages/hyperverse-ethereum-randompick/scripts/deploy.js b/packages/hyperverse-ethereum-randompick/scripts/deploy.js index 32412e49..4c136f2c 100644 --- a/packages/hyperverse-ethereum-randompick/scripts/deploy.js +++ b/packages/hyperverse-ethereum-randompick/scripts/deploy.js @@ -7,12 +7,29 @@ const hre = require('hardhat'); const fs = require('fs-extra'); require('dotenv').config(); async function main() { + let vrfCoordinator, linkToken, keyHash; + switch (hre.network.name) { + case 'ethereum': + vrfCoordinator = '0x6168499c0cFfCaCD319c818142124B7A15E857ab'; + linkToken = '0x01BE23585060835E02B77ef475b0Cc51aA1e0709'; + keyHash = '0xd89b2bf150e3b9e13446986e571fb9cab24b13cea0a43ea20a6049a85cc807cc'; + break; + case 'polygon': + vrfCoordinator = '0x8C7382F9D8f56b33781fE506E897a4F1e2d17255'; + linkToken = '0x326C977E6efc84E512bB9C30f76E30c160eD06FB'; + keyHash = '0x6e75b569a01ef56d18cab6a8e71e6600d6ce853834d4a5748b720d06f878b3a4'; + break; + default: + throw new Error('Unsupported network'); + } + const RandomPick = await ethers.getContractFactory('RandomPick'); - const randomPick = await RandomPick.deploy(); + const randomPick = await RandomPick.deploy(vrfCoordinator, linkToken, keyHash); await randomPick.deployed(); - - - console.log(`[${hre.network.name}] RandomPick deployed to: ${randomPick.address}`); + console.log(JSON.stringify(randomPick)); + console.log( + `[${hre.network.name}] RandomPick deployed to: ${randomPick.address} from transaction ${randomPick.transactionHash}` + ); const env = JSON.parse(fs.readFileSync('contracts.json').toString()); env[hre.network.name] = env[hre.network.name] || {}; @@ -27,7 +44,7 @@ async function main() { // and properly handle errors. main() .then(() => process.exit(0)) - .catch((error) => { + .catch(error => { console.error(error); process.exit(1); }); diff --git a/packages/hyperverse-ethereum-randompick/source/Provider.tsx b/packages/hyperverse-ethereum-randompick/source/Provider.tsx index 2f0eaf82..469be072 100644 --- a/packages/hyperverse-ethereum-randompick/source/Provider.tsx +++ b/packages/hyperverse-ethereum-randompick/source/Provider.tsx @@ -4,15 +4,10 @@ import { HyperverseModuleInstance } from '@decentology/hyperverse'; import { RandomPick } from './useRandomPick'; const client = new QueryClient(); -const Provider: FC = ({ children, tenantId }) => { - if (tenantId == null) { - throw new Error('Tenant ID is required'); - } +const Provider: FC = ({ children }) => { return ( - - {children} - + {children} ); }; diff --git a/packages/hyperverse-ethereum-randompick/source/environment.ts b/packages/hyperverse-ethereum-randompick/source/environment.ts index 15b405cc..bf33e206 100644 --- a/packages/hyperverse-ethereum-randompick/source/environment.ts +++ b/packages/hyperverse-ethereum-randompick/source/environment.ts @@ -17,7 +17,7 @@ function useEnvironment() { if (blockchain == null) { throw new Error('Blockchain is not set'); } - if (blockchain?.name !== Blockchain.Ethereum) { + if (blockchain?.name !== Blockchain.Ethereum && blockchain?.name !== Blockchain.Polygon) { throw new Error('Blockchain is not EVM compatible'); } diff --git a/packages/hyperverse-ethereum-randompick/source/useRandomPick.ts b/packages/hyperverse-ethereum-randompick/source/useRandomPick.ts index 9cabfaac..2f5cecbf 100644 --- a/packages/hyperverse-ethereum-randompick/source/useRandomPick.ts +++ b/packages/hyperverse-ethereum-randompick/source/useRandomPick.ts @@ -7,8 +7,7 @@ import { useEnvironment } from './environment'; type ContractState = ethers.Contract; const sleep = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms)); -function RandomPickState(initialState: { tenantId: string } = { tenantId: '' }) { - const { tenantId } = initialState; +function RandomPickState() { const { address, web3Provider, provider, connect } = useEthereum(); const { ContractABI, contractAddress } = useEnvironment(); const [contract, setRandomPickContract] = useState( @@ -75,7 +74,6 @@ function RandomPickState(initialState: { tenantId: string } = { tenantId: '' }) ); return { - tenantId, contract, StartRandomPick: ( options?: Omit, 'mutationFn'>