Skip to content

Commit

Permalink
restructure IDistribution.ReferralInfo (#650)
Browse files Browse the repository at this point in the history
  • Loading branch information
doerfli committed Aug 30, 2024
1 parent 931ea38 commit 862862b
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 12 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -574,6 +574,7 @@ New structs must be added to `MockStorageLayout` to be included in analysis.
| uint256 | 32 bytes |
| uint128 | 16 bytes |
| uint160 | 20 bytes |
| uint32 | 4 bytes |
| uint16 | 2 bytes |
| string | 32 bytes |
| bytes | 32 bytes |
Expand Down
20 changes: 10 additions & 10 deletions contracts/distribution/DistributionService.sol
Original file line number Diff line number Diff line change
Expand Up @@ -208,16 +208,16 @@ contract DistributionService is

{
referralId = ReferralLib.toReferralId(distributionNftId, code);
IDistribution.ReferralInfo memory info = IDistribution.ReferralInfo(
distributionNftId,
distributorNftId,
code,
discountPercentage,
maxReferrals,
0, // used referrals
expiryAt,
data
);
IDistribution.ReferralInfo memory info = IDistribution.ReferralInfo({
distributionNftId: distributionNftId,
distributorNftId: distributorNftId,
referralCode: code,
discountPercentage: discountPercentage,
maxReferrals: maxReferrals,
usedReferrals: 0,
expiryAt: expiryAt,
data: data
});

instance.getInstanceStore().createReferral(referralId, info);
}
Expand Down
8 changes: 6 additions & 2 deletions contracts/instance/module/IDistribution.sol
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,17 @@ interface IDistribution {
}

struct ReferralInfo {
// slot 0
NftId distributionNftId;
NftId distributorNftId;
string referralCode;
UFixed discountPercentage;
uint32 maxReferrals;
uint32 usedReferrals;
// slot 1
UFixed discountPercentage;
Timestamp expiryAt;
// slot 2
string referralCode;
// slot 3
bytes data;
}

Expand Down
2 changes: 2 additions & 0 deletions contracts/instance/module/IRisk.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@ import {Timestamp} from "../../type/Timestamp.sol";
interface IRisk {

struct RiskInfo {
// slot 0
NftId productNftId;
Timestamp createdAt;
// slot 1
bytes data;
}
}

0 comments on commit 862862b

Please sign in to comment.