commit
ffa0fe22e3
@ -1,4 +1,4 @@
|
||||
{
|
||||
"_format": "hh-sol-dbg-1",
|
||||
"buildInfo": "../../build-info/a5fa4780a59b1f26cae53eb04fc69734.json"
|
||||
"buildInfo": "../../build-info/0043b38db58c3ff291cf622f3b61e1a3.json"
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
{
|
||||
"_format": "hh-sol-dbg-1",
|
||||
"buildInfo": "../../build-info/a5fa4780a59b1f26cae53eb04fc69734.json"
|
||||
"buildInfo": "../../build-info/0043b38db58c3ff291cf622f3b61e1a3.json"
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
{
|
||||
"_format": "hh-sol-dbg-1",
|
||||
"buildInfo": "../../build-info/a5fa4780a59b1f26cae53eb04fc69734.json"
|
||||
"buildInfo": "../../build-info/916d546d680bb337e1c490eb628d93df.json"
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
{
|
||||
"_format": "hh-sol-dbg-1",
|
||||
"buildInfo": "../../../../build-info/a5fa4780a59b1f26cae53eb04fc69734.json"
|
||||
"buildInfo": "../../../../build-info/0043b38db58c3ff291cf622f3b61e1a3.json"
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
{
|
||||
"_format": "hh-sol-dbg-1",
|
||||
"buildInfo": "../../../../build-info/a5fa4780a59b1f26cae53eb04fc69734.json"
|
||||
"buildInfo": "../../../../build-info/0043b38db58c3ff291cf622f3b61e1a3.json"
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
{
|
||||
"_format": "hh-sol-dbg-1",
|
||||
"buildInfo": "../../../../build-info/a5fa4780a59b1f26cae53eb04fc69734.json"
|
||||
"buildInfo": "../../../../build-info/0043b38db58c3ff291cf622f3b61e1a3.json"
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
{
|
||||
"_format": "hh-sol-dbg-1",
|
||||
"buildInfo": "../../../../build-info/a5fa4780a59b1f26cae53eb04fc69734.json"
|
||||
"buildInfo": "../../../../build-info/0043b38db58c3ff291cf622f3b61e1a3.json"
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
{
|
||||
"_format": "hh-sol-dbg-1",
|
||||
"buildInfo": "../../../../build-info/a5fa4780a59b1f26cae53eb04fc69734.json"
|
||||
"buildInfo": "../../../../build-info/0043b38db58c3ff291cf622f3b61e1a3.json"
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
{
|
||||
"_format": "hh-sol-dbg-1",
|
||||
"buildInfo": "../../../../build-info/a5fa4780a59b1f26cae53eb04fc69734.json"
|
||||
"buildInfo": "../../../../build-info/0043b38db58c3ff291cf622f3b61e1a3.json"
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
{
|
||||
"_format": "hh-sol-dbg-1",
|
||||
"buildInfo": "../../../../build-info/a5fa4780a59b1f26cae53eb04fc69734.json"
|
||||
"buildInfo": "../../../../build-info/0043b38db58c3ff291cf622f3b61e1a3.json"
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
{
|
||||
"_format": "hh-sol-dbg-1",
|
||||
"buildInfo": "../../../../build-info/a5fa4780a59b1f26cae53eb04fc69734.json"
|
||||
"buildInfo": "../../../../build-info/0043b38db58c3ff291cf622f3b61e1a3.json"
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
{
|
||||
"_format": "hh-sol-dbg-1",
|
||||
"buildInfo": "../../build-info/afbde6718590f5775bc92171f5c6c7f4.json"
|
||||
"buildInfo": "../../build-info/948b888bf726ea051449ea823f31e46a.json"
|
||||
}
|
||||
|
File diff suppressed because one or more lines are too long
@ -34,8 +34,11 @@ contract P2PIX is
|
||||
IReputation public reputation;
|
||||
Counters.Counter public depositCount;
|
||||
|
||||
|
||||
/// @dev Default blocks that lock will hold tokens.
|
||||
uint256 public defaultLockBlocks;
|
||||
/// @dev The scalar of BRZ token.
|
||||
uint256 constant public WAD = 1e18;
|
||||
|
||||
/// @dev Stores an relayer's last computed credit.
|
||||
mapping(uint256 => uint256) public userRecord;
|
||||
@ -199,7 +202,7 @@ contract P2PIX is
|
||||
// Halt execution and output `lockID`.
|
||||
return lockID;
|
||||
} else {
|
||||
if (l.amount <= 100 ether) {
|
||||
if (l.amount <= 1e2 ether) {
|
||||
_addLock(lockID, l, d);
|
||||
// Halt execution and output `lockID`.
|
||||
return lockID;
|
||||
@ -208,9 +211,9 @@ contract P2PIX is
|
||||
_castAddrToKey(msg.sender)
|
||||
];
|
||||
uint256 spendLimit;
|
||||
(spendLimit) = _limiter(userCredit);
|
||||
(spendLimit) = _limiter(userCredit / WAD);
|
||||
|
||||
if (l.amount > spendLimit || l.amount > 1e6)
|
||||
if (l.amount > (spendLimit * WAD) || l.amount > 1e6 ether)
|
||||
revert AmountNotAllowed();
|
||||
|
||||
_addLock(lockID, l, d);
|
||||
@ -350,8 +353,8 @@ contract P2PIX is
|
||||
uint256 _newUserRecord = (userRecord[userKey] >>
|
||||
1);
|
||||
|
||||
if (_newUserRecord <= 1e2) {
|
||||
userRecord[userKey] = 1e2;
|
||||
if (_newUserRecord <= 1e2 ether) {
|
||||
userRecord[userKey] = 1e2 ether;
|
||||
} else {
|
||||
userRecord[userKey] = _newUserRecord;
|
||||
}
|
||||
|
File diff suppressed because one or more lines are too long
@ -29,6 +29,7 @@ import type {
|
||||
|
||||
export interface P2PIXInterface extends utils.Interface {
|
||||
functions: {
|
||||
"WAD()": FunctionFragment;
|
||||
"_castAddrToKey(address)": FunctionFragment;
|
||||
"allowedERC20s(address)": FunctionFragment;
|
||||
"cancelDeposit(uint256)": FunctionFragment;
|
||||
@ -58,6 +59,7 @@ export interface P2PIXInterface extends utils.Interface {
|
||||
|
||||
getFunction(
|
||||
nameOrSignatureOrTopic:
|
||||
| "WAD"
|
||||
| "_castAddrToKey"
|
||||
| "allowedERC20s"
|
||||
| "cancelDeposit"
|
||||
@ -85,6 +87,7 @@ export interface P2PIXInterface extends utils.Interface {
|
||||
| "withdrawBalance"
|
||||
): FunctionFragment;
|
||||
|
||||
encodeFunctionData(functionFragment: "WAD", values?: undefined): string;
|
||||
encodeFunctionData(
|
||||
functionFragment: "_castAddrToKey",
|
||||
values: [PromiseOrValue<string>]
|
||||
@ -203,6 +206,7 @@ export interface P2PIXInterface extends utils.Interface {
|
||||
values?: undefined
|
||||
): string;
|
||||
|
||||
decodeFunctionResult(functionFragment: "WAD", data: BytesLike): Result;
|
||||
decodeFunctionResult(
|
||||
functionFragment: "_castAddrToKey",
|
||||
data: BytesLike
|
||||
@ -482,6 +486,8 @@ export interface P2PIX extends BaseContract {
|
||||
removeListener: OnEvent<this>;
|
||||
|
||||
functions: {
|
||||
WAD(overrides?: CallOverrides): Promise<[BigNumber]>;
|
||||
|
||||
_castAddrToKey(
|
||||
_addr: PromiseOrValue<string>,
|
||||
overrides?: CallOverrides
|
||||
@ -632,6 +638,8 @@ export interface P2PIX extends BaseContract {
|
||||
): Promise<ContractTransaction>;
|
||||
};
|
||||
|
||||
WAD(overrides?: CallOverrides): Promise<BigNumber>;
|
||||
|
||||
_castAddrToKey(
|
||||
_addr: PromiseOrValue<string>,
|
||||
overrides?: CallOverrides
|
||||
@ -780,6 +788,8 @@ export interface P2PIX extends BaseContract {
|
||||
): Promise<ContractTransaction>;
|
||||
|
||||
callStatic: {
|
||||
WAD(overrides?: CallOverrides): Promise<BigNumber>;
|
||||
|
||||
_castAddrToKey(
|
||||
_addr: PromiseOrValue<string>,
|
||||
overrides?: CallOverrides
|
||||
@ -1036,6 +1046,8 @@ export interface P2PIX extends BaseContract {
|
||||
};
|
||||
|
||||
estimateGas: {
|
||||
WAD(overrides?: CallOverrides): Promise<BigNumber>;
|
||||
|
||||
_castAddrToKey(
|
||||
_addr: PromiseOrValue<string>,
|
||||
overrides?: CallOverrides
|
||||
@ -1167,6 +1179,8 @@ export interface P2PIX extends BaseContract {
|
||||
};
|
||||
|
||||
populateTransaction: {
|
||||
WAD(overrides?: CallOverrides): Promise<PopulatedTransaction>;
|
||||
|
||||
_castAddrToKey(
|
||||
_addr: PromiseOrValue<string>,
|
||||
overrides?: CallOverrides
|
||||
|
@ -36,6 +36,8 @@ describe("Reputation", () => {
|
||||
expect(tx2).to.eq(curve(500));
|
||||
expect(tx3).to.eq(curve(444444));
|
||||
expect(tx4).to.eq(curve(988700));
|
||||
|
||||
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -14,7 +14,7 @@ import {
|
||||
import {
|
||||
ethers,
|
||||
network,
|
||||
/* , tracer */
|
||||
/* tracer */
|
||||
} from "hardhat";
|
||||
|
||||
// import keccak256 from "keccak256";
|
||||
@ -1578,7 +1578,7 @@ describe("P2PIX", () => {
|
||||
expect(storage.amount).to.eq(ethers.constants.One);
|
||||
expect(storage2.amount).to.eq(ethers.constants.Zero);
|
||||
expect(record1).to.eq(0);
|
||||
expect(record2).to.eq(100);
|
||||
expect(record2).to.eq(price);
|
||||
});
|
||||
it("should unlock expired through lock function", async () => {
|
||||
// test method through lock fx
|
||||
|
Loading…
x
Reference in New Issue
Block a user