-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added contract audit changes, code review changes
- Loading branch information
1 parent
20110ce
commit 4c4e5eb
Showing
16 changed files
with
3,376 additions
and
3,715 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 7 additions & 5 deletions
12
sdk/src/contexts/solana/utils/tokenBridgeRelayer/accounts/foreignContract.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 0 additions & 1 deletion
1
sdk/src/contexts/solana/utils/tokenBridgeRelayer/accounts/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,6 @@ | ||
export * from './foreignContract'; | ||
export * from './redeemerConfig'; | ||
export * from './registeredToken'; | ||
export * from './relayerFee'; | ||
export * from './senderConfig'; | ||
export * from './tmpTokenAccount'; | ||
export * from './tokenTransferMessage'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 0 additions & 18 deletions
18
sdk/src/contexts/solana/utils/tokenBridgeRelayer/accounts/relayerFee.ts
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
sdk/src/contexts/solana/utils/tokenBridgeRelayer/accounts/signerSequence.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { deriveAddress } from '../../utils'; | ||
import { PublicKey, PublicKeyInitData } from '@solana/web3.js'; | ||
import { BN } from '@project-serum/anchor'; | ||
|
||
export interface SignerSequence { | ||
value: BN; | ||
} | ||
|
||
export function deriveSignerSequenceAddress( | ||
programId: PublicKeyInitData, | ||
payerKey: PublicKeyInitData, | ||
): PublicKey { | ||
return deriveAddress( | ||
[Buffer.from('seq'), new PublicKey(payerKey).toBuffer()], | ||
programId, | ||
); | ||
} |
11 changes: 8 additions & 3 deletions
11
sdk/src/contexts/solana/utils/tokenBridgeRelayer/accounts/tokenTransferMessage.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,16 @@ | ||
import { deriveAddress } from '../../utils'; | ||
import { PublicKey, PublicKeyInitData } from '@solana/web3.js'; | ||
import { BN } from '@project-serum/anchor'; | ||
|
||
export function deriveTokenTransferMessageAddress( | ||
programId: PublicKeyInitData, | ||
sequence: bigint, | ||
payer: PublicKeyInitData, | ||
sequence: BN, | ||
): PublicKey { | ||
const sequenceBuf = Buffer.alloc(8); | ||
sequenceBuf.writeBigUInt64LE(sequence); | ||
return deriveAddress([Buffer.from('bridged'), sequenceBuf], programId); | ||
sequenceBuf.writeBigUInt64LE(BigInt(sequence.toString())); | ||
return deriveAddress( | ||
[Buffer.from('bridged'), new PublicKey(payer).toBuffer(), sequenceBuf], | ||
programId, | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.