-
Notifications
You must be signed in to change notification settings - Fork 88
feat(smart-contracts):batch conversion xdeployer #912
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
olivier7delf
wants to merge
172
commits into
master
Choose a base branch
from
feat/deploy-batch-conversion-contracts
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from 108 commits
Commits
Show all changes
172 commits
Select commit
Hold shift + click to select a range
71d0605
batch erc20 conversion contract and local deployment
olivier7delf 5f7fc4f
tests batchPayments functions
olivier7delf eb1c4d8
clear batch contract
olivier7delf db22abc
add comments in smart contract
olivier7delf 1a3e6b8
add batchEthConversionPaymentsWithReference
olivier7delf 0ebe8b0
refacto batch contracts approval functions
olivier7delf 1818239
PR - update batch contact - function visibility and comments
olivier7delf 72c2a73
keep prefix underscore usage for function args
olivier7delf 3ed489c
convention naming in batch contract and more comments
olivier7delf 1800632
batchConv - delete chainlink implementation
olivier7delf 1eb224d
batchConv erc20 - delete a require - add error tests
olivier7delf f8c2745
prettier contract
olivier7delf 84216f7
doc: modify command to create request (#880)
rom1trt 73cb822
chore: update escrow addresses (#886)
KolevDarko 3e8763d
feat: goerli payment (#892)
rom1trt 8b51b33
refactor: factorize goerli tests (#893)
rom1trt 0f20179
feat: add goerli support (advanced-logic) (#895)
rom1trt 3c1db98
tmp
olivier7delf 31cf53f
any-to-erc20-proxy payment - correct documention on proxy used
olivier7delf f3ff088
wip
olivier7delf ebd3ff4
refacto receive function - add comments to test functions
olivier7delf 1c07569
comments about unique token in smart contract
olivier7delf 2357f60
prettier
olivier7delf b721ef4
Update packages/smart-contracts/src/contracts/BatchPaymentsPublic.sol
olivier7delf 83398ea
Update packages/smart-contracts/src/contracts/BatchPaymentsPublic.sol
olivier7delf d5c11ec
Update packages/smart-contracts/src/contracts/BatchPaymentsPublic.sol
olivier7delf e704f4e
Update packages/smart-contracts/src/contracts/BatchPaymentsPublic.sol
olivier7delf 978b701
Update packages/smart-contracts/src/contracts/BatchConversionPayments…
olivier7delf ef4b86f
Update packages/smart-contracts/src/contracts/BatchConversionPayments…
olivier7delf 23b2980
Update packages/smart-contracts/src/contracts/BatchConversionPayments…
olivier7delf abc5471
Update packages/smart-contracts/src/contracts/BatchConversionPayments…
olivier7delf 4367d97
Update packages/smart-contracts/src/contracts/BatchConversionPayments…
olivier7delf 4f683a3
Update packages/smart-contracts/src/contracts/BatchConversionPayments…
olivier7delf dde44db
Update packages/smart-contracts/src/contracts/BatchConversionPayments…
olivier7delf f20d802
Update packages/smart-contracts/src/contracts/BatchConversionPayments…
olivier7delf a047149
Update packages/smart-contracts/src/contracts/BatchConversionPayments…
olivier7delf 014c430
receive comment
olivier7delf f63d653
tmp tests fail
olivier7delf 0c8f375
batch calcul updated and tested - it includes fees now
olivier7delf 7cde97d
delete basicFee inside the contract - update test - refacto script to…
olivier7delf 69b10dc
check the addresses of the contracts deployed and raise an error if n…
olivier7delf aa08563
smart contract add variable tenThousand
olivier7delf 570de98
contract require message - wording
olivier7delf b3787cb
smart contract delete chainlink
olivier7delf 101d9cd
revert batchPayments modif
olivier7delf f4c4452
merge with detached branch
olivier7delf 2f79b95
Merge branch 'master' into feat/batch-conversion
olivier7delf 70f9fe9
contract - remove irrelevant variable - wording uTokens
olivier7delf 4b9f0af
renaming requestInfo into conversionDetail and requestsInfoParent int…
olivier7delf c2d842e
contract - clean constructor
olivier7delf 73fa7a7
wording receive comments
olivier7delf 04a2d92
clean packages
olivier7delf 93fb63c
Merge branch 'master' into feat/batch-conversion
olivier7delf d49d1ad
Merge branch 'master' into feat/batch-conversion-payment
olivier7delf 24c9ef4
Merge branch 'feat/batch-conversion' into feat/batch-conversion-payment
olivier7delf 5e86486
wip
olivier7delf 1a55c1e
refacto batch conversion ERC20 tests
olivier7delf 8e3485d
eth batch functions tested
olivier7delf a5dcb32
rewording and cleaning
olivier7delf 39199c8
refacto tests batch conversion ERC20
olivier7delf 30e61e9
refacto tests: batch conversion Eth
olivier7delf c17d2ba
Merge branch 'master' into feat/batch-conversion
olivier7delf 9285407
Merge branch 'feat/batch-conversion' into feat/batch-conversion-payment
olivier7delf d7e0b25
test erc20 can be run multiple time - revoke these approvals
olivier7delf bff175f
test swap-erc-20-fee-proxy revoke approval
olivier7delf b6b854c
refacto any-to-erc20-proxy to create the function checkRequestAndGetP…
olivier7delf 8876f91
prettier
olivier7delf 503e6ea
prettier test swap
olivier7delf 24862d1
batch conversion proxy functions and approvals
olivier7delf d305475
test batch erc20
olivier7delf 239c216
tests batch conversion payment done
olivier7delf 0d44f52
prettier
olivier7delf ed525a4
clean tests and restore previous batchFee values
olivier7delf 09f3fca
merge with master
olivier7delf 69cb5ab
test refacto to simplify batchConvFunction
olivier7delf 2736a8e
Merge branch 'master' into feat/batch-conversion
olivier7delf 6bbccca
update batch conversion contract
olivier7delf b961daf
clean escrow
olivier7delf 367fee4
Merge branch 'feat/batch-conversion' into feat/batch-conversion-payment
olivier7delf 714590f
version with errors on 2 proxies
olivier7delf 2bf4116
make proxies public
olivier7delf f0437d5
batch conversion deploy on rinkeby
olivier7delf 978cd11
batch conversion deployed on goerli
olivier7delf d09aa03
update contract to make proxies public
olivier7delf 75c7a3c
Merge branch 'feat/batch-conversion' into feat/deploy-batch-conversio…
olivier7delf 9f746bc
test refacto: delete emitOneTx - path and add before - adminSigner
olivier7delf 2a683ee
deploy instead of connect to batchProxy
olivier7delf 65c9f94
end cleaning old test version
olivier7delf c6dc943
refacto new test structure
olivier7delf 44d6372
refacto test add eth beginning
olivier7delf 7cd6854
tests batchRouter erros
olivier7delf 9439c7d
abi update
olivier7delf fc1c6d2
Merge branch 'master' into feat/batch-conversion
olivier7delf bc407d0
batch conv tests delete proxy global variables
olivier7delf 3459966
test refactored
olivier7delf 4dbf265
tests: cleaning
olivier7delf 34e77e1
Merge branch 'feat/batch-conversion' into feat/deploy-batch-conversio…
olivier7delf d385a31
update batchConversionPayments proxies on rinkeby, goerli, and matic
olivier7delf 21a4871
add type for batch payment inputs
olivier7delf d52958f
Merge branch 'feat/batch-conversion' into feat/deploy-batch-conversio…
olivier7delf 68bdf3e
delete payment-processor batch
olivier7delf 05fb4e3
Merge branch 'feat/batch-conversion' into feat/deploy-batch-conversio…
olivier7delf 8bb8435
clean payment processor
olivier7delf d19a3bd
merge with master
olivier7delf aa18bef
add logs
olivier7delf 0cad7b8
add batch conversion proxy address
olivier7delf 103d432
remove batch payment deprecated - should not be deployed anymore
olivier7delf d92341c
add comments to batch fees
olivier7delf 9738e7d
erase xdeployer batchpayments legacy
olivier7delf fa280d0
master merged
olivier7delf fb168a1
proxy addresses updated
olivier7delf 256f5d6
add fee batch amount limit to batchMultiERC20ConversionPayments
olivier7delf 1510142
batchFees amount limited for batchNoConversion erc20 functions
olivier7delf 59a1485
batch erc20 functions tested
olivier7delf 53e75c8
functions and test working
olivier7delf 69d76a7
refacto smart contract and optimize gas
olivier7delf 552ebbb
rename ConversionDetail into RequestDetail
olivier7delf aec302c
rename batchRouter function into batchPayment
olivier7delf ce934f2
typo corrections
olivier7delf 385c36f
fix erc20 tests with batchFee value limited to 200
olivier7delf ccbc6d6
add the gas optimization for batch eth functions and clean tests
olivier7delf 878c84e
test ready
olivier7delf 1d2855d
legacy - delete BatchPayment modification
olivier7delf d2f0cfe
add privates functions - rename enable by skip fee USD limit - change…
olivier7delf 05cd466
rename ETH functions into Native functions
olivier7delf aaf052b
abi code
olivier7delf 6b853c2
pretty batch contract
olivier7delf 61b2899
Merge branch 'master' into fix/btach-conversion-capped
olivier7delf f428ea4
update batch conversion processor
olivier7delf b3b5f72
update contract comment and receiver function
olivier7delf 7a7d8b7
Merge branch 'fix/btach-conversion-capped' into chore/payment-process…
olivier7delf ac9b2a3
rename batchPayment into batchPayments
olivier7delf 57d4e5f
Merge branch 'fix/btach-conversion-capped' into chore/payment-process…
olivier7delf 93b8bb6
clean batch abi files
olivier7delf 63ae2a1
Merge branch 'fix/btach-conversion-capped' into chore/payment-process…
olivier7delf 42913a7
update payment processor batchPayments and fix one test
olivier7delf 43baa37
add batch fee amount USD to batch payment processor and its tests
olivier7delf fc6887f
batch conversion payment processor functions and tests
olivier7delf ae46de2
increase DAI funds to tests batch payments with big amounts and be ab…
olivier7delf 85f330e
Merge branch 'master' into fix/btach-conversion-capped
olivier7delf 70d3fe9
Merge branch 'fix/btach-conversion-capped' into chore/payment-process…
olivier7delf 1d28a64
update merge master
olivier7delf e7a6bff
Merge branch 'fix/btach-conversion-capped' into feat/deploy-batch-con…
olivier7delf fb8d60c
naming convention and update with master
olivier7delf da33fa4
Merge branch 'fix/btach-conversion-capped' into feat/deploy-batch-con…
olivier7delf fc92e94
update with batch fee amount in USD limit
olivier7delf 1a4efd1
deployment batch conversion with fee amount USD limit
olivier7delf d215a6a
batch contract deployed for tests
olivier7delf 9436290
Merge branch 'master' into fix/btach-conversion-capped
olivier7delf 6de03f6
Merge branch 'fix/btach-conversion-capped' into chore/payment-process…
olivier7delf d98ec6b
Merge branch 'chore/payment-processor-batch-fee-usd-limited' into fea…
olivier7delf cf50687
contract deployed WIP verify failing
olivier7delf d3ba003
add Yo PR - function s comments on batch contracts
olivier7delf d176d6f
Merge branch 'master' into fix/btach-conversion-capped
olivier7delf a154712
files cleaned
olivier7delf 502741d
contract deployed
olivier7delf 2670ef6
naming convention and update with master
olivier7delf ee220e2
fix(graph retriever): null values (#961)
benjlevesque 84431e3
fix: NEAR native timestamp precision (#963)
yomarion 17608de
add batch proxy addresses and clean tests
olivier7delf 478f60b
Merge branch 'fix/btach-conversion-capped' into chore/payment-process…
olivier7delf 58b4aec
Merge branch 'chore/payment-processor-batch-fee-usd-limited' into fea…
olivier7delf 0f56100
set not to skipFeeUSDLimit by default and fix tests with currencyMana…
olivier7delf 1db3616
modify FAKE token and add DAI token within private currencyManager
olivier7delf a30f233
Revert "modify FAKE token and add DAI token within private currencyMa…
olivier7delf 1530231
update batch payment - currencyManager and version and the associated…
olivier7delf ecb2c58
convention and typo corrections
olivier7delf 6a432a8
refacto batch pay inputs - no more batch type and an options with cur…
olivier7delf f185d8e
Merge branch 'chore/payment-processor-batch-fee-usd-limited' into fea…
olivier7delf 5b826c5
can deploy and setup batch contract in one cmd line
olivier7delf c37424f
update batch and re order hardhat order as mainnet is the slower
olivier7delf 17a8eb8
merge with master
olivier7delf File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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
82 changes: 82 additions & 0 deletions
82
packages/smart-contracts/scripts-create2/contract-setup/setupBatchConversionPayments.ts
This file contains hidden or 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,82 @@ | ||
import { batchConversionPaymentsArtifact } from '../../src/lib'; | ||
import { HardhatRuntimeEnvironmentExtended } from '../types'; | ||
import utils from '@requestnetwork/utils'; | ||
import { updateBatchPaymentFees, updateBatchConversionPaymentProxy } from './adminTasks'; | ||
|
||
/** | ||
* Updates the values of the batch fees of the BatchConversionPayments contract, if needed | ||
* @param contractAddress address of the BatchConversionPayments Proxy | ||
* @param hre Hardhat runtime environment | ||
*/ | ||
export const setupBatchConversionPayments = async ( | ||
contractAddress: string, | ||
hre: HardhatRuntimeEnvironmentExtended, | ||
): Promise<void> => { | ||
// Setup contract parameters | ||
const batchConversionPaymentContract = new hre.ethers.Contract( | ||
contractAddress, | ||
batchConversionPaymentsArtifact.getContractAbi(), | ||
); | ||
await Promise.all( | ||
hre.config.xdeploy.networks.map(async (network) => { | ||
console.log(`Setup BatchConversionPayments on ${network}`); | ||
let provider; | ||
if (network === 'celo') { | ||
provider = utils.getCeloProvider(); | ||
} else { | ||
provider = utils.getDefaultProvider(network); | ||
} | ||
const wallet = new hre.ethers.Wallet(hre.config.xdeploy.signer, provider); | ||
const signer = wallet.connect(provider); | ||
const batchConversionPaymentConnected = batchConversionPaymentContract.connect(signer); | ||
const adminNonce = await signer.getTransactionCount(); | ||
const gasPrice = await provider.getGasPrice(); | ||
|
||
// start from the adminNonce, increase gasPrice if needed | ||
const gasCoef = 2; | ||
await Promise.all([ | ||
await updateBatchPaymentFees( | ||
batchConversionPaymentConnected, | ||
adminNonce, | ||
gasPrice.mul(gasCoef), | ||
'BatchNoConversionFee', | ||
), | ||
await updateBatchPaymentFees( | ||
batchConversionPaymentConnected, | ||
adminNonce + 1, | ||
gasPrice.mul(gasCoef), | ||
'BatchConversionFee', | ||
), | ||
await updateBatchConversionPaymentProxy( | ||
batchConversionPaymentConnected, | ||
network, | ||
adminNonce + 2, | ||
gasPrice.mul(gasCoef), | ||
'erc20', | ||
), | ||
await updateBatchConversionPaymentProxy( | ||
batchConversionPaymentConnected, | ||
network, | ||
adminNonce + 3, | ||
gasPrice.mul(gasCoef), | ||
'eth', | ||
), | ||
await updateBatchConversionPaymentProxy( | ||
batchConversionPaymentConnected, | ||
network, | ||
adminNonce + 4, | ||
gasPrice.mul(gasCoef), | ||
'erc20Conversion', | ||
), | ||
await updateBatchConversionPaymentProxy( | ||
batchConversionPaymentConnected, | ||
network, | ||
adminNonce + 5, | ||
gasPrice.mul(gasCoef), | ||
'ethConversion', | ||
), | ||
]); | ||
}), | ||
); | ||
console.log('Setup for setupBatchConversionPayment successfull'); | ||
}; |
47 changes: 0 additions & 47 deletions
47
packages/smart-contracts/scripts-create2/contract-setup/setupBatchPayments.ts
This file was deleted.
Oops, something went wrong.
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.