How to use the ethers.utils.getAddress function in ethers

To help you get started, we’ve selected a few ethers examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github hubiinetwork / nahmii-contracts / test / scenarios / DriipSettlementChallenge.js View on Github external
);

                    // Index is 1-based
                    const intendedIndex = await ethersDriipSettlementChallenge.proposalIndexByWalletCurrency(
                        trade.buyer.wallet, trade.currencies.intended.ct, trade.currencies.intended.id
                    );
                    intendedIndex._bn.should.eq.BN(1);

                    // Index is 1-based
                    const conjugateIndex = await ethersDriipSettlementChallenge.proposalIndexByWalletCurrency(
                        trade.buyer.wallet, trade.currencies.conjugate.ct, trade.currencies.conjugate.id
                    );
                    conjugateIndex._bn.should.eq.BN(2);

                    const intendedProposal = await ethersDriipSettlementChallenge.proposals(intendedIndex.sub(1));
                    intendedProposal.wallet.should.equal(utils.getAddress(trade.buyer.wallet));
                    intendedProposal.nonce._bn.should.eq.BN(trade.nonce._bn);
                    intendedProposal.blockNumber._bn.should.eq.BN(trade.blockNumber._bn);
                    intendedProposal.status.should.equal(mocks.settlementStatuses.indexOf('Qualified'));
                    intendedProposal.stageAmount._bn.should.eq.BN(trade.buyer.balances.intended.current._bn);
                    intendedProposal.targetBalanceAmount._bn.should.eq.BN(0);
                    intendedProposal.driipType.should.equal(mocks.driipTypes.indexOf('Trade'));
                    intendedProposal.balanceReward.should.be.false;

                    const conjugateProposal = await ethersDriipSettlementChallenge.proposals(conjugateIndex.sub(1));
                    conjugateProposal.wallet.should.equal(utils.getAddress(trade.buyer.wallet));
                    conjugateProposal.nonce._bn.should.eq.BN(trade.nonce._bn);
                    conjugateProposal.blockNumber._bn.should.eq.BN(trade.blockNumber._bn);
                    conjugateProposal.status.should.equal(mocks.settlementStatuses.indexOf('Qualified'));
                    conjugateProposal.stageAmount._bn.should.eq.BN(trade.buyer.balances.conjugate.current._bn);
                    conjugateProposal.targetBalanceAmount._bn.should.eq.BN(0);
                    conjugateProposal.driipType.should.equal(mocks.driipTypes.indexOf('Trade'));
github hubiinetwork / nahmii-contracts / test / scenarios / FraudChallengeByOrder.js View on Github external
it('should set new value and emit event', async () => {
                    const result = await web3FraudChallengeByOrder.setFraudChallenge(address);
                    result.logs.should.be.an('array').and.have.lengthOf(1);
                    result.logs[0].event.should.equal('SetFraudChallengeEvent');
                    const fraudChallenge = await web3FraudChallengeByOrder.fraudChallenge();
                    utils.getAddress(fraudChallenge).should.equal(address);
                });
            });
github hubiinetwork / nahmii-contracts / test / scenarios / FraudChallengeByOrder.js View on Github external
it('should set new value and emit event', async () => {
                    const result = await web3FraudChallengeByOrder.setConfiguration(address);
                    result.logs.should.be.an('array').and.have.lengthOf(1);
                    result.logs[0].event.should.equal('SetConfigurationEvent');
                    const configuration = await web3FraudChallengeByOrder.configuration();
                    utils.getAddress(configuration).should.equal(address);
                });
            });
github hubiinetwork / nahmii-contracts / test / scenarios / FraudChallengeByTradeSucceedingPayment.js View on Github external
it('should set new value and emit event', async () => {
                    const result = await web3FraudChallengeByTradeSucceedingPayment.setWalletLocker(address);
                    result.logs.should.be.an('array').and.have.lengthOf(1);
                    result.logs[0].event.should.equal('SetWalletLockerEvent');
                    const walletLocker = await web3FraudChallengeByTradeSucceedingPayment.walletLocker();
                    utils.getAddress(walletLocker).should.equal(address);
                });
            });
github hubiinetwork / nahmii-contracts / test / scenarios / FraudChallengeByDuplicateDriipNonceOfPayments.js View on Github external
it('should set new value and emit event', async () => {
                    const result = await web3FraudChallengeByDuplicateDriipNonceOfPayments.setSecurityBond(address);
                    result.logs.should.be.an('array').and.have.lengthOf(1);
                    result.logs[0].event.should.equal('SetSecurityBondEvent');
                    const securityBond = await web3FraudChallengeByDuplicateDriipNonceOfPayments.securityBond();
                    utils.getAddress(securityBond).should.equal(address);
                });
            });
