Skip to content

Commit

Permalink
Pull decimals from token directly (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
zpetersen-paxos authored Oct 31, 2024
1 parent 168b4c3 commit 965f7a4
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 4 deletions.
2 changes: 1 addition & 1 deletion contracts/OFTWrapper.sol
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ contract OFTWrapper is OFTCore, RateLimiter {
address _lzEndpoint,
address _delegate,
RateLimitConfig[] memory _rateLimitConfigs
) OFTCore(6, _lzEndpoint, _delegate) {
) OFTCore(PaxosTokenV2(_paxosToken).decimals(), _lzEndpoint, _delegate) {
paxosToken = PaxosTokenV2(_paxosToken);
_setRateLimits(_rateLimitConfigs);
}
Expand Down
4 changes: 4 additions & 0 deletions contracts/fixture/PaxosTokenFixture.sol
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,8 @@ contract PaxosTokenFixture is PaxosTokenV2 {
balances[burnFromAddress] -= value;
return true;
}

function decimals() public pure override returns (uint8) {
return 6;
}
}
8 changes: 7 additions & 1 deletion test/OFTProxyBasicTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,13 @@ describe('OFTWrapper Test', function () {
});
});

describe('decimalConversionRate', function () {
it('can get decimal conversion rate', async function () {
let res = await this.contract.decimalConversionRate();
assert.equal(res, 1)
});
});

describe('token', function () {
it('can get token address', async function () {
let res = await this.contract.token();
Expand All @@ -42,7 +49,6 @@ describe('OFTWrapper Test', function () {
}
await this.contract.setRateLimits([newRateLimitConfig])
const rateLimitConfig = await this.contract.rateLimits(newRateLimitConfig.dstEid);
console.log(rateLimitConfig)
assert.equal(rateLimitConfig.limit.toString(), newRateLimitConfig.limit.toString())
assert.equal(rateLimitConfig.window, newRateLimitConfig.window)
});
Expand Down
4 changes: 2 additions & 2 deletions test/OFTProxySendTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,12 @@ describe('OFTWrapper Send Test', function () {
dstEid: 2,
limit: ethers.utils.parseEther('1000'),
window: 100
}
}
const rateLimitConfigB = {
dstEid: 1,
limit: ethers.utils.parseEther('1000'),
window: 100
}
}
myOFTA = await MyOFT.connect(ownerA).deploy(tokenFixture.address, mockEndpointA.address, ownerA.address, [rateLimitConfigA])
myOFTB = await MyOFT.connect(ownerB).deploy(tokenFixtureB.address, mockEndpointB.address, ownerB.address, [rateLimitConfigB])

Expand Down

0 comments on commit 965f7a4

Please sign in to comment.