Skip to content

Commit

Permalink
refactor: redpacket history (#2374)
Browse files Browse the repository at this point in the history
  • Loading branch information
zhouhanseng authored Jun 7, 2021
1 parent 6bde5af commit fb2c900
Show file tree
Hide file tree
Showing 48 changed files with 1,372 additions and 860 deletions.
8 changes: 8 additions & 0 deletions packages/contracts/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,11 @@ Mainnet 0x26760783c12181efa3c435aee4ae686c53bdddbb
Ropsten 0x6d84e4863c0530bc0bb4291ef0ff454a40660ca3
Rinkeby 0x575f906db24154977c7361c2319e2b25e897e3b6
```

> May-21-2020
```plain
commit 494216e
Mainnet 0x8D8912E1237F9FF3EF661F32743CFB276E052F98
Ropsten 0x2E37676de88aD97f2BdBAa24d1421b4E3f3a63c8
```
121 changes: 121 additions & 0 deletions packages/contracts/abis/HappyRedPacketV1.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
[
{ "inputs": [], "stateMutability": "nonpayable", "type": "constructor" },
{
"anonymous": false,
"inputs": [
{ "indexed": false, "internalType": "bytes32", "name": "id", "type": "bytes32" },
{ "indexed": false, "internalType": "address", "name": "claimer", "type": "address" },
{ "indexed": false, "internalType": "uint256", "name": "claimed_value", "type": "uint256" },
{ "indexed": false, "internalType": "address", "name": "token_address", "type": "address" }
],
"name": "ClaimSuccess",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{ "indexed": false, "internalType": "uint256", "name": "total", "type": "uint256" },
{ "indexed": false, "internalType": "bytes32", "name": "id", "type": "bytes32" },
{ "indexed": false, "internalType": "address", "name": "creator", "type": "address" },
{ "indexed": false, "internalType": "uint256", "name": "creation_time", "type": "uint256" },
{ "indexed": false, "internalType": "address", "name": "token_address", "type": "address" }
],
"name": "CreationSuccess",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{ "indexed": false, "internalType": "bytes32", "name": "id", "type": "bytes32" },
{ "indexed": false, "internalType": "address", "name": "token_address", "type": "address" },
{ "indexed": false, "internalType": "uint256", "name": "remaining_balance", "type": "uint256" }
],
"name": "RefundSuccess",
"type": "event"
},
{
"inputs": [{ "internalType": "bytes32", "name": "id", "type": "bytes32" }],
"name": "check_availability",
"outputs": [
{ "internalType": "address", "name": "token_address", "type": "address" },
{ "internalType": "uint256", "name": "balance", "type": "uint256" },
{ "internalType": "uint256", "name": "total", "type": "uint256" },
{ "internalType": "uint256", "name": "claimed", "type": "uint256" },
{ "internalType": "bool", "name": "expired", "type": "bool" },
{ "internalType": "bool", "name": "ifclaimed", "type": "bool" }
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [{ "internalType": "bytes32", "name": "id", "type": "bytes32" }],
"name": "check_claimed_list",
"outputs": [{ "internalType": "address[]", "name": "claimer_addrs", "type": "address[]" }],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{ "internalType": "bytes32", "name": "id", "type": "bytes32" },
{ "internalType": "string", "name": "password", "type": "string" },
{ "internalType": "address", "name": "_recipient", "type": "address" },
{ "internalType": "bytes32", "name": "validation", "type": "bytes32" }
],
"name": "claim",
"outputs": [{ "internalType": "uint256", "name": "claimed", "type": "uint256" }],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "contract_creator",
"outputs": [{ "internalType": "address", "name": "", "type": "address" }],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{ "internalType": "bytes32", "name": "_hash", "type": "bytes32" },
{ "internalType": "uint8", "name": "_number", "type": "uint8" },
{ "internalType": "bool", "name": "_ifrandom", "type": "bool" },
{ "internalType": "uint256", "name": "_duration", "type": "uint256" },
{ "internalType": "bytes32", "name": "_seed", "type": "bytes32" },
{ "internalType": "string", "name": "_message", "type": "string" },
{ "internalType": "string", "name": "_name", "type": "string" },
{ "internalType": "uint256", "name": "_token_type", "type": "uint256" },
{ "internalType": "address", "name": "_token_addr", "type": "address" },
{ "internalType": "uint256", "name": "_total_tokens", "type": "uint256" }
],
"name": "create_red_packet",
"outputs": [],
"stateMutability": "payable",
"type": "function"
},
{
"inputs": [{ "internalType": "bytes32", "name": "id", "type": "bytes32" }],
"name": "refund",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [{ "internalType": "address", "name": "a", "type": "address" }],
"name": "toBytes",
"outputs": [{ "internalType": "bytes", "name": "b", "type": "bytes" }],
"stateMutability": "pure",
"type": "function"
},
{
"inputs": [
{ "internalType": "uint256", "name": "token_type", "type": "uint256" },
{ "internalType": "address", "name": "token_address", "type": "address" },
{ "internalType": "address", "name": "sender_address", "type": "address" },
{ "internalType": "address", "name": "recipient_address", "type": "address" },
{ "internalType": "uint256", "name": "amount", "type": "uint256" }
],
"name": "transfer_token",
"outputs": [],
"stateMutability": "payable",
"type": "function"
}
]
File renamed without changes.
49 changes: 36 additions & 13 deletions packages/contracts/types/HappyRedPacket.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,6 @@ export interface HappyRedPacket extends BaseContract {
_total_tokens: number | string | BN,
): PayableTransactionObject<void>

refund(id: string | number[]): NonPayableTransactionObject<void>

check_availability(id: string | number[]): NonPayableTransactionObject<{
token_address: string
balance: string
Expand All @@ -97,19 +95,44 @@ export interface HappyRedPacket extends BaseContract {
5: string
}>

contract_creator(): NonPayableTransactionObject<string>
refund(id: string | number[]): NonPayableTransactionObject<void>
}
events: {
ClaimSuccess(cb?: Callback<ClaimSuccess>): EventEmitter
ClaimSuccess(options?: EventOptions, cb?: Callback<ClaimSuccess>): EventEmitter

CreationSuccess(cb?: Callback<CreationSuccess>): EventEmitter
CreationSuccess(options?: EventOptions, cb?: Callback<CreationSuccess>): EventEmitter

RefundSuccess(cb?: Callback<RefundSuccess>): EventEmitter
RefundSuccess(options?: EventOptions, cb?: Callback<RefundSuccess>): EventEmitter

allEvents(options?: EventOptions, cb?: Callback<EventLog>): EventEmitter
ClaimSuccess: ContractEventLog<{
id: string
claimer: string
claimed_value: string
token_address: string
0: string
1: string
2: string
3: string
}>
CreationSuccess: ContractEventLog<{
total: string
id: string
name: string
message: string
creator: string
creation_time: string
token_address: string
0: string
1: string
2: string
3: string
4: string
5: string
6: string
}>
RefundSuccess: ContractEventLog<{
id: string
token_address: string
remaining_balance: string
0: string
1: string
2: string
}>
allEvents: (options?: EventOptions, cb?: Callback<EventLog>) => EventEmitter
}

once(event: 'ClaimSuccess', cb: Callback<ClaimSuccess>): void
Expand Down
105 changes: 105 additions & 0 deletions packages/contracts/types/HappyRedPacketV1.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
/* Autogenerated file. Do not edit manually. */
/* tslint:disable */
/* eslint-disable */

import BN from 'bn.js'
import { Contract, ContractOptions } from 'web3-eth-contract'
import { EventLog } from 'web3-core'
import { EventEmitter } from 'events'
import { ContractEvent, Callback, TransactionObject, BlockType } from './types'

interface EventOptions {
filter?: object
fromBlock?: BlockType
topics?: string[]
}

export class HappyRedPacketV1 extends Contract {
constructor(jsonInterface: any[], address?: string, options?: ContractOptions)
clone(): HappyRedPacketV1
methods: {
check_availability(id: string | number[]): TransactionObject<{
token_address: string
balance: string
total: string
claimed: string
expired: boolean
ifclaimed: boolean
0: string
1: string
2: string
3: string
4: boolean
5: boolean
}>

check_claimed_list(id: string | number[]): TransactionObject<string[]>

claim(
id: string | number[],
password: string,
_recipient: string,
validation: string | number[],
): TransactionObject<string>

contract_creator(): TransactionObject<string>

create_red_packet(
_hash: string | number[],
_number: number | string,
_ifrandom: boolean,
_duration: number | string,
_seed: string | number[],
_message: string,
_name: string,
_token_type: number | string,
_token_addr: string,
_total_tokens: number | string,
): TransactionObject<void>

refund(id: string | number[]): TransactionObject<void>

toBytes(a: string): TransactionObject<string>

transfer_token(
token_type: number | string,
token_address: string,
sender_address: string,
recipient_address: string,
amount: number | string,
): TransactionObject<void>
}
events: {
ClaimSuccess: ContractEvent<{
id: string
claimer: string
claimed_value: string
token_address: string
0: string
1: string
2: string
3: string
}>
CreationSuccess: ContractEvent<{
total: string
id: string
creator: string
creation_time: string
token_address: string
0: string
1: string
2: string
3: string
4: string
}>
RefundSuccess: ContractEvent<{
id: string
token_address: string
remaining_balance: string
0: string
1: string
2: string
}>
allEvents: (options?: EventOptions, cb?: Callback<EventLog>) => EventEmitter
}
}
Loading

0 comments on commit fb2c900

Please sign in to comment.