github hubiinetwork / nahmii-contracts / test / scenarios / DriipSettlementByPayment.js View on Github external
it('should equal value initialized', async () => {
                (await ethersDriipSettlementByPayment.communityVote())
                    .should.equal(utils.getAddress(ethersCommunityVote.address));
            });
        });
github hubiinetwork / nahmii-contracts / test / scenarios / FraudChallengeBySuccessivePayments.js View on Github external
it('should equal value initialized', async () => {
                const fraudChallenge = await ethersFraudChallengeBySuccessivePayments.fraudChallenge();
                fraudChallenge.should.equal(utils.getAddress(ethersFraudChallenge.address));
            });
        });
github hubiinetwork / nahmii-contracts / test / scenarios / FraudChallengeByDoubleSpentOrders.js View on Github external
it('should set new value and emit event', async () => {
                    const result = await web3FraudChallengeByDoubleSpentOrders.setConfiguration(address);
                    result.logs.should.be.an('array').and.have.lengthOf(1);
                    result.logs[0].event.should.equal('SetConfigurationEvent');
                    const configuration = await web3FraudChallengeByDoubleSpentOrders.configuration();
                    utils.getAddress(configuration).should.equal(address);
                });
            });
github hubiinetwork / nahmii-contracts / test / scenarios / DriipSettlementState.js View on Github external
'payment', mocks.hash1, glob.user_a, 1, glob.user_b, 2, {gasLimit: 1e6}
                    );

                    const logs = await provider.getLogs(filter);
                    logs[logs.length - 1].topics[0].should.equal(filter.topics[0]);

                    (await ethersDriipSettlementState.settlementsCount())
                        ._bn.should.eq.BN(1);

                    const settlement = await ethersDriipSettlementState.settlements(0);
                    settlement.settledKind.should.equal('payment');
                    settlement.settledHash.should.equal(mocks.hash1);
                    settlement.origin.nonce._bn.should.eq.BN(1);
                    settlement.origin.wallet.should.equal(utils.getAddress(glob.user_a));
                    settlement.target.nonce._bn.should.eq.BN(2);
                    settlement.target.wallet.should.equal(utils.getAddress(glob.user_b));

                    (await ethersDriipSettlementState.settlementByWalletAndIndex(glob.user_a, 0))
                        .should.deep.equal(settlement);
                    (await ethersDriipSettlementState.settlementByWalletAndIndex(glob.user_b, 0))
                        .should.deep.equal(settlement);
                    (await ethersDriipSettlementState.settlementByWalletAndNonce(glob.user_a, 1))
                        .should.deep.equal(settlement);
                    (await ethersDriipSettlementState.settlementByWalletAndNonce(glob.user_b, 2))
                        .should.deep.equal(settlement);
                });
            });
github hubiinetwork / nahmii-contracts / test / scenarios / DriipSettlementDisputeByTrade.js View on Github external
const logs = await provider.getLogs(filter);
                    logs[logs.length - 1].topics[0].should.equal(filter.topics[0]);

                    const proposal = await ethersDriipSettlementChallengeState._proposals(0);
                    proposal.wallet.should.equal(utils.getAddress(order.wallet));
                    proposal.currency.ct.should.equal(order.placement.currencies.conjugate.ct);
                    proposal.currency.id._bn.should.eq.BN(order.placement.currencies.conjugate.id._bn);

                    (await ethersWalletLocker._fungibleUnlocksCount())
                        ._bn.should.eq.BN(0);

                    (await ethersSecurityBond._absoluteDeprivalsCount())
                        ._bn.should.eq.BN(1);

                    const deprival = await ethersSecurityBond.absoluteDeprivals(0);
                    deprival.wallet.should.equal(utils.getAddress(glob.user_b));

                    (await ethersSecurityBond._fractionalRewardsCount())
                        ._bn.should.eq.BN(1);

                    const reward = await ethersSecurityBond.fractionalRewards(0);
                    reward.wallet.should.equal(utils.getAddress(glob.user_a));
                    reward.fraction._bn.should.eq.BN(1e17.toString());
                    reward.unlockTime._bn.should.eq.BN(0);
                });
            });