Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Contract refactor #10

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions CommitPoolApp/Complete.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { Component } from "react";
import { View, StyleSheet, Image, Text, Button, TouchableOpacity } from "react-native";
import { ethers, utils } from 'ethers';
import abi from '../commitpool-contract-singleplayer/out/abi/contracts/SinglePlayerCommit.sol/SinglePlayerCommit.json'
import abi from '../CommitPoolContract/out/abi/contracts/SinglePlayerCommit.sol/SinglePlayerCommit.json'
import ConfettiCannon from 'react-native-confetti-cannon';

export default class Complete extends Component <{success: boolean, next: any, account: any}, {loading: Boolean, step: Number, fill: number}> {
Expand Down Expand Up @@ -29,7 +29,7 @@ export default class Complete extends Component <{success: boolean, next: any, a

contract = contract.connect(wallet);

await contract.processCommitmentUser();
await contract.processAndSettleUser();
this.props.next(4);
}

Expand Down
2 changes: 1 addition & 1 deletion CommitPoolApp/MakeCommitment.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { Component } from "react";
import { View, StyleSheet, Image, Text, Button, TouchableOpacity, TextInput } from "react-native";
import { ethers, utils } from 'ethers';
import abi from '../commitpool-contract-singleplayer/out/abi/contracts/SinglePlayerCommit.sol/SinglePlayerCommit.json'
import abi from '../CommitPoolContract/out/abi/contracts/SinglePlayerCommit.sol/SinglePlayerCommit.json'
import daiAbi from './daiAbi.json'
import { Dimensions } from 'react-native';
import DropDownPicker from 'react-native-dropdown-picker';
Expand Down
2 changes: 1 addition & 1 deletion CommitPoolApp/Track.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { AnimatedCircularProgress } from 'react-native-circular-progress';
import { ethers } from 'ethers';
import { AsyncStorage } from 'react-native';
import { Moment } from 'moment';
import abi from '../commitpool-contract-singleplayer/out/abi/contracts/SinglePlayerCommit.sol/SinglePlayerCommit.json'
import abi from '../CommitPoolContract/out/abi/contracts/SinglePlayerCommit.sol/SinglePlayerCommit.json'

export default class Track extends Component <{next: any, account: any, code: string}, {refreshToken: string, type: string, account:any, total: number, startTime: Number, endTime: Number, loading: Boolean, step: Number, fill: number, goal: number, accessToken: String}> {
constructor(props) {
Expand Down
2 changes: 1 addition & 1 deletion CommitPoolApp/Wallet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import ConfettiCannon from 'react-native-confetti-cannon';
import QRCode from 'react-native-qrcode-svg';
import { ethers } from 'ethers';
import daiAbi from './daiAbi.json'
import abi from '../commitpool-contract-singleplayer/out/abi/contracts/SinglePlayerCommit.sol/SinglePlayerCommit.json'
import abi from '../CommitPoolContract/out/abi/contracts/SinglePlayerCommit.sol/SinglePlayerCommit.json'


export default class Wallet extends Component <{next: any, account: any}, {balance: number, daiBalance: number, commitment: any}> {
Expand Down
File renamed without changes.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -135,11 +135,42 @@
"internalType": "uint256",
"name": "amount",
"type": "uint256"
},
{
"indexed": false,
"internalType": "uint256",
"name": "committerBalance",
"type": "uint256"
}
],
"name": "Deposit",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "address",
"name": "committer",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "amount",
"type": "uint256"
},
{
"indexed": false,
"internalType": "uint256",
"name": "slashedBalance",
"type": "uint256"
}
],
"name": "FundsSlashed",
"type": "event"
},
{
"anonymous": false,
"inputs": [
Expand Down Expand Up @@ -183,6 +214,31 @@
"name": "NewCommitment",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "address",
"name": "owner",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "amount",
"type": "uint256"
},
{
"indexed": false,
"internalType": "uint256",
"name": "slashedBalance",
"type": "uint256"
}
],
"name": "OwnerWithdrawal",
"type": "event"
},
{
"anonymous": false,
"inputs": [
Expand Down Expand Up @@ -241,6 +297,12 @@
"internalType": "uint256",
"name": "amount",
"type": "uint256"
},
{
"indexed": false,
"internalType": "uint256",
"name": "committerBalance",
"type": "uint256"
}
],
"name": "Withdrawal",
Expand Down Expand Up @@ -415,25 +477,6 @@
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "amount",
"type": "uint256"
}
],
"name": "deposit",
"outputs": [
{
"internalType": "bool",
"name": "success",
"type": "bool"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
Expand Down Expand Up @@ -476,7 +519,7 @@
"outputs": [
{
"internalType": "bool",
"name": "success",
"name": "commitmentExists",
"type": "bool"
}
],
Expand All @@ -492,13 +535,7 @@
}
],
"name": "disableActivity",
"outputs": [
{
"internalType": "bool",
"name": "success",
"type": "bool"
}
],
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
Expand Down Expand Up @@ -571,50 +608,6 @@
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "bytes32",
"name": "_activityKey",
"type": "bytes32"
},
{
"internalType": "uint256",
"name": "_goalValue",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "_startTime",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "_endTime",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "_stake",
"type": "uint256"
},
{
"internalType": "string",
"name": "_userId",
"type": "string"
}
],
"name": "makeCommitment",
"outputs": [
{
"internalType": "bool",
"name": "success",
"type": "bool"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "owner",
Expand All @@ -637,33 +630,39 @@
}
],
"name": "ownerWithdraw",
"outputs": [
{
"internalType": "bool",
"name": "success",
"type": "bool"
}
],
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "committer",
"name": "commitmentOwner",
"type": "address"
}
],
"name": "processCommitment",
"outputs": [],
"name": "processAndSettle",
"outputs": [
{
"internalType": "bool",
"name": "success",
"type": "bool"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "processCommitmentUser",
"outputs": [],
"name": "processAndSettleUser",
"outputs": [
{
"internalType": "bool",
"name": "success",
"type": "bool"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
Expand Down Expand Up @@ -763,13 +762,7 @@
}
],
"name": "updateActivityAllowed",
"outputs": [
{
"internalType": "bool",
"name": "success",
"type": "bool"
}
],
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
Expand All @@ -787,32 +780,7 @@
}
],
"name": "updateActivityOracle",
"outputs": [
{
"internalType": "bool",
"name": "success",
"type": "bool"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "amount",
"type": "uint256"
}
],
"name": "withdraw",
"outputs": [
{
"internalType": "bool",
"name": "success",
"type": "bool"
}
],
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
Expand Down
Loading