Skip to content

Commit

Permalink
feat: release 0.0.15
Browse files Browse the repository at this point in the history
update contract to upgradable ones
  • Loading branch information
wfnuser committed Sep 22, 2024
1 parent 519685b commit 2a7a648
Show file tree
Hide file tree
Showing 5 changed files with 163 additions and 18 deletions.
16 changes: 10 additions & 6 deletions examples/simple-react/src/components/sections/ConfirmTask.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import { Button } from "../Button";
export function ConfirmTask() {
const [taskId, setTaskId] = useState("2460577971");
const [github, setGithub] = useState("wfnuser");

const [taskPoints, setTaskPoints] = useState(10);
const tryMe = async () => {
const taskInfo = await sdk.contract.confirmTask(taskId, github);
const taskInfo = await sdk.contract.confirmTask(taskId, github, taskPoints);
console.log(taskInfo);
};

Expand All @@ -17,15 +17,19 @@ export function ConfirmTask() {
<Section title="Confirm Task">
<div>
<label>TaskId</label>
<input
value={taskId}
onChange={(e) => setTaskId(e.target.value)}
/>
<input value={taskId} onChange={(e) => setTaskId(e.target.value)} />
</div>
<div>
<label>Github</label>
<input value={github} onChange={(e) => setGithub(e.target.value)} />
</div>
<div>
<label>Task Points</label>
<input
value={taskPoints}
onChange={(e) => setTaskPoints(e.target.value)}
/>
</div>
<div>
<Button onClick={tryMe}>Try Me!</Button>
</div>
Expand Down
2 changes: 1 addition & 1 deletion examples/simple-react/src/lib/youbet-sdk/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export const openCampusTestOptions: SdkCtorOptions = {
networkOptions: {
rpcUrl: 'https://open-campus-codex-sepolia.drpc.org',
chainId: 656476,
contractAddress: '0xD5C57B49b58744202EB1e67F4b7e6cB1aD06844f',
contractAddress: '0xd8dcbd828a40f6590a5bee5095c38994dab3bdee',
},
chainName: 'OpenCampus-Testnet',
};
2 changes: 1 addition & 1 deletion packages/youbet-sdk/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "youbet-sdk",
"version": "0.0.14",
"version": "0.0.15",
"description": "Awesome SDK it is.",
"main": "./dist/cjs/main.js",
"module": "./dist/esm/index.js",
Expand Down
157 changes: 149 additions & 8 deletions packages/youbet-sdk/src/lib/abi/bet.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
[
{ "type": "constructor", "inputs": [], "stateMutability": "nonpayable" },
{
"type": "function",
"name": "UPGRADE_INTERFACE_VERSION",
"inputs": [],
"outputs": [{ "name": "", "type": "string", "internalType": "string" }],
"stateMutability": "view"
},
{
"type": "function",
"name": "_createGoal",
Expand Down Expand Up @@ -42,7 +49,8 @@
"name": "confirmTask",
"inputs": [
{ "name": "_taskId", "type": "string", "internalType": "string" },
{ "name": "github", "type": "string", "internalType": "string" }
{ "name": "github", "type": "string", "internalType": "string" },
{ "name": "taskPoints", "type": "uint256", "internalType": "uint256" }
],
"outputs": [],
"stateMutability": "nonpayable"
Expand All @@ -57,13 +65,6 @@
"outputs": [],
"stateMutability": "nonpayable"
},
{
"type": "function",
"name": "contractOwner",
"inputs": [],
"outputs": [{ "name": "", "type": "address", "internalType": "address" }],
"stateMutability": "view"
},
{
"type": "function",
"name": "createGoal",
Expand Down Expand Up @@ -349,6 +350,15 @@
"outputs": [{ "name": "", "type": "address", "internalType": "address" }],
"stateMutability": "view"
},
{
"type": "function",
"name": "initialize",
"inputs": [
{ "name": "initialOwner", "type": "address", "internalType": "address" }
],
"outputs": [],
"stateMutability": "nonpayable"
},
{
"type": "function",
"name": "linkWallet",
Expand All @@ -359,6 +369,27 @@
"outputs": [],
"stateMutability": "nonpayable"
},
{
"type": "function",
"name": "owner",
"inputs": [],
"outputs": [{ "name": "", "type": "address", "internalType": "address" }],
"stateMutability": "view"
},
{
"type": "function",
"name": "proxiableUUID",
"inputs": [],
"outputs": [{ "name": "", "type": "bytes32", "internalType": "bytes32" }],
"stateMutability": "view"
},
{
"type": "function",
"name": "renounceOwnership",
"inputs": [],
"outputs": [],
"stateMutability": "nonpayable"
},
{
"type": "function",
"name": "settleGoal",
Expand All @@ -377,6 +408,29 @@
"outputs": [],
"stateMutability": "payable"
},
{
"type": "function",
"name": "transferOwnership",
"inputs": [
{ "name": "newOwner", "type": "address", "internalType": "address" }
],
"outputs": [],
"stateMutability": "nonpayable"
},
{
"type": "function",
"name": "upgradeToAndCall",
"inputs": [
{
"name": "newImplementation",
"type": "address",
"internalType": "address"
},
{ "name": "data", "type": "bytes", "internalType": "bytes" }
],
"outputs": [],
"stateMutability": "payable"
},
{
"type": "event",
"name": "DebugLog",
Expand Down Expand Up @@ -508,6 +562,38 @@
],
"anonymous": false
},
{
"type": "event",
"name": "Initialized",
"inputs": [
{
"name": "version",
"type": "uint64",
"indexed": false,
"internalType": "uint64"
}
],
"anonymous": false
},
{
"type": "event",
"name": "OwnershipTransferred",
"inputs": [
{
"name": "previousOwner",
"type": "address",
"indexed": true,
"internalType": "address"
},
{
"name": "newOwner",
"type": "address",
"indexed": true,
"internalType": "address"
}
],
"anonymous": false
},
{
"type": "event",
"name": "ProjectCreated",
Expand Down Expand Up @@ -615,6 +701,19 @@
],
"anonymous": false
},
{
"type": "event",
"name": "Upgraded",
"inputs": [
{
"name": "implementation",
"type": "address",
"indexed": true,
"internalType": "address"
}
],
"anonymous": false
},
{
"type": "event",
"name": "WalletLinked",
Expand All @@ -633,5 +732,47 @@
}
],
"anonymous": false
},
{
"type": "error",
"name": "AddressEmptyCode",
"inputs": [
{ "name": "target", "type": "address", "internalType": "address" }
]
},
{
"type": "error",
"name": "ERC1967InvalidImplementation",
"inputs": [
{
"name": "implementation",
"type": "address",
"internalType": "address"
}
]
},
{ "type": "error", "name": "ERC1967NonPayable", "inputs": [] },
{ "type": "error", "name": "FailedInnerCall", "inputs": [] },
{ "type": "error", "name": "InvalidInitialization", "inputs": [] },
{ "type": "error", "name": "NotInitializing", "inputs": [] },
{
"type": "error",
"name": "OwnableInvalidOwner",
"inputs": [
{ "name": "owner", "type": "address", "internalType": "address" }
]
},
{
"type": "error",
"name": "OwnableUnauthorizedAccount",
"inputs": [
{ "name": "account", "type": "address", "internalType": "address" }
]
},
{ "type": "error", "name": "UUPSUnauthorizedCallContext", "inputs": [] },
{
"type": "error",
"name": "UUPSUnsupportedProxiableUUID",
"inputs": [{ "name": "slot", "type": "bytes32", "internalType": "bytes32" }]
}
]
4 changes: 2 additions & 2 deletions packages/youbet-sdk/src/modules/contractModule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,9 @@ export class ContractModule {
await tx.wait();
}

async confirmTask(taskId: string, github: string): Promise<void> {
async confirmTask(taskId: string, github: string, taskPoints: number): Promise<void> {
const contract = await this._getContract();
const tx = await contract.confirmTask(taskId, github);
const tx = await contract.confirmTask(taskId, github, taskPoints);
await tx.wait();
}

Expand Down

0 comments on commit 2a7a648

Please sign in to comment